[FFmpeg-user] Transcoding MPEG .ts results in slow playback speed
Peter B.
pb at das-werkstatt.com
Fri Jan 25 17:16:05 EET 2019
Hi everyone :)
I have a tricky source video:
====================
It's an MPEG TS file, that regardless of what I try to transcode it to,
the resulting file has its duration doubled.
The resulting file plays back to slow (at only half the normal speed).
I've tried transcoding to FFV1, and Huffyuv: Same behavior - so I
presume it's the source.
The exact details of how the source was created are not known, but I'm
pretty sure it was done using some "regular" tool designed for home
video editing. No "AV-nerd" or expert involved.
Mediainfo says 25fps for the source, but when I transcode it to e.g.
FFV1, Mediainfo shows no value for framerate at all and says it's
variable framerate. Whereas VLC or ffprobe say it's 25fps... Seems odd.
If I rewrap to MKV in an extra step before, and then transcode (using
same command!), timing seems to be fine.
Any ideas what's happening here, and how to skip that extra rewrapping step?
Thank you very much in advance for any ideas/help :)
Peter B.
I've created a sample (with "dd") of the first few MB to recreate the issue:
http://download.das-werkstatt.com/pb/contribs/files/bad_timing-MPEGTS.tar.bz2
Commandline and complete, uncut console output here:
Original Transcode (produces wrong timing in target):
// -----------------------------------
$ ffmpeg-git -i bad_timing.ts -c:v ffv1 -c:a copy out/too_slow.mkv
// -----------------------------------
ffmpeg version N-93022-g260f196 Copyright (c) 2000-2019 the FFmpeg
developers
built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.10) 20160609
configuration: --prefix=/usr/local --enable-gpl --enable-nonfree
--enable-version3 --enable-postproc --enable-ffplay --enable-swscale
--enable-avfilter --enable-pthreads --enable-bzlib --enable-zlib
--enable-decoder=png --enable-encoder=png --samples=../fate-suite
--enable-libfreetype --enable-libopenjpeg --disable-decoder=jpeg2000
--enable-libvpx --enable-libvorbis --enable-libx264 --enable-libx265
libavutil 56. 26.100 / 56. 26.100
libavcodec 58. 44.100 / 58. 44.100
libavformat 58. 26.100 / 58. 26.100
libavdevice 58. 6.101 / 58. 6.101
libavfilter 7. 48.100 / 7. 48.100
libswscale 5. 4.100 / 5. 4.100
libswresample 3. 4.100 / 3. 4.100
libpostproc 55. 4.100 / 55. 4.100
Input #0, mpegts, from 'bad_timing.ts':
Duration: 00:00:07.28, start: 0.000000, bitrate: 9114 kb/s
Program 1
Metadata:
service_name : Service01
service_provider: FFmpeg
Stream #0:0[0x100]: Video: mpeg2video (Main) ([2][0][0][0] /
0x0002), yuv420p(tv, top first), 1920x1080 [SAR 1:1 DAR 16:9], 25 fps,
25 tbr, 90k tbn, 50 tbc
Stream #0:1[0x101]: Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz,
stereo, fltp, 256 kb/s
Stream mapping:
Stream #0:0 -> #0:0 (mpeg2video (native) -> ffv1 (native))
Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
Output #0, matroska, to 'out/too_slow.mkv':
Metadata:
encoder : Lavf58.26.100
Stream #0:0: Video: ffv1 (FFV1 / 0x31564646), yuv420p, 1920x1080
[SAR 1:1 DAR 16:9], q=2-31, 200 kb/s, 25 fps, 1k tbn, 25 tbc
Metadata:
encoder : Lavc58.44.100 ffv1
Stream #0:1: Audio: mp2 (P[0][0][0] / 0x0050), 48000 Hz, stereo,
fltp, 256 kb/s
[mpeg2video @ 0x381e3c0] ac-tex damaged at 114 400:00:12.68
bitrate=10608.3kbits/s speed=8.32x
[mpeg2video @ 0x381e3c0] Warning MVs not available
[mpeg2video @ 0x381e3c0] concealing 3296 DC, 3296 AC, 3296 MV errors in
P frame
frame= 182 fps= 88 q=-0.0 Lsize= 36255kB time=00:00:14.36
bitrate=20681.3kbits/s speed=6.98x
video:36024kB audio:226kB subtitle:0kB other streams:0kB global
headers:0kB muxing overhead: 0.013793%
Rewrapping intermediate step:
// --------------------------------
$ ffmpeg-git -i bad_timing.ts -c copy rewrap.mkv
// --------------------------------
ffmpeg version N-93022-g260f196 Copyright (c) 2000-2019 the FFmpeg
developers
built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.10) 20160609
configuration: --prefix=/usr/local --enable-gpl --enable-nonfree
--enable-version3 --enable-postproc --enable-ffplay --enable-swscale
--enable-avfilter --enable-pthreads --enable-bzlib --enable-zlib
--enable-decoder=png --enable-encoder=png --samples=../fate-suite
--enable-libfreetype --enable-libopenjpeg --disable-decoder=jpeg2000
--enable-libvpx --enable-libvorbis --enable-libx264 --enable-libx265
libavutil 56. 26.100 / 56. 26.100
libavcodec 58. 44.100 / 58. 44.100
libavformat 58. 26.100 / 58. 26.100
libavdevice 58. 6.101 / 58. 6.101
libavfilter 7. 48.100 / 7. 48.100
libswscale 5. 4.100 / 5. 4.100
libswresample 3. 4.100 / 3. 4.100
libpostproc 55. 4.100 / 55. 4.100
Input #0, mpegts, from 'bad_timing.ts':
Duration: 00:00:07.28, start: 0.000000, bitrate: 9114 kb/s
Program 1
Metadata:
service_name : Service01
service_provider: FFmpeg
Stream #0:0[0x100]: Video: mpeg2video (Main) ([2][0][0][0] /
0x0002), yuv420p(tv, top first), 1920x1080 [SAR 1:1 DAR 16:9], 25 fps,
25 tbr, 90k tbn, 50 tbc
Stream #0:1[0x101]: Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz,
stereo, fltp, 256 kb/s
Output #0, matroska, to 'rewrap.mkv':
Metadata:
encoder : Lavf58.26.100
Stream #0:0: Video: mpeg2video (Main) (mpg2 / 0x3267706D),
yuv420p(tv, top first), 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 25 fps, 25
tbr, 1k tbn, 90k tbc
Stream #0:1: Audio: mp2 (P[0][0][0] / 0x0050), 48000 Hz, stereo,
fltp, 256 kb/s
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
frame= 182 fps=0.0 q=-1.0 Lsize= 7891kB time=00:00:07.22
bitrate=8948.3kbits/s speed= 159x
video:7660kB audio:226kB subtitle:0kB other streams:0kB global
headers:0kB muxing overhead: 0.061223%
Transcoding from intermediate, rewrapped MKV (produces correct timing):
// --------------------------------
$ ffmpeg-git -i rewrap.mkv -c:v ffv1 -c:a copy out/rewrap.mkv
// --------------------------------
ffmpeg version N-93022-g260f196 Copyright (c) 2000-2019 the FFmpeg
developers
built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.10) 20160609
configuration: --prefix=/usr/local --enable-gpl --enable-nonfree
--enable-version3 --enable-postproc --enable-ffplay --enable-swscale
--enable-avfilter --enable-pthreads --enable-bzlib --enable-zlib
--enable-decoder=png --enable-encoder=png --samples=../fate-suite
--enable-libfreetype --enable-libopenjpeg --disable-decoder=jpeg2000
--enable-libvpx --enable-libvorbis --enable-libx264 --enable-libx265
libavutil 56. 26.100 / 56. 26.100
libavcodec 58. 44.100 / 58. 44.100
libavformat 58. 26.100 / 58. 26.100
libavdevice 58. 6.101 / 58. 6.101
libavfilter 7. 48.100 / 7. 48.100
libswscale 5. 4.100 / 5. 4.100
libswresample 3. 4.100 / 3. 4.100
libpostproc 55. 4.100 / 55. 4.100
Input #0, matroska,webm, from 'rewrap.mkv':
Metadata:
ENCODER : Lavf58.26.100
Duration: 00:00:07.28, start: 0.000000, bitrate: 8879 kb/s
Stream #0:0: Video: mpeg2video (Main), yuv420p(tv, top first),
1920x1080 [SAR 1:1 DAR 16:9], 25 fps, 25 tbr, 1k tbn, 50 tbc (default)
Metadata:
DURATION : 00:00:07.280000000
Stream #0:1: Audio: mp2, 48000 Hz, stereo, s16p, 256 kb/s (default)
Metadata:
DURATION : 00:00:07.248000000
Stream mapping:
Stream #0:0 -> #0:0 (mpeg2video (native) -> ffv1 (native))
Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
Output #0, matroska, to 'out/rewrap.mkv':
Metadata:
encoder : Lavf58.26.100
Stream #0:0: Video: ffv1 (FFV1 / 0x31564646), yuv420p, 1920x1080
[SAR 1:1 DAR 16:9], q=2-31, 200 kb/s, 25 fps, 1k tbn, 25 tbc (default)
Metadata:
DURATION : 00:00:07.280000000
encoder : Lavc58.44.100 ffv1
Stream #0:1: Audio: mp2 (P[0][0][0] / 0x0050), 48000 Hz, stereo,
s16p, 256 kb/s (default)
Metadata:
DURATION : 00:00:07.248000000
[mpeg2video @ 0x3dea640] ac-tex damaged at 114 400:00:06.52 bitrate=
1.1kbits/s speed=4.25x
[mpeg2video @ 0x3dea640] Warning MVs not available
[mpeg2video @ 0x3dea640] concealing 3296 DC, 3296 AC, 3296 MV errors in
P frame
frame= 182 fps= 92 q=-0.0 Lsize= 36255kB time=00:00:07.24
bitrate=41017.0kbits/s speed=3.66x
video:36024kB audio:226kB subtitle:0kB other streams:0kB global
headers:0kB muxing overhead: 0.013798%
More information about the ffmpeg-user
mailing list