[MEncoder-users] Audio sync problems

Fredrik Eriksson feffese at yahoo.se
Fri Dec 2 09:00:29 CET 2005


HTUME 20051111 wrote:

>>>On Saturday, 26 November 2005 at 21:43, Karl Mitchell wrote:
>>>      
>>>
>>so I had to use "--engage allow_avc_in_vfw_mode" in mkvmerge.  Any suggestions?
>>
>>However, my aim was to create an MP4 container, for the sake of
>>portability.  If your or anyone can tell me how to do this, I'd be grateful.
>>
>>Regards,
>>
>>-Karl
>>
>>mencoder dvd://1 -dvd-device /Volumes/Neptune/Movies/DVD/VIDEO_TS -alang
>>eng -nosound -vf pullup,softskip -ovc x264 -x264encopts
>>bitrate=1200:turbo=1:pass=1 -ofps 24000/1001 -o test.mp4
>>
>>mencoder dvd://1 -dvd-device /Volumes/Neptune/Movies/DVD/VIDEO_TS -alang
>>eng -oac faac -faacopts br=128 -vf pullup,softskip -ovc x264
>>-x264encopts bitrate=1200:turbo=1:pass=1 -ofps 24000/1001 -o test.aac
>>-of rawaudio
>>
>>mkvmerge -o test.mkv test.mp4 test.aac --engage
>>allow_avc_in_vfw_mode-engage allow_avc_in_vfw_mode
>>
>>    
>>
>
>hi.
>I've been looking for info about whether MEncoder uses vfw mode or
>not. such as "packed Bframes" or "Delay frames".
>
>I'm using commands below, to make x264+aac.mp4. On MacOSX
>10.4.3,MEncoder dev-CVS-051115-06:05-4.0.1
>
>#1st PASS (may be -ni is not needed )
>mencoder XXX.mpeg -oac copy -ovc x264 -x264encopts
>threads=2:me=3:bitrate=1024:qp_min=16:qp_max=51:i4x4:frameref=5:subq=6:keyint=230:cabac:deblock:nob_adapt:bframes=1:turbo=1:pass=1
>-passlogfile XXX.avi.log -vf
>pullup,softskip,crop=704:464:8:8,scale=640:480,hqdn3d=4:3:6,pp=l5,harddup
>-ni -sws 9 -ofps 23.976 -of avi -o /dev/null
>
>#2nd PASS
>mencoder XXX.mpeg -oac copy -ovc x264 -x264encopts
>threads=2:me=3:bitrate=1024:qp_min=16:qp_max=51:i4x4:frameref=5:subq=6:keyint=230:cabac:deblock:nob_adapt:bframes=1:pass=2
>-passlogfile XXX.avi.log -vf
>pullup,softskip,crop=704:464:8:8,scale=640:480,hqdn3d=4:3:6,pp=l5,harddup
>-ni -sws 9 -ofps 23.976 -of avi -o XXX.avi
>
>#extract rawvideo
>mp4box -aviraw video XXX.avi
>
>#Audio encode
>ffmpeg -i XXX.mpeg -y -vn -f mp4 -acodec aac -ar 48000 -ac 2 -ab 64
>-map 0.1:0.0 XXX_aac.mp4
>
>#mux
>mp4box -fps 23.976 -add XXX_video.h264 -add XXX_aac.mp4 -new XXX.mp4
>
>
>Good points:
>1. Playable in QuickTime Player 7.0.3 Pro, VLC, MPlayer OSX. (not
>tested on Win nor any *nix distros)
>
>Bad points:
>1. Durations of Audio & Video has some slight difference. Video is
>always longer, Up to 0.22sec~0.15sec. encoding Audio & Video is not
>good thing any way. but encoding all on ffmpeg has same problem, So I
>may try to trim Video or scale Audio.
>2. Not editable in QuickTime Player 7.0.3 Pro. "Edit", I mean
>correcting Audio durations, changing aspect ratio for playing,,,.
>After  these operations,  QT7  claims that I have to  encode again.
>This never take place when I use no bframes.
>3. I guess -oac faac could result more accurate durations, but
>sometimes MEncoder says "bus erroer".  not always, but so far there,
>seems to be no rule.
>
>Bad points 2. seems to be caused by vfw mode. Is there any way to
>enable other modes in MEncoder?
>  
>
I've been wondering about the same thing myself:

mencoder-cvs -ffourcc avc1 -of lavf -lavfopts format=mp4 dvd://2 
-chapter 1-1 -vf pullup,softskip,crop=704:480:10:0,harddup -ofps 
24000/1001 -nosound -ovc x264 -x264encopts 
bitrate=1330:keyint=300:frameref=15:bframes=16:qp_max=40:qp_step=5:qcomp=0.7:weight_b:4x4mv:8x8dct:me=3:me_range=20:subq=6:pass=3 
-o CCS.try1.mp4

when I try to run the resulting file through mkvmerge it tells me:

Warning: Quicktime/MP4 reader: MPEG4 part 10/AVC track 1 is missing its 
decoder config. Skipping this track.

the only way I've been able to create a "real" mkv file with x264 video 
with mencoder is to use -of rawvideo, mux it with MP4Box (MP4Box -fps 
23.976 -add file.h264 file.mp4), and then mux it with mkvmerge. However, 
since you can't specify fps as exact in mp4box as you can in mencoder, 
the output will be wrong, and the audio will be out of sync.

it would be nice if the mp4 muxer created a file that is compadible with 
mkvmerge...

Fredrik




More information about the MEncoder-users mailing list