3

我正在尝试使用 FFMPEG x265 对视频进行编码,将其放入 MPEG2 TS,然后通过 UDP 流式传输。然后在另一台电脑上接收并保存。执行 PSNR。

编码工作正常,但是当我尝试流式传输时出现错误:

[mpegts @ 00000000050b0520] HEVC 比特流错误,缺少起始码,大小 1436 数据 00000100

  • 第 1 步 - 编码:

ffmpeg -re -i test.ts -r 25 -b:v 2500k -preset medium -c:v libx265 -x265-params crf=27 -y -f mpegts test1.ts

没有错误,一切正常。

  • 第 2 步 - 流式传输:

缺少启动代码。

ffmpeg -re -i test1.ts -c copy -f mpegts udp://172.18.60.47:1234 ffmpeg version N-68441-g4fa42e0 Copyright (c) 2000-2014 the FFmpeg developers built on Dec 14 2014 22:13:03 with gcc 4.9.2 (GCC) configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnut le-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --e modplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libsc r --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable- --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-decklink --enable-zl libavutil 54. 15.100 / 54. 15.100 libavcodec 56. 14.100 / 56. 14.100 libavformat 56. 15.105 / 56. 15.105 libavdevice 56. 3.100 / 56. 3.100 libavfilter 5. 3.101 / 5. 3.101 libswscale 3. 1.101 / 3. 1.101 libswresample 1. 1.100 / 1. 1.100 libpostproc 53. 3.100 / 53. 3.100 Input #0, mpegts, from 'test1.ts': Duration: 00:00:10.12, start: 1.480000, bitrate: 456 kb/s Program 1 Metadata: service_name : Service01 service_provider: FFmpeg Stream #0:0[0x100]: Video: hevc (Main) ([36][0][0][0] / 0x0024), yuv420p(tv), 1280x720, 25 fps, 25 tbr, 90k tbn, 25 tbc Output #0, mpegts, to 'udp://172.18.60.47:1234': Metadata: encoder : Lavf56.15.105 Stream #0:0: Video: hevc ([36][0][0][0] / 0x0024), yuv420p, 1280x720, q=2-31, 25 fps, 25 tbr, 90k tbn, 25 tbc Stream mapping: Stream #0:0 -> #0:0 (copy) Press [q] to stop, [?] for help **[mpegts @ 0000000004ed7320] HEVC bitstream error, startcode missing, size 2462 data 00000102** [mpegts @ 0000000004ed7320] HEVC bitstream error, startcode missing, size 302 data 00000102 [mpegts @ 0000000004ed7320] HEVC bitstream error, startcode missing, size 134 data 00000100 [mpegts @ 0000000004ed7320] HEVC bitstream error, startcode missing, size 149 data 00000100 [mpegts @ 0000000004ed7320] HEVC bitstream error, startcode missing, size 5107 data 00000102 [mpegts @ 0000000004ed7320] HEVC bitstream error, startcode missing, size 1331 data 00000102 [mpegts @ 0000000004ed7320] HEVC bitstream error, startcode missing, size 341 data 00000100 frame= 8 fps=0.0 q=-1.0 Lsize= 37kB time=00:00:00.24 bitrate=1278.4kbits/s video:34kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 9.718209% Received signal 2: terminating.

当我使用 x264 执行上述步骤时,一切正常。我可以流式传输视频,我可以在另一端接收它。知道有什么问题吗?这是一个BUG吗?

x264 的命令:

ffmpeg -re -i test.ts -r 25 -b:v 2500k -preset medium -c:v libx264 -x264-params crf=27 -y -f mpegts test1.ts

ffmpeg -re -i test1.ts -c 复制 -f mpegts udp://172.18.60.47:1234

谢谢您的帮助!!

BR,鲁迪

4

0 回答 0