Skip to content

Commit

Permalink
0.9.5.6で空のoption-fileができてしまい、異常終了する問題を修正。
Browse files Browse the repository at this point in the history
  • Loading branch information
rigaya committed Dec 2, 2023
1 parent 5e2240c commit 13e7994
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Amatsukaze/TranscodeSetting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1134,18 +1134,21 @@ tstring ConfigWrapper::getOptions(
sb.append(_T(" --option-file \"%s\""), optionFilePath);
} else if (auto rcMode = getRCMode(conf.encoder, eoInfo.rcMode); rcMode) {
// --dynamic-rcが増えすぎた時に備え、ファイル渡しする
bool addOptFileCmd = false;
std::unique_ptr<FILE, decltype(&fclose)> fp(_tfopen(optionFilePath.c_str(), _T("w")), fclose);
if (rcMode->isBitrateMode) {
for (int i = 0; i < (int)zones.size(); ++i) {
const auto& zone = zones[i];
fprintf(fp.get(), " --dynamic-rc %d:%d,%s=%d\n",
zone.startFrame, zone.endFrame - 1, to_string(rcMode->name).c_str(),
(int)std::round(eoInfo.rcModeValue[0] * zone.bitrate));
addOptFileCmd = true;
}
} else {
for (int i = 0; i < (int)zones.size(); ++i) {
const auto& zone = zones[i];
if (zone.qualityOffset == 0.0) continue;
addOptFileCmd = true;
if (tstring(rcMode->name) == _T("cqp")) {
fprintf(fp.get(), " --dynamic-rc %d:%d,%s=%d:%d:%d\n",
zone.startFrame, zone.endFrame - 1, to_string(rcMode->name).c_str(),
Expand All @@ -1163,7 +1166,9 @@ tstring ConfigWrapper::getOptions(
}
}
}
sb.append(_T(" --option-file \"%s\""), optionFilePath);
if (addOptFileCmd) {
sb.append(_T(" --option-file \"%s\""), optionFilePath);
}
}
}
}
Expand Down

0 comments on commit 13e7994

Please sign in to comment.