Skip to content

obs-ffmpeg: Add AV1 support for VA-API #8832

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

Merged
merged 2 commits into from
Jan 23, 2024
Merged

Conversation

nowrep
Copy link
Contributor

@nowrep nowrep commented May 2, 2023

AV1 support for VA-API encoder.

Description

Added FFmpeg VAAPI AV1 encoder.

Motivation and Context

Draft for now as av1_vaapi FFmpeg encoder is not yet upstreamed.

How Has This Been Tested?

Tested with Mesa driver.

Types of changes

  • New feature (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.

@tytan652 tytan652 added Work In Progress Linux Affects Linux New Feature New feature or plugin labels May 2, 2023
@nowrep nowrep force-pushed the vaapi-av11 branch 6 times, most recently from a49538a to 40e1a2c Compare May 3, 2023 08:59
@Conan-Kudo
Copy link
Contributor

Patches have been submitted upstream: http://ffmpeg.org/pipermail/ffmpeg-devel/2023-July/311892.html

@Bleuzen Bleuzen mentioned this pull request Aug 19, 2023
6 tasks
@Bleuzen
Copy link
Contributor

Bleuzen commented Aug 19, 2023

Hi @nowrep , the obs_extract_av1_headers function you implemented in this PR would also be useful for the nvenc av1 ffmpeg encoder:
#8794

one idea to handle this might be to split this PR into

  • one adding av1 utility functions (obs-av1.c & obs-av1.h)
  • one adding the vaapi encoder

This way the first PR could already be merged and afterwards there would be no conflict between the nvenc & vaapi PRs. What do you think?

@nowrep nowrep mentioned this pull request Aug 19, 2023
6 tasks
@nowrep
Copy link
Contributor Author

nowrep commented Aug 19, 2023

Opened #9475 with only the AV1 parsing commit.

@nowrep nowrep force-pushed the vaapi-av11 branch 2 times, most recently from 25228f0 to c4faeec Compare September 22, 2023 06:41
@Conan-Kudo
Copy link
Contributor

FYI, looks like we'll have AV1 support in ffmpeg 6.1: FFmpeg/FFmpeg@3be81e3

@nowrep nowrep marked this pull request as ready for review September 22, 2023 07:20
@GloriousEggroll
Copy link
Contributor

If anyone (who is comfortable with patching/rebuilding ffmpeg) wants to test this, I've backported the ffmpeg av1 encoder patches required for it to work on ffmpeg 6.0, verified it works on my side with this PR:

https://gist.github.com/GloriousEggroll/6e207ec166ec76510f32505439adef43

*Please, if you are not familiar with patching do not ask for assistance here, I will not provide it. This PR is not a 'how to' guide and I do not want to pollute the tracker with unrelated comments.

Copy link
Collaborator

@kkartaltepe kkartaltepe left a comment

Choose a reason for hiding this comment

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

Also tested this now that I have some amd and intel hardware, and it seems to work fine on my machine with ffmpeg's dev branch.

@shmerl
Copy link

shmerl commented Nov 12, 2023

Now that ffmpeg landed AV1 vaapi encoding, will this be merged into OBS?

@ANISANi
Copy link

ANISANi commented Nov 24, 2023

Wow, I tested this on 7900XTX with pached ffmpeg and all work (short test) :) . Waiting until support for ffmpeg 6.1 is added? Or did I miss something?

@shmerl
Copy link

shmerl commented Nov 24, 2023

6.1 should have it: https://github.com/FFmpeg/FFmpeg/blob/n6.1/libavcodec/Makefile#L258

@Lenny003
Copy link

Surely this will be merged soon!

@GrabbenD
Copy link

Would this work with a RX 6800 XT?

@Lenny003
Copy link

Would this work with a RX 6800 XT?

Should only work with cards that support vaapi AV1 Encoding (RDNA3+, Intel Arc etc)

@deadmeu
Copy link
Contributor

deadmeu commented Dec 25, 2023

With Mesa 23.3 out now I assume this is one of the last changes required to bring AV1 encode support for RDNA3 on Linux? If so, it would be great to see this merged 😄

@shmerl
Copy link

shmerl commented Dec 25, 2023

Mesa had VAAPI AV1 encoding for AMD for a while already, so it's not a blocker.

@shmerl
Copy link

shmerl commented Jan 7, 2024

Can this be merged please, so it could be released in 30.0.3?

@RytoEX
Copy link
Member

RytoEX commented Jan 7, 2024

Can this be merged please, so it could be released in 30.0.3?

We don't add new features in patch/point releases. PRs are reviewed and merged as we have time to do so.

@shmerl
Copy link

shmerl commented Jan 7, 2024

We don't add new features in patch/point releases. PRs are reviewed and merged as we have time to do so.

I see, thanks. May be this can be added to 30.1 then? Since such releases happen around twice a year, it would be good not to miss the next one.

@RytoEX
Copy link
Member

RytoEX commented Jan 7, 2024

We don't add new features in patch/point releases. PRs are reviewed and merged as we have time to do so.

I see, thanks. May be this can be added to 30.1 then? Since such releases happen around twice a year, it would be good not to miss the next one.

Again, PRs are reviewed and merged as we have time to do so. We have a lot of things to look at and prioritize at any given time. We understand and share the enthusiasm for AV1, but I'd please ask that we keep PR comments to actual reviews of the PR content so that reviewers don't have to dig through unrelated contents to figure out if a specific topic on the substance of the PR has been discussed/resolved. Thank you for your understanding.

@nowrep nowrep force-pushed the vaapi-av11 branch 2 times, most recently from 0faf4ff to 9952d32 Compare January 19, 2024 06:53
Use High profile for H264 and auto level with all codecs.
Remove setting default value for unused "rendermode" option.
Copy link
Member

@RytoEX RytoEX left a comment

Choose a reason for hiding this comment

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

Fixed my own mistake. Seems fine, and others off-thread have said this seems fine.

@RytoEX RytoEX added this to the OBS Studio (Next Version) milestone Jan 23, 2024
@RytoEX RytoEX merged commit 5d0323e into obsproject:master Jan 23, 2024
@nowrep nowrep deleted the vaapi-av11 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
Linux Affects Linux New Feature New feature or plugin
Projects
None yet
Development

Successfully merging this pull request may close these issues.