From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.ffmpeg.org (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTPS id E53A54DFDC for ; Sun, 8 Feb 2026 19:55:37 +0000 (UTC) Authentication-Results: ffbox; dkim=fail (body hash mismatch (got b'Eut8i6maRhKzxRrIA1UaqeJg59gyebIUl7SAzQAPtYA=', expected b'scwZ77ACgsBY1yR4tklIQfbnnTdLKS5M37vrlfQ24yg=')) header.d=gmail.com header.a=rsa-sha256 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ffmpeg.org; i=@ffmpeg.org; q=dns/txt; s=mail; t=1770580523; h=to : date : message-id : mime-version : reply-to : subject : list-id : list-archive : list-archive : list-help : list-owner : list-post : list-subscribe : list-unsubscribe : from : cc : content-type : content-transfer-encoding : from; bh=BYZlJy2H/blQNCaweSFIGqQ7YywQBUlY4iunZUvEL7Y=; b=hOSzH3C19n0te/BkaM4mqOFKntGbtWbbDbI2DvDcapLk9WS9sLYSnfUA9/bUnEPyKCkOe 75Hs7vuPXY2CnolMZ2f72iVAc8is1IItK2CkkoBNWBw5nuxpaNEaU1jAo5saAH5swiV7ZAI tfusetZw3ReQCN1lhb/3XwWGWm8fB+D9Is0kxee3uqWegss800x4W1LCMB3v2Qm9KfY8yxZ P7aJvAPHWoZg2/gxCwtg4Fm0JHXNP+P/E0ELQNmkScK/pSMPEEfmyH/waBGZ6ZDoJCLY2fA ZTHsKDHOZQa7Ji70/PTGoad8WaOdUBpk+zQLPBrca1lr6TeqsJaWa4VTg0KA== Received: from [172.20.0.4] (unknown [172.20.0.4]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTP id 913C9691126; Sun, 8 Feb 2026 21:55:23 +0200 (EET) ARC-Seal: i=1; cv=none; a=rsa-sha256; d=ffmpeg.org; s=arc; t=1770580505; b=QKgRRYxppMNySUBFNjjesMrsi1HNHNACAFnYA3A4/O0BKuEySRyDZQgdAdwMeJ7WLh526 hVjCWUq7CZxEVdPDngwnaV/Qwmz/OH/QlR/zqc+nUCLuNMtW2nLxHBdLzwE5wUsLnhcYZ9f HWYO5mUDe2FKT1Z4hnr8dV/ggCeUF4zGRkagSq27q7TyuHjLsAiDQ7fggEtnp03CU8yEgmE pdRGIzUt4OUFbimsZcHkZBrWx6MFNAzTISesjKfXYWl7tUKxKXmwu+bcozSwqu4dqxhjPJr vOd1ehfPK8iO2NULIu5zdVLF5gNbiBvXirVDdgYO3PGTjM6uuo8lQCLoe8yA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=ffmpeg.org; s=arc; t=1770580505; h=from : sender : reply-to : subject : date : message-id : to : cc : mime-version : content-type : content-transfer-encoding : content-id : content-description : resent-date : resent-from : resent-sender : resent-to : resent-cc : resent-message-id : in-reply-to : references : list-id : list-help : list-unsubscribe : list-subscribe : list-post : list-owner : list-archive; bh=Eut8i6maRhKzxRrIA1UaqeJg59gyebIUl7SAzQAPtYA=; b=RA5snLvGpAyYNHJuy+1ntUOgwVn0r8ACgedRuZ5mIrHtQ8ol1VRx2vd2u6vwBAMfBXhCb km0E4Eiev8+K90FzSOvGLj/zXTZ2uMvbCylPaReHrMoUj7cwxchN8RTVaSgB1QuipVGk3/v vE2PAmlLeNMInXDt2Z/+4V8Go5QxBJxUgyFF1woTc+RmqJfxPOgOsinfIKjFwP+54SJ5MX1 NOBa5hsl2d+wEaouJtz2n6ouVY6WyTUwgfUOcICTqDcCiqKMPkmgXQA+MGIV7YXZVTYieq/ VUc5c9Owwp5ScOXpHKqidVGDt2VL3lGhqn58zebCTZq2GEHAEYkbOump71eA== ARC-Authentication-Results: i=1; ffmpeg.org; dkim=pass header.d=gmail.com; arc=none; dmarc=pass header.from=gmail.com policy.dmarc=quarantine Authentication-Results: ffmpeg.org; dkim=pass header.d=gmail.com; arc=none (Message is not ARC signed); dmarc=pass (Used From Domain Record) header.from=gmail.com policy.dmarc=quarantine Received: from mail-pj1-f43.google.com (mail-pj1-f43.google.com [209.85.216.43]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTPS id ADD7B68EB37 for ; Sun, 8 Feb 2026 06:56:30 +0200 (EET) Received: by mail-pj1-f43.google.com with SMTP id 98e67ed59e1d1-354a2d107bfso912718a91.0 for ; Sat, 07 Feb 2026 20:56:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1770526588; x=1771131388; darn=ffmpeg.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=scwZ77ACgsBY1yR4tklIQfbnnTdLKS5M37vrlfQ24yg=; b=UXg2YGOWJztYqfkBqHAtCNlwDSZScok0vsHzeo4MepmuWpl8PFVegI/374Q1wPsf6S pPQuDVMp6WD5TnTVw9tZNHq42q6Ij0bOqC1GMgIRphp1CT4cVc0vmrpI1NpYiE4vxKLV QU30UHODwbcLQ08jbTRS0y33WfZuMq2ptTJKGg9xEWwEvGnMyAmDohx0Glml5wRkA0zP wYyzqN+Ey3YU23O8CfP1Sw8h7BBpQeySU8fPIEcVxWFo9ht2amnaItwKTd2CO02AsUoh sBNdeb511Qghp2nJLRDFiIK1EwDd8eGVAOhz/74SDbVy9ilQFjMZQCImdSFM22pjs9fu EprA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770526588; x=1771131388; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=scwZ77ACgsBY1yR4tklIQfbnnTdLKS5M37vrlfQ24yg=; b=g5r2BIM8i5rTRrvftXDPbAYWPGc4nezmphnR5rmCtrRdjmozjrNFnCl0JqmifmO0qf NvTuNL1/FoJeYVOa7RL+nYkQsKF3r32ohUDRcDr1LSj+1UPI3vPPkSJETwyVEvswUN/7 o22yqDrGhJnh9JvQqu0UYGkzjBZRzhJYSioVd8sdQU40n/HD+7RFektyI+qaqL9HSz1O ILSdRCoAMkJpXdQwCM1+x9va29DIpGFF8yAj23aDWkdJNsMt1i53s1qqKxZtttAJPmEf Yn91gzueHUeGhZ0MnDB7RO1yGElb04wj9yY92qUuYSW53mywT2AD5v4Rhu/xd8bUwO6r RvqA== X-Gm-Message-State: AOJu0YyYGOaetf/Xno60GVKcwRap2aBsoKzZlBKA80pFoyDtDHa9gDtv nGrdXaL7y6ISZwe5GL7uyU3+AsIkr18WOByHDUGWRmuLCH8t4acL5SLXWjxs+Q== X-Gm-Gg: AZuq6aLekLLG0TDqoCC6B8AbSIh5IXLwhrLEUkATmhz92tgvE5ac5da76GtFemdk0bE i2hNMX1M0zdN75UQpH6yYa3VVtcIJmV/Ck3YZtuj9M4MEKfFDAfTAneeHuVogJGoAvY2rE/bYfA shgGEwK/AOMcLfUiMKYVOlj+u4yk6UEwhVg4qVIXuigTFTsGNxQVhyncM3v3Nm3gidX0BirOU2Y y1eAzkBU6/nuyQh7OVdLjaDrTE2ucp//8nWieurbQfis/CAcXMOysz/LaFQZDove2Kcjp5aVLPH vy9Tr7ZEosCD/J5jLMuNEj0cj/gWWl88uZFdbdMKoMDQbQhhwOqABF6B2hmgBCviDA8Nq/cUk/A 7EUYT9CAlzek2TMNB9+zZ+r/Im1LxJ7kSk5vokEjWVaY1J8py5luf86f8DZ4CVPGTx0jwZxZaeA kYG6prO0fjvzlaJ8pHE6M/oyPfqJyX X-Received: by 2002:a17:90b:3c11:b0:343:6108:1712 with SMTP id 98e67ed59e1d1-354b3e2b2a7mr5974856a91.18.1770526587610; Sat, 07 Feb 2026 20:56:27 -0800 (PST) Received: from MAC-FYWM4WRFG3 ([49.37.162.158]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-354c6787190sm3517945a91.1.2026.02.07.20.56.25 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sat, 07 Feb 2026 20:56:27 -0800 (PST) To: ffmpeg-devel@ffmpeg.org Date: Sun, 8 Feb 2026 10:26:21 +0530 Message-ID: <20260208045621.46911-1-om.bhandankar@gmail.com> X-Mailer: git-send-email 2.50.0 MIME-Version: 1.0 X-MailFrom: SRS0=Numh=AM=gmail.com=om.bhandankar@ffmpeg.org X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-ffmpeg-devel.ffmpeg.org-0; header-match-ffmpeg-devel.ffmpeg.org-1; header-match-ffmpeg-devel.ffmpeg.org-2; header-match-ffmpeg-devel.ffmpeg.org-3; emergency; member-moderation Message-ID-Hash: 3KAWHUDFZMUEAKMZH372JAQ5AVLL3BZA X-Message-ID-Hash: 3KAWHUDFZMUEAKMZH372JAQ5AVLL3BZA X-Mailman-Approved-At: Sun, 08 Feb 2026 19:54:58 +0000 X-Mailman-Version: 3.3.10 Precedence: list Reply-To: FFmpeg development discussions and patches Subject: [FFmpeg-devel] [PATCH] fftools: add -ignore_unknown_options for forward-compatible CLI usage List-Id: FFmpeg development discussions and patches Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Om Bhandankar via ffmpeg-devel Cc: ombhandankar , Cursor Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Archived-At: List-Archive: List-Post: From: ombhandankar Add a new global option -ignore_unknown_options that downgrades the "Unrecognized option" fatal error to a non-fatal warning, allowing processing to continue. This enables scripts and programs that invoke FFmpeg to include options from newer versions while maintaining compatibility with older ones. The option must appear before any unrecognized options on the command line. Both option parsing paths are handled: split_commandline() used by ffmpeg, and parse_options() used by ffplay/ffprobe. The option is defined in CMDUTILS_COMMON_OPTIONS so all tools support it. When an unrecognized option is skipped, its potential argument is not consumed, as there is no reliable way to determine whether an unknown option expects an argument. Ref: https://trac.ffmpeg.org/ticket/11626 Signed-off-by: Om Bhandankar Co-authored-by: Cursor --- Changelog | 1 + doc/fftools-common-opts.texi | 14 ++++++++++++++ fftools/cmdutils.c | 15 ++++++++++++++- fftools/cmdutils.h | 1 + fftools/opt_common.h | 1 + 5 files changed, 31 insertions(+), 1 deletion(-) diff --git a/Changelog b/Changelog index a09dcd82c2..017bb4940f 100644 --- a/Changelog +++ b/Changelog @@ -2,6 +2,7 @@ Entries are sorted chronologically from oldest to youngest within each release, releases are sorted from youngest to oldest. version : +- -ignore_unknown_options global option for forward-compatible CLI usage - yasm support dropped, users need to use nasm - VVC VAAPI decoder - RealVideo 6.0 decoder diff --git a/doc/fftools-common-opts.texi b/doc/fftools-common-opts.texi index f6d452c40e..586736829e 100644 --- a/doc/fftools-common-opts.texi +++ b/doc/fftools-common-opts.texi @@ -318,6 +318,20 @@ All FFmpeg tools will normally show a copyright notice, build options and library versions. This option can be used to suppress printing this information. +@item -ignore_unknown_options +Ignore unrecognized options instead of exiting with an error. + +When this option is set, any unrecognized command-line option will produce +a warning message instead of a fatal error, and processing will continue. +This is useful for scripts and programs that invoke FFmpeg with options +that may not be available in all versions, allowing forward-compatible +command lines. + +Note that this option must appear before any unrecognized options on the +command line. Also note that if an unrecognized option would normally +expect an argument, the argument will not be consumed and may be +misinterpreted as a subsequent option or filename. + @item -cpuflags flags (@emph{global}) Allows setting and clearing cpu flags. This option is intended for testing. Do not use it unless you know what you're doing. diff --git a/fftools/cmdutils.c b/fftools/cmdutils.c index 8ac20bf049..459651c522 100644 --- a/fftools/cmdutils.c +++ b/fftools/cmdutils.c @@ -58,6 +58,7 @@ AVDictionary *swr_opts; AVDictionary *format_opts, *codec_opts; int hide_banner = 0; +int ignore_unknown_options = 0; void uninit_opts(void) { @@ -435,8 +436,13 @@ int parse_options(void *optctx, int argc, char **argv, const OptionDef *options, } opt++; - if ((ret = parse_option(optctx, opt, argv[optindex], options)) < 0) + if ((ret = parse_option(optctx, opt, argv[optindex], options)) < 0) { + if (ignore_unknown_options && ret == AVERROR_OPTION_NOT_FOUND) { + av_log(NULL, AV_LOG_WARNING, "Ignoring unrecognized option '%s'.\n", opt); + continue; + } return ret; + } optindex += ret; } else { if (parse_arg_function) { @@ -581,6 +587,9 @@ void parse_loglevel(int argc, char **argv, const OptionDef *options) idx = locate_option(argc, argv, options, "hide_banner"); if (idx) hide_banner = 1; + idx = locate_option(argc, argv, options, "ignore_unknown_options"); + if (idx) + ignore_unknown_options = 1; } static const AVOption *opt_find(void *obj, const char *name, const char *unit, @@ -894,6 +903,10 @@ do { \ continue; } + if (ignore_unknown_options) { + av_log(NULL, AV_LOG_WARNING, "Ignoring unrecognized option '%s'.\n", opt); + continue; + } av_log(NULL, AV_LOG_ERROR, "Unrecognized option '%s'.\n", opt); return AVERROR_OPTION_NOT_FOUND; } diff --git a/fftools/cmdutils.h b/fftools/cmdutils.h index ad020f893a..baa6dcee0f 100644 --- a/fftools/cmdutils.h +++ b/fftools/cmdutils.h @@ -48,6 +48,7 @@ extern AVDictionary *sws_dict; extern AVDictionary *swr_opts; extern AVDictionary *format_opts, *codec_opts; extern int hide_banner; +extern int ignore_unknown_options; /** * Initialize dynamic library loading diff --git a/fftools/opt_common.h b/fftools/opt_common.h index 9bb5268472..e8625dbe19 100644 --- a/fftools/opt_common.h +++ b/fftools/opt_common.h @@ -226,6 +226,7 @@ int opt_cpucount(void *optctx, const char *opt, const char *arg); { "cpuflags", OPT_TYPE_FUNC, OPT_FUNC_ARG | OPT_EXPERT, { .func_arg = opt_cpuflags }, "force specific cpu flags", "flags" }, \ { "cpucount", OPT_TYPE_FUNC, OPT_FUNC_ARG | OPT_EXPERT, { .func_arg = opt_cpucount }, "force specific cpu count", "count" }, \ { "hide_banner", OPT_TYPE_BOOL, OPT_EXPERT, {&hide_banner}, "do not show program banner", "hide_banner" }, \ + { "ignore_unknown_options", OPT_TYPE_BOOL, OPT_EXPERT, {&ignore_unknown_options}, "ignore unrecognized options instead of failing" }, \ CMDUTILS_COMMON_OPTIONS_AVDEVICE \ #endif /* FFTOOLS_OPT_COMMON_H */ -- 2.50.0 _______________________________________________ ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org