Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

obs-ffmpeg: Add quality preset for VA-API #7953

Closed
wants to merge 1 commit into from

Conversation

nowrep
Copy link
Contributor

@nowrep nowrep commented Dec 21, 2022

Description

Added support for VA-API quality preset in Mesa >= 22.3.
https://gitlab.freedesktop.org/mesa/mesa/-/commit/a727ec83ba01776e9c6f61c912c4caac280e968e

Motivation and Context

Better encoding quality on AMD cards on Linux.

How Has This Been Tested?

On ArchLinux (mesa 22.3.1, ffmpeg 5.1.2).

Types of changes

  • New feature (non-breaking change which adds functionality)
  • Tweak (non-breaking change to improve existing functionality)

Checklist:

  • My code has been run through clang-format.
  • I have read the contributing document.
  • My code is not on the master branch.
  • The code has been tested.
  • All commit messages are properly formatted and commits squashed where appropriate.
  • I have included updates to all appropriate documentation.

Screenshot:

2022-12-21_16:44:02

@tytan652
Copy link
Collaborator

tytan652 commented Dec 21, 2022

Screenshot of the UI change are missing.

@tytan652
Copy link
Collaborator

tytan652 commented Dec 21, 2022

On ArchLinux with mesa-git.

Please test on a real release not a git package.

@nowrep
Copy link
Contributor Author

nowrep commented Dec 21, 2022

Done.

Comment on lines +191 to +192
if (strncmp("Mesa Gallium", vendor_string, 12) != 0)
return false;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, but driver filters is a no-go.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It has to be like this, since the quality value has different meaning on other va drivers (intel).

Copy link
Collaborator

@tytan652 tytan652 Dec 21, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is not supported by any drivers, it is going to be an issue.

Edit: So no Mesa-only or Intel-only feature.

Copy link
Collaborator

@kkartaltepe kkartaltepe Jan 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem here appears to be that AMD decided to just ignore the defined meaning of this value and come up with their own new and exciting meaning for the parameter.

https://intel.github.io/libva/structVAEncMiscParameterBufferQualityLevel.html - A lower value means higher quality, and a value of 1 represents the highest quality. The quality level setting is used as a trade-off between quality and speed/power consumption, with higher quality corresponds to lower speed and higher power consumption.

https://gitlab.freedesktop.org/mesa/mesa/-/blob/a727ec83ba01776e9c6f61c912c4caac280e968e/src/gallium/frontends/va/config.c#L213 - AMD decided to use this to control a whole suite of encoder modes without regard to the API definition.

I'm not a fan of trying to divine the meaning of a parameter after AMD intentionally broke the api for their implementation, better to just ignore this if drivers want to use this as a special out of spec signal since they may change it any time on us.

@tytan652 tytan652 added the Design Issue There is an issue with incorporating this pull request's design. It may take some time to finalize. label Dec 23, 2022
@tytan652 tytan652 added the Linux Affects Linux label Jan 7, 2023
@nowrep nowrep closed this Apr 30, 2023
jmickelonis added a commit to jmickelonis/obs-studio that referenced this pull request Feb 2, 2024
@nowrep nowrep deleted the vaapi-preset branch April 21, 2024 07:37
@nowrep nowrep restored the vaapi-preset branch April 21, 2024 07:37
@nowrep nowrep deleted the vaapi-preset branch April 21, 2024 07:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Design Issue There is an issue with incorporating this pull request's design. It may take some time to finalize. Linux Affects Linux
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants