From patchwork Wed Jan 17 09:22:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 45631 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:c58a:b0:199:de12:6fa6 with SMTP id gn10csp232074pzb; Wed, 17 Jan 2024 01:23:25 -0800 (PST) X-Google-Smtp-Source: AGHT+IF1sP+EEjznzpW7pFSj+WkWiZTQ+72wsNhGpPGbGtKvBA93dst5pj1+d+uVqPq5Zkk1KJB7 X-Received: by 2002:a17:907:500a:b0:a27:5446:27d9 with SMTP id fw10-20020a170907500a00b00a27544627d9mr3236305ejc.5.1705483405564; Wed, 17 Jan 2024 01:23:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1705483405; cv=none; d=google.com; s=arc-20160816; b=gBj9U7rqN3+VV7TwDbsR4I8IkF6y1Z0L5Zr7lonZ6RBSPixYfDGXE/SwmMWjlqm4lt Op57WDs65/my15T+YrLfOCgvJKOveENWQ9l1NdCvl+MyC8QJUfVftMjtBRvGpDASiFly lW8VZbHYjh6Q1wR72hM4rtPluGbzdry/J6V4tEoQCKfnK9I2cskJPS0cUARZLNtaxx0P pZzgWgnJ14IV96phbV5Ixzh/7CjXXo1YUGuclI7nOzKVyj57JrLvh3A8Rnr36VLchvEo Z3YPiZo+OiaKxPJ6AvZS1JbqC3mPXHjhY3ewT472FP/qK0ZqkeaxyIAcxNHkfo/wXVmh Cweg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:dkim-signature:delivered-to; bh=IDWCzGjxVeSqwcIwSzczGRGcj/tp5IrOE59kDe0gTNQ=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=znHZ2zaAPgkjJ2NU66BkWg4gT2ctpI4EnUIYvBU4ua/cbJSkGiBYaJAF77kT4WbaRf LDrOrvAGxRjD6fHadi1hQgabbc9TMsYt+3FvTmaxxqUTLNMBGf1CSBGO/HWnQ3TYlAnM md7HowAJXs6oyWiKdnFlmgPlPchnhHR/uf5oa5RA/CrsFbkwByuA1fkx5SrUq28zbQBA cWpxCspUa3vdf2JMLzgIyUc9BeaJYB4FDdA3HS+HqjCleAHhVwITcIIuP7SgKdepC+5D zJXg0e9pdiVoAIV3koIbe2O9ENGU6jI3MAJvNRvcNr9B0YIdur8Vxb+fOCYTYmqk6cwR bA6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@khirnov.net header.s=mail header.b=BY8cIfBt; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id h2-20020a1709063c0200b00a2ed24c42d0si430094ejg.390.2024.01.17.01.23.25; Wed, 17 Jan 2024 01:23:25 -0800 (PST) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@khirnov.net header.s=mail header.b=BY8cIfBt; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id EFB3968D05F; Wed, 17 Jan 2024 11:22:52 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail1.khirnov.net (quelana.khirnov.net [94.230.150.81]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id CA67E68CD77 for ; Wed, 17 Jan 2024 11:22:40 +0200 (EET) Authentication-Results: mail1.khirnov.net; dkim=pass (2048-bit key; unprotected) header.d=khirnov.net header.i=@khirnov.net header.a=rsa-sha256 header.s=mail header.b=BY8cIfBt; dkim-atps=neutral Received: from localhost (mail1.khirnov.net [IPv6:::1]) by mail1.khirnov.net (Postfix) with ESMTP id 6767719C2 for ; Wed, 17 Jan 2024 10:22:40 +0100 (CET) Received: from mail1.khirnov.net ([IPv6:::1]) by localhost (mail1.khirnov.net [IPv6:::1]) (amavis, port 10024) with ESMTP id h--4e2slLQK2 for ; Wed, 17 Jan 2024 10:22:39 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=khirnov.net; s=mail; t=1705483358; bh=Ldoxe/mkZo3nm0hAKBdrmUnbhmEkRmYbUdHJ4AdgbmM=; h=From:To:Subject:Date:In-Reply-To:References:From; b=BY8cIfBtwaRdtdOZJ7ewPHfY0ig3Tn+TBooOdxnNptQ0KIrOem9QZHZZP7C6R2Vgo TsuOOqH6DZpqYAcb+nwn3cnqg3XYu2NrwU/QAJ+7gdMANYNgSwvq1Ei0rN/CbQEBLf tWrerT1tRicysku1QSnyIV7tzcYctMDjOo/s4bo14qrIGoRR2oBqWymAjDi+bn5uHO C+hbDM2Y8E9Lz/teg/VvlRpHw/rSSGowWxfd0t9siSnZHSr1Za/xb1mZBjWINWzxe4 eU2QHVNQiZ+HMsACqyWGaAKD6564LGkJE0NrY16fQcM/zKBwOBKjtDhmqyjBWF+GEU YWySjSwElayHw== Received: from libav.khirnov.net (libav.khirnov.net [IPv6:2a00:c500:561:201::7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "libav.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail1.khirnov.net (Postfix) with ESMTPS id 6763519BE for ; Wed, 17 Jan 2024 10:22:38 +0100 (CET) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id 2B86A3A07AE for ; Wed, 17 Jan 2024 10:22:38 +0100 (CET) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Wed, 17 Jan 2024 10:22:33 +0100 Message-ID: <20240117092233.8503-6-anton@khirnov.net> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240117092233.8503-1-anton@khirnov.net> References: <20240117092233.8503-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 6/6] fftools/ffmpeg: deprecate -filter_script 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: JKXvl2QMDjl+ It is equivalent to -/filter. --- doc/ffmpeg.texi | 6 ------ doc/filters.texi | 3 --- fftools/ffmpeg.h | 2 ++ fftools/ffmpeg_mux_init.c | 36 ++++++++++++++++++++++++++++++------ fftools/ffmpeg_opt.c | 4 +++- tests/fate/filter-audio.mak | 2 +- tests/fate/filter-video.mak | 6 +++--- 7 files changed, 39 insertions(+), 20 deletions(-) diff --git a/doc/ffmpeg.texi b/doc/ffmpeg.texi index 31a2b90b34..f58103810a 100644 --- a/doc/ffmpeg.texi +++ b/doc/ffmpeg.texi @@ -977,12 +977,6 @@ syntax. See the @ref{filter_complex_option,,-filter_complex option} if you want to create filtergraphs with multiple inputs and/or outputs. -@anchor{filter_script option} -@item -filter_script[:@var{stream_specifier}] @var{filename} (@emph{output,per-stream}) -This option is similar to @option{-filter}, the only difference is that its -argument is the name of the file from which a filtergraph description is to be -read. - @item -reinit_filter[:@var{stream_specifier}] @var{integer} (@emph{input,per-stream}) This boolean option determines if the filtergraph(s) to which this stream is fed gets reinitialized when input frame parameters change mid-stream. This option is enabled by diff --git a/doc/filters.texi b/doc/filters.texi index 6ec7d54b5f..1d70f4d934 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -307,9 +307,6 @@ For example, in case of the @ref{drawtext,,drawtext filter}, you might prefer to use the @option{textfile} option in place of @option{text} to specify the text to render. -When using the @command{ffmpeg} tool, you might consider to use the -@ref{filter_script option,,-filter_script option,ffmpeg}. - @chapter Timeline editing Some filters support a generic @option{enable} option. For the filters diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h index c73fb91c14..3014a626b4 100644 --- a/fftools/ffmpeg.h +++ b/fftools/ffmpeg.h @@ -221,7 +221,9 @@ typedef struct OptionsContext { SpecifierOptList copy_initial_nonkeyframes; SpecifierOptList copy_prior_start; SpecifierOptList filters; +#if FFMPEG_OPT_FILTER_SCRIPT SpecifierOptList filter_scripts; +#endif SpecifierOptList reinit_filters; SpecifierOptList fix_sub_duration; SpecifierOptList fix_sub_duration_heartbeat; diff --git a/fftools/ffmpeg_mux_init.c b/fftools/ffmpeg_mux_init.c index 80109df0ae..5422a64cbc 100644 --- a/fftools/ffmpeg_mux_init.c +++ b/fftools/ffmpeg_mux_init.c @@ -415,36 +415,58 @@ static MuxStream *mux_stream_alloc(Muxer *mux, enum AVMediaType type) static int ost_get_filters(const OptionsContext *o, AVFormatContext *oc, OutputStream *ost, char **dst) { - const char *filters = NULL, *filters_script = NULL; + const char *filters = NULL; +#if FFMPEG_OPT_FILTER_SCRIPT + const char *filters_script = NULL; MATCH_PER_STREAM_OPT(filter_scripts, str, filters_script, oc, ost->st); +#endif MATCH_PER_STREAM_OPT(filters, str, filters, oc, ost->st); if (!ost->enc) { - if (filters_script || filters) { + if ( +#if FFMPEG_OPT_FILTER_SCRIPT + filters_script || +#endif + filters) { av_log(ost, AV_LOG_ERROR, "%s '%s' was specified, but codec copy was selected. " "Filtering and streamcopy cannot be used together.\n", +#if FFMPEG_OPT_FILTER_SCRIPT filters ? "Filtergraph" : "Filtergraph script", - filters ? filters : filters_script); + filters ? filters : filters_script +#else + "Filtergraph", filters +#endif + ); return AVERROR(ENOSYS); } return 0; } if (!ost->ist) { - if (filters_script || filters) { + if ( +#if FFMPEG_OPT_FILTER_SCRIPT + filters_script || +#endif + filters) { av_log(ost, AV_LOG_ERROR, "%s '%s' was specified for a stream fed from a complex " "filtergraph. Simple and complex filtering cannot be used " "together for the same stream.\n", +#if FFMPEG_OPT_FILTER_SCRIPT filters ? "Filtergraph" : "Filtergraph script", - filters ? filters : filters_script); + filters ? filters : filters_script +#else + "Filtergraph", filters +#endif + ); return AVERROR(EINVAL); } return 0; } +#if FFMPEG_OPT_FILTER_SCRIPT if (filters_script && filters) { av_log(ost, AV_LOG_ERROR, "Both -filter and -filter_script set\n"); return AVERROR(EINVAL); @@ -452,7 +474,9 @@ static int ost_get_filters(const OptionsContext *o, AVFormatContext *oc, if (filters_script) *dst = file_read(filters_script); - else if (filters) + else +#endif + if (filters) *dst = av_strdup(filters); else *dst = av_strdup(ost->type == AVMEDIA_TYPE_VIDEO ? "null" : "anull"); diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c index d5bc7e9c8b..1978f438fe 100644 --- a/fftools/ffmpeg_opt.c +++ b/fftools/ffmpeg_opt.c @@ -1625,9 +1625,11 @@ const OptionDef options[] = { { "filter_threads", OPT_TYPE_FUNC, OPT_FUNC_ARG | OPT_EXPERT, { .func_arg = opt_filter_threads }, "number of non-complex filter threads" }, +#if FFMPEG_OPT_FILTER_SCRIPT { "filter_script", OPT_TYPE_STRING, OPT_SPEC | OPT_EXPERT | OPT_OUTPUT, { .off = OFFSET(filter_scripts) }, - "read stream filtergraph description from a file", "filename" }, + "deprecated, use -/filter", "filename" }, +#endif { "reinit_filter", OPT_TYPE_INT, OPT_SPEC | OPT_INPUT | OPT_EXPERT, { .off = OFFSET(reinit_filters) }, "reinit filtergraph on input parameter changes", "" }, diff --git a/tests/fate/filter-audio.mak b/tests/fate/filter-audio.mak index 1d6f7c7f4e..05df1bb213 100644 --- a/tests/fate/filter-audio.mak +++ b/tests/fate/filter-audio.mak @@ -128,7 +128,7 @@ FATE_AFILTER-$(call FILTERDEMDECENCMUX, FIREQUALIZER ATRIM VOLUME, WAV, PCM_S16L fate-filter-firequalizer: tests/data/asynth-44100-2.wav fate-filter-firequalizer: tests/data/filtergraphs/firequalizer fate-filter-firequalizer: REF = tests/data/asynth-44100-2.wav -fate-filter-firequalizer: CMD = ffmpeg -auto_conversion_filters -i $(TARGET_PATH)/tests/data/asynth-44100-2.wav -filter_script $(TARGET_PATH)/tests/data/filtergraphs/firequalizer -f wav -c:a pcm_s16le - +fate-filter-firequalizer: CMD = ffmpeg -auto_conversion_filters -i $(TARGET_PATH)/tests/data/asynth-44100-2.wav -/filter $(TARGET_PATH)/tests/data/filtergraphs/firequalizer -f wav -c:a pcm_s16le - fate-filter-firequalizer: CMP = oneoff fate-filter-firequalizer: CMP_UNIT = s16 fate-filter-firequalizer: SIZE_TOLERANCE = 1058400 - 1097208 diff --git a/tests/fate/filter-video.mak b/tests/fate/filter-video.mak index 576f5a7dd0..ee9f0f5e40 100644 --- a/tests/fate/filter-video.mak +++ b/tests/fate/filter-video.mak @@ -269,11 +269,11 @@ fate-filter-weave: CMD = framecrc -c:v pgmyuv -i $(SRC) -vf weave=bottom FATE_FILTER_VSYNTH_PGMYUV-$(CONFIG_SELECT_FILTER) += fate-filter-select-alternate fate-filter-select-alternate: tests/data/filtergraphs/select-alternate -fate-filter-select-alternate: CMD = framecrc -c:v pgmyuv -i $(SRC) -filter_script $(TARGET_PATH)/tests/data/filtergraphs/select-alternate +fate-filter-select-alternate: CMD = framecrc -c:v pgmyuv -i $(SRC) -/filter $(TARGET_PATH)/tests/data/filtergraphs/select-alternate FATE_FILTER_VSYNTH_PGMYUV-$(call ALLYES, SETPTS_FILTER SETTB_FILTER) += fate-filter-setpts fate-filter-setpts: tests/data/filtergraphs/setpts -fate-filter-setpts: CMD = framecrc -c:v pgmyuv -i $(SRC) -filter_script $(TARGET_PATH)/tests/data/filtergraphs/setpts +fate-filter-setpts: CMD = framecrc -c:v pgmyuv -i $(SRC) -/filter $(TARGET_PATH)/tests/data/filtergraphs/setpts FATE_SHUFFLEFRAMES += fate-filter-shuffleframes fate-filter-shuffleframes: CMD = framecrc -c:v pgmyuv -i $(SRC) -vf shuffleframes="2|1|0" @@ -362,7 +362,7 @@ fate-filter-curves: CMD = framecrc -i $(TARGET_SAMPLES)/utvideo/utvideo_rgb_medi FATE_FILTER_SAMPLES-$(call FILTERDEMDEC, FORMAT PERMS GRADFUN SCALE, VMD, VMDVIDEO) += fate-filter-gradfun-sample fate-filter-gradfun-sample: tests/data/filtergraphs/gradfun -fate-filter-gradfun-sample: CMD = framecrc -auto_conversion_filters -i $(TARGET_SAMPLES)/vmd/12.vmd -filter_script $(TARGET_PATH)/tests/data/filtergraphs/gradfun -an -frames:v 20 +fate-filter-gradfun-sample: CMD = framecrc -auto_conversion_filters -i $(TARGET_SAMPLES)/vmd/12.vmd -/filter $(TARGET_PATH)/tests/data/filtergraphs/gradfun -an -frames:v 20 FATE_FILTER-$(call FILTERFRAMECRC, TESTSRC SINE CONCAT, FILE_PROTOCOL) += fate-filter-concat fate-filter-concat-vfr fate-filter-concat: tests/data/filtergraphs/concat