You are not logged in.

#1 2009-03-21 03:18:44

radu242
Member
Registered: 2009-03-15
Posts: 11

A/V sync problems with mencoder -- trying to convert to 30fps

The title says it all. When encoding with mencoder (latest from extra repo), with seemingly everything tried, I absolutely cannot get the audio to sync! It's driving me nuts! Here is the basic command command I used:

mencoder -fps 30 -ofps 30 -ovc xvid -oac mp3lame -xvidencopts bitrate=whatever_i_want:trellis:aspect=16/9 -lameopts cbr:br=128 -vf harddup,expand=aspect=16/9,scale=480:272 infile -o outfile

Where the infile was any one of:
* A standard, .avi Xvid 23.976 fps 800kb/s video with MP3 112kb/s audio DVD rip you can find on the net and filesharing sites (here the vbitrate was 800kb/s)
* An .mpeg MPEG1 25fps 1150kb/s video MP2 224kb/s audio (here bitrates were outputted to the same values)
* An .mp4 H264 29.989fps high-bitrate (in the 2000s, was somewhat random) video AAC audio file downloaded directly from Youtube with a DL mp4 from YT Firefox extension

I also tried to mess with the codec settings, like using libavcodec, no trellis as an option, different bitrates etc. but the audio is still out of sync! Although on the mencoder man page it says to put harddup at the end of the filer chain, I've tried that; all it did was cause weird graphical glitch of a band of rectangles containing some video on the right side of the screen, as well as ignoring the expand filter. And it didn't even fix the A/V sync. To be specific, the audio is considerably behind the video e. g. by the time the video ends, audio is still playing from long before the ending credits from an earlier scene, and cuts off as the file ends.

On a side note, framerate conversion with ffmpeg (which, if I understand correctly, mencoder/mplayer is based on), with -r 30 works. But for some reason I find a quality difference (even when using libxvid directly as a -vcodec) and, on top of that, cropping fails with "Vertical crop dimensions are outside the range of the original image." (which they weren't). Argh, I don't think I've every googlesearched this hard only to not get an answer!

Why am I trying to do this? I am converting these videos for playback on my Samsung P2, whose video format requirements are pretty strict (scroll down to video).

And just as a side question, if that if all figured out, I'm trying to make sense of multi-pass encoding. Anyone have some howto to point me to? Any tips on multipass/framerate encoding? And please, don't tell me to RTFM. Mplayer/Mencoder's man page is 300kb uncompressed in itself. I have already tried to made sense of this large document and it has failed to give me an answer (it is a good resource for xvidencopts and the like, but not so much a good guide for mplayer/mencoder.

Offline

Board footer

Powered by FluxBB