[MPlayer-dev-eng] Video lags behind audio a bit when using libmad for mp3 decoding
Siarhei Siamashka
siarhei.siamashka at gmail.com
Wed Aug 16 07:37:44 CEST 2006
On Saturday 05 August 2006 20:59, Uoti Urpala wrote:
> > Using -ac mad, video and audio are out of sync a bit. This lag can be
> > observed with very low audio bitrate (32kbps). The problem is in
> > ad_libmad.c:48
>
> No it isn't. If this affects desync it means the bug is elsewhere.
Found what's the matter. The reason is that I tried not quite 32kbps audio.
The first mp3 frame is really 96 bytes long (32kbps), but the others are have
size 500-600 bytes it is way much larger than 32kbps (such strange clip was
created with 'mencoder -oac mp3lame -lameopts br=32 ...'). So 'sh->i_bps' is
estimated wrong and when calculating a_pts in mplayer.c:2499 it makes quite a
big difference as libmad decoder always fully fills input buffer with data.
There is no problem with cbr audio though, but properly supporting various
weird vbr such as in this case would be nice to have.
A solution may be just reading data for decoding only when needed (as
ad_mp3lib does) or support 'new way of calculating audio pts' as
recommended in mplayer.c comments.
I'll try to make some patch later.
More information about the MPlayer-dev-eng
mailing list