[FFmpeg-devel] [PATCH] ffmpeg: fix streamcopy of some mp3 in avi

Michael Niedermayer michaelni at gmx.at
Wed Jul 18 02:49:02 CEST 2012

On Tue, Jul 17, 2012 at 01:18:19PM -0400, Mike Scheutzow wrote:
> Michael Niedermayer wrote:
> >Fixes Ticket1432
> >
> >Thanks-to: Mike Scheutzow <mike.scheutzow at alcatel-lucent.com> for some of the bug analysis
> >Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> >---
> > ffmpeg.c |    2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> >diff --git a/ffmpeg.c b/ffmpeg.c
> >index c9f2a61..82b9544 100644
> >--- a/ffmpeg.c
> >+++ b/ffmpeg.c
> >@@ -2964,7 +2964,7 @@ static int transcode_init(void)
> >                 codec->frame_size         = icodec->frame_size;
> >                 codec->audio_service_type = icodec->audio_service_type;
> >                 codec->block_align        = icodec->block_align;
> >-                if(codec->block_align == 1 && codec->codec_id == CODEC_ID_MP3)
> >+                if((codec->block_align == 1 || codec->block_align == 1152) && codec->codec_id == CODEC_ID_MP3)
> >                     codec->block_align= 0;
> >                 if(codec->codec_id == CODEC_ID_AC3)
> >                     codec->block_align= 0;
> For the sample file, the timestamps returned by avi_read_packet()
> for stream 1 are complete crap. This is true for ffprobe, ffplay and
> any other app that uses the avi demuxer.

I dont remember the timestamps for stream 1 looking very odd nor
was i able to reproduce any AV desync with the original file.
The stream copyied file OTOH had timestamps that are total crap.
And the patch above fixes exactly that stream copy case, the code has
no effect on anything else.
But its very possible that i have overlooked something, if so please

> Yet your preferred solution is to hack a special case into a single
> application, and declare the problem fixed?

Well, the problem was that the timestamps from the demuxer before
stream copy looked good and after stream copy looked very bad
the patch (which recieved no comments in 3 days before being applied)
just fixes this stream copy messup of timestamps.

Its certainly possible that there are bugs in the avi demuxer and
certainly possible that your patch fixes one. If so please elaborate,
because all issues ive seen where after stream copy of this file not
before, so iam plain and simple not aware of a issue in the original
file and thus applying a fix in the demuxer instead of the stream copy
code seemed wrong to me.

Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

it is not once nor twice but times without number that the same ideas make
their appearance in the world. -- Aristotle
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20120718/d0d65f4b/attachment.asc>

More information about the ffmpeg-devel mailing list