[FFmpeg-devel] [PATCH]Fix AC3-in-avi for the remaining cases
Justin Ruggles
justin.ruggles
Sat Jan 1 21:52:07 CET 2011
On 01/01/2011 03:03 PM, Carl Eugen Hoyos wrote:
> Hi!
>
> Current svn produces avi files that don't playback on any player when muxing
> AC3 with 32kHz/320kB, 32kHz/384kB and 44.1kHz/384kB.
> I believe Justin suggested to set blkalign to maximum frame size (first
> patch).
> An alternative is to just fix the failing cases (second patch).
>
> Opinions?
>
> Please comment, Carl Eugen
>
>
> Index: libavformat/riff.c
> ===================================================================
> --- libavformat/riff.c (revision 26183)
> +++ libavformat/riff.c (working copy)
> @@ -370,12 +370,10 @@
> av_log(enc, AV_LOG_WARNING, "requested bits_per_coded_sample (%d) and actually stored (%d) differ\n", enc->bits_per_coded_sample, bps);
> }
>
> - if (enc->codec_id == CODEC_ID_MP2 || enc->codec_id == CODEC_ID_MP3 || enc->codec_id == CODEC_ID_AC3) {
> + if (enc->codec_id == CODEC_ID_MP2 || enc->codec_id == CODEC_ID_MP3) {
> 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;
> - //For high bitrate AC-3, set blkalign to maximum bytes per frame value
> - //to allow playback on WMP and MPlayer
> - if (enc->bit_rate > 384000)
> + } else if (enc->codec_id == CODEC_ID_AC3) {
> blkalign = 3840;
> } else if (enc->codec_id == CODEC_ID_ADPCM_G726) { //
> blkalign = 1;
I like this version better.
Regarding the other patch, if it would be better for some reason to use
a more accurate value for AC-3 we could do:
switch (enc->sample_rate) {
8000: blkalign = 960;
11025: blkalign = 697;
12000: blkalign = 640;
16000: blkalign = 1920;
22050: blkalign = 1394;
24000: blkalign = 1280;
32000: blkalign = 3840;
44100: blkalign = 2788;
48000: blkalign = 2560;
}
-Justin
More information about the ffmpeg-devel
mailing list