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

Set the codec level for AMF encoders #11548

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

lexano-ivs
Copy link
Contributor

Description

The default "level" setting was being used for each codec (AVC, HEVC, AV1) supported by AMF. For example, all HEVC encoders were using level 6.2 and this caused some playback devices to reject decoding the bitstream because the device reported a maximum decode level lower than 6.2.

This PR adds functionality to determine the best match for the codec level instead of relying on the defaults, for AMF encoders.

Motivation and Context

The default behaviour of setting the codec level to the maximum resulted in several Android-based devices failing to decode HEVC streams in the TEB (Twitch Enhanced Broadcasting) beta program, which is currently testing HEVC compatibility. Adjusting the level appropriately instantly fixed the decode failures.

Also, most APIs (such as NVENC and VAAPI) have an "Auto" option for setting the codec level, in which case the driver or library code adjust the level. This Auto option doesn't seem to be available for AMF, hence the need to implement something at the application layer.

How Has This Been Tested?

Several local unit tests were carried out by using a configuration override with Enhanced Broadcasting to verify the selected level is accurate. The code has been (and continues to be) tested in the TEB beta builds.

Types of changes

  • Enhancement (non-breaking change which adds 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.

HEVC uses a different scheme for specifying the level
and requires the value to be multiplied by 3.
The default "level" setting was being used for each codec
(AVC, HEVC, AV1) supported by AMF. For example, all HEVC
encoders were using level 6.2 and this caused some playback
devices to reject the bitstream for decode because the device
reported a maximum decode level lower than 6.2.

Add functionality to determine the best match for the codec
level instead of relying on the defaults.
@WizardCM WizardCM added the Enhancement Improvement to existing functionality label Nov 24, 2024
@Lain-B
Copy link
Collaborator

Lain-B commented Nov 24, 2024

I'm generally fine with this, but I sort of want to hear other people's opinions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement Improvement to existing functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants