Repository navigation
Description
Imported from obsproject/obs-studio#13849.
Original report: obsproject/obs-studio#13849
Reported by liying-official on 2026-08-31.
Problem
Selecting SVT-AV1 with CBR can leave the encoder using VBR. OBS builds an SVT
parameter dictionary but assigns it to svtav1_opts, the internal FFmpeg
member name, instead of the public svtav1-params AVOption. The assignment
fails, its result is ignored, and the intended rc=2 override is lost.
Correcting only the option name exposes two more problems: bias-pct is
obsolete in current SVT versions, and tbr receives bits per second although
SVT parses the unsuffixed value as kilobits per second. FFmpeg already supplies
the target bitrate from AVCodecContext::bit_rate, so tbr is redundant.
Reproduction
- Select Advanced output mode and the SVT-AV1 encoder.
- Select CBR with a target bitrate such as 6000 Kbps.
- Inspect the parameters delivered to FFmpeg/SVT during encoder setup.
The private rate-control dictionary is missing, so the CBR override is absent.
Bitrate variation alone does not prove this bug: valid CBR output can vary
with content and buffering. The regression checks encoder configuration.
Acceptance criteria
- Deliver the selected SVT rate-control parameters through
svtav1-params. - Preserve CBR low-delay configuration and the target bitrate's correct units.
- Do not pass obsolete
bias-pctor a redundanttbroverride. - Report an assignment error and fail initialization, freeing partial state.
- Preserve VBR, CQP, explicit custom options, and AOM configuration behavior.
- Demonstrate a real software encode using the corrected CBR configuration.
Decisions and verification
This is a focused C bug fix, not a Rust port. No public headers, existing C
tests, or API signatures are changed. A new cmocka test uses production setup
code, deterministic video metadata, and real FFmpeg option handling.
Five of seven tests fail against the original implementation. All seven pass
after the fix under ASan/UBSan/LSan. An eight-frame, 128x128 smoke encode passes
with SVT-AV1 4.2.0 on the host and 2.3.0 in Docker; both report CBR / 6000 Kbps
with low-delay prediction. No GUI recording session or long-duration bitrate
measurement is claimed.
./lint and ./unittest pass. Linux CTest passes all six executables with
Rust OFF and ON; both configurations export the same 1,752 symbols. The new
target is listed in the Windows/macOS validation scripts, but those platforms
were not run locally. FFmpeg builds without libsvtav1 explicitly skip this test.
Prior work and credits
The upstream issue and the descriptions of the closed, unmerged proposals
#13901 (Jia-ben00) and
#13959 (lnuxe) identify
the same configuration problems. This change adds production-code regression
coverage and initialization-failure handling.
Prepared with assistance from Codex (GPT-6). Human review is pending.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
test(obs-ffmpeg): RED SVT-AV1 rate-control test (obs-rust#24)
obs-ffmpeg: Fix SVT-AV1 rate-control options