From 14c14662b2955bac9c9bdcebe2f5b1da187f82cf Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Fri, 25 Nov 2022 15:38:23 +0100 Subject: lavfi/vf_w3fdif: set output frame durations --- libavfilter/vf_w3fdif.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/libavfilter/vf_w3fdif.c b/libavfilter/vf_w3fdif.c index 512c8070c7..4b29e8cb39 100644 --- a/libavfilter/vf_w3fdif.c +++ b/libavfilter/vf_w3fdif.c @@ -481,6 +481,8 @@ static int filter(AVFilterContext *ctx, int is_second) AVFilterLink *outlink = ctx->outputs[0]; AVFrame *out, *adj; ThreadData td; + int64_t cur_pts = s->cur->pts; + int64_t next_pts = s->next->pts; out = ff_get_video_buffer(outlink, outlink->w, outlink->h); if (!out) @@ -492,9 +494,6 @@ static int filter(AVFilterContext *ctx, int is_second) if (out->pts != AV_NOPTS_VALUE) out->pts *= 2; } else { - int64_t cur_pts = s->cur->pts; - int64_t next_pts = s->next->pts; - if (next_pts != AV_NOPTS_VALUE && cur_pts != AV_NOPTS_VALUE) { out->pts = cur_pts + next_pts; } else { @@ -502,6 +501,9 @@ static int filter(AVFilterContext *ctx, int is_second) } } + out->duration = (next_pts != AV_NOPTS_VALUE && cur_pts != AV_NOPTS_VALUE) ? + next_pts - cur_pts : 0; + adj = s->field ? s->next : s->prev; td.out = out; td.cur = s->cur; td.adj = adj; ff_filter_execute(ctx, deinterlace_slice, &td, NULL, @@ -541,6 +543,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame) av_frame_free(&s->prev); if (out->pts != AV_NOPTS_VALUE) out->pts *= 2; + out->duration *= 2; return ff_filter_frame(ctx->outputs[0], out); } -- cgit v1.2.3