[FFmpeg-devel] ffmpeg latest git - rewrapping (codec copy) breaks container fps/tbr values

David Favor david at davidfavor.com
Mon Apr 13 23:11:41 CEST 2015


David Favor wrote:
> The following command:
> 
>     ffmpeg -i clip.mts -c:v copy -c:a copy clip.mp4 (or clip.mov)
> 
> seems to incorrectly write container values for fps + tbr which
> causes .mp4/.mov files to play with very odd jerky movements.
> 
> imac> avinfo clip.mts
> clip.mts
>    length: 00:01:00.03, start: 1.433367, bitrate: 24821 kb/s
>    stream: #0:0[0x100]: Video: h264 (High) ([27][0][0][0] / 0x001B), 
> yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 29.97 fps, 29.97 tbr, 90k tbn, 
> 59.94 tbc
>    stream: #0:1[0x101]: Audio: ac3 ([129][0][0][0] / 0x0081), 48000 Hz, 
> stereo, fltp, 256 kb/s
> 
> imac> avinfo clip.mp4
> clip.mp4
>    length: 00:01:00.04, start: 0.000000, bitrate: 22955 kb/s
>    stream: #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 
> 1920x1080 [SAR 1:1 DAR 16:9], 22690 kb/s, 59.94 fps, 59.94 tbr, 90k tbn, 
> 59.94 tbc (default)
>    stream: #0:1(und): Audio: ac3 (ac-3 / 0x332D6361), 48000 Hz, stereo, 
> fltp, 256 kb/s (default)
> 
> Notice both fps + tbr have changed from 29.97 to 59.94 which seems the 
> problem.
> 
> Someone let me know if this is really a bug or if this has changed + no 
> longer works.
> 
> Thanks.
> 
> _______
> 
> ffmpeg run log...
> 
> imac> ffmpeg -i clip.mts -c:v copy -c:a copy clip.mp4
> ffmpeg version 2.6.2-2015-04-13-71430-g4d74c8d Copyright (c) 2000-2015 
> the FFmpeg developers
>   built with Apple LLVM version 6.0 (clang-600.0.57) (based on LLVM 3.5svn)
>   configuration: --cc=/usr/bin/clang --prefix=/david-favor/osx-10.9.5 
> --mandir=/david-favor/osx-10.9.5/share/man --enable-gpl --enable-yasm 
> --arch=x86_64 --enable-version3 --enable-pthreads --enable-shared 
> --disable-static --disable-debug --extra-cflags='-pipe 
> -I/david-favor/osx-10.9.5/include -I/opt/local/include 
> -I/usr/local/include -I/usr/include' 
> --extra-ldflags='-Wl,-rpath,/david-favor/osx-10.9.5/lib 
> -Wl,-rpath,/opt/local/lib -Wl,-rpath,/usr/local/lib -Wl,-rpath,/usr/lib 
> -L/david-favor/osx-10.9.5/lib -L/opt/local/lib -L/usr/local/lib 
> -L/usr/lib' --enable-ffplay --enable-ffprobe --enable-ffserver 
> --enable-indev=qtkit --enable-indev=avfoundation 
> --enable-runtime-cpudetect --enable-nonfree --enable-zlib --enable-bzlib 
> --enable-openssl --enable-gnutls --enable-swscale --enable-avfilter 
> --enable-avresample --enable-postproc --enable-vda --enable-libfribidi 
> --enable-libmp3lame --enable-libfaac --enable-libfdk_aac --enable-libvpx 
> --enable-libtheora --enable-libvorbis --enable-libxvid --enable-libopus 
> --enable-libopenjpeg --enable-libschroedinger --enable-libspeex 
> --enable-libbluray --enable-libx264 --enable-libx265 --enable-postproc 
> --enable-frei0r --enable-libopencv --enable-libopencore-amrnb 
> --enable-fontconfig --enable-libfreetype --enable-libmodplug 
> --enable-libass
>   libavutil      54. 22.101 / 54. 22.101
>   libavcodec     56. 34.100 / 56. 34.100
>   libavformat    56. 30.100 / 56. 30.100
>   libavdevice    56.  4.100 / 56.  4.100
>   libavfilter     5. 14.100 /  5. 14.100
>   libavresample   2.  1.  0 /  2.  1.  0
>   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 'clip.mts':
>   Duration: 00:01:00.03, start: 1.433367, bitrate: 24821 kb/s
>   Program 1
>     Metadata:
>       service_name    : Service01
>       service_provider: FFmpeg
>     Stream #0:0[0x100]: Video: h264 (High) ([27][0][0][0] / 0x001B), 
> yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 29.97 fps, 29.97 tbr, 90k tbn, 
> 59.94 tbc
>     Stream #0:1[0x101]: Audio: ac3 ([129][0][0][0] / 0x0081), 48000 Hz, 
> stereo, fltp, 256 kb/s
> File 'clip.mp4' already exists. Overwrite ? [y/N] y
> [mp4 @ 0x7f8d5e81dc00] Codec for stream 0 does not use global headers 
> but container format requires global headers
> [mp4 @ 0x7f8d5e81dc00] Codec for stream 1 does not use global headers 
> but container format requires global headers
> [mp4 @ 0x7f8d5e81dc00] track 1: codec frame size is not set
> Output #0, mp4, to 'clip.mp4':
>   Metadata:
>     encoder         : Lavf56.30.100
>     Stream #0:0: Video: h264 ([33][0][0][0] / 0x0021), yuv420p, 
> 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 29.97 fps, 29.97 tbr, 90k tbn, 90k 
> tbc
>     Stream #0:1: Audio: ac3 ([165][0][0][0] / 0x00A5), 48000 Hz, stereo, 
> 256 kb/s
> Stream mapping:
>   Stream #0:0 -> #0:0 (copy)
>   Stream #0:1 -> #0:1 (copy)
> Press [q] to stop, [?] for help
> [mp4 @ 0x7f8d5e81dc00] pts has no value
>     Last message repeated 392 times
> [mp4 @ 0x7f8d5e81dc00] pts has no value1kB time=00:00:13.12 
> bitrate=23053.4kbits/s
>     Last message repeated 308 times
> [mp4 @ 0x7f8d5e81dc00] pts has no value65kB time=00:00:23.42 
> bitrate=22964.7kbits/s
>     Last message repeated 279 times
> [mp4 @ 0x7f8d5e81dc00] pts has no value11kB time=00:00:32.76 
> bitrate=22977.7kbits/s
>     Last message repeated 222 times
> [mp4 @ 0x7f8d5e81dc00] pts has no value29kB time=00:00:40.19 
> bitrate=22976.6kbits/s
>     Last message repeated 311 times
> [mp4 @ 0x7f8d5e81dc00] pts has no value63kB time=00:00:50.62 
> bitrate=22972.5kbits/s
>     Last message repeated 279 times
> [mp4 @ 0x7f8d5e81dc00] pts has no value52kB time=00:00:59.96 
> bitrate=22956.9kbits/s
> [mp4 @ 0x7f8d5e81dc00] pts has no value
> frame= 3599 fps=1190 q=-1.0 Lsize=  168254kB time=00:01:00.00 
> bitrate=22972.3kbits/s
> video:166308kB audio:1875kB subtitle:0kB other streams:0kB global 
> headers:0kB muxing overhead: 0.042559%
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Work around to escape jittery playback.

     ffmpeg -fflags +genpts -i clip.mts -c:v copy -c:a copy clip.mp4

Container info still seems wrong + maybe this is a side effect of
footage being interlaced (60i).

If this is the case, what is the correct way to force the container
fps + tbr to match source footage, in lossless manner (no transcode)?

A head scratcher.



More information about the ffmpeg-devel mailing list