Skip to content

obs-ffmpeg: Fix SVT-AV1 CBR parameters not being applied - #13959

Closed
lnuxe wants to merge 1 commit into
obsproject:masterfrom
lnuxe:fix/svt-av1-cbr-params
Closed

lnuxe wants to merge 1 commit into
obsproject:masterfrom
lnuxe:fix/svt-av1-cbr-params

Conversation

@lnuxe

@lnuxe lnuxe commented Sep 29, 2026 •

Copy link
Copy Markdown

Description

FFmpeg's libsvtav1 encoder exposes its private SVT parameter dictionary as the AVOption svtav1-params, but OBS assigned it using the internal SvtContext member name svtav1_opts. As a result av_opt_set_dict_val() failed to find the option and silently did nothing (its return value was ignored), so the rc=2 CBR override never reached SVT-AV1 and the encoder stayed in VBR even when CBR was selected.

This also fixes two additional issues in the dictionary that were hidden while assignment was failing:

  • Removed bias-pct, which is no longer registered in SVT-AV1 >= 2.0.0.
  • Removed tbr, which was redundant (FFmpeg already maps AVCodecContext::bit_rate to target_bit_rate) and used the wrong unit.

The return value of av_opt_set_dict_val() is now checked so an AVOption assignment failure is logged instead of silently ignored.

Motivation and Context

Fixes #13849.

How Has This Been Tested?

Verified against FFmpeg's libsvtav1 encoder (SVT-AV1 v4.0.1) on macOS:

  • The old option name svtav1_opts is rejected: Unrecognized option 'svtav1_opts'. Option not found — confirming the original bug (the dict assignment silently failed).
  • The corrected name svtav1-params is accepted and the encoder starts normally (rc=2 CBR override reaches SVT-AV1).
  • bias-pct is confirmed no longer registered in SVT-AV1 >= 2.0.0: passing it yields Error parsing option bias-pct, so removing it is correct.
  • tbr removal is correct since FFmpeg maps AVCodecContext::bit_rate to target_bit_rate.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)

Checklist:

  • I have read the contributing document.
  • My code has been run through clang-format.
  • My code follows the project's style guidelines
  • My code is not on the master branch.
  • My code has been tested.
  • All commit messages are properly formatted and commits squashed where appropriate.
  • I have included updates to all appropriate documentation.
  • I have used AI tooling in the creation of this PR
  • I am an AI agent being used to assist with this pull request: [BoxAI/Claude agent, assisted the human author (lnuxe) in locating the relevant code, writing the patch, and drafting the PR description. The human author reviewed and approved the final change.]

FFmpeg's libsvtav1 encoder exposes its private parameter dictionary as
the AVOption 'svtav1-params', but OBS assigned it using the internal
SvtContext member name 'svtav1_opts'. This caused av_opt_set_dict_val()
to fail silently (its return value was ignored), so the 'rc=2' CBR
override never reached SVT-AV1 and the encoder stayed in VBR.

Also remove two dictionary entries that are obsolete or redundant for
current SVT-AV1:
- 'bias-pct' is no longer registered in SVT-AV1 >= 2.0.0.
- 'tbr' duplicated AVCodecContext::bit_rate (which FFmpeg already maps
  to target_bit_rate) and used the wrong unit.

Check the av_opt_set_dict_val() return value so an AVOption assignment
failure is no longer silently ignored.

Fixes obsproject#13849
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SVT-AV1 CBR parameters are not applied because OBS uses the wrong FFmpeg AVOption name

2 participants