PR #25213 opened by Ramiro Polla (ramiro) URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/25213 Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/25213.patch
>From 46615677549e6ec42dc02eb3f073cc21119546b5 Mon Sep 17 00:00:00 2001 From: Ramiro Polla <[email protected]> Date: Mon, 19 Oct 2026 13:13:05 +0200 Subject: [PATCH 1/2] avformat/webp_anim_dec: fix seeking by setting correct packet position Set pkt->pos to the start of the ANMF chunk (before the header) after av_get_packet() is called. This fixes seeking and the warning message: Skipping chunk: [0][0][0][0] --- libavformat/webp_anim_dec.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libavformat/webp_anim_dec.c b/libavformat/webp_anim_dec.c index 14abb61db4..e81deea6c8 100644 --- a/libavformat/webp_anim_dec.c +++ b/libavformat/webp_anim_dec.c @@ -272,6 +272,7 @@ static int webp_anim_read_packet(AVFormatContext *s, AVPacket *pkt) ret = av_get_packet(pb, pkt, size); if (ret < 0) return ret; + pkt->pos = offset; if (!ctx->cur_frame++) pkt->flags |= AV_PKT_FLAG_KEY; pkt->pts = AV_NOPTS_VALUE; -- 2.54.0 >From b2da025bb35774548c8d2864ab99997f13b43448 Mon Sep 17 00:00:00 2001 From: Ramiro Polla <[email protected]> Date: Mon, 19 Oct 2026 13:13:05 +0200 Subject: [PATCH 2/2] avformat/webp_anim_dec: fix keyframe flag when seeking The keyframe flag was only being set when looping, and not when seeking back. Use ctx->first_anmf_offset to detect first keyframe instead of trying to count cur_frame. --- libavformat/webp_anim_dec.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/libavformat/webp_anim_dec.c b/libavformat/webp_anim_dec.c index e81deea6c8..6cd90b3315 100644 --- a/libavformat/webp_anim_dec.c +++ b/libavformat/webp_anim_dec.c @@ -61,7 +61,7 @@ typedef struct WebPAnimDemuxContext { /* * variables for the key frame detection */ - int cur_frame; ///< number of frames of the current animation file + int64_t first_anmf_offset; int vp8x_flags; int has_iccp; @@ -70,8 +70,6 @@ typedef struct WebPAnimDemuxContext { int has_xmp; int usebgcolor; - - int64_t first_anmf_offset; } WebPAnimDemuxContext; /** @@ -253,7 +251,6 @@ static int webp_anim_read_packet(AVFormatContext *s, AVPacket *pkt) if (avio_feof(pb)) { if (!ctx->ignore_loop && (ctx->loop_count == 0 || ++ctx->cur_loop < ctx->loop_count)) { - ctx->cur_frame = 0; ret = avio_seek(pb, ctx->first_anmf_offset, SEEK_SET); if (ret < 0) return ret; @@ -273,7 +270,7 @@ static int webp_anim_read_packet(AVFormatContext *s, AVPacket *pkt) if (ret < 0) return ret; pkt->pos = offset; - if (!ctx->cur_frame++) + if (offset == ctx->first_anmf_offset) pkt->flags |= AV_PKT_FLAG_KEY; pkt->pts = AV_NOPTS_VALUE; pkt->dts = AV_NOPTS_VALUE; -- 2.54.0 _______________________________________________ ffmpeg-devel mailing list -- [email protected] To unsubscribe send an email to [email protected]
