[MPlayer-users] A-V-sync in mencoder

Ville Saari 113762 at foo.bar.org
Thu Mar 18 16:52:44 CET 2004


On Tue, Mar 16, 2004 at 01:29:45PM -0500, D Richard Felker III wrote:

> > so I was wondering if it would be feasible to implement an option to
> > resample the audio instead?
> 
> Agree, but this should rarely even be necessary. Most of the problem
> is just bugs in mencoder.

But not all. I have encountered some TV-captured mpeg files that have
perfect audio sync when played, but when demuxed into separate audio
and video files, result significantly different length tracks which,
when muxed back together, result terrible desyncs. With any tools -
not just mplayer/mencoder.

In some cases resampling the audio to slightly different speed fixes
the problem. In some other cases the sync difference stays most of the
time constant, but has sudden jumps every now and then.

> >   use -fps 25 -ofps 24 to slow PAL-movies down to their original film
> >   speed with no need to worry about audio sync.
> 
> No, this is total nonsense. It changes the meaning of the -fps and
> -ofps options. Think of what would happen when encoding from NTSC
> dvds!
> 
> On the other hand, with your proposal, -fps 24 would probably do what
> you want.

You're right. My head was thinking something entirely different than what
my fingers were typing :-)

But you got my point anyway. Interpreting the frame rate differently than
what the source file headers dictate would become possible. A perfectionist
could even use this for NTSC too - to get exactly 24 fps instead of 23.976.

> > - The number of frames in the mencoded file would match the original
> >   exactly so the frame numbers for -frames, vrc_override etc. would
> >   be unambiguous.
> 
> Not true! Telecine!!!!

But if you do inverse telecine, then you are intentionally using a filter
that changes the number of frames. And although the relation between
the input and output frames would then not be one-to-one, it would still
be predictable which would be quite an improvement over the current
situation, where it depends on sunspots and the phase of the moon among
other things.

> Basically mencoder just sucks, but it vaguely works. IMO you should
> always use -mc 0 -noskip, but this can easily break a/v sync if your
> input file isn't perfect or if you want to do inverse telecine.

And it most likely _will_ break it. In my experience -mc 0 almost
never produces acceptable results unless the input file was produced
by mencoder itself. And even then it wouldn't be 100% sure.

> You can try overhauling mencoder if you think you can make it work.

It was quite enough for me to try to figure out enough of the filter
api so I could write the special filters I needed. Had to do it the
hard way because I couldn't find any documentation for the api. Does
such exist?

-- 
 Ville




More information about the MPlayer-users mailing list