fix: encoder option filter keeps the built-in scaling-list presets refs #8015 (#8016)

This commit is contained in:
Jash Ambaliya authored and GitHub committed 2026-11-24 20:43:01 -05:00
1 parent faa9f924c9
commit 8f27c0e8fb
2 files changed
+17

No files matched your search

+8
View File
@@ -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()) {
+9
View File
@@ -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");
}