Bug 2179535

Summary: FFmpeg version 6 seems not to be supported
Product: [Fedora] Fedora Reporter: Yann Soubeyrand <bugzilla.redhat>
Component: firefoxAssignee: Martin Stransky <stransky>
Status: CLOSED COMPLETED QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: unspecified    
Version: 38CC: awilliam, dominik, erack, fzatlouk, gecko-bugs-nobody, jhorak, klaas, klember, ngompa13, pjasicek, robatino, rstrode, sandmann, stransky, trpost
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: RejectedBlocker
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-10-02 11:38:05 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Yann Soubeyrand 2023-03-18 11:06:36 UTC
Description of problem:

I rebased my Fedora Silverblue on Silverblue 38 beta and replaced libav*-free with ffmpeg-libs from RPM Fusion (but IIUC, the problem should be the same without RPM Fusion), and Firefox seems not to be able to use FFmpeg:

```
[yann@laptop ~]$ MOZ_LOG="PlatformDecoderModule:5" firefox
[Child 32283: Main Thread]: D/PlatformDecoderModule PDMInitializer, Init PDMs in Content process
[Child 32283: Main Thread]: D/PlatformDecoderModule FFMPEG: H264/AAC codecs unsupported without [
[Child 32283: Main Thread]: D/PlatformDecoderModule FFMPEG:   libavcodec.so.59
[Child 32283: Main Thread]: D/PlatformDecoderModule FFMPEG: , libavcodec.so.58
[Child 32283: Main Thread]: D/PlatformDecoderModule FFMPEG: , libavcodec-ffmpeg.so.58
[Child 32283: Main Thread]: D/PlatformDecoderModule FFMPEG: , libavcodec-ffmpeg.so.57
[Child 32283: Main Thread]: D/PlatformDecoderModule FFMPEG: , libavcodec-ffmpeg.so.56
[Child 32283: Main Thread]: D/PlatformDecoderModule FFMPEG: , libavcodec.so.57
[Child 32283: Main Thread]: D/PlatformDecoderModule FFMPEG: , libavcodec.so.56
[Child 32283: Main Thread]: D/PlatformDecoderModule FFMPEG: , libavcodec.so.55
[Child 32283: Main Thread]: D/PlatformDecoderModule FFMPEG: , libavcodec.so.54
[Child 32283: Main Thread]: D/PlatformDecoderModule FFMPEG: , libavcodec.so.53
[Child 32283: Main Thread]: D/PlatformDecoderModule FFMPEG:  ]
```

After some investigations, Fedora 38 comes with the recently released FFmpeg version 6 which provides libavcodec.so.60 which Firefox doesn’t support at the time (it’s planned for Firefox 112 but Fedora 38 comes with Firefox 110): https://bugzilla.mozilla.org/show_bug.cgi?id=1819374.

Arch Linux has patches, but they’re for Firefox 111, I don’t know if they can be backported: https://github.com/archlinux/svntogit-packages/tree/packages/firefox/trunk.

Version-Release number of selected component (if applicable):

firefox-110.0-3.fc38.x86_64

How reproducible:

It’s permanently reproducible.

Steps to Reproduce:
1. Start Firefox.
2. Try to play a video which requires FFmpeg codecs.

Actual results:

The video doesn’t play.

Expected results:

The video plays like it was the case in Fedora 37.

Comment 1 Neal Gompa 2023-03-19 23:19:58 UTC
It looks like fixes have been committed upstream for Firefox 112: https://bugzilla.mozilla.org/show_bug.cgi?id=1819374

Perhaps they can be backported?

Comment 2 Neal Gompa 2023-03-19 23:37:04 UTC
Pull requests submitted with patches from Arch Linux:

* Rawhide: https://src.fedoraproject.org/rpms/firefox/pull-request/49
* F38: https://src.fedoraproject.org/rpms/firefox/pull-request/50

Comment 3 Fedora Blocker Bugs Application 2023-03-19 23:40:10 UTC
Proposed as a Blocker for 38-final by Fedora user ngompa using the blocker tracking app because:

 Firefox not being able to properly decode content through FFmpeg violates the Final release criterion that the default browser must withstand a basic functionality test.

Comment 4 Martin Stransky 2023-03-20 10:08:14 UTC
Firefox 112 release date is 2023-04-11 which looks too late for Fedora 38 release.

Comment 5 Adam Williamson 2023-03-20 23:43:22 UTC
Discussed at 2023-03-20 blocker review meeting: https://meetbot-raw.fedoraproject.org/fedora-blocker-review/2023-03-20/f38-blocker-review.2023-03-20-16.00.html . We agreed to delay the decision on this bug as it's not clear exactly what is affected; we found during quick in-meeting testing that obvious things (youtube, twitch, bluejeans test call) seem to work OK. So we'd ask for some more detail on what exactly is broken by this in order to make the decision.

Comment 6 Martin Stransky 2023-03-21 09:29:49 UTC
(In reply to Adam Williamson from comment #5)
> Discussed at 2023-03-20 blocker review meeting:
> https://meetbot-raw.fedoraproject.org/fedora-blocker-review/2023-03-20/f38-
> blocker-review.2023-03-20-16.00.html . We agreed to delay the decision on
> this bug as it's not clear exactly what is affected; we found during quick
> in-meeting testing that obvious things (youtube, twitch, bluejeans test
> call) seem to work OK. So we'd ask for some more detail on what exactly is
> broken by this in order to make the decision.

Yes, that's correct. Only broken thing is H.264 decode via ffmpeg from rpmfusion. Default Fedora setup is not affected as H.264 is decoded by OpenH264 and it's not affected by that.
Also open formats (VP8/9 and AV1) are decoded by Firefox internal/bundled ffvpx decoder and it's not affected.
So I think it's safe to leave it to 112.0 and release it as update.

Comment 7 Martin Stransky 2023-03-21 09:32:33 UTC
Note that VA-API decode of open formats (VP8/9 and AV1) are not affected as Firefox internal/bundled ffvpx decoder is used for it.

Comment 8 Kalev Lember 2023-03-21 10:09:09 UTC
(In reply to Martin Stransky from comment #6)
> Yes, that's correct. Only broken thing is H.264 decode via ffmpeg from
> rpmfusion. Default Fedora setup is not affected as H.264 is decoded by
> OpenH264 and it's not affected by that.

Note that Fedora has ffmpeg as well now (with problematic codecs stripped out) and it's installed by default in F38 (since https://pagure.io/fedora-comps/c/85ce9364001f0546ac229fc0ebbe968a4197620d?branch=main). How does firefox behave in a situation like that? Does it pick standalone openh264 or ffmpeg?

Comment 9 Martin Stransky 2023-03-21 10:19:30 UTC
(In reply to Kalev Lember from comment #8)
> Note that Fedora has ffmpeg as well now (with problematic codecs stripped
> out) and it's installed by default in F38 (since
> https://pagure.io/fedora-comps/c/
> 85ce9364001f0546ac229fc0ebbe968a4197620d?branch=main). How does firefox
> behave in a situation like that? Does it pick standalone openh264 or ffmpeg?

I expect it doesn't support H.264 decode, right? In such case should be ignored by Firefox (and if not it's a bug which needs to be fixed).

Comment 10 Kalev Lember 2023-03-21 10:34:22 UTC
I believe it does - it includes a patch to dlopen openh264, https://src.fedoraproject.org/rpms/ffmpeg/blob/rawhide/f/ffmpeg-dlopen-openh264.patch and the spec file passes --enable-libopenh264-dlopen to configure, https://src.fedoraproject.org/rpms/ffmpeg/blob/rawhide/f/ffmpeg.spec

Comment 11 Martin Stransky 2023-03-21 10:43:19 UTC
(In reply to Kalev Lember from comment #10)
> I believe it does - it includes a patch to dlopen openh264,
> https://src.fedoraproject.org/rpms/ffmpeg/blob/rawhide/f/ffmpeg-dlopen-
> openh264.patch and the spec file passes --enable-libopenh264-dlopen to
> configure,
> https://src.fedoraproject.org/rpms/ffmpeg/blob/rawhide/f/ffmpeg.spec

I just tested rawhide + firefox 110 + ffmpeg-free-6.0-1.fc39.x86_64 and H.264 decode works.

Comment 12 Kalev Lember 2023-03-21 10:48:36 UTC
Ah, excellent!

Comment 13 Martin Stransky 2023-03-21 10:52:34 UTC
It's because ffmpeg-free-6.0 is ignored by Firefox (due to missing 6.0 support) and falls back to OpenH264.

Note that Firefox carries OpenH264 specific patches (https://bugzilla.mozilla.org/show_bug.cgi?id=1670333) as OpenH264 doesn't support to decode infra frames.
If H.264 is decoded by ffmpeg and then directed to OpenH264, Firefox doesn't use the OpenH264 workarounds and seek in H.264 video stream may fails.
(A root cause is OpenH264 bug indeed as ffmpeg H.264 decoders works fine).

So actually when Firefox is updated to support ffmpeg-6.0 and ffmpeg-free-6.0+OpenH264 redirect is installed that will lead to H.264 decode bugs.

I wonder if ffmpeg-free-6.0 should be ignored by Firefox somehow (but I don't know how).

Comment 14 Martin Stransky 2023-03-21 10:54:00 UTC
OpenH264 ticket - https://github.com/cisco/openh264/issues/3350

Comment 15 Neal Gompa 2023-03-21 12:11:41 UTC
You could check to see if "libopenh264" is the codec handler for h264 from libavcodec and then skip it.

Comment 16 Adam Williamson 2023-03-24 15:31:41 UTC
-5 in https://pagure.io/fedora-qa/blocker-review/issue/1117 , marking rejected as a blocker. I won't propose as an FE given the 112 release date.

Comment 17 Neal Gompa 2023-03-31 16:03:01 UTC
Noting report from Fedora Kinoite 38 user: https://pagure.io/fedora-kde/SIG/issue/324

Comment 18 Yann Soubeyrand 2023-10-02 11:38:05 UTC
Hello,

I guess this bug can be closed now that it’s fixed.