[FFmpeg-devel] [PATCH] Use sample size in case incorrect timestamps for aac in AVI (Ticket #1755)

Heesuk Jung heesuk.jung at lge.com
Fri Oct 12 06:59:11 CEST 2012


I found additional case(ss=4096) and so add condition.

>From b7245ddaea8f9389f9bea301e0778494f0085bf9 Mon Sep 17 00:00:00 2001
From: Heesuk Jung <heesuk.jung at lge.com>
Date: Fri, 12 Oct 2012 13:47:22 +0900
Subject: [PATCH] [PATCH] Use sample size in case incorrect timestamps for
aac in AVI (Ticket #1755)

In some case for aac in AVI, avidec extracts wrong PTS value.
(www.ffmpeg.org/trac/ffmpeg/ticket/1755)

I found additional case(ss=4096) and so add condition.

Problematic file link :
https://docs.google.com/open?id=0B6r7ZfWFIypCOTdZQUtGVEdJUUE
---
 libavformat/avidec.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/libavformat/avidec.c b/libavformat/avidec.c
index e383245..835c36d 100644
--- a/libavformat/avidec.c
+++ b/libavformat/avidec.c
@@ -682,6 +682,7 @@ static int avi_read_header(AVFormatContext *s)
                         ast->dshow_block_align = 0;
                     }
                     if(st->codec->codec_id == AV_CODEC_ID_AAC &&
ast->dshow_block_align == 1024 && ast->sample_size == 1024 ||
+                       st->codec->codec_id == AV_CODEC_ID_AAC &&
ast->dshow_block_align == 4096 && ast->sample_size == 4096 ||
                        st->codec->codec_id == AV_CODEC_ID_MP3 &&
ast->dshow_block_align == 1152 && ast->sample_size == 1152) {
                         av_log(s, AV_LOG_DEBUG, "overriding
sample_size\n");
                         ast->sample_size = 0;
-- 
1.7.0.4

-----Original Message-----
From: ffmpeg-devel-bounces at ffmpeg.org
[mailto:ffmpeg-devel-bounces at ffmpeg.org] On Behalf Of Michael Niedermayer
Sent: Wednesday, October 10, 2012 11:49 PM
To: FFmpeg development discussions and patches
Subject: Re: [FFmpeg-devel] [PATCH] Use sample size in case incorrect
timestamps for aac in AVI (Ticket #1755)

On Wed, Oct 10, 2012 at 06:03:30PM +0900, Heesuk Jung wrote:
> Understand and send patch again.
> Thanks for prompt response!
> 
> From 2848da6b6092d68a8724d3b6a941e49b961c5e21 Mon Sep 17 00:00:00 2001
> From: Heesuk Jung <heesuk.jung at lge.com>
> Date: Wed, 10 Oct 2012 14:00:06 +0900
> Subject: [PATCH]  Use sample size in case incorrect timestamps for aac 
> in AVI (Ticket #1755)
> 
> In some case for aac in AVI, avidec extracts wrong PTS value.
> (www.ffmpeg.org/trac/ffmpeg/ticket/1755)
> In getDuration function, I suggest using sample size instead of len.
> 
> Also I have done regression test in our media pool.
> 
> Test result of 11 problematic files is ok after patch apply.
> (11 files have fixed sample size in AVI Stream Header)
> 
> Regression test reseult of 4 non-problematic files is ok after patch
apply.
> (4 files have variable sample size in AVI Stream Header)
> ---
>  libavformat/avidec.c |   16 ++++++++++------
>  1 files changed, 10 insertions(+), 6 deletions(-)
> 
> diff --git a/libavformat/avidec.c b/libavformat/avidec.c index 
> b4c5fe8..43d80ce 100644
> --- a/libavformat/avidec.c
> +++ b/libavformat/avidec.c
> @@ -115,9 +115,13 @@ static int guess_ni_flag(AVFormatContext *s);
>             (tag >> 24) & 0xff,                          \
>             size)
>  
> -static inline int get_duration(AVIStream *ast, int len){
> +static inline int get_duration(AVIStream *ast, int len, enum 
> +AVCodecID codecId) {
>      if(ast->sample_size){
> -        return len;
> +        if (codecId == AV_CODEC_ID_AAC) {
> +            return ast->sample_size;
> +        } else {
> +            return len;
> +        }

Ive commited a simpler fix (which is also more specific) please test if its
ok with the other files as well or if it needs to be activated for more
cases than ss=1024


[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The real ebay dictionary, page 2
"100% positive feedback" - "All either got their money back or didnt
complain"
"Best seller ever, very honest" - "Seller refunded buyer after failed scam"
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-PATCH-Use-sample-size-in-case-incorrect-timestamps-f.patch
Type: application/octet-stream
Size: 1385 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20121012/a7bc2d53/attachment.obj>


More information about the ffmpeg-devel mailing list