diff --git a/src/zm_ffmpeg.cpp b/src/zm_ffmpeg.cpp index 8b98705041..9731d919ab 100644 --- a/src/zm_ffmpeg.cpp +++ b/src/zm_ffmpeg.cpp @@ -526,6 +526,14 @@ static std::string zm_filter_file_option(const std::string &key, const std::stri for (const char *const *k = param_keys; *k; k++) { if (name == *k) deny = true; } + // scaling-list also accepts built-in presets, which do not name a file + if (deny and name == "scaling-list") { + const size_t eq = item.find('='); + if (eq != std::string::npos) { + const std::string preset = item.substr(eq + 1); + if (preset == "off" or preset == "none" or preset == "flat" or preset == "jvt" or preset == "default") deny = false; + } + } if (deny) { Warning("Ignoring file option '%s' in encoder option %s", name.c_str(), key.c_str()); } else if (!item.empty()) { diff --git a/tests/zm_ffmpeg_options.cpp b/tests/zm_ffmpeg_options.cpp index 0facefdb9b..12e1e52b85 100644 --- a/tests/zm_ffmpeg_options.cpp +++ b/tests/zm_ffmpeg_options.cpp @@ -153,3 +153,12 @@ TEST_CASE("zm_parse_options drops file-writing entries spelled with _ or a leadi auto o2 = parse("x265-params=analysis_save=/tmp/a:--csv=/tmp/c:crf=20"); REQUIRE(o2["x265-params"] == "crf=20"); } + +TEST_CASE("zm_parse_options keeps a built-in scaling-list preset and drops a scaling-list file", "[ffmpeg]") { + auto o = parse("x265-params=scaling-list=default:crf=20"); + REQUIRE(o["x265-params"] == "scaling-list=default:crf=20"); + o = parse("x264-params=scaling-list=flat:keyint=30"); + REQUIRE(o["x264-params"] == "scaling-list=flat:keyint=30"); + o = parse("x264-params=scaling-list=/etc/passwd:keyint=30"); + REQUIRE(o["x264-params"] == "keyint=30"); +}