Skip to content

Commit

Permalink
fix qp range for preset with av1_nvenc
Browse files Browse the repository at this point in the history
  • Loading branch information
ddennedy committed Dec 11, 2023
1 parent d9bf8b5 commit 866f964
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions src/docks/encodedock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -381,25 +381,30 @@ void EncodeDock::loadPresetFromProperties(Mlt::Properties &preset)
&& videoQuality > -1) {
//val = min + (max - min) * paramval;
if (vcodec.startsWith("libx264") || vcodec == "libx265" || vcodec.contains("nvenc")
|| vcodec.endsWith("_amf") || vcodec.endsWith("_vaapi"))
|| vcodec.endsWith("_amf") || vcodec.endsWith("_vaapi")) {
// 0 (best, 100%) - 51 (worst)
ui->videoQualitySpinner->setValue(TO_RELATIVE((vcodec == "av1_nvenc") ? 63 : 51, 0, videoQuality));
else if (vcodec.endsWith("_videotoolbox"))
const auto qmax = QString::fromLatin1(preset.get("vcodec")) =="libaom-av1" ? 63 : maxQpNvenc(vcodec);
ui->videoQualitySpinner->setValue(TO_RELATIVE(qmax, 0, videoQuality));
} else if (vcodec.endsWith("_videotoolbox")) {
#if defined(Q_OS_MAC) && defined(Q_PROCESSOR_ARM)
ui->videoQualitySpinner->setValue(ui->hwencodeCheckBox->isChecked() ? videoQuality * 55.0 / 23.0 :
videoQuality);
#else
ui->videoQualitySpinner->setValue(videoQuality);
#endif
else if (vcodec.endsWith("_qsv"))
} else if (vcodec.endsWith("_qsv")) {
// 1 (best, 100%) - 51 (worst)
ui->videoQualitySpinner->setValue(TO_RELATIVE(51, 1, videoQuality));
else if (vcodec.startsWith("libvpx") || vcodec.startsWith("libaom-")) // 0 (best, 100%) - 63 (worst)
} else if (vcodec.startsWith("libvpx") || vcodec.startsWith("libaom-")) {
// 0 (best, 100%) - 63 (worst)
ui->videoQualitySpinner->setValue(TO_RELATIVE(63, 0, videoQuality));
else if (vcodec.startsWith("libwebp")) // 100 (best) - 0 (worst)
} else if (vcodec.startsWith("libwebp")) {
// 100 (best) - 0 (worst)
ui->videoQualitySpinner->setValue(TO_RELATIVE(0, 100, videoQuality));
else // 1 (best, NOT 100%) - 31 (worst)
} else {
// 1 (best, NOT 100%) - 31 (worst)
ui->videoQualitySpinner->setValue(TO_RELATIVE(31, 1, videoQuality));
}
}
onVideoCodecComboChanged(ui->videoCodecCombo->currentIndex(), true);
on_audioRateControlCombo_activated(ui->audioRateControlCombo->currentIndex());
Expand Down

0 comments on commit 866f964

Please sign in to comment.