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! { resolutions! {
nHD: 640 x 360 at 500_000 in AvcAac, nHD: 640 x 360 at 500_000 in AvcAac,
HD: 1280 x 720 at 1_000_000 in AvcAac, HD: 1280 x 720 at 1_000_000 in AvcAac,
FullHD: 1920 x 1080 at 2_000_000 in Av1Opus, FullHD: 1920 x 1080 at 750_000 in Av1Opus,
WQHD: 2560 x 1440 at 3_000_000 in Av1Opus, WQHD: 2560 x 1440 at 1_000_000 in Av1Opus,
// TODO qsx muss mal sagen wieviel bitrate für 4k // 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)] #[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) { fn append_to_cmd(self, cmd: &mut Command, venc: bool, _aenc: bool, vaapi: bool) {
// select codec and bitrate // select codec and bitrate
const QUALITY: &str = "22"; const QUALITY: &str = "18";
if venc { if venc {
let vcodec = match (self.format, vaapi) { let vcodec = match (self.format, vaapi) {
(FfmpegOutputFormat::Av1Flac, false) (FfmpegOutputFormat::Av1Flac, false)
@ -114,14 +114,23 @@ impl FfmpegOutput {
}; };
cmd.arg("-c:v").arg(vcodec); cmd.arg("-c:v").arg(vcodec);
if let Some(bv) = self.video_bitrate { 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()); cmd.arg("-b:v").arg(bv.to_string());
} else if vaapi { },
None if vaapi => {
cmd.arg("-rc_mode").arg("CQP"); cmd.arg("-rc_mode").arg("CQP");
cmd.arg("-global_quality").arg(QUALITY); cmd.arg("-global_quality").arg(QUALITY);
} else { },
_ => {
cmd.arg("-crf").arg(QUALITY); cmd.arg("-crf").arg(QUALITY);
} }
}
} else { } else {
cmd.arg("-c:v").arg("copy"); cmd.arg("-c:v").arg("copy");
} }