[FFmpeg-devel] [PATCH] lavf/apngdec: use AVStream.time_base instead of r_frame_rate

Michael Niedermayer michaelni at gmx.at
Tue Nov 25 22:15:31 CET 2014


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

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
That is unless apng has proper timestamps, in which case they
should be used


[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Everything should be made as simple as possible, but not simpler.
-- Albert Einstein
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20141125/df15f071/attachment.asc>


More information about the ffmpeg-devel mailing list