From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTPS id 937074480B for ; Mon, 27 Jan 2025 10:13:26 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id F053268BC2E; Mon, 27 Jan 2025 12:13:23 +0200 (EET) Received: from mout-p-102.mailbox.org (mout-p-102.mailbox.org [80.241.56.152]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 196B0688115 for ; Mon, 27 Jan 2025 12:13:17 +0200 (EET) Received: from smtp1.mailbox.org (smtp1.mailbox.org [10.196.197.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-102.mailbox.org (Postfix) with ESMTPS id 4YhPPk48zLz9tJN for ; Mon, 27 Jan 2025 11:13:14 +0100 (CET) Message-ID: Date: Mon, 27 Jan 2025 15:43:11 +0530 MIME-Version: 1.0 To: ffmpeg-devel@ffmpeg.org References: <20250127044121.498-1-ffmpeg@gyani.pro> Content-Language: en-US From: Gyan Doshi In-Reply-To: <20250127044121.498-1-ffmpeg@gyani.pro> Subject: Re: [FFmpeg-devel] [PATCH v5] avfilter/setpts: add option strip_fps to decide framerate handling X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: On 2025-01-27 10:10 am, Gyan Doshi wrote: > In f121d95, the outlink framerate was unconditionally unset. > This breaks/bloats outputs from CFR muxers unless the user explicitly > sets a sane framerate. And the most common invocation for setpts seen in > workflows, our docs and across the web is `PTS-STARTPTS` or others of the > general form `PTS+constant` which preserves the input framerate. > > Default value is false, which restores old behaviour. > > Fixes #11428 Pushed as 959b799c8d7564c599f80228248e269d27111d11 Regards, Gyan > --- > v5: renamed option to strip_fps > > doc/filters.texi | 6 ++++++ > libavfilter/setpts.c | 6 +++++- > tests/fate/hevc.mak | 2 +- > tests/fate/mov.mak | 2 +- > tests/filtergraphs/setpts | 2 +- > 5 files changed, 14 insertions(+), 4 deletions(-) > > diff --git a/doc/filters.texi b/doc/filters.texi > index b926b865ae..a14c7e7e77 100644 > --- a/doc/filters.texi > +++ b/doc/filters.texi > @@ -31478,6 +31478,12 @@ This filter accepts the following options: > @item expr > The expression which is evaluated for each frame to construct its timestamp. > > +@item strip_fps (@emph{video only}) > +Boolean option which determines if the original framerate metadata is unset. > +If set to true, be advised that a sane frame rate should be explicitly > +specified if output is sent to a constant frame rate muxer. > +Default is @code{false}. > + > @end table > > The expression is evaluated through the eval API and can contain the following > diff --git a/libavfilter/setpts.c b/libavfilter/setpts.c > index 75d96247af..397be5c817 100644 > --- a/libavfilter/setpts.c > +++ b/libavfilter/setpts.c > @@ -98,6 +98,7 @@ typedef struct SetPTSContext { > const AVClass *class; > char *expr_str; > AVExpr *expr; > + int strip_fps; > double var_values[VAR_VARS_NB]; > enum AVMediaType type; > } SetPTSContext; > @@ -153,8 +154,10 @@ static int config_input(AVFilterLink *inlink) > static int config_output_video(AVFilterLink *outlink) > { > FilterLink *l = ff_filter_link(outlink); > + SetPTSContext *s = outlink->src->priv; > > - l->frame_rate = (AVRational){ 1, 0 }; > + if (s->strip_fps) > + l->frame_rate = (AVRational){ 1, 0 }; > > return 0; > } > @@ -320,6 +323,7 @@ static int process_command(AVFilterContext *ctx, const char *cmd, const char *ar > #if CONFIG_SETPTS_FILTER > static const AVOption setpts_options[] = { > { "expr", "Expression determining the frame timestamp", OFFSET(expr_str), AV_OPT_TYPE_STRING, { .str = "PTS" }, .flags = V|F|R }, > + { "strip_fps", "Unset framerate metadata", OFFSET(strip_fps), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, .flags = V|F }, > { NULL } > }; > AVFILTER_DEFINE_CLASS(setpts); > diff --git a/tests/fate/hevc.mak b/tests/fate/hevc.mak > index 9e6fd72618..2365bd7775 100644 > --- a/tests/fate/hevc.mak > +++ b/tests/fate/hevc.mak > @@ -210,7 +210,7 @@ $(HEVC_TESTS_444_12BIT): SCALE_OPTS := -pix_fmt yuv444p12le -vf scale > fate-hevc-conformance-%: CMD = framecrc -i $(TARGET_SAMPLES)/hevc-conformance/$(subst fate-hevc-conformance-,,$(@)).bit $(SCALE_OPTS) > $(HEVC_TESTS_422_10BIN): CMD = framecrc -i $(TARGET_SAMPLES)/hevc-conformance/$(subst fate-hevc-conformance-,,$(@)).bin $(SCALE_OPTS) > $(HEVC_TESTS_MULTIVIEW): CMD = framecrc -i $(TARGET_SAMPLES)/hevc-conformance/$(subst fate-hevc-conformance-,,$(@)).bit \ > - -pix_fmt yuv420p -map "0:view:0" -map "0:view:1" -vf setpts=N > + -pix_fmt yuv420p -map "0:view:0" -map "0:view:1" -vf setpts=N:strip_fps=1 > > FATE_HEVC-$(call FRAMECRC, HEVC, HEVC, HEVC_PARSER) += $(HEVC_TESTS_8BIT) $(HEVC_TESTS_444_8BIT) > FATE_HEVC-$(call FRAMECRC, HEVC, HEVC, HEVC_PARSER SCALE_FILTER) += \ > diff --git a/tests/fate/mov.mak b/tests/fate/mov.mak > index ca13ebfd44..f7e5e52217 100644 > --- a/tests/fate/mov.mak > +++ b/tests/fate/mov.mak > @@ -225,7 +225,7 @@ fate-mov-pcm-remux: CMP = oneline > fate-mov-pcm-remux: REF = e76115bc392d702da38f523216bba165 > > FATE_MOV_FFMPEG-$(call TRANSCODE, RAWVIDEO, MOV, TESTSRC_FILTER SETPTS_FILTER) += fate-mov-vfr > -fate-mov-vfr: CMD = md5 -filter_complex testsrc=size=2x2:duration=1,setpts=N*N -c rawvideo -fflags +bitexact -f mov > +fate-mov-vfr: CMD = md5 -filter_complex testsrc=size=2x2:duration=1,setpts=N*N:strip_fps=1 -c rawvideo -fflags +bitexact -f mov > fate-mov-vfr: CMP = oneline > fate-mov-vfr: REF = 1558b4a9398d8635783c93f84eb5a60d > > diff --git a/tests/filtergraphs/setpts b/tests/filtergraphs/setpts > index 79037d1b65..733fef720b 100644 > --- a/tests/filtergraphs/setpts > +++ b/tests/filtergraphs/setpts > @@ -1,2 +1,2 @@ > settb=1/1000, > -setpts=1/(35*TB) * (N + 0.05 * sin(N*2*PI/25)) > +setpts=1/(35*TB) * (N + 0.05 * sin(N*2*PI/25)):strip_fps=1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".