voelin-media: give av1_vaapi a two-second rate-control buffer

The measurements on the RX 7900 GRE had av1_vaapi as the one backend that
did not hold its bitrate: 3.5 % over at 1080p60 / 6 Mbit/s and 7.9 % over
at 1440p60 / 10 Mbit/s, on the desktop pattern, every frame encoded. A
stream that keeps sending more than the estimate allows is answered by
the congestion control with loss and a lower target.

Measured directly on the encoder, 600 frames after 120 of warm-up:
`maxrate`, `rc_mode`, `blbrc` and the QP bounds change nothing; only the
buffer does. With twice the bitrate as `bufsize` it lands at -0.8 %
(1440p60), -0.2 % (1080p60) and -1.2 % (720p30 / 2 Mbit/s), no frame
skipped, the largest frame 68 KB against 64 KB before (h264_vaapi's
largest at the same settings is 86 KB). Every other backend keeps the
one-second buffer it was within 2 % with.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
selikhovandClaude Opus 5.5 committed 2026-10-03 06:35:27 +03:00
1 parent 665de8dcd2
commit eb1a83ce1f
1 file changed
+9 -1
+9 -1
View File
@@ -806,7 +806,15 @@ impl FfmpegEncoder {
// SVT-AV1 takes CBR from its own `rc=2` and rejects a maximum
// that is not above the target.
generic("maxrate", if self.spec.name == "libsvtav1" { 0 } else { bitrate }),
generic("bufsize", bitrate),
// A one-second buffer, except for VA-API AV1: with one second
// Mesa's rate control overshot by 3.5 % at 1080p60 / 6 Mbit/s and
// 7.9 % at 1440p60 / 10 Mbit/s (RX 7900 GRE, desktop pattern);
// with two it lands within 1.2 % at both and at 720p30, no frame
// skipped, the largest 68 KB against 64 KB at 1440p60.
generic(
"bufsize",
u64::from(bitrate) * if self.spec.name == "av1_vaapi" { 2 } else { 1 },
),
generic("g", gop),
generic("bf", 0),
generic("colorspace", "smpte170m"),