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

Enable AV1, HEVC via RTMP to YouTube #8522

Merged
merged 7 commits into from
Mar 26, 2023
Merged

Conversation

nquah
Copy link
Contributor

@nquah nquah commented Mar 25, 2023

Implementation credited to yuriy-chumak

Description

Motivation and Context

Veovera Software Organization (aka VSO), a not-for-profit organization, was formed to help enhance software for the public good. VSO members currently include Adobe, Google and Veriskope. VSO published an Enhanced RTMP spec, which adds long-awaited support for HEVC and AV1 to the FLV container, enabling their use in RTMP.

Furthermore, with the advent of GPUs that support real-time AV1 encoding, we can now enable AV1 streaming.

This change updates the RTMP implementation in OBS to support HEVC and AV1. It additionally enables these codecs for RTMP ingestion to YouTube. This YouTube feature is currently in beta.

Note: YouTube transcodes live streams, and does not currently support AV1 for live delivery. Creators can still benefit from maintaining higher ingestion quality, with fewer compression artifacts, even at lower bitrates.

How Has This Been Tested?

  • Tested using FFmpeg as the RTMP server, and FFplay as the client.

  • Tested against YouTube’s RTMP server, up to 4K 60fps.

  • Tested AV1 live encoding using NVENC (NVIDIA), QSV (Intel) and AMF (AMD) encoders.

Types of changes

New feature (non-breaking change which adds functionality)

Known Issues

  • This feature is in beta at YouTube. Please report feedback.
  • Not all encoder settings may yield equal results. Check existing YouTube recommendations for H.264/RTMP here for comparison, and please report feedback.
  • Playback of rich content at high resolution may struggle for reasons unrelated to encoding performance, e.g. network connectivity or device performance of the client playing the stream.
  • HDR via RTMP is flag-guarded and not yet supported by YouTube.
  • 10-bit AV1 streaming to YouTube may not work properly yet.

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.

@WizardCM WizardCM added the New Feature New feature or plugin label Mar 25, 2023
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.

Some quick feedback.

Commit messages must follow the 50/72 rule, outlined in our Commit Guidelines.

Commit messages should have a prefix for the commit subject. In this case, as there are multiple components being modified, obs-outputs is probably most appropriate as the prefix. Then the commit message body should note that "this commit also modifies libobs, rtmp-services, and UI components". See other commits for examples.

Files must be formatted with clang-format 13.0.1. Currently, the file that is failing this check is plugins/obs-outputs/rtmp-av1.h.

I will leave code review to others.

@nquah nquah force-pushed the enhanced-rtmp branch 3 times, most recently from 51a1769 to 4cc8d2b Compare March 25, 2023 02:07
libobs/obs-bits.h Outdated Show resolved Hide resolved
@derrod
Copy link
Member

derrod commented Mar 25, 2023

I pushed my changes now. These mainly split up the PR into different commits to make things a little easier to review. It also splits out the change blocking HDR into a separate commit which can more easily be reverted later if this limitation no longer exists.

Additionally, there were a number of cleanup changes I made such as removing (now) unused code as well as removing the reliance on FFmpeg (which obs-outputs does not link to) for compilation.

@derrod derrod force-pushed the enhanced-rtmp branch 2 times, most recently from 7b9f632 to f64b3fa Compare March 25, 2023 20:04
@derrod
Copy link
Member

derrod commented Mar 25, 2023

Whoops somebody forgot to run this through Linux CI so a breaking change was undetected because MSVC does things differently, yay. Hopefully should be fixed now.

@nquah nquah requested a review from RytoEX March 25, 2023 21:17
UI/data/locale/en-US.ini Outdated Show resolved Hide resolved
Copy link
Collaborator

@tytan652 tytan652 left a comment

Choose a reason for hiding this comment

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

Unicode character issues.

plugins/rtmp-services/data/services.json Outdated Show resolved Hide resolved
plugins/rtmp-services/data/services.json Outdated Show resolved Hide resolved
plugins/rtmp-services/data/services.json Outdated Show resolved Hide resolved
plugins/rtmp-services/data/services.json Outdated Show resolved Hide resolved
plugins/rtmp-services/data/services.json Outdated Show resolved Hide resolved
plugins/rtmp-services/data/services.json Outdated Show resolved Hide resolved
plugins/rtmp-services/data/services.json Outdated Show resolved Hide resolved
plugins/rtmp-services/data/services.json Outdated Show resolved Hide resolved
plugins/rtmp-services/data/services.json Outdated Show resolved Hide resolved
@jp9000 jp9000 changed the title Enables AV1, HEVC via RTMP to YouTube Enable AV1, HEVC via RTMP to YouTube Mar 26, 2023
@derrod derrod force-pushed the enhanced-rtmp branch 3 times, most recently from 4009cc7 to 4168c30 Compare March 26, 2023 14:25
yuriy-chumak and others added 5 commits March 26, 2023 16:37
Implements AV1 and HEVC according to enhanced RTMP spec found at
https://github.com/veovera/enhanced-rtmp

Co-authored-by: derrod <dennis@obsproject.com>
Currently unsupported by all remotes accepting enhanced RTMP. This
commit may be removed at a later date.
@flying1314
Copy link

could you provide the modified ffmpeg for us to test it

@Fenrirthviti
Copy link
Member

could you provide the modified ffmpeg for us to test it

We are not using a modified ffmpeg. The changes for our support are to librtmp.

@winlinvip
Copy link

SRS media server support this extended RTMP specification, so you can push HEVC via RTMP to SRS very easy:

git clone https://github.com/ossrs/srs.git
cd srs/trunk && ./configure --h265=on && make
./objs/srs -c conf/http.ts.live.conf

Then, you can use OBS 29.1+ to push HEVC via RTMP.
Start OBS with the following settings in the Settings > Stream tab:

  • Server: rtmp://localhost/live
  • Stream Key: livestream
  • Encoder: Please select the HEVC hardware encoder.

image

image

Finally, open the player http://localhost:8080/players/srs_player.html?stream=livestream.ts

Or use VLS or ffplay to play http://localhost:8080/live/livestream.ts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
New Feature New feature or plugin
Projects
None yet
Development

Successfully merging this pull request may close these issues.