Closed Bug 1798512 Opened 2 years ago Closed 2 years ago

Update Snap libs to support VAAPI AV1 hardware decoding

Categories

(Firefox Build System :: Third Party Packaging, enhancement)

Firefox 106
x86_64
Linux
enhancement

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 1793507

People

(Reporter: michel.memeteau, Assigned: olivier)

References

(Blocks 1 open bug)

Details

User Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:106.0) Gecko/20100101 Firefox/106.0

Steps to reproduce:

Use default firefox snap on Ubuntu 22.04 to play web video with AV1
Vaapi enabled in firefox ( works with VP9 )

Actual results:

video is software decoded

Expected results:

Video could be hardware decoded on supported hardware if ffmpeg is up to date , 5.1 tested on 22.04 worked perfectly for AV1

The Bugbug bot thinks this bug should belong to the 'Core::Audio/Video: Playback' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Component: Untriaged → Audio/Video: Playback
Product: Firefox → Core
Depends on: 1760941
OS: Unspecified → Linux
Hardware: Unspecified → x86_64
Component: Audio/Video: Playback → Third Party Packaging
Product: Core → Firefox Build System

https://github.com/canonical/firefox-snap/blob/767875a21a6bd2c543fdee4119e67fbe5b7d2f53/snapcraft.yaml#L438-L439 explicitely states they want to stay on a lower version for compatibility reasons ?

Yes because FF Snap was based on Core20, and soon core22

(In reply to michel memeteau from comment #3)

Yes because FF Snap was based on Core20, and soon core22

And my understanding is that core22 work is ongoing per your comment https://bugzilla.mozilla.org/show_bug.cgi?id=1760941#c31 and there is no specific extra work required to do so. Why filing this bug ?

This bug is specific to AV1 HW decoding

either FF deb 22.04 or FF snap based on Core22 won't have a ffmpeg version recent enough that could hw decode AV1

Assignee: nobody → olivier
Blocks: snap

core22 uses ubuntu 22.04, which has version 4.4.2 of ffmpeg.
According to Michel, we need ffmpeg 5 to support hardware-accelerated AV1 decoding, so we would need to build ffmpeg 5 from source as part of the snap build.

When building ffmpeg from source, we'll need to make sure potentially problematic codecs (from a legal point of view) are not built.

Martin, would it be just fine to use our in-tree ffmpeg code? I'm more worried about the legal aspects, as Olivier pointed.

Flags: needinfo?(stransky)

AV1 VA-API is broken right now - Bug 1793507. Perhaps due to internal ffmpeg update to 5.0.x line.

Flags: needinfo?(stransky)

To be clear, AV1 is HW decoded by bundled ffvpx, external ffmpeg is not used for it. External ffmpeg is used for H.264 only.

Thanks martin : is there a documentation page that explain how codecs are handled in Firefox ?

Especially , I'm wondering if widevine might be one day decoded through Vaapi , something that macOS and WIndows have a step further compared to linux if I'm right.

But I can confirm that upgrading system ffmpeg to 5.1.2 through PPA on Linux with libvpx disabled in prefs.js made AV1 VAAPI decoding possible

Summary: Update Snap ffmpeg to support VAAPI AV1 hardware decoding → Update Snap libs to support VAAPI AV1 hardware decoding

(In reply to Martin Stránský [:stransky] (ni? me) from comment #10)

To be clear, AV1 is HW decoded by bundled ffvpx, external ffmpeg is not used for it. External ffmpeg is used for H.264 only.

So that would mean this is orthogonal to Snap? I dont see anything disabling ffvpx in the build of the snap package, so I would assume that we still use it. Michel's comment #11 would suggest this is the case, since he has to disable the pref to force use the system's libvpx.

So if Snap uses bundled ffvpx for AV1 decoding and it is currently broken, there is no specific handling to perform on Snap package. I don't remember if bundled ffvpx is disabled on deb packages though.

At best, hacking Snap package would be indeed a workaround for bug 1793507.

Depends on: 1793507

Yes, it's dupe of Bug 1793507.

Status: UNCONFIRMED → RESOLVED
Closed: 2 years ago
Duplicate of bug: 1793507
Resolution: --- → DUPLICATE

The fix was landed in central, it should work on Firefox Nightly (edge channel of Snap package), can you confirm?

Flags: needinfo?(michel.memeteau)

Quickly tested Snap edge On AV1 GPU capable hardware ( Iris XE )
With

media.ffmpeg.vaapi.enabled = true
media.ffvpx.enabled = false

Result
-> No Vaapi either with VP9 or AV1

Same with media.ffvpx.enabled = true

I guess because it needs to be based on core22 to have required libva

Anyway I m not ure I understand your target ? Do you want AV1 hw decoding to be handled by bundled libffvpx ? over libffmpeg ?

Flags: needinfo?(michel.memeteau)

(In reply to michel memeteau from comment #15)

Quickly tested Snap edge On AV1 GPU capable hardware ( Iris XE )
With

media.ffmpeg.vaapi.enabled = true
media.ffvpx.enabled = false

Result
-> No Vaapi either with VP9 or AV1

Same with media.ffvpx.enabled = true

I guess because it needs to be based on core22 to have required libva

No, as mentionned in comment 10, decoding is to be done by bundled FFVPX

Can you verify the version and make sure it includes https://hg.mozilla.org/mozilla-central/rev/2f5cc64f2978 and https://hg.mozilla.org/mozilla-central/rev/7284ad26b1c5 ?

(In reply to Alexandre LISSY :gerard-majax from comment #16)

(In reply to michel memeteau from comment #15)

I guess because it needs to be based on core22 to have required libva

No, as mentionned in comment 10, decoding is to be done by bundled FFVPX

OK ffmpeg is not involve but as libva ( and iHD driver ? ) is too old on Core20 , ffvpx cannot initialize the vaapi stack ( GLX VAAPI error is thrown ) when running on Iris XE as Olivier explained

You need to log in before you can comment on or make changes to this bug.