[FFmpeg-devel] [HACK]Allow muxing high-bitrate AC-3 in avi

Carl Eugen Hoyos cehoyos
Wed Dec 29 18:50:52 CET 2010


Hi!

Currently, when muxing stereo AC-3 >384k in avi, the resulting file cannot be 
played back with WMP, vlc, xine, ffplay and MPlayer (both demuxers).

Attached hack allows playback on all these players, tested with 448k and 640k 
(and 576k on non-WMP). 0 does not seem to work on any player (I may not have 
tested all combinations).

Is this good enough or do I have to find the smallest working value?

Carl Eugen
-------------- next part --------------
Index: libavformat/riff.c
===================================================================
--- libavformat/riff.c	(revision 26126)
+++ libavformat/riff.c	(working copy)
@@ -373,6 +373,9 @@
     if (enc->codec_id == CODEC_ID_MP2 || enc->codec_id == CODEC_ID_MP3 || enc->codec_id == CODEC_ID_AC3) {
         blkalign = enc->frame_size; //this is wrong, but it seems many demuxers do not work if this is set correctly
         //blkalign = 144 * enc->bit_rate/enc->sample_rate;
+        //High bitrate AC-3 will not playback with MPlayer and WMP without arbitrary high blkalign
+        if (enc->bit_rate > 384)
+            blkalign = 3000;
     } else if (enc->codec_id == CODEC_ID_ADPCM_G726) { //
         blkalign = 1;
     } else if (enc->block_align != 0) { /* specified by the codec */



More information about the ffmpeg-devel mailing list