#126 H264 support for Firefox
Closed: Fixed a year ago by catanzaro. Opened 2 years ago by aday.

The Workstation has a solution for H264 enablement, through the Cisco-provided codec. However, this currently only works for GStreamer. One major missing piece is how to provide the same level of H264 support for Firefox.

Ideally, I suppose that we'd use the same H264 codec for Firefox as we use elsewhere on the desktop.

@stransky , do you have any ideas or suggestions here?


There's a plan to use Cisco H264 in Firefox as well, Jan Horak already did some progress here and he works on it so better to ask him, @xhorak ?

There's a plan to use Cisco H264 in Firefox as well, Jan Horak already did some progress here and he works on it so better to ask him, @xhorak ?

Excellent!

Hi, we could start with the ffmpeg-libs with compiled support of openh264. If we have the ffmpeg with openh264 codec installed, it should work out of box in the Firefox.

I guess this means another chainsawed version of ffmpeg, this time bundled in Firefox?

Hi, we could start with the ffmpeg-libs with compiled support of openh264. If we have the ffmpeg with openh264 codec installed, it should work out of box in the Firefox.

Thanks for this, @xhorak . I think the WG would be interested to know if work is planned to do this, and if you have a target release in mind.

I guess this means another chainsawed version of ffmpeg, this time bundled in Firefox?

I'm afraid so. Firefox only supports ffmpeg as multimedia backend on Linux and adding another would be a significant effort in terms of development and maintenance.

Does it have to be bundled to Firefox, can't it be a system library? E.g. SUSE maintains a version of ffmpeg that is stripped off all patented codecs and ship it as a system library AFAIK.

BTW this is not a problem of H.264 only. Firefox already supports AV1 which is gaining adoption, but again it relies on ffmpeg's dav1d codec, so although it's free codec of which we already have implementations in Fedora without ffmpeg it won't be available to Firefox users.

Does it have to be bundled to Firefox, can't it be a system library? E.g. SUSE maintains a version of ffmpeg that is stripped off all patented codecs and ship it as a system library AFAIK.

I suspect it might cause problems; please check with @kwizart.

Ah sorry, I've been reminded that it should probably not cause policy problems for kwizart since it should work more or less the same way as the current packaging for chromium-libs-media vs. chromium-libs-media-freeworld.

@eischmann Both SUSE and OpenMandriva use a variant of the same solution to make shipping ffmpeg viable: they strip the patented stuff and change ffmpeg to use dlopen for libraries that they can't ship in the main repositories.

The SUSE ffmpeg-4 package: https://build.opensuse.org/package/show/openSUSE:Factory/ffmpeg-4

The OpenMandriva ffmpeg package: https://github.com/OpenMandrivaAssociation/ffmpeg

The OpenMandriva patch is probably the way we'd want to go. RPM Fusion can use Supplements to make it so those libraries get installed automatically if ffmpeg is installed so that library progressively enhances to support those codecs.

Does this depend on either #84 or #170?

Not really. This issue is blocked on the special project alluded to above. It's not ready for further discussion and should be kept open for now.

Not really. This issue is blocked on the special project alluded to above. It's not ready for further discussion and should be kept open for now.

Never mind, looks like Firefox will use OpenH264 directly: https://bugzilla.mozilla.org/show_bug.cgi?id=1057646

However, it only solves H.264, not AV1 which is becoming more and more important.

Well this issue is about H.264. AV1 is a free codec. Does Workstation WG really need to track free codecs? Moving away from GStreamer was a self-inflicted decision, I'm afraid....

FWIW WebKit supports AV1 if gst-plugins-rs is installed, but I don't think we have that packaged for Fedora and we don't have it in GNOME runtime either, so I don't know if it works.

However, it only solves H.264, not AV1 which is becoming more and more important.

Firefox supports AV1 out of the box by bundled dav1d decoder.

However, it only solves H.264, not AV1 which is becoming more and more important.

Firefox supports AV1 out of the box by bundled dav1d decoder.

That's great news! Because it was not the case a while ago. Then I think we're fine because there is no other relevant free codec in the web world Firefox doesn't already support.

It looks like Firefox requires direct linking to OpenH264? We cannot do that in Fedora.

It looks like Firefox requires direct linking to OpenH264? We cannot do that in Fedora.

No. Firefox uses OpenH264 via GMP (gecko media plugin). See

https://bugzilla.mozilla.org/show_bug.cgi?id=1663844
https://bugzilla.mozilla.org/show_bug.cgi?id=1619988

thanks @stransky!

Any chance these will end up in a flatpak (which is how I consume FF in Fedora)?

I just kicked off a new firefox flatpak build.

The openh264 situation is a bit more complicated for flatpaks though: the third party repo setup we have with Cisco (openh264 rpms are downloaded directly from Cisco servers) doesn't integrate with flatpaks at all. I think we'll need to come up with some kind of extension point and a way to distribute the extension through Cisco.

so you're saying there is another hurdle to getting videos playing in the FF flatpak?

Yes, sadly. rpm-based firefox can now use mozilla-openh264 (that's the "OpenH264 via GMP" that stransky mentioned) from fedora-cisco-openh264 repo, but there is nothing equivalent for flatpak-based firefox.

Firefox does have another way to get the openh264 gmp plugin (automatically download from a third party), but that's disabled in Fedora.

Is there any way to opt-in to the automatically download from third party at runtime (an about:config setting or something)?

Is there any way to opt-in to the automatically download from third party at runtime (an about:config setting or something)?

The automated download from cisco depends on https://bugzilla.mozilla.org/show_bug.cgi?id=1619988 after that we can enable the automatic download for flatpak.

@ngompa mentioned today that he thought this was fixed in Firefox 82. However, I tested firefox-82.0.2-1.fc33 today against two different test pages:

And both pages fail to play the MP4 video with openh264-2.1.1-1.fc33 installed. So this test is a failure. Hi @stransky, was this expected to be working yet? Can you provide a status update please?

@ngompa mentioned today that he thought this was fixed in Firefox 82. However, I tested firefox-82.0.2-1.fc33 today against two different test pages:

And both pages fail to play the MP4 video with openh264-2.1.1-1.fc33 installed. So this test is a failure. Hi @stransky, was this expected to be working yet? Can you provide a status update please?

Both videos works for me. Can you file a new bug, run firefox on terminal as

MOZ_LOG="GMP:5" firefox > log.txt 2>&1

and attach the log here?

Thanks.

Also can you try a new profile for instance?

We discovered there is also a mozilla-openh264 subpackage that I was missing, which also needs to be installed somehow, #84. But that doesn't seem to be enough to make video playback work.

The problem here turned out to be that you need to log out of your desktop and log in again for OpenH264 to work after mozilla-openh264 is installed.

Metadata Update from @catanzaro:
- Issue tagged with: meeting

2 years ago

Hi @stransky, we notice that currently MOZ_GMP_PATH in set with a profile.d scriptlet. Would it be possible to move this to the /usr/bin/firefox shell script instead? We're concerned that otherwise, users will be confused if installing mozilla-openh264 doesn't work until you log out and log in again.

Metadata Update from @catanzaro:
- Issue untagged with: meeting

a year ago

Hi @stransky, we notice that currently MOZ_GMP_PATH in set with a profile.d scriptlet. Would it be possible to move this to the /usr/bin/firefox shell script instead? We're concerned that otherwise, users will be confused if installing mozilla-openh264 doesn't work until you log out and log in again.

Added to firefox-83.0-7 packages.

Great, thanks!

With that, I think we can close this.

Metadata Update from @catanzaro:
- Issue close_status updated to: Fixed
- Issue status updated to: Closed (was: Open)

a year ago

Is there any way to opt-in to the automatically download from third party at runtime (an about:config setting or something)?

The automated download from cisco depends on https://bugzilla.mozilla.org/show_bug.cgi?id=1619988 after that we can enable the automatic download for flatpak.

I guess maybe we can open a separate issue (maybe one already exists) for getting this working seamlessly in a flatpak.

Login to comment on this ticket.

Metadata