Hi!

Attached patch from 2002 fixes ticket #4565.
Michael added a comment in 359fa0fe that some demuxers 
may not like it though.

Please comment, Carl Eugen
From 816005ddef962b42b48fc5d6dc70b70c7f1f0d72 Mon Sep 17 00:00:00 2001
From: Juanjo <[email protected]>
Date: Tue, 26 May 2015 23:25:27 +0200
Subject: [PATCH] lavf/riffenc: Set correct block align for mp2.

Fixes ticket #4565.

Signed-off-by: Carl Eugen Hoyos <[email protected]>
---
 libavformat/riffenc.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/riffenc.c b/libavformat/riffenc.c
index d429df0..8373f0b 100644
--- a/libavformat/riffenc.c
+++ b/libavformat/riffenc.c
@@ -103,7 +103,7 @@ int ff_put_wav_header(AVIOContext *pb, AVCodecContext *enc, 
int flags)
     }
 
     if (enc->codec_id == AV_CODEC_ID_MP2) {
-        blkalign = frame_size;
+        blkalign = 144 * enc->bit_rate/enc->sample_rate;
     } else if (enc->codec_id == AV_CODEC_ID_MP3) {
         blkalign = 576 * (enc->sample_rate <= (24000 + 32000)/2 ? 1 : 2);
     } else if (enc->codec_id == AV_CODEC_ID_AC3) {
-- 
1.7.10.4

_______________________________________________
ffmpeg-devel mailing list
[email protected]
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Reply via email to