I'm using ffmpeg 3.2.7 and I have a problem converting a ts-file lossless to mkv. The source file is a dumped IPTV-stream recorded with dumprtp (from dvbstream 0.5).
ffmpeg -i Test.ts -map 0:0 -map 0:2 -vcodec copy -acodec copy -f matroska Test.mkv
The convertion is successful, but the output file is pixelated every few seconds.
When I'm converting it with MKVToolnix everything looks fine.
Does anyone has a solution for that problem? Maybe some option to sync the stream correctly?
Here's a sample output:
# ffmpeg -i Test.ts -map 0:0 -map 0:2 -vcodec copy -acodec copy -f matroska Test.mkv
ffmpeg version 3.2.7 Copyright (c) 2000-2017 the FFmpeg developers
built with gcc 6.3.0 (OpenWrt GCC 6.3.0 r212-46f973b)
configuration: --enable-cross-compile --cross-prefix=i486-openwrt-linux-gnu- --arch=i386 --target-os=linux --prefix=/opt --pkg-config=pkg-config --enable-shared --enable-static --enable-pthreads --enable-zlib --disable-doc --disable-debug --disable-lzma --disable-vaapi --disable-vdpau --disable-outdevs --enable-avresample --enable-libopus --enable-small --enable-gpl --enable-libmp3lame --enable-libx264
libavutil 55. 34.101 / 55. 34.101
libavcodec 57. 64.101 / 57. 64.101
libavformat 57. 56.101 / 57. 56.101
libavdevice 57. 1.100 / 57. 1.100
libavfilter 6. 65.100 / 6. 65.100
libavresample 3. 1. 0 / 3. 1. 0
libswscale 4. 2.100 / 4. 2.100
libswresample 2. 3.100 / 2. 3.100
libpostproc 54. 1.100 / 54. 1.100
[mpegts @ 0x81f6280] changing packet size to 192
[mpegts @ 0x81f6280] changing packet size to 188
[mpegts @ 0x81f6280] changing packet size to 192
[NULL @ 0x81f9580] SPS unavailable in decode_picture_timing
[NULL @ 0x81f9580] non-existing PPS 0 referenced
[h264 @ 0x81f9580] SPS unavailable in decode_picture_timing
[h264 @ 0x81f9580] non-existing PPS 0 referenced
[h264 @ 0x81f9580] decode_slice_header error
[h264 @ 0x81f9580] no frame!
[mpegts @ 0x81f6280] changing packet size to 188
[mpegts @ 0x81f6280] changing packet size to 192
[mpegts @ 0x81f6280] changing packet size to 188
[mpegts @ 0x81f6280] changing packet size to 192
[mpegts @ 0x81f6280] changing packet size to 188
[mpegts @ 0x81f6280] changing packet size to 192
[mpegts @ 0x81f6280] changing packet size to 188
[mpegts @ 0x81f6280] changing packet size to 192
[mpegts @ 0x81f6280] changing packet size to 188
[mpegts @ 0x81f6280] changing packet size to 192
[mpegts @ 0x81f6280] changing packet size to 188
[mpegts @ 0x81f6280] changing packet size to 192
[mpegts @ 0x81f6280] changing packet size to 188
[mpegts @ 0x81f6280] changing packet size to 192
[mpegts @ 0x81f6280] changing packet size to 188
[mpegts @ 0x81f6280] changing packet size to 192
[mpegts @ 0x81f6280] changing packet size to 188
[mpegts @ 0x81f6280] changing packet size to 192
[mpegts @ 0x81f6280] changing packet size to 188
[mpegts @ 0x81f6280] changing packet size to 192
[mpegts @ 0x81f6280] changing packet size to 188
[mpegts @ 0x81f6280] changing packet size to 192
[mpegts @ 0x81f6280] changing packet size to 188
[mpegts @ 0x81f6280] changing packet size to 192
[mpegts @ 0x81f6280] changing packet size to 188
[mpegts @ 0x81f6280] changing packet size to 192
[mpegts @ 0x81f6280] changing packet size to 188
[mpegts @ 0x81f6280] changing packet size to 192
[mpegts @ 0x81f6280] changing packet size to 188
[mpegts @ 0x81f6280] changing packet size to 192
[mpegts @ 0x81f6280] changing packet size to 188
[mpegts @ 0x81f6280] changing packet size to 192
[mpegts @ 0x81f6280] changing packet size to 188
[mpegts @ 0x81f6280] changing packet size to 192
[mpegts @ 0x81f6280] changing packet size to 188
[mpegts @ 0x81f6280] changing packet size to 192
[mpegts @ 0x81f6280] changing packet size to 188
[mp3 @ 0x81fb860] Header missing
[h264 @ 0x81f9580] SPS unavailable in decode_picture_timing
[h264 @ 0x81f9580] non-existing PPS 0 referenced
[h264 @ 0x81f9580] SPS unavailable in decode_picture_timing
[h264 @ 0x81f9580] non-existing PPS 0 referenced
[h264 @ 0x81f9580] decode_slice_header error
[h264 @ 0x81f9580] no frame!
[h264 @ 0x81f9580] SPS unavailable in decode_picture_timing
[h264 @ 0x81f9580] non-existing PPS 0 referenced
[h264 @ 0x81f9580] SPS unavailable in decode_picture_timing
[h264 @ 0x81f9580] non-existing PPS 0 referenced
[h264 @ 0x81f9580] decode_slice_header error
[h264 @ 0x81f9580] no frame!
[h264 @ 0x81f9580] SPS unavailable in decode_picture_timing
[h264 @ 0x81f9580] non-existing PPS 0 referenced
[h264 @ 0x81f9580] SPS unavailable in decode_picture_timing
[h264 @ 0x81f9580] non-existing PPS 0 referenced
[h264 @ 0x81f9580] decode_slice_header error
[h264 @ 0x81f9580] no frame!
[h264 @ 0x81f9580] SPS unavailable in decode_picture_timing
[h264 @ 0x81f9580] non-existing PPS 0 referenced
[h264 @ 0x81f9580] SPS unavailable in decode_picture_timing
[h264 @ 0x81f9580] non-existing PPS 0 referenced
[h264 @ 0x81f9580] decode_slice_header error
[h264 @ 0x81f9580] no frame!
[mp3 @ 0x81fb860] Header missing
Last message repeated 1 times
[h264 @ 0x81f9580] SPS unavailable in decode_picture_timing
[h264 @ 0x81f9580] non-existing PPS 0 referenced
[h264 @ 0x81f9580] SPS unavailable in decode_picture_timing
[h264 @ 0x81f9580] non-existing PPS 0 referenced
[h264 @ 0x81f9580] decode_slice_header error
[h264 @ 0x81f9580] no frame!
[mp3 @ 0x81fb860] Header missing
Last message repeated 3 times
[h264 @ 0x81f9580] SPS unavailable in decode_picture_timing
[h264 @ 0x81f9580] non-existing PPS 0 referenced
[h264 @ 0x81f9580] SPS unavailable in decode_picture_timing
[h264 @ 0x81f9580] non-existing PPS 0 referenced
[h264 @ 0x81f9580] decode_slice_header error
[h264 @ 0x81f9580] no frame!
[h264 @ 0x81f9580] SPS unavailable in decode_picture_timing
[h264 @ 0x81f9580] non-existing PPS 0 referenced
[h264 @ 0x81f9580] SPS unavailable in decode_picture_timing
[h264 @ 0x81f9580] non-existing PPS 0 referenced
[h264 @ 0x81f9580] decode_slice_header error
[h264 @ 0x81f9580] no frame!
[h264 @ 0x81f9580] SPS unavailable in decode_picture_timing
[h264 @ 0x81f9580] non-existing PPS 0 referenced
[h264 @ 0x81f9580] SPS unavailable in decode_picture_timing
[h264 @ 0x81f9580] non-existing PPS 0 referenced
[h264 @ 0x81f9580] decode_slice_header error
[h264 @ 0x81f9580] no frame!
[h264 @ 0x81f9580] SPS unavailable in decode_picture_timing
[h264 @ 0x81f9580] non-existing PPS 0 referenced
[h264 @ 0x81f9580] SPS unavailable in decode_picture_timing
[h264 @ 0x81f9580] non-existing PPS 0 referenced
[h264 @ 0x81f9580] decode_slice_header error
[h264 @ 0x81f9580] no frame!
[mp3 @ 0x81fb860] Header missing
Last message repeated 1 times
[h264 @ 0x81f9580] SPS unavailable in decode_picture_timing
[h264 @ 0x81f9580] non-existing PPS 0 referenced
[h264 @ 0x81f9580] SPS unavailable in decode_picture_timing
[h264 @ 0x81f9580] non-existing PPS 0 referenced
[h264 @ 0x81f9580] decode_slice_header error
[h264 @ 0x81f9580] no frame!
[h264 @ 0x81f9580] SPS unavailable in decode_picture_timing
[h264 @ 0x81f9580] non-existing PPS 0 referenced
[h264 @ 0x81f9580] SPS unavailable in decode_picture_timing
[h264 @ 0x81f9580] non-existing PPS 0 referenced
[h264 @ 0x81f9580] decode_slice_header error
[h264 @ 0x81f9580] no frame!
[h264 @ 0x81f9580] SPS unavailable in decode_picture_timing
[h264 @ 0x81f9580] non-existing PPS 0 referenced
[h264 @ 0x81f9580] SPS unavailable in decode_picture_timing
[h264 @ 0x81f9580] non-existing PPS 0 referenced
[h264 @ 0x81f9580] decode_slice_header error
[h264 @ 0x81f9580] no frame!
[mp3 @ 0x81fb860] Header missing
Last message repeated 3 times
[h264 @ 0x81f9580] SPS unavailable in decode_picture_timing
[h264 @ 0x81f9580] non-existing PPS 0 referenced
[h264 @ 0x81f9580] SPS unavailable in decode_picture_timing
[h264 @ 0x81f9580] non-existing PPS 0 referenced
[h264 @ 0x81f9580] decode_slice_header error
[h264 @ 0x81f9580] no frame!
[h264 @ 0x81f9580] SPS unavailable in decode_picture_timing
[h264 @ 0x81f9580] non-existing PPS 0 referenced
[h264 @ 0x81f9580] SPS unavailable in decode_picture_timing
[h264 @ 0x81f9580] non-existing PPS 0 referenced
[h264 @ 0x81f9580] decode_slice_header error
[h264 @ 0x81f9580] no frame!
[mp3 @ 0x81fb860] Header missing
Last message repeated 1 times
[h264 @ 0x81f9580] SPS unavailable in decode_picture_timing
[h264 @ 0x81f9580] non-existing PPS 0 referenced
[h264 @ 0x81f9580] SPS unavailable in decode_picture_timing
[h264 @ 0x81f9580] non-existing PPS 0 referenced
[h264 @ 0x81f9580] decode_slice_header error
[h264 @ 0x81f9580] no frame!
[h264 @ 0x81f9580] SPS unavailable in decode_picture_timing
[h264 @ 0x81f9580] non-existing PPS 0 referenced
[h264 @ 0x81f9580] SPS unavailable in decode_picture_timing
[h264 @ 0x81f9580] non-existing PPS 0 referenced
[h264 @ 0x81f9580] decode_slice_header error
[h264 @ 0x81f9580] no frame!
[h264 @ 0x81f9580] SPS unavailable in decode_picture_timing
[h264 @ 0x81f9580] non-existing PPS 0 referenced
[h264 @ 0x81f9580] SPS unavailable in decode_picture_timing
[h264 @ 0x81f9580] non-existing PPS 0 referenced
[h264 @ 0x81f9580] decode_slice_header error
[h264 @ 0x81f9580] no frame!
[h264 @ 0x81f9580] SPS unavailable in decode_picture_timing
[h264 @ 0x81f9580] non-existing PPS 0 referenced
[h264 @ 0x81f9580] SPS unavailable in decode_picture_timing
[h264 @ 0x81f9580] non-existing PPS 0 referenced
[h264 @ 0x81f9580] decode_slice_header error
[h264 @ 0x81f9580] no frame!
[mp3 @ 0x81fb860] Header missing
Last message repeated 1 times
[h264 @ 0x81f9580] SPS unavailable in decode_picture_timing
[h264 @ 0x81f9580] non-existing PPS 0 referenced
[h264 @ 0x81f9580] SPS unavailable in decode_picture_timing
[h264 @ 0x81f9580] non-existing PPS 0 referenced
[h264 @ 0x81f9580] decode_slice_header error
[h264 @ 0x81f9580] no frame!
[h264 @ 0x81f9580] SPS unavailable in decode_picture_timing
[h264 @ 0x81f9580] non-existing PPS 0 referenced
[h264 @ 0x81f9580] SPS unavailable in decode_picture_timing
[h264 @ 0x81f9580] non-existing PPS 0 referenced
[h264 @ 0x81f9580] decode_slice_header error
[h264 @ 0x81f9580] no frame!
[mp3 @ 0x81fb860] Header missing
Last message repeated 1 times
[h264 @ 0x81f9580] SPS unavailable in decode_picture_timing
[h264 @ 0x81f9580] non-existing PPS 0 referenced
[h264 @ 0x81f9580] SPS unavailable in decode_picture_timing
[h264 @ 0x81f9580] non-existing PPS 0 referenced
[h264 @ 0x81f9580] decode_slice_header error
[h264 @ 0x81f9580] no frame!
[mp3 @ 0x81fb860] Header missing
Last message repeated 1 times
[h264 @ 0x81f9580] SPS unavailable in decode_picture_timing
[h264 @ 0x81f9580] non-existing PPS 0 referenced
[h264 @ 0x81f9580] SPS unavailable in decode_picture_timing
[h264 @ 0x81f9580] non-existing PPS 0 referenced
[h264 @ 0x81f9580] decode_slice_header error
[h264 @ 0x81f9580] no frame!
[h264 @ 0x81f9580] SPS unavailable in decode_picture_timing
[h264 @ 0x81f9580] non-existing PPS 0 referenced
[h264 @ 0x81f9580] SPS unavailable in decode_picture_timing
[h264 @ 0x81f9580] non-existing PPS 0 referenced
[h264 @ 0x81f9580] decode_slice_header error
[h264 @ 0x81f9580] no frame!
[mp3 @ 0x81fb860] Header missing
Last message repeated 1 times
[h264 @ 0x81f9580] SPS unavailable in decode_picture_timing
[h264 @ 0x81f9580] non-existing PPS 0 referenced
[h264 @ 0x81f9580] SPS unavailable in decode_picture_timing
[h264 @ 0x81f9580] non-existing PPS 0 referenced
[h264 @ 0x81f9580] decode_slice_header error
[h264 @ 0x81f9580] no frame!
[h264 @ 0x81f9580] SPS unavailable in decode_picture_timing
[h264 @ 0x81f9580] non-existing PPS 0 referenced
[h264 @ 0x81f9580] SPS unavailable in decode_picture_timing
[h264 @ 0x81f9580] non-existing PPS 0 referenced
[h264 @ 0x81f9580] decode_slice_header error
[h264 @ 0x81f9580] no frame!
[h264 @ 0x81f9580] SPS unavailable in decode_picture_timing
[h264 @ 0x81f9580] non-existing PPS 0 referenced
[h264 @ 0x81f9580] SPS unavailable in decode_picture_timing
[h264 @ 0x81f9580] non-existing PPS 0 referenced
[h264 @ 0x81f9580] decode_slice_header error
[h264 @ 0x81f9580] no frame!
[h264 @ 0x81f9580] SPS unavailable in decode_picture_timing
[h264 @ 0x81f9580] non-existing PPS 0 referenced
[h264 @ 0x81f9580] SPS unavailable in decode_picture_timing
[h264 @ 0x81f9580] non-existing PPS 0 referenced
[h264 @ 0x81f9580] decode_slice_header error
[h264 @ 0x81f9580] no frame!
[h264 @ 0x81f9580] SPS unavailable in decode_picture_timing
[h264 @ 0x81f9580] non-existing PPS 0 referenced
[h264 @ 0x81f9580] SPS unavailable in decode_picture_timing
[h264 @ 0x81f9580] non-existing PPS 0 referenced
[h264 @ 0x81f9580] decode_slice_header error
[h264 @ 0x81f9580] no frame!
[mp3 @ 0x81fb860] Header missing
Last message repeated 7 times
[h264 @ 0x81f9580] SPS unavailable in decode_picture_timing
[h264 @ 0x81f9580] non-existing PPS 0 referenced
[h264 @ 0x81f9580] SPS unavailable in decode_picture_timing
[h264 @ 0x81f9580] non-existing PPS 0 referenced
[h264 @ 0x81f9580] decode_slice_header error
[h264 @ 0x81f9580] no frame!
[mp3 @ 0x81fb860] Header missing
Last message repeated 1 times
[h264 @ 0x81f9580] reference picture missing during reorder
Last message repeated 1 times
[h264 @ 0x81f9580] Missing reference picture, default is 2147483647
Last message repeated 1 times
[h264 @ 0x81f9580] mmco: unref short failure
Last message repeated 1 times
[h264 @ 0x81f9580] number of reference frames (0+5) exceeds max (4; probably corrupt input), discarding one
[mp3 @ 0x81fb860] Header missing
Last message repeated 3 times
[h264 @ 0x81f9580] reference picture missing during reorder
Last message repeated 2 times
[h264 @ 0x81f9580] Missing reference picture, default is 65627
Last message repeated 2 times
[mp3 @ 0x81fb860] Header missing
Last message repeated 1 times
[h264 @ 0x81f9580] mmco: unref short failure
Last message repeated 3 times
[h264 @ 0x81f9580] Increasing reorder buffer to 2
[mp3 @ 0x81fb860] Header missing
Last message repeated 295 times
[mpegts @ 0x81f6280] changing packet size to 192
[mpegts @ 0x81f6280] changing packet size to 188
[mp3 @ 0x81fb860] Header missing
Last message repeated 13 times
[mpegts @ 0x81f6280] changing packet size to 192
[mpegts @ 0x81f6280] changing packet size to 188
[mp3 @ 0x81fb860] Header missing
Last message repeated 2 times
[mpegts @ 0x81f6280] decoding for stream 1 failed
[mpegts @ 0x81f6280] changing packet size to 192
[mpegts @ 0x81f6280] changing packet size to 188
[mpegts @ 0x81f6280] changing packet size to 192
[mpegts @ 0x81f6280] changing packet size to 188
[mpegts @ 0x81f6280] PES packet size mismatch
Last message repeated 1 times
[mpegts @ 0x81f6280] Could not find codec parameters for stream 1 (Audio: mp3, 0 channels, s16p): unspecified frame size
Consider increasing the value for the 'analyzeduration' and 'probesize' options
Input #0, mpegts, from 'Test.ts':
Duration: 00:01:00.54, start: 48882.340000, bitrate: 3181 kb/s
Stream #0:0[0x100]: Video: h264, yuv420p(tv, bt470bg, top first), 720x576 [SAR 16:11 DAR 20:11], 25 fps, 50 tbr, 90k tbn, 50 tbc
Stream #0:1[0x103]: Audio: mp3, 0 channels, s16p
Stream #0:2[0x102]: Audio: mp2, 48000 Hz, stereo, s16p, 192 kb/s
Stream #0:3[0x101]: Audio: ac3, 48000 Hz, stereo, fltp, 384 kb/s
Output #0, matroska, to 'Test.mkv':
Metadata:
encoder : Lavf57.56.101
Stream #0:0: Video: h264 (H264 / 0x34363248), yuv420p(tv, bt470bg, top first), 720x576 [SAR 16:11 DAR 20:11], q=2-31, 25 fps, 50 tbr, 1k tbn, 90k tbc
Stream #0:1: Audio: mp2 (P[0][0][0] / 0x0050), 48000 Hz, stereo, 192 kb/s
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Stream #0:2 -> #0:1 (copy)
Press [q] to stop, [?] for help
[mpegts @ 0x81f6280] changing packet size to 192
[mpegts @ 0x81f6280] changing packet size to 188
[mpegts @ 0x81f6280] changing packet size to 192
[mpegts @ 0x81f6280] changing packet size to 188
[mpegts @ 0x81f6280] changing packet size to 192
[mpegts @ 0x81f6280] changing packet size to 188
[mpegts @ 0x81f6280] changing packet size to 192
[mpegts @ 0x81f6280] changing packet size to 188
[mpegts @ 0x81f6280] changing packet size to 192
[mpegts @ 0x81f6280] changing packet size to 188
[mpegts @ 0x81f6280] changing packet size to 192
[mpegts @ 0x81f6280] changing packet size to 188
[mpegts @ 0x81f6280] changing packet size to 192
[mpegts @ 0x81f6280] changing packet size to 188
[mpegts @ 0x81f6280] changing packet size to 192
[mpegts @ 0x81f6280] changing packet size to 188
[mpegts @ 0x81f6280] changing packet size to 192
[mpegts @ 0x81f6280] changing packet size to 188
[mpegts @ 0x81f6280] changing packet size to 192
[mpegts @ 0x81f6280] changing packet size to 188
[mpegts @ 0x81f6280] changing packet size to 192
[mpegts @ 0x81f6280] changing packet size to 188
[mpegts @ 0x81f6280] changing packet size to 192
[mpegts @ 0x81f6280] changing packet size to 188
[mpegts @ 0x81f6280] changing packet size to 192
[mpegts @ 0x81f6280] changing packet size to 188
[mpegts @ 0x81f6280] changing packet size to 192
[mpegts @ 0x81f6280] changing packet size to 188
[mpegts @ 0x81f6280] changing packet size to 192
[mpegts @ 0x81f6280] changing packet size to 188
[mpegts @ 0x81f6280] changing packet size to 192
[mpegts @ 0x81f6280] changing packet size to 188
[mpegts @ 0x81f6280] changing packet size to 192
[mpegts @ 0x81f6280] changing packet size to 188
[mpegts @ 0x81f6280] changing packet size to 192
[mpegts @ 0x81f6280] changing packet size to 188
[mpegts @ 0x81f6280] changing packet size to 192
[mpegts @ 0x81f6280] changing packet size to 188
[mpegts @ 0x81f6280] changing packet size to 192
[mpegts @ 0x81f6280] changing packet size to 188
[mpegts @ 0x81f6280] changing packet size to 192
[mpegts @ 0x81f6280] changing packet size to 188
[mpegts @ 0x81f6280] changing packet size to 192
[mpegts @ 0x81f6280] changing packet size to 188
[mpegts @ 0x81f6280] changing packet size to 192
[mpegts @ 0x81f6280] changing packet size to 188
[mpegts @ 0x81f6280] changing packet size to 192
[mpegts @ 0x81f6280] changing packet size to 188
[mpegts @ 0x81f6280] changing packet size to 192
.
.
.
[mpegts @ 0x81f6280] changing packet size to 188
[mpegts @ 0x81f6280] changing packet size to 192
[mpegts @ 0x81f6280] changing packet size to 188
[mpegts @ 0x81f6280] PES packet size mismatch
frame= 2971 fps=2674 q=-1.0 Lsize= 17441kB time=00:00:59.90 bitrate=2385.2kbits/s speed=53.9x
video:16037kB audio:1410kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Thank you
I cannot reproduce your input stream playing fine using multiple players. The .ts looks better than the mkv in all players tough, i guess due to error correction infos in the .ts but in the end it does not play 100% fine. Looking at the output of ffplay there are lots of mpeg related errors which means you just do not have all video data in your stream dump to decode it correctly.
Unfortunately there is no way for you to go with direct stream copy from your fragmented .ts file into a frame accurate container without Decoding and re-encoding i fear.