[FFmpeg-user] Some inputs make MP4 output sync incompatible with other applications

Francois Visagie francois.visagie at gmail.com
Fri Aug 23 15:11:23 CEST 2013

Hi All,


I'm batch encoding our DVDs to H.264 AAC MP4s. Two of these output MP4s have
audio that start too early in both MPC-HC and Windows Media Player, although
ffplay syncs them correctly.


This problem seems specific to the MP4 container; when I e.g. mux to an .mpg
container the problem doesn't occur. What's also interesting to note is that
encoding individual VOBs later in the same titlesets (i.e. which don't have
headers) also doesn't produce this problem. Both MPC-HC and WMP play all
original VOBs fine. Therefore FWIW the problem seems to be in the way that
ffmpeg interprets and then recreates header information.


I'm trying to prevent this MP4 desync for other applications in a way that
safely can be left in the batch process also for better-behaved inputs.


Specifying different MP4-type formats like ipod, mov, mp4 and psp makes no
difference. Through trial-and-error, so far either '-copypts' or the
now-deprecated '-async 1' prevents desync in other applications.


For reasons not related to this issue I'd prefer to continue with

-          From limited testing so far, it seems '-copypts' doesn't always
produce correct results when applied across the board also to well-behaved
inputs; is that expected?

-          What other - perhaps MP4-specific - settings or other mechanisms
can I try to make MP4 sync information more compatible with other
applications, and that are safe also to use with well-behaved inputs?


Some examples:


Out of sync for other applications:

ffmpeg -i VTS_01_1.cut.VOB -filter:a aformat=channel_layouts=stereo -c:a
libvo_aacenc -c:v libx264 -preset ultrafast -b:v 1000000 zzz.mp4


In sync for other applications:

ffmpeg -i VTS_01_1.cut.VOB -filter:a aformat=channel_layouts=stereo -c:a
libvo_aacenc -c:v libx264 -preset ultrafast -b:v 1000000 zzz.mpg

ffmpeg -i VTS_01_1.cut.VOB -filter:a aformat=channel_layouts=stereo -c:a
libvo_aacenc -c:v libx264 -preset ultrafast -b:v 1000000 -copypts


Sample clip used in these examples (67 MB):



Console output for ffmpeg -i VTS_01_1.cut.VOB -filter:a
aformat=channel_layouts=stereo -c:a libvo_aacenc -c:v libx264 -preset
ultrafast -b:v 1000000 zzz.mp4:


C:\Users\fvisagie\Videos\My DVDs\MainMovie\Roxette Live in Sydney -
1991\VIDEO_TS\TESTSYNCCUT>ffmpeg -i VTS_01_1.cut.VOB -filter:a

o -c:a libvo_aacenc -c:v libx264 -preset ultrafast -b:v 1000000 zzz.mp4

ffmpeg version N-55159-gf118b41 Copyright (c) 2000-2013 the FFmpeg

  built on Aug  1 2013 18:01:57 with gcc 4.7.3 (GCC)

  configuration: --enable-gpl --enable-version3 --disable-w32threads
--enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r
--enable-gnutls --enab

le-iconv --enable-libass --enable-libbluray --enable-libcaca
--enable-libfreetype --enable-libgsm --enable-libilbc --enable-libmodplug
--enable-libmp3lame --ena

ble-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg
--enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr

eex --enable-libtheora --enable-libtwolame --enable-libvo-aacenc
--enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libx264
--enable-libxavs --

enable-libxvid --enable-zlib

  libavutil      52. 40.100 / 52. 40.100

  libavcodec     55. 19.100 / 55. 19.100

  libavformat    55. 12.102 / 55. 12.102

  libavdevice    55.  3.100 / 55.  3.100

  libavfilter     3. 82.100 /  3. 82.100

  libswscale      2.  4.100 /  2.  4.100

  libswresample   0. 17.103 /  0. 17.103

  libpostproc    52.  3.100 / 52.  3.100

Input #0, mpeg, from 'VTS_01_1.cut.VOB':

  Duration: 00:01:12.11, start: 0.060000, bitrate: 7840 kb/s

    Stream #0:0[0x1bf]: Data: dvd_nav_packet

    Stream #0:1[0x1e0]: Video: mpeg2video (Main), yuv420p, 720x480 [SAR 8:9
DAR 4:3], max. 6000 kb/s, 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc

    Stream #0:2[0x8a]: Audio: dts (DTS), 48000 Hz, 5.1(side), fltp, 1536

    Stream #0:3[0x80]: Audio: ac3, 48000 Hz, stereo, fltp, 192 kb/s

[libx264 @ 003c2b80] using SAR=8/9

[libx264 @ 003c2b80] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX

[libx264 @ 003c2b80] profile Constrained Baseline, level 3.0

[libx264 @ 003c2b80] 264 - core 135 r2345 f0c1c53 - H.264/MPEG-4 AVC codec -
Copyleft 2003-2013 - http://www.videolan.org/x264.html - options: cabac=0
ref=1 deb

lock=0:0:0 analyse=0:0 me=dia subme=0 psy=1 psy_rd=1.00:0.00 mixed_ref=0
me_range=16 chroma_me=1 trellis=0 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1

offset=0 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1
interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=0
keyint=250 keyint_m

in=25 scenecut=0 intra_refresh=0 rc=abr mbtree=0 bitrate=1000 ratetol=1.0
qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=0

Output #0, mp4, to 'zzz.mp4':


    encoder         : Lavf55.12.102

    Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p,
720x480 [SAR 8:9 DAR 4:3], q=-1--1, 1000 kb/s, 30k tbn, 29.97 tbc

    Stream #0:1: Audio: aac (libvo_aacenc) ([64][0][0][0] / 0x0040), 48000
Hz, stereo, s16, 128 kb/s

Stream mapping:

  Stream #0:1 -> #0:0 (mpeg2video -> libx264)

  Stream #0:2 -> #0:1 (dca -> libvo_aacenc)

Press [q] to stop, [?] for help

[mpeg2video @ 003cbec0] warning: first frame is no keyframe

    Last message repeated 1 times

[mpeg2video @ 003cbec0] ac-tex damaged at 12 16=00:01:08.36
bitrate=1187.3kbits/s dup=8 drop=0

[mpeg2video @ 003cbec0] Warning MVs not available

[mpeg2video @ 003cbec0] concealing 630 DC, 630 AC, 630 MV errors in I frame

frame= 2181 fps=397 q=-1.0 Lsize=   10737kB time=00:01:12.77
bitrate=1208.6kbits/s dup=10 drop=0

video:9549kB audio:1125kB subtitle:0 global headers:0kB muxing overhead

[libx264 @ 003c2b80] frame I:9     Avg QP:22.00  size: 12125

[libx264 @ 003c2b80] frame P:2172  Avg QP:25.35  size:  4452

[libx264 @ 003c2b80] mb I  I16..4: 100.0%  0.0%  0.0%

[libx264 @ 003c2b80] mb P  I16..4: 21.7%  0.0%  0.0%  P16..4: 31.0%  0.0%
0.0%  0.0%  0.0%    skip:47.3%

[libx264 @ 003c2b80] final ratefactor: 25.51

[libx264 @ 003c2b80] coded y,uvDC,uvAC intra: 11.2% 48.1% 15.5% inter: 11.7%
23.9% 1.7%

[libx264 @ 003c2b80] i16 v,h,dc,p: 45% 30% 15% 10%

[libx264 @ 003c2b80] i8c dc,h,v,p: 46% 26% 19%  8%

[libx264 @ 003c2b80] kb/s:1074.91

[libvo_aacenc @ 03f07240] 1 frames left in the queue on closing


C:\Users\fvisagie\Videos\My DVDs\MainMovie\Roxette Live in Sydney -


Thanks in advance,



Francois Visagie



T: +27 (83) 326-4358

F: +27 (86) 511-3490

E: francois.visagie at gmail.com



More information about the ffmpeg-user mailing list