[MEncoder-users] Audio sync issue with x264 b-frames

Karl Mitchell karl.l.mitchell at jpl.nasa.gov
Sat Dec 3 18:51:08 CET 2005

Hi Jonathan,

x264 output into the default AVI container always, in my experience, 
produces sync problems.  You'll probably have to encode to mp4 using 
libavformat.  I had similar experiences to you with audio, but I 
eventually found that -oac faac worked fine (after a recompile from 
CVS), and also produced fully H.264-compliant files that played on 
Quicktime, etc.

Good luck,


>When encoding to x264 with b-frames enabled audio seems to be ahead of the
>sound a fixed amount depending on the max # of b-frames set.  I don't know
>if this a limitation of mencoder during the encode or ffmpeg during
>playback or avi as the container format or what.  I tried using
>libavformat to encode to mp4 but the sound was horribly messed up with
>-oac pcm and didn't play at all with -oac copy.
>The command lines I used are below the line with no b-frames had perfect
>sync, I couldn't tell any difference between the DVD source and the avi
>without bframes.
>mencoder.exe dvd://1 -alang en -oac copy -ofps 24000/1001 -vf
>pullup,softskip -o c:\test.b.avi -ovc x264 -x264encopts
>-endpos 150s
>mencoder.exe dvd://1 -alang en -oac copy -ofps 24000/1001 -vf
>pullup,softskip -o c:\test.avi   -ovc x264 -x264encopts
>psnr:subq=6:4x4mv:8x8dct:me=3:frameref=5:bitrate=450:pass=1 -endpos 150s
>This is with CVS mplayer/mencoder
>$ uname -a
>MINGW32_NT-5.1 XXXXXXX 1.0.10(0.46/3/2) 2004-03-15 07:17 i686 unknown
>$ gcc -v
>Reading specs from g:/MinGW/bin/../lib/gcc-lib/mingw32/3.2.3/specs
>Configured with: ../gcc/configure --with-gcc --with-gnu-ld --with-gnu-as
>--host=mingw32 --target=mingw32 --prefix=/mingw --enable-threads
>--disable-nls --enable-languages=c++,f77,objc --disable-win32-registry
>--disable-shared --enable-sjlj-exceptions
>Thread model: win32
>gcc version 3.2.3 (mingw special 20030504-1)
>$ ld -v
>GNU ld version 2.13.90 20030111
>$ as --version
>GNU assembler 2.13.90 20030111
>Copyright 2002 Free Software Foundation, Inc.
>This program is free software; you may redistribute it under the terms of
>the GNU General Public License.  This program has absolutely no warranty.
>This assembler was configured for a target of `mingw32'.
>I can provide mencoder/mplayer output if it would help, I thought I had
>saved it but I can't find it now and I can't re-encode till I get home.
>MEncoder-users mailing list
>MEncoder-users at mplayerhq.hu

More information about the MEncoder-users mailing list