[MPlayer-users] Separating audio and video without losing sync?

Nico Sabbi nicola.sabbi at poste.it
Tue Apr 12 16:47:51 CEST 2011


Linards Ticmanis ha scritto:
> I know, and I just want to find out at WHICH timestamps they start. If I
> know this, and if I managed to decode them to a totally constant video
> frame rate and audio PCM rate, I can add samples of silence in front of
> the decoded audio stream and/or black frames in front of the decoded
> video. Then it *should* be easy to fit them together again.
>    

>    
>> Since audio streams are always preloaded by some
>> hundred milliseconds
>> the best approximation you can get is to run some tool that drops as
>> many audio frames as necessary
>> to resync the two streams, but you will never get to a 0.0 difference...
>>      
> By dropping single audio samples from the *decoded* audio raw stream, I
> should be able to get the difference down to 1/48000 of a second, which
> is good enough for me. ;-)
>
> The point is, how do I find out how many samples to drop (or add)? For
> that I have to find out the exact timestamps at which the streams start.
> Can mencoder or mplayer give me that information? If so, the rest should
> be fairly easy.
>    
mplayer -frames <SOMETHING>  ... will report the ct value that at the 
very beginning of the streams
will be more or less  equal to the preload value in milliseconds. Divide 
that by the frame rate of the audio
stream and you'll get the amount of audio frames to drop (or prepend, 
but I've never seen audio delayed
with respect  to video).

>    
>
>> or use the mpeg2 muxer in mencoder (with the right parameters) that does
>> all that for you:-)
>>      
> Yeah, except that I'm hacking at mpeg2enc code... transferring that code
> into mencoder would certainly be a major effort, plus I like the
> encoding quality of mpeg2enc (if it's allowed to say so on this list).
>
> Thank you!
>    

I remember a lot of ringing artefacts, but good luck!


More information about the MPlayer-users mailing list