Don't accept OpenH264 as h264 decoder from ffmpeg by default
Categories
(Core :: Audio/Video: Playback, task, P3)
Tracking
()
Tracking | Status | |
---|---|---|
firefox113 | --- | unaffected |
firefox114 | --- | wontfix |
firefox115 | --- | fixed |
People
(Reporter: jrmuizel, Assigned: jrmuizel)
References
(Depends on 1 open bug)
Details
Attachments
(1 file)
OpenH264 currently has issues decoding some H264 content:
https://github.com/cisco/openh264/issues/3479
https://github.com/cisco/openh264/issues/3478
For now, it's probably better to stop using OpenH264 by default and hope that users are able to find a better h264 decoder.
We should be able to detect this here:
https://searchfox.org/mozilla-central/rev/69a482382823f42f482e840f65725218d7654cc4/dom/media/platforms/ffmpeg/FFmpegDataDecoder.cpp#83
Assignee | ||
Comment 1•3 years ago
|
||
OpenH264 currently has issues decoding some H264 content:
https://github.com/cisco/openh264/issues/3479
https://github.com/cisco/openh264/issues/3478
For now, it's probably better to stop using OpenH264 by default and hope that users are able to find a better h264 decoder.
Updated•3 years ago
|
Comment 2•3 years ago
•
|
||
(In reply to Jeff Muizelaar [:jrmuizel] from comment #0)
That one has apparently been fixed by: https://github.com/cisco/openh264/pull/3482 ("fix issue-3478")
Updated•3 years ago
|
Comment 3•3 years ago
|
||
Does this bug actually affects anybody? ffmpeg has its own (patented) h264 decoder which is used by default. When ffmpeg is build with openh264 decoder it means somebody does that on purpose and wants that as it needs extra effort to do so (ffmpeg does not build with openh264 by default). It may also mean the h264 content won't be available at all when we disable it.
Comment 4•3 years ago
|
||
As for the bugs here:
https://github.com/cisco/openh264/issues/3479
https://github.com/cisco/openh264/issues/3478
Firefox/Fedora (and probably other distros) use OpenH264 to decode h264 content but GMP interface (not ffmpeg). It's because we can't link OpenH264 with Firefox, OpenH264 is downloaded directly from Cisco servers after Firefox installation so the Firefox/Openh264 binding is dynamic (we also disable download OpenH264 from Mozilla as Mozilla provided H264 is pretty outdated - see Bug 1619988).
Assignee | ||
Comment 5•3 years ago
|
||
(In reply to Martin Stránský [:stransky] (ni? me) from comment #3)
Does this bug actually affects anybody? ffmpeg has its own (patented) h264 decoder which is used by default. When ffmpeg is build with openh264 decoder it means somebody does that on purpose and wants that as it needs extra effort to do so (ffmpeg does not build with openh264 by default). It may also mean the h264 content won't be available at all when we disable it.
The default Flatpak runtime has ffmpeg with openh264 and no builtin h264 decoder so this change would change the behaviour of the Firefox Flatpak package.
I'm not sure what the best thing for Fedora to do is. Ideally, Fedora wouldn't be using a broken H264 decoded by default but I don't know how often the brokenness shows up. Perhaps, Fedora could provide some resources to help improve the correctness and performance of OpenH264?
Comment 6•3 years ago
|
||
-
Would merging this patch really be better than current situation?
-
Downloading a working deb or rpm file from https://chrome.google.com is easier than finding out why Firefox can't play some videos at all but others.
-
Would regular users really google until they found
flatpak install flathub org.freedesktop.Platform.ffmpeg-full
? -
Not all h264 videos fail or have stuttering. We (community and Fedora) should instead file actionable bug reports on Github.
-
We would get even more inconsistency. Fedora's Firefox rpm package would still be using openh264.
Ideally all Linux builds behave just the same. Fedora Flatpak, Fedora rpm and other Linux builds should fall back to the same solution if ffmpeg is not found: bug 1663844
-
-
GMP-Openh264 is still used for WebRTC, an update from 1.8.1 to 2.2.x would be desired: bug 1619988
- https://github.com/cisco/openh264/issues/3478 has apparently been fixed by https://github.com/cisco/openh264/pull/3482.
- https://github.com/cisco/openh264/issues/3479#issuecomment-1038521709: "I will be looking at this issue next."
-
Because the update process is overly complex and Firefox' gmp-openh264 outdated, Fedora apparently removed the gmp-openh264 download mechanism from Firefox and loads its own via MOZ_GMP_PATH env var:
https://src.fedoraproject.org/rpms/firefox/blob/rawhide/f/disable-openh264-download.patch
https://src.fedoraproject.org/rpms/openh264/blob/rawhide/f/openh264.spec#_136https://codecs.fedoraproject.org/openh264/34/x86_64/os/Packages/m/mozilla-openh264-2.1.1-2.fc34.x86_64.rpm
==
http://ciscobinary.openh264.org/mozilla-openh264-2.1.1-2.fc34.x86_64.rpm-
rmp content: /./usr/lib64/mozilla/plugins/gmp-gmpopenh264/system-installed/ contains
- libgmpopenh264.[so|so.6|so.2.1.1]
- gmpopenh264.info
Name: gmpopenh264
Description: GMP Plugin for OpenH264.
Version: 2.1.1
APIs: encode-video[h264], decode-video[h264]
-
Please consider deprecating Fedora's mozilla-openh264 package and just update https://searchfox.org/mozilla-central/source/toolkit/content/gmp-sources/openh264.json.
-
-
Who publishes the gmp plugin files at http://ciscobinary.openh264.org? Does Cisco built and publish GMP+Openh264 or does it Mozilla?
- Could Cisco do it together with building their regular package? The urls and hashes required for https://searchfox.org/mozilla-central/source/toolkit/content/gmp-sources/openh264.json should ideally be listed by Cisco on https://github.com/cisco/openh264/releases to make the update process easier.
-
Small overview:
- bug 1513000 did the last update to 1.8.1.
- It sounds like gmp-openh264 (https://github.com/mozilla/gmp-api + openh264) is built in CI and used for CI tests, but real Firefox asks a Mozilla update server to get the real Cisco gmp-openh264 download url, unless the built-in fallback url (bug 1267495) has a higher version: https://searchfox.org/mozilla-central/source/toolkit/content/gmp-sources/openh264.json
- bug 1587543 changed 1.8.1 to 1.8.1.1 to retrigger downloads: https://searchfox.org/mozilla-central/source/toolkit/content/gmp-sources/openh264.json.
- bug 1462786 wants to use the real plugin instead of building it in CI, but the regular download seems too late. Can't just a simple wget be added somewhere before starting up Firefox in CI tests?
Comment 7•3 years ago
|
||
Not all h264 videos fail or have stuttering. We (community and Fedora) should instead file actionable bug reports on Github.
I would be more okay with this if there were a way to opt into testing this. As it is, I am using ffmpeg, which seems to work fine, and I have no idea how to opt into OpenH264.
Would merging this patch really be better than current situation?
Overall though, I do think this would be better than the current situation. OpenH264 seems to be known to be broken, and fixing it with ffmpeg is easy and fairly well documented across most distributions.
Comment 8•3 years ago
•
|
||
Unless Firefox also ships FDK-AAC-Stripped like Fedora and Flatpak (stripped ffmpeg with fdk_aac as part of freedesktop-sdk), there is little point in having OpenH264 for video decoding in Mozilla binaries (bug 1663844). Youtube could use H264+Opus, but prefers VP9 and AV1. Other websites require H264+AAC.
(In reply to Asif Youssuff from comment #7)
I have no idea how to opt into OpenH264.
- It doesn't seem to be possible yet with Mozilla binaries.
- bug 1663844
- https://src.fedoraproject.org/rpms/firefox/blob/rawhide/f/mozilla-1670333.patch is not upstreamed yet: bug 1670333
- Fedora's Firefox rpm seems to use a free & patent-expired/patented-stuff-stripped-out AAC audio decoder (FDK-AAC-Stripped system library):
https://src.fedoraproject.org/rpms/firefox/blob/rawhide/f/mozilla-1667096.patch is not upstreamed yet: bug 1667096 - Setting media.ffmpeg.enabled=false and media.gmp.decoder.enabled=true does not seem to work.
I tested an mp4 h264-main video without aac audio, but the file is just downloaded. I tested both: Wating for Openh264 installation inside Firefox and manually setting it via MOZ_GMP_PATH.
MOZ_GMP_PATH=/home/darkspirit/.mozilla/firefox/fay7j5mf.default-nightly/gmp-gmpopenh264/1.8.1.1/ MOZ_LOG="PlatformDecoderModule:5" mozregression --launch 2022-02-15 --pref media.ffmpeg.enabled:false media.gmp.decoder.enabled:true media.gmp.insecure.allow:true -P stdout -a file:///home/darkspirit/Downloads/gmp/h264main.nosound.mp4 - An update of Mozilla's gmp-openh264 would bring support for h264 high profile (https://test-videos.co.uk/bigbuckbunny/mp4-h264):
(Jean-Yves Avenard [:jya] from bug 1663844 comment #0)Currently the GMP OpenH264 decoder is disabled by default. Primary reason is that our version OpenH264 only supports the main profile.
Once the OpenH264 plugin is updated to 2.1.x we could theoretically use if for most h264 videos.
- You can test Openh264 by using Flatpak Firefox without having ffmpeg-full manually installed:
Remove possibly manually installed ffmpeg:
$ flatpak uninstall org.freedesktop.Platform.ffmpeg-full
Install Firefox:
$ sudo flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
$ flatpak install flathub org.mozilla.firefox
$ flatpak run org.mozilla.firefox https://bug1619882.bmoattachments.org/attachment.cgi?id=9149605
Comment 9•3 years ago
|
||
(In reply to Jeff Muizelaar [:jrmuizel] from comment #5)
(In reply to Martin Stránský [:stransky] (ni? me) from comment #3)
Does this bug actually affects anybody? ffmpeg has its own (patented) h264 decoder which is used by default. When ffmpeg is build with openh264 decoder it means somebody does that on purpose and wants that as it needs extra effort to do so (ffmpeg does not build with openh264 by default). It may also mean the h264 content won't be available at all when we disable it.
The default Flatpak runtime has ffmpeg with openh264 and no builtin h264 decoder so this change would change the behaviour of the Firefox Flatpak package.
That's really interesting and I don't understand it. If default Flatpak runtime has ffmpeg with openh264 AFAIK it means it violates openh264 license as it's requested to get openh264 directly from Cisco (as Cisco has to counts download numbers for the license). That's reason why Fedora uses openh264 via GMP and not via ffmpeg (see Bug 1057646).
I'm not sure what the best thing for Fedora to do is. Ideally, Fedora wouldn't be using a broken H264 decoded by default but I don't know how often the brokenness shows up. Perhaps, Fedora could provide some resources to help improve the correctness and performance of OpenH264?
Fedora is not affected by this change as we don't use openh264 via. ffmpeg due to reason I wrote above.
Comment 10•3 years ago
|
||
(In reply to Darkspirit from comment #8)
Unless Firefox also ships FDK-AAC-Stripped like Fedora and Flatpak (stripped ffmpeg with fdk_aac as part of freedesktop-sdk), there is little point in having OpenH264 for video decoding in Mozilla binaries (bug 1663844). Youtube could use H264+Opus, but prefers VP9 and AV1. Other websites require H264+AAC.
YT uses Opus so generally OpenH264 can work there. But sure sites with H264+AAC may be broken unless AAC is also enabled in Flatpak/ffmpeg.
Comment 11•3 years ago
•
|
||
The Flatpak/Freedesktop SDK contains ffmpeg
- with "noopenh264" (which can use libopenh264 if it has been downloaded by separate org.freedesktop.Platform.openh264 package)
https://gitlab.com/freedesktop-sdk/freedesktop-sdk/-/blob/master/elements/components/ffmpeg.bst
https://github.com/endlessm/noopenh264 - with FDK-AAC-Stripped
https://gitlab.com/freedesktop-sdk/freedesktop-sdk/-/blob/7533b38d90a72b340e83ca25d302ee239f541175/elements/include/ffmpeg.yml#L11
Flatpak package org.freedesktop.Platform.openh264 seems to download libopenh264 to extend basic ffmpeg from Freedesktop SDK, it does not load gmp+openh264.
https://gitlab.com/freedesktop-sdk/openh264-extension/-/blob/master/elements/config.yml
https://gitlab.com/freedesktop-sdk/openh264-extension/-/blob/master/Readme.md#flatpak-openh264-extension
This extension provides bootstrapping mechanism which allows installing Cisco's
free to use OpenH264 codec on end-user machine. This system is intended to be
used in conjunction with noopenh264. Applications link against stubs in noopenh264
and as such it determines the ABI. Applications however use openh264 during
runtime so the two must be ABI-compatible.
OpenSuse's ffmpeg has at least FDK-AAC-Stripped.
https://build.opensuse.org/package/view_file/openSUSE:Factory/ffmpeg-4/ffmpeg-4.2-dlopen-fdk_aac.patch?expand=1
https://build.opensuse.org/package/show/openSUSE:Factory/fdk-aac-free
Debian's ffmpeg does not seem to have AAC by default, AAC/ADTS and H264 seem to be part of libavcodec-extra58.
There is only an uninteresting non-free package of the unstripped variant: https://packages.debian.org/stable/libfdk-aac2
Comment 12•3 years ago
|
||
(In reply to Martin Stránský [:stransky] (ni? me) from comment #9)
That's really interesting and I don't understand it. If default Flatpak runtime has ffmpeg with openh264 AFAIK it means it violates openh264 license as it's requested to get openh264 directly from Cisco (as Cisco has to counts download numbers for the license). That's reason why Fedora uses openh264 via GMP and not via ffmpeg (see Bug 1057646).
Flatpak provides a wrapper which downloads openh264 straight from cisco webpage on end-user host. This should comply with cisco license.
Comment 13•3 years ago
|
||
There's a r+ patch which didn't land and no activity in this bug for 2 weeks.
:jrmuizel, could you have a look please?
If you still have some work to do, you can add an action "Plan Changes" in Phabricator.
For more information, please visit auto_nag documentation.
Updated•2 years ago
|
Comment 15•2 years ago
|
||
This patch makes sense now with Bug 1831342 (GMP/OpenH264 decoding). GMP uses latest OpenH264 and has patches to handle broken OpenH264 behavior so we want to use OpenH264 via GMP and not via ffmpeg.
Andrew, what do you think?
Comment 16•2 years ago
•
|
||
mozilla-openh264 2.3.1 distro packages download distro-made gmp-openh264 binaries from Cisco. It's not worse if Firefox would do it instead.
That would relieve distros from their packaging burden of mozilla-openh264.
- bug 1827333 should ship 2.3.2 to all Firefox 114+ Linux users now. Fedora(x86_64,i386,aarch64,ppc64le,s390x),OpenSuse,Gentoo already have 2.3.1. Flatpak has 2.2.0.
- bug 1766638: Update GMP plugins right after startup (at least on MOZ_WIDGET_GTK).
- Uplift a pref to ignore the MOZ_GMP_PATH env var by default.
- bug 1827453: Uplift media.gmp.decoder.enabled=true for MOZ_WIDGET_GTK because distros are already shipping it. If it's not enabled, decoding would fail due to missing decoder.
- this bug/Flatpak: Stop using openh264 via ffmpeg noopenh264 adapter. It has been affected by the seeking bug as well (bug 1670333 comment 26).
That would solve bug 1831342 and be a long-term fix at the same time.
Updated•2 years ago
|
Comment 17•2 years ago
|
||
I agree, we can land this with the caveat that we disallow ffmpeg + openh264 on nightly, where we are currently shipping the updated plugin, but still allow it by default on beta and later. I may request uplift of this with several other patches to give distros more options on how they wish to go about the plugin update.
Updated•2 years ago
|
Comment 18•2 years ago
|
||
Comment 19•2 years ago
|
||
Backed out for causing bustages on FFmpegDataDecoder.cpp
Comment 20•2 years ago
|
||
Ah, it appears MOZ_FFVPX includes the decoder file even if MOZ_FFMPEG is disabled. I will fix.
Comment 21•2 years ago
|
||
Comment 22•2 years ago
|
||
bugherder |
Comment 23•2 years ago
|
||
Is this something that needs to be backported to 114 before we build the RC next week or can it ride the trains?
Assignee | ||
Comment 24•2 years ago
|
||
I think it's ok to ride. Andrew?
Comment 25•2 years ago
|
||
(In reply to Ryan VanderMeulen [:RyanVM] from comment #23)
Is this something that needs to be backported to 114 before we build the RC next week or can it ride the trains?
Not this bug, but bug 1831342 but with the pref set to false.
bug 1827703 (114) changed GMP-OpenH264 playback which caused bug 1831342: Playback becomes awful for versions older than latest OpenH264 2.3.2.
The regression only affects Linux distributions without ffmpeg h264 decoder (to avoid patent license fees).
Those distributions enable media.gmp.decoder.enabled, compile GMP-OpenH264 for Firefox themselves (because Mozilla's plugin version is too outdated), publish it as system package via Cisco, download it from Cisco, and load it into Firefox via MOZ_GMP_PATH environment variable.
Otherwise Firefox would fail to play Twitch streams etc.
Those Linux distributions need either
a) to create&publish their own GMP-OpenH264 2.3.2 package update before their users try to use Firefox 114+
or
b) they (or Mozilla) need to backport bug 1831342 (the pref) to 114, but set to false. <-----------------------------------------------------------------
I assume Flatpak is unaffected by the regression as it uses OpenH264 via ffmpeg noopenh264 (with its own problems) and not via GMP.
Only Stable is packaged for Flatpak. I would be able to test after its release.
comment 16 would be the long-term fix (hopefully sooner than later): Flatpak and distributions without ffmpeg h264 decoder would then use the same code path and every Nightly user could test the same thing.
Comment 26•2 years ago
|
||
(In reply to Ryan VanderMeulen [:RyanVM] from comment #23)
Is this something that needs to be backported to 114 before we build the RC next week or can it ride the trains?
Uplift request: bug 1831342 comment 13
Updated•2 years ago
|
Updated•3 months ago
|
Description
•