[MPlayer-dev-eng] [PATCH] ae_lavc: set nBlockAlign like libavformat

Nicolas George nicolas.george at normalesup.org
Sat Aug 27 16:34:21 CEST 2011


With the current code, in the AVI WAVE header, nBlockAlign is set to 1,
while ffmpeg, with the same settings, sets a different value. The attached
patch makes ae_lavc + AVI muxer behave like ffmpeg by imitating
libavformat/riff.c around line 402.

The following command allow to test the change:

First, generate a source file:

perl -e 'print ((("\xFF" x 50 . "\x00" x 50) x 48 . "\x80" x 43200) x 10)' | \
ffmpeg -f lavfi -i testsrc=duration=10 -f u8 -ar 48000 -ac 1 -i - \
  -sample_fmt s16 -acodec ac3 -y /tmp/source.avi

Then, encode with mencoder:

./mencoder /tmp/source.avi -ovc lavc -oac lavc -lavcopts acodec=$c \
  -o /tmp/test-menc-$c.avi

The same with ffmpeg:

ffmpeg -i /tmp/source.avi -acodec $c /tmp/test-ffmpeg-$c.avi

The play it with mplayer:

For c=mp2 and c=ac3:
test-ffmpeg: ok
test-menc, current code: huge desync (A-V:3735.528)
test-menc, patched: ok.

For c=aac:
test-ffmpeg: big desync (A-V:243.729)
test-menc, current code: bigger desync (A-V:736.910)
test-menc, patched: same desync as ffmpeg.

Obviously there is still something wrong, but at least it is the same wrong
as ffmpeg, so if someone fixes it, we can imitate.

Regards,

-- 
  Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-ae_lavc-set-nBlockAlign-like-libavformat.patch
Type: text/x-diff
Size: 1638 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20110827/49043a7b/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20110827/49043a7b/attachment.asc>


More information about the MPlayer-dev-eng mailing list