[MEncoder-users] Audio/video synchronization bug with MEncoder

Eric Buist buisteri at iro.umontreal.ca
Mon Apr 7 04:22:46 CEST 2008


I think I have found a solution for my problem.

Eric Buist a écrit :
> Hello,
> I tried to convert a DivX video to MPEG-2 for DVD using MEncoder
> 2:1.0~rc1-0ubuntu13.2, and I have many time-consuming difficulties.
> The command-line I used was:
> mencoder -oac lavc -ovc lavc -of mpeg -mpegopts format=dvd:tsaf -vf
> scale=720:480,telecine,harddup -srate 48000 -af lavcresample=48000
> -lavcopts
> vcodec=mpeg2video:vrc_buf_size=1835:vrc_maxrate=9000:vbitrate=3350:vratetol=10:keyint=15:aspect=16/9:acodec=ac3:abitrate=128:vstrict=0:trell:mbd=2:dc=10
> -ofps 24000/1001 -o out.mpg out.avi
> The resolution of the input AVI was 704x288 with 25 fps. I hoped to get
> a NTSC resolution of 720x480 by rescaling and setting the aspect ratio
> to 16:9. I tried to set the frame rate to 24000/1001, and use soft
> telecine to get the 30000/1001 frame rate required for a DVD.
>   
The telecine LAVC option performs hard-telecine. With this option, it
seems that I should have set the framerate to 30000/1001 rather that
24000/1001. Otherwise, the telecine filter was increasing the framerate
while -ofps was dropping frames. I got much better result (and A/V
sync!) by putting telecine in mpegopts instead of lavcopts. This is the
soft telecine I was expecting: I encode in 24000/1001 fps which is near
the original 25 fps (only a few frames dropped), and I tell the DVD
player to duplicate frames at playback time. These two telecine options
are confusing, because they share the same name without having the same
meaning.
> First, encoding was very very long, twice the length as the movie, and I
> have a Pentium D 2.8GHz CPU. If I don't use quality-enhancing options, I
> sometimes get white pixels appearing in my encodes.
I am still worried about this, because I have to upscale the original
video. This may be the cause of these artifacts. Should I use a filter
to correct this? Or change hos the scaling is done using an option for
the scale filter?
>   During my first
> trials, I was always getting a 4.7GB MPEG file as output.
With the correct telecine option, I get 3Gb MPEG files even with bitrate
of 4000kbps. It does not use all the space on the DVD, but at least, it
fits on the disk.

>  I was trying
> to change the vbitrate parameter without any effect.
Still no effect. I suppose that no more bits are needed to encode the
particular information I give to MEncoder.
>  I got more success
> after I have set vratetol to 10.
I can also drop the vratetol option now.
>  I made several tests without quality
> enhancing options (trell, mbd, etc.), and I made my final encoding using
> the options.
> But problems appeared when I played the movie. At the beginning,
> everything was fine, but if I seek after a few minutes of video, audio
> and video are out of sync. I tried both with Totem and MPlayer, with the
> same bad results.
> I thought the problem was telecine stuff so I reprocessed my output file
> using the command-line:
>   
I was right, but the first fix was sufficient to solve the problem.
> mencoder -ovc copy -oac copy -of mpeg -mpegopts format=dvd:tsaf:telecine
> -o hp1-3350-t.mpg hp1-3350.mpg
> I hoped that this way, I could add back soft telecine information into
> the MPEG program stream, but I got exactly the same results: A/V sync
> problem.
> Do I really have to play around with A/V delay to fix that? This is too
> much hard work for me, and I don't have the time to do trial and error
> with this.
I was upset about finding multiple A/V delays, because the sync problem
was getting worser as the movie played.
>  If there is no other solution than this, or recompiling from
> source to get the most recent version of MEncoder on Ubuntu 7.10, I will
> revert to using TMPGEnc with Wine, but I would like to avoid this,
> because TMPGEnc seems to have difficulty with AVI files containing MP3
> audio.
>   
I tested, and TMPGEnc seems to work with Wine, which is a good new; at
least, I have a fallback.
Before using TMPGEnc, I was considering re-encoding the audio to AC-3
using MEncoder. This way, TMPGEnc would have been happy with the audio.
I have also tried succesfully with FFMpeg.
> Thanks in advance.
> Eric
> _______________________________________________
> MEncoder-users mailing list
> MEncoder-users at mplayerhq.hu
> https://lists.mplayerhq.hu/mailman/listinfo/mencoder-users
>   
Eric



More information about the MEncoder-users mailing list