Fix call encoder levels under comma decimal locales

This commit is contained in:
evgeny committed 2026-10-15 00:06:20 +02:00
1 parent faee775dff
commit ef397a6b48
2 files changed
+32 -1

No files matched your search

+4 -1
View File
@@ -163,10 +163,13 @@ bool LiveVideoEncoder::open(const LiveVideoConfig& config) {
if (constrained) {
c->thread_count = 1;
av_dict_set(&options, "profile", name == "libx264" ? "baseline" : "main", 0);
QByteArray level = QByteArray::number(config.level / (name == "libx264" ? 10.0 : 30.0), 'f', 1);
// Оба encoder принимают level × 10 целым: дробный разбор зависит от LC_NUMERIC.
QByteArray level = QByteArray::number(name == "libx264" ? config.level : config.level / 3);
params += ":ref=1:";
if (name == "libx264") params += "level=" + level;
else params += "level-idc=" + level + ":high-tier=0:hrd=0:info=0:scenecut=0";
DEBUG_DEBUG(DEBUG_CATEGORY_VIDEO, "live encoder level name=%s contract=%d parameter=%s",
name.constData(), config.level, level.constData());
}
av_dict_set(&options, name == "libx264" ? "x264-params" : "x265-params", params.constData(), 0);
} else if (name.endsWith("_nvenc")) {