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 initial support for the OpenH264 H.264 software codec #8529
base: master
Are you sure you want to change the base?
Conversation
Does this require #8015? |
Not yet. This is only the wiring for the ffmpeg plugin, which I think means it only shows up in the "advanced view" right now? I literally just banged this out and am taking a bit of a break before continuing to iterate on it. I've got local builds going so I can test the functionality... |
3182c09
to
64c44cd
Compare
7afe715
to
cc43f38
Compare
cc43f38
to
1d94907
Compare
I've pulled in #8015 into this pull request to simplify things for me and to show the full context of this change. |
6164cb4
to
de4b18d
Compare
I've now tested that this works, thanks to @Gawdl3y's help! 🎉 |
18b8266
to
407c73c
Compare
766e518
to
2df1d26
Compare
7fe6632
to
ac0df1b
Compare
ac0df1b
to
143e6f4
Compare
Hey @Conan-Kudo, remind me to come back to this after we make our v30 release branch. Sorry about the delay |
3fa343c
to
6cf0198
Compare
6cf0198
to
fb7f0aa
Compare
I agree with @tytan652 that the PR has its selection logic backwards: It installs OpenH264 as a fallback for x264, but x264 is a core module and the former is a very distro-specific option. As such the PR needs to add OpenH264 as an optional codec and check for its availability and still fall back to x264 as the default. |
I added it this way because OBS crashes the other way because there will not be x264 in the first place in Fedora's build unless you install the plugin from RPM Fusion. |
And ffmpeg is a "core module" too. Both are always present in upstream OBS builds, it depends on detection logic and whether ffmpeg is compiled with OpenH264 support. |
x264 is the built-in fallback and the app is structured around that. The better way to solve this would be for Fedora to patch (Also I’m unsure as to whether that should be implemented in Afaik we officially support Ubuntu and Flatpak and any distro-specific changes need to be made by distributors while packaging the app. |
|
Again, that will not work because you are creating a fallback for a fallback, you are not even checking if ffmpeg supports the encoder at runtime before making that decision and with that you also make macOS and Windows fall back to OpenH264 if x264 is not found. It creates additional code complexity and maintenance burden for an edge case on a single distribution and IMO that’s not a good deal. |
It's not just a single distribution. At this point in time, it benefits four distributions:
This is also supported by the FFmpeg library included in the Freedesktop runtime for Flatpak too. |
We can add generic support for OpenH264 if it is available (as in "checked if available via FFmpeg" because we do not ship FFmpeg with OpenH264 support on Windows and macOS as we do not support that codec at all), and that availability will probably be limited to Linux only and depends on the distribution-specific variant of FFmpeg available. If that check is positive, it can be added to the list of available encoders. But distribution-specific fixes need to be implemented/patched by distributors. Adding a global (as in: affecting all platforms) fallback on OpenH264 if the actual fallback Upstream distributors can then handle the added complexity of adding an OpenH264 fallback if it is available at all and abort the OBS Studio launch if it cannot be found. Also AV1 is not a "baseline/fallback" encoder, so the comparison with its implementation is not applicable. |
It would probably be sensible to split the encoder addition and the UI changes into separate PRs so we can move things along. The former is probably fine (with some minor code review nits). |
The code here assumes that the only software encoder is the x264-based H.264 encoder. That may not always remain true. This change adjusts the encoder string to indicate that it's an H.264 encoder from x264.
This allows users to leverage the OpenH264 codec from Cisco to encode H.264 video content. It is significantly reduced in capability from alternatives, but it does the job. This also provides a framework for adding support for other H.264 software codecs provided through FFmpeg.
OpenH264 exists as the codec of last resort, so it is implemented such that it is only used as the software codec if x264 is not available.
fb7f0aa
to
04164cd
Compare
Description
This allows users to leverage the OpenH264 codec from Cisco to encode H.264 video content. It is significantly reduced in capability from alternatives, but it does the job.
This also provides a framework for adding support for other H.264 software codecs provided through FFmpeg.
Motivation and Context
A number of distributions use OpenH264 distributed by Cisco to provide a fully licensed H.264 implementation (in particular, both Fedora Linux and openSUSE Linux do). However, OBS Studio cannot currently use it.
This change allows OBS Studio to use OpenH264 through FFmpeg if it's available.
How Has This Been Tested?
This was tested on Fedora Linux 38 for x86_64 with ffmpeg 6.0.
Types of changes
Checklist: