[MPlayer-users] a/v sync problems with -audiofile

Robert R. Wal rrw at hell.pl
Sun Aug 4 19:13:02 CEST 2002


On 02.08.04 Georg Prager pressed the following keys:

> Ok, first I extract the german audio with
> "mplayer -hardframedrop -ao pcm -aofile german.wav -vo null -dvd 2"
> 
> then I normalize with
> "normalize german.wav"
> 
> and make a mp3 with
> "lame german.wav german.mp3"
> or
> "bladeenc german.wav german.mp3"
> 
> When I play the divx with the german audio-stream
> "mplayer movie.avi -audiofile german.mp3"
> video and audio get out of sync although the mp3 has the same sampling 
> frequency (48kHz) as the extracted wav file.
> 
> When I play with "mplayer movie.avi -audiofile german.wav" everything works 
> pretty fine, but unfortunately wav is too big.

You're having problems since mp3 is fscking crap and people who created
it cannot even count. Well at least it is true in case of Frauhoffer
implementation. The problem is, that whenever reference encoder creates
mp3 at 128 kbps its bitrate is much more like 127kbps. mp3 at 96 is really
more like 95 etc.[1]

I think that other programs that produce mp3 encoded audio have to
repeat this error in order to be ,,standards compliant''.

Authors of multimedia encoders go to great lengths to compensate for
this. Unfortunatelly it's close to impossible to produce synced a/v
files if you compressed audio and video separatelly.

VirtualDub changes bitrate information to more precise. mencoder does
something similar to compensate for this constant linear drift (I
believe that's what people call it).

I usually avoided this problem using virtualdub on windows:

1. Encode audio+video to needed codecs with VirtualDub
2. load .WAV file with second language and encode it to avi (possibly
with video in ,,direct stream copy'' mode)
3. extract both mp3 streams to mp3 encapsulated in .wav (,,save WAVE''
in virtualdub)
4. mux video only AVI with two WAVE streams using avimux program on
windows.

Voila, you have AVI with two audio streams that are in sync with video
stream and that is playable with most video players.

Robert

[1] I might have forgotten or mistaken some facts; you will find more
 information on this subject in virtualdub's help.

PS. You are free to replace any or all programs with their Linux
counterparts if you find them.

PPS. In step 4 you can also use a+v AVI plus one WAVE stream.

-- 
Bastard Operator From 149.156.96.35




More information about the MPlayer-users mailing list