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

Add AV1 Decoding/Encoding Support #2780

Open
eliteprox opened this issue Mar 29, 2023 · 6 comments
Open

Add AV1 Decoding/Encoding Support #2780

eliteprox opened this issue Mar 29, 2023 · 6 comments

Comments

@eliteprox
Copy link
Contributor

eliteprox commented Mar 29, 2023

Is your feature request related to a problem? Please describe.

  • A broadcaster sending a stream in AV1 encoding may not be able to use livepeer due to lack of AV1 decoding
  • A broadcaster may want to transcode a stream to AV1 instead of H.264

Describe the solution you'd like

  1. Upgrade livepeer ffmpeg to the latest 6.0 release
  2. Add an AV1 decoder to the ffmpeg build script, adding support to ingest AV1 encoded streams to go-livepeer.
  3. Add an AV1 encoder to the ffmpeg build script, add encoder profile formats as needed to LPMS and go-livepeer.
  4. Develop a sample -transcodingOptions config file to demonstrate output of AV1 encoded video.

Describe alternatives you've considered
Here are some data points that may help with further scope analysis:

  • The ffmpeg encoder av1_nvenc appears to be needed for encoding AV1 on NVIDIA hardware. Other encoders are available for CPU and are supported in older versions of ffmpeg (for something like CPU encoding).
  • NVENC AV1 support was added to ffmpeg in version n6.0 and the changes are located here FFmpeg/FFmpeg@5c288a4
  • Livepeer ffmpeg version is currently based on n4.3, for which the commit prior to livepeer customizations can be found here: livepeer/FFmpeg@dc91b91

Additional context

  • Adding AV1 support will increase Livepeer's value as a transcoding service.
  • Adding AV1 decoding may help publishers who accidentally stream to us with an AV1 encoder not realizing it isn't supported.
  • AV1 decoding/encoding will reduce bandwidth requirements on the livepeer network which could lead to an improved overall experience.
@github-actions github-actions bot added the status: triage this issue has not been evaluated yet label Mar 29, 2023
@stronk-dev
Copy link
Contributor

I did some preliminary (untested) work in the md/Intel_AV1 branch (6343f37 42b4f49)

This is now already a few months old, so will be tough to rebase but might be a good starting point

LPMS will indeed require more changes and these can be modeled after NetInt support:
livepeer/lpms@8b5dca9
https://github.com/livepeer/lpms/pull/279/files

@eliteprox
Copy link
Contributor Author

eliteprox commented Mar 29, 2023

Thanks for sharing those links! It looks like 42b4f49 covered almost everything outside of lpms. I am familiar with how to modify lpms and debug it as part of livepeer, so I can help out here.

Any idea what would be the cheapest nvidia hardware with av1 support? I don't think I have any AV1 supported hardware

@stronk-dev
Copy link
Contributor

From a convo between me, Alex and Ivan back then:

- For testing, just add replace github.com/livepeer/lpms => ../lpms to go-livepeer's go.mod, to use your local lpms dir.
- AV1 encoding is supported by Nvidia starting from 30xx series, that's pretty modern hardware. I think it makes sense to go step by step, starting with CPU decoding support. For that, I'd add libaom compilation step and --enable-libaom to go-livepeer's install_ffmpeg.sh. After that, it boils down pretty much to adding corresponding constants to capabilities.go, and no changes to lpms at all. Adding hardware transcoding would involve changes to lpms, to pass correct Nvidia codec name. It's best to keep PRs small and easily reviewable.
I thought 30xx series added AV1 decoder, and 40xx series have AV1 encoder (released couple weeks ago)
Seems to be the case, only Ada lovelace family supports AV1 nvenc && Ampere for nvdec 

So yeah we'd need one of those outrageously expensive 40xx cards... I was thinking of getting the NVIDIA RTX 4000 SFF when it becomes available in my area. If/when I get I can give you access but would still be way out. However, the Intel cards with AV1 support are cheap (I have one at the office and papa bear has one too) so maybe we can start with Intel support here (I think they are in the latest FFMPEG release?)

@Pon-node
Copy link

@stronk-dev @eliteprox if you need stupidly expensive 40xx series card for testing let me know, I can set up a server for you to play around.

@papabear99
Copy link
Contributor

Would love to see Intel QSV support! From a few tests I've seen their encoders are high quality and fast, with the inexpensive A380 (currently $119 @ Newegg) beating the 3090 in both H.264 and H.265 and as mentioned support AV1 encoding.

@cyberj0g
Copy link
Contributor

cyberj0g commented Apr 3, 2023

Great proposal! The implementation would be fairly trivial and can follow this, except for Ffmpeg 6.0 migration. We had some issues with newer version of Ffmpeg, while integrating Netint support, probably related to slight changes in the API.

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

No branches or pull requests

6 participants