我正在尝试使用FFMPEG x265对视频进行编码,将其放入MPEG2 TS,然后通过UDP进行流式传输。然后在另一台PC上接收并保存。执行PSNR。
编码工作正常,但当我尝试流时,我得到错误:
[mpegts @ 00000000050b0520] HEVC比特流错误,缺少起始码,大小1436数据00000100
ffmpeg -re -i test.ts -r 25 -b:v 2500k -preset medium -c:v libx265 -x265-params crf = 27 -y -f mpegts test1.ts
没有错误,一切都很好。
缺少启动代码。
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 copy -f mpegts udp://172.18.60.47:1234
感谢您的帮助!!
BR, 鲁迪