[FFmpeg-devel] [PATCH] lavf/apngdec: use AVStream.time_base instead of r_frame_rate
Benoit Fouet
benoit.fouet at free.fr
Tue Nov 25 22:53:56 CET 2014
Hi,
On November 25, 2014 10:15:31 PM GMT+01:00, Michael Niedermayer <michaelni at gmx.at> wrote:
>On Tue, Nov 25, 2014 at 02:56:07PM -0300, James Almer wrote:
>> Should fix framedrops on some apng files
>>
>> Signed-off-by: James Almer <jamrial at gmail.com>
>> ---
>> This is still not optimal because the value of time_base will be
>updated on every frame,
>> and in some cases delay_num and delay_den varies between frames.
>>
>> Better fix welcome.
>>
>> libavformat/apngdec.c | 4 ++--
>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/libavformat/apngdec.c b/libavformat/apngdec.c
>> index d766a87..47d3753 100644
>> --- a/libavformat/apngdec.c
>> +++ b/libavformat/apngdec.c
>> @@ -265,8 +265,8 @@ static int decode_fctl_chunk(AVFormatContext *s,
>APNGDemuxContext *ctx, AVPacket
>> delay_num = 1;
>> delay_den = ctx->default_fps;
>> }
>> - s->streams[0]->r_frame_rate.num = delay_den;
>> - s->streams[0]->r_frame_rate.den = delay_num;
>> + s->streams[0]->time_base.num = delay_num;
>> + s->streams[0]->time_base.den = delay_den;
>> pkt->duration = 1;
>
>this is wrong, the timebase and r_frame_rate are constant
>once they have been set
>
OK, good to know.
>i suggest to use set_pts_info to set a reasonable precisse
>timebase something like one millionth or billionth or similar in
>base 2. and then set pts based on these delays and the previous
>timestamp
James, do you want to have a look at this approach or do you want me to do it?
>That is unless apng has proper timestamps, in which case they
>should be used
>
It doesn't. Each frame has its duration, which is represented by a fraction of a second, and it can very well change between images.
--
Ben
More information about the ffmpeg-devel
mailing list