Skip to content

Commit

Permalink
av1_vaapi use -q & --max-crf 255
Browse files Browse the repository at this point in the history
  • Loading branch information
alexheretic committed Jun 27, 2024
1 parent 58384eb commit 906be28
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Unreleased
* Show full ffmpeg command after errors.
* For *_vaapi encoders map `--crf` to ffmpeg `-q` (instead of `-qp`).
* Set av1_vaapi default `--max-crf` to 255.

# v0.7.14
* Fix bash completions of some filenames.
Expand Down
2 changes: 1 addition & 1 deletion src/command/args/encode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -338,8 +338,8 @@ impl Encoder {
pub fn default_max_crf(&self) -> f32 {
match self.as_str() {
"libx264" | "libx265" => 46.0,
// rav1e: use max -qp
"librav1e" => 255.0,
"av1_vaapi" => 255.0,
// Works well for svt-av1
_ => 55.0,
}
Expand Down
19 changes: 10 additions & 9 deletions src/ffmpeg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -202,15 +202,16 @@ impl VCodecSpecific for Arc<str> {
}

fn crf_arg(&self) -> &str {
// use crf-like args to support encoders that don't have crf
if &**self == "librav1e" || self.ends_with("_vaapi") {
"-qp"
} else if self.ends_with("_nvenc") {
"-cq"
} else if self.ends_with("_qsv") {
"-global_quality"
} else {
"-crf"
// // use crf-like args to support encoders that don't have crf
match &**self {
// https://ffmpeg.org//ffmpeg-codecs.html#librav1e
"librav1e" => "-qp",
// https://ffmpeg.org//ffmpeg-codecs.html#VAAPI-encoders
e if e.ends_with("_vaapi") => "-q",
e if e.ends_with("_nvenc") => "-cq",
// https://ffmpeg.org//ffmpeg-codecs.html#QSV-Encoders
e if e.ends_with("_qsv") => "-global_quality",
_ => "-crf",
}
}
}

0 comments on commit 906be28

Please sign in to comment.