optimize some libsvtav1 params

This commit is contained in:
Dominic 2024-05-24 12:01:45 +02:00
parent d323915aed
commit 9a4b3142ff
Signed by: msrd0
GPG key ID: AAF7C8430CA3345D
2 changed files with 20 additions and 11 deletions

View file

@ -133,10 +133,10 @@ macro_rules! resolutions {
resolutions! {
nHD: 640 x 360 at 500_000 in AvcAac,
HD: 1280 x 720 at 1_000_000 in AvcAac,
FullHD: 1920 x 1080 at 2_000_000 in Av1Opus,
WQHD: 2560 x 1440 at 3_000_000 in Av1Opus,
FullHD: 1920 x 1080 at 750_000 in Av1Opus,
WQHD: 2560 x 1440 at 1_000_000 in Av1Opus,
// TODO qsx muss mal sagen wieviel bitrate für 4k
UHD: 3840 x 2160 at 4_000_000 in Av1Opus
UHD: 3840 x 2160 at 2_000_000 in Av1Opus
}
#[derive(Deserialize, Serialize)]

View file

@ -102,7 +102,7 @@ impl FfmpegOutput {
fn append_to_cmd(self, cmd: &mut Command, venc: bool, _aenc: bool, vaapi: bool) {
// select codec and bitrate
const QUALITY: &str = "22";
const QUALITY: &str = "18";
if venc {
let vcodec = match (self.format, vaapi) {
(FfmpegOutputFormat::Av1Flac, false)
@ -114,13 +114,22 @@ impl FfmpegOutput {
};
cmd.arg("-c:v").arg(vcodec);
if let Some(bv) = self.video_bitrate {
cmd.arg("-b:v").arg(bv.to_string());
} else if vaapi {
cmd.arg("-rc_mode").arg("CQP");
cmd.arg("-global_quality").arg(QUALITY);
} else {
cmd.arg("-crf").arg(QUALITY);
if vcodec == "libsvtav1" {
cmd.arg("-svtav1-params").arg("fast-decode=1");
cmd.arg("-preset").arg("8");
}
match self.video_bitrate {
Some(bv) if vcodec != "libsvtav1" => {
cmd.arg("-b:v").arg(bv.to_string());
},
None if vaapi => {
cmd.arg("-rc_mode").arg("CQP");
cmd.arg("-global_quality").arg(QUALITY);
},
_ => {
cmd.arg("-crf").arg(QUALITY);
}
}
} else {
cmd.arg("-c:v").arg("copy");