FFMPEG: encode x265, container mpeg2 ts, stream-STARTCODE MISSING

3.3k Views Asked by At

I am trying to encode a video with FFMPEG x265, put it into MPEG2 TS and then stream it over UDP. Then receive on another PC and save it. Perform PSNR.

The encoding works fine, but when I try to stream I get the error:

[mpegts @ 00000000050b0520] HEVC bitstream error, startcode missing, size 1436 data 00000100

  • Step 1- Encoding:

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

No error, everything fine.

  • Step 2- Streaming:

Start code missing.

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.

When I do the steps above with x264 everything works fine. I can stream the video and I can receive it on the other side. Any idea what is wrong? Is this a BUG?

Commands for 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

Thanks for the help!!

BR, Rudi

0

There are 0 best solutions below