Closed Bug 1622425 Opened 4 years ago Closed 3 years ago

flatpak: Couldn't find ffmpeg VA-API decoder

Categories

(Core :: Audio/Video: Playback, defect, P5)

75 Branch
x86_64
Linux
defect

Tracking

()

RESOLVED WORKSFORME
Tracking Status
firefox-esr68 --- unaffected
firefox73 --- unaffected
firefox74 --- unaffected
firefox75 --- disabled
firefox76 --- disabled

People

(Reporter: okias, Unassigned)

References

(Blocks 2 open bugs)

Details

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

Steps to reproduce:

Version 75.0b3

  • flatpak install --user https://flathub.org/beta-repo/appstream/org.mozilla.firefox.flatpakref
  • flatpak override --user --socket=wayland --env=GDK_BACKEND=wayland org.mozilla.firefox
    Compositing WebRender
    Window Protocol wayland/drm
    Desktop Environment gnome
    Description Mesa DRI Intel(R) HD Graphics 520 (Skylake GT2)
    WEBRENDER
    opt-in by default: WebRender is an opt-in feature
    available by user: Force enabled by pref

Actual results:

flatpak run --branch=beta org.mozilla.firefox
Gdk-Message: 22:03:20.836: Unable to load hand2 from the cursor theme
Gdk-Message: 22:03:21.012: Unable to load hand2 from the cursor theme
[Child 72: Main Thread]: D/PlatformDecoderModule Couldn't load function avcodec_get_hw_config
[Child 72: Main Thread]: D/PlatformDecoderModule Couldn't load function av_hwdevice_ctx_create
[Child 72: Main Thread]: D/PlatformDecoderModule Couldn't load function av_hwframe_transfer_get_formats
[Child 72: Main Thread]: D/PlatformDecoderModule Couldn't load function av_hwdevice_ctx_create_derived
[Child 72: Main Thread]: D/PlatformDecoderModule Sandbox decoder rejects requested type
[Child 72: Main Thread]: D/PlatformDecoderModule Sandbox decoder rejects requested type
[Child 72: Main Thread]: D/PlatformDecoderModule Sandbox decoder rejects requested type
[Child 72: Main Thread]: D/PlatformDecoderModule Sandbox decoder rejects requested type
[Child 72: Main Thread]: D/PlatformDecoderModule Sandbox decoder supports requested type
[Child 72: Main Thread]: D/PlatformDecoderModule Sandbox decoder supports requested type
[Child 72: Main Thread]: D/PlatformDecoderModule Sandbox decoder supports requested type
[Child 72: Main Thread]: D/PlatformDecoderModule Sandbox decoder rejects requested type

...

[Child 72: Main Thread]: D/PlatformDecoderModule Sandbox decoder rejects requested type
[Child 72: Main Thread]: D/PlatformDecoderModule Sandbox decoder rejects requested type
[Child 72: Main Thread]: D/PlatformDecoderModule Sandbox decoder supports requested type
[Child 72: Main Thread]: D/PlatformDecoderModule Sandbox decoder supports requested type
[Child 72: Main Thread]: D/PlatformDecoderModule Sandbox decoder rejects requested type
[Child 72: Main Thread]: D/PlatformDecoderModule Sandbox decoder rejects requested type
[Child 72: Main Thread]: D/PlatformDecoderModule Sandbox decoder rejects requested type
[Child 72: Main Thread]: D/PlatformDecoderModule Sandbox decoder rejects requested type
[Child 72: Main Thread]: D/PlatformDecoderModule Sandbox decoder supports requested type
[Child 72: Main Thread]: D/PlatformDecoderModule Sandbox decoder rejects requested type
[Child 72: Main Thread]: D/PlatformDecoderModule Sandbox decoder rejects requested type
[Child 72: MediaPlayback #1]: D/PlatformDecoderModule Sandbox decoder rejects requested type
[Child 72: MediaPlayback #1]: D/PlatformDecoderModule Sandbox decoder supports requested type
[Child 72: MediaPlayback #2]: D/PlatformDecoderModule Sandbox decoder supports requested type
xcb_connection_has_error() returned true
[Child 72: MediaPlayback #1]: D/PlatformDecoderModule Sandbox decoder rejects requested type
[Child 72: MediaPDecoder #1]: D/PlatformDecoderModule Initialising VA-API FFmpeg decoder
[Child 72: MediaPDecoder #2]: D/PlatformDecoderModule AudioTrimmer[0x7f350e4553e0] ::operator(): sample[0,21000] no trimming information
[RDD 222: MediaPDecoder #1]: D/PlatformDecoderModule OpusDataDecoder[0x7fa6acb3b3c0] ::ProcessDecode: Opus decoder skipping 312 of 960 frames
[Child 72: MediaPDecoder #2]: D/PlatformDecoderModule AudioTrimmer[0x7f350e4553e0] ::HandleDecodedResult: sample[0,21000] (decoded[0,13500] no trimming needed
[Child 72: MediaPDecoder #1]: D/PlatformDecoderModule Decoder does not support VAAPI device type
[Child 72: MediaPDecoder #1]: D/PlatformDecoderModule Couldn't find ffmpeg VA-API decoder
[Child 72: MediaPDecoder #1]: D/PlatformDecoderModule Initialising FFmpeg decoder.

Expected results:

VAAPI decoding should work under flatpak.

Bugbug thinks this bug should belong to this component, but please revert this change in case of error.

Component: Untriaged → Graphics: WebRender
Product: Firefox → Core
Component: Graphics: WebRender → Untriaged
Product: Core → Firefox
Component: Untriaged → Audio/Video: Playback
OS: Unspecified → Linux
Product: Firefox → Core
Hardware: Unspecified → x86_64
Version: 73 Branch → 75 Branch
Blocks: flatpak
Summary: VAAPI fails when flatpak beta is used → flatpak: Couldn't find ffmpeg VA-API decoder
Status: UNCONFIRMED → NEW
Ever confirmed: true

Bug 1630754 may also affect this one.

Depends on: 1630754

Howdie,

I'm still seeing this issue with stable flatpak 78.0.2 (64-bit) even after following this guide: https://mastransky.wordpress.com/2020/06/03/firefox-on-fedora-finally-gets-va-api-on-wayland/

about:support:

  • Compositing: WebRender
  • Window Protocol: wayland/drm

about:config:

  • widget.wayland-dmabuf-vaapi.enabled: true
  • media.ffvpx.enabled: false

e.g. this Instagram video: https://www.instagram.com/tv/CCs-N1Eh2Z5/

Jul 21 04:21:04 hellmouth org.mozilla.firefox.desktop[18784]: [Child 520: Main Thread]: D/PlatformDecoderModule Sandbox decoder rejects requested type
Jul 21 04:21:04 hellmouth org.mozilla.firefox.desktop[18784]: [Child 520: Main Thread]: D/PlatformDecoderModule Sandbox decoder rejects requested type
Jul 21 04:21:04 hellmouth org.mozilla.firefox.desktop[18784]: [Child 520: MediaPlayback #1]: D/PlatformDecoderModule Sandbox decoder rejects requested type
Jul 21 04:21:04 hellmouth org.mozilla.firefox.desktop[18784]: [Child 520: MediaPlayback #1]: D/PlatformDecoderModule Sandbox decoder rejects requested type
Jul 21 04:21:04 hellmouth org.mozilla.firefox.desktop[18784]: [Child 520: MediaPlayback #1]: D/PlatformDecoderModule Sandbox decoder rejects requested type
Jul 21 04:21:04 hellmouth org.mozilla.firefox.desktop[18784]: [Child 520: MediaPlayback #1]: D/PlatformDecoderModule Sandbox decoder rejects requested type
Jul 21 04:21:04 hellmouth org.mozilla.firefox.desktop[18784]: [Child 520: MediaPDecoder #1]: D/PlatformDecoderModule Initialising FFmpeg decoder.
Jul 21 04:21:04 hellmouth org.mozilla.firefox.desktop[18784]: [Child 520: MediaPDecoder #1]: D/PlatformDecoderModule FFmpeg init successful.
Jul 21 04:21:04 hellmouth org.mozilla.firefox.desktop[18784]: [Child 520: MediaPDecoder #1]: D/PlatformDecoderModule Initialising VA-API FFmpeg decoder
Jul 21 04:21:04 hellmouth org.mozilla.firefox.desktop[18784]: [Child 520: MediaPDecoder #1]: D/PlatformDecoderModule Decoder does not support VAAPI device type
Jul 21 04:21:04 hellmouth org.mozilla.firefox.desktop[18784]: [Child 520: MediaPDecoder #1]: D/PlatformDecoderModule Couldn't find ffmpeg VA-API decoder
Jul 21 04:21:04 hellmouth org.mozilla.firefox.desktop[18784]: [Child 520: MediaPDecoder #1]: D/PlatformDecoderModule Initialising FFmpeg decoder.
Jul 21 04:21:04 hellmouth org.mozilla.firefox.desktop[18784]: [Child 520: MediaPDecoder #2]: D/PlatformDecoderModule AudioTrimmer[0x7f41eadd2600] ::operator(): sample[0,21333] no trimming information
Jul 21 04:21:04 hellmouth org.mozilla.firefox.desktop[18784]: [libfdk_aac @ 0x7f41e9c32800] 2 channels - front:2 side:0 back:0 lfe:0 top:0
Jul 21 04:21:04 hellmouth org.mozilla.firefox.desktop[18784]: [OpenH264] this = 0x0x7f41e9ee6000, Info:CWelsDecoder::SetOption():DECODER_OPTION_TRACE_CALLBACK callback = 0x7f41e9494360.
Jul 21 04:21:04 hellmouth org.mozilla.firefox.desktop[18784]: [libopenh264 @ 0x7f41e9c37800] [OpenH264] this = 0x0x7f41e9ee6000, Info:CWelsDecoder::init_decoder(), openh264 codec version = d13f170, ParseOnly = 0
Jul 21 04:21:04 hellmouth org.mozilla.firefox.desktop[18784]: [Child 520: MediaPDecoder #2]: D/PlatformDecoderModule AudioTrimmer[0x7f41eadd2600] ::HandleDecodedResult: sample[0,21333] (decoded[0,21333] no trimming needed
Jul 21 04:21:04 hellmouth org.mozilla.firefox.desktop[18784]: [libopenh264 @ 0x7f41e9c37800] [OpenH264] this = 0x0x7f41e9ee6000, Info:CWelsDecoder::init_decoder(), openh264 codec version = d13f170, ParseOnly = 0
Jul 21 04:21:04 hellmouth org.mozilla.firefox.desktop[18784]: [libopenh264 @ 0x7f41e9c37800] [OpenH264] this = 0x0x7f41e9ee6000, Info:eVideoType: 1
Jul 21 04:21:04 hellmouth org.mozilla.firefox.desktop[18784]: [Child 520: MediaPDecoder #1]: D/PlatformDecoderModule FFmpeg init successful.
Jul 21 04:21:04 hellmouth org.mozilla.firefox.desktop[18784]: [libopenh264 @ 0x7f41e9c37800] [OpenH264] this = 0x0x7f41e9ee6000, Warning:the total count of mb exceeds the level limits!
Jul 21 04:21:04 hellmouth org.mozilla.firefox.desktop[18784]: [libopenh264 @ 0x7f41e9c37800] [OpenH264] this = 0x0x7f41e9ee6000, Warning: max_num_ref_frames exceeds level limits!
Jul 21 04:21:04 hellmouth org.mozilla.firefox.desktop[18784]: [libopenh264 @ 0x7f41e9c37800] [OpenH264] this = 0x0x7f41e9ee6000, Info:WelsRequestMem(): memory alloc size = 1152 * 656, ref list size = 6

But outside of flatpak, on the terminal, I get:

❯ ffmpeg -version
ffmpeg version n4.3.1 Copyright (c) 2000-2020 the FFmpeg developers
built with gcc 10.1.0 (GCC)
configuration: --prefix=/usr --disable-debug --disable-static --disable-stripping --enable-avisynth --enable-fontconfig --enable-gmp --enable-gnutls --enable-gpl --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libdav1d --enable-libdrm --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libiec61883 --enable-libjack --enable-libmfx --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librav1e --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libv4l2 --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxcb --enable-libxml2 --enable-libxvid --enable-nvdec --enable-nvenc --enable-omx --enable-shared --enable-version3
libavutil 56. 51.100 / 56. 51.100
libavcodec 58. 91.100 / 58. 91.100
libavformat 58. 45.100 / 58. 45.100
libavdevice 58. 10.100 / 58. 10.100
libavfilter 7. 85.100 / 7. 85.100
libswscale 5. 7.100 / 5. 7.100
libswresample 3. 7.100 / 3. 7.100
libpostproc 55. 7.100 / 55. 7.100

❯ vainfo
vainfo: VA-API version: 1.8 (libva 2.8.0)
vainfo: Driver version: Mesa Gallium driver 20.1.3 for AMD Radeon RX 5700 XT (NAVI10, DRM 3.37.0, 5.7.9-arch1-1, LLVM 10.0.0)
vainfo: Supported profile and entrypoints
VAProfileMPEG2Simple : VAEntrypointVLD
VAProfileMPEG2Main : VAEntrypointVLD
VAProfileVC1Simple : VAEntrypointVLD
VAProfileVC1Main : VAEntrypointVLD
VAProfileVC1Advanced : VAEntrypointVLD
VAProfileH264ConstrainedBaseline: VAEntrypointVLD
VAProfileH264ConstrainedBaseline: VAEntrypointEncSlice
VAProfileH264Main : VAEntrypointVLD
VAProfileH264Main : VAEntrypointEncSlice
VAProfileH264High : VAEntrypointVLD
VAProfileH264High : VAEntrypointEncSlice
VAProfileHEVCMain : VAEntrypointVLD
VAProfileHEVCMain : VAEntrypointEncSlice
VAProfileHEVCMain10 : VAEntrypointVLD
VAProfileHEVCMain10 : VAEntrypointEncSlice
VAProfileJPEGBaseline : VAEntrypointVLD
VAProfileVP9Profile0 : VAEntrypointVLD
VAProfileVP9Profile2 : VAEntrypointVLD
VAProfileNone : VAEntrypointVideoProc

Any suggestions for what I can try next? Or any additional information that you'd like me to provide to help figure this out?

Cheers!

VAAPI decoding is actually working for me with Firefox 82.0.3 and Fedora Silverblue 33, having the org.freedesktop.Platform.VAAPI.Intel and org.freedesktop.Platform.ffmpeg-full seems to have done the trick for me. intel_gpu_top shows that the hardware video decoder is indeed being used. I don't even have ffmpeg installed on the host system, only the flatpak. Running Firefox with the flatpak run --env=MOZ_LOG=PlatformDecoderModule:5 org.mozilla.firefox command gives me the below output for reference:

[Child 89: MediaPDecoder #1]: D/PlatformDecoderModule Initialising FFmpeg decoder.
[Child 89: MediaController #1]: D/PlatformDecoderModule Sandbox decoder rejects requested type
[Child 89: MediaPDecoder #1]: D/PlatformDecoderModule FFmpeg init successful.
[Child 89: MediaPDecoder #1]: D/PlatformDecoderModule Initialising VA-API FFmpeg decoder
[Child 89: MediaPDecoder #2]: D/PlatformDecoderModule AudioTrimmer[0x7fc729573c00] ::Decode: sample[0,23219] no trimming information
[libfdk_aac @ 0x7fc72cf0f800] 2 channels - front:2 side:0 back:0 lfe:0 top:0
[Child 89: MediaPDecoder #2]: D/PlatformDecoderModule AudioTrimmer[0x7fc729573c00] ::HandleDecodedResult: sample[0,23219] (decoded[0,23219] no trimming needed
libva info: VA-API version 1.5.0
libva info: va_getDriverName() returns 0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/i965_drv_video.so
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/intel-vaapi-driver/i965_drv_video.so
libva info: Found init function __vaDriverInit_1_5
libva info: va_openDriver() returns 0
[AVHWDeviceContext @ 0x7fc72c936fc0] Format 0x32315659 -> yuv420p.
[AVHWDeviceContext @ 0x7fc72c936fc0] Format 0x30323449 -> yuv420p.
[AVHWDeviceContext @ 0x7fc72c936fc0] Format 0x3231564e -> nv12.
[AVHWDeviceContext @ 0x7fc72c936fc0] Format 0x32595559 -> yuyv422.
[AVHWDeviceContext @ 0x7fc72c936fc0] Format 0x59565955 -> uyvy422.
[AVHWDeviceContext @ 0x7fc72c936fc0] Format 0x48323234 -> yuv422p.
[AVHWDeviceContext @ 0x7fc72c936fc0] Format 0x58424752 -> rgb0.
[AVHWDeviceContext @ 0x7fc72c936fc0] Format 0x58524742 -> bgr0.
[AVHWDeviceContext @ 0x7fc72c936fc0] Format 0x30313050 -> p010le.
[AVHWDeviceContext @ 0x7fc72c936fc0] VAAPI driver: Intel i965 driver for Intel(R) Skylake - 2.3.0.
[AVHWDeviceContext @ 0x7fc72c936fc0] Driver not found in known nonstandard list, using standard behaviour.
[h264 @ 0x7fc72cf15000] nal_unit_type: 7(SPS), nal_ref_idc: 3
[h264 @ 0x7fc72cf15000] nal_unit_type: 8(PPS), nal_ref_idc: 3
[Child 89: MediaPDecoder #1]: D/PlatformDecoderModule VA-API FFmpeg init successful
[h264 @ 0x7fc72cf15000] nal_unit_type: 6(SEI), nal_ref_idc: 0
[h264 @ 0x7fc72cf15000] nal_unit_type: 5(IDR), nal_ref_idc: 3
[Child 89: MediaPDecoder #2]: D/PlatformDecoderModule Choosing FFmpeg pixel format for VA-API video decoding.
[Child 89: MediaPDecoder #2]: D/PlatformDecoderModule Requesting pixel format VAAPI_VLD
[h264 @ 0x7fc72cf15000] Format vaapi_vld chosen by get_format().
[h264 @ 0x7fc72cf15000] Format vaapi_vld requires hwaccel initialisation.
[h264 @ 0x7fc72cf15000] Considering format 0x3231564e -> nv12.
[h264 @ 0x7fc72cf15000] Picked nv12 (0x3231564e) as best match for yuv420p.

This is mine on silverblue

Child 113: MediaPDecoder #1]: D/PlatformDecoderModule Initialising VA-API FFmpeg decoder
[Child 113: MediaPDecoder #1]: D/PlatformDecoderModule Decoder does not support VAAPI device type <------
[Child 113: MediaPDecoder #1]: D/PlatformDecoderModule Couldn't find ffmpeg VA-API decoder <----
[Child 113: MediaPDecoder #1]: D/PlatformDecoderModule Initialising FFmpeg decoder.
[OpenH264] this = 0x0x7fbd68403000, Info:CWelsDecoder::SetOption():DECODER_OPTION_TRACE_CALLBACK callback = 0x7fbd67247360.
[libopenh264 @ 0x7fbd6933f800] [OpenH264] this = 0x0x7fbd68403000, Info:CWelsDecoder::init_decoder(), openh264 codec version = d13f170, ParseOnly = 0
[libopenh264 @ 0x7fbd6933f800] [OpenH264] this = 0x0x7fbd68403000, Info:CWelsDecoder::init_decoder(), openh264 codec version = d13f170, ParseOnly = 0
[libopenh264 @ 0x7fbd6933f800] [OpenH264] this = 0x0x7fbd68403000, Info:eVideoType: 1
[Child 113: MediaPDecoder #1]: D/PlatformDecoderModule FFmpeg init successful.
[libopenh264 @ 0x7fbd6933f800] [OpenH264] this = 0x0x7fbd68403000, Info:WelsRequestMem(): memory alloc size = 640 * 368, ref list size = 6
[libopenh264 @ 0x7fbd6933f800] [OpenH264] this = 0x0x7fbd68403000, Info:SyncPictureResolutionExt(), overall memory usage: 8722206 bytes
[libopenh264 @ 0x7fbd6933f800] [OpenH264] this = 0x0x7fbd68403000, Info:DecodeFrameConstruction(): will output first frame of new sequence, 640 x 368, crop_left:0, crop_right:0, crop_top:0, crop_bottom:4, ignored error packet:0.
[libopenh264 @ 0x7fbd6933f800] No frame produced
[Child 113: MediaPDecoder #2]: D/PlatformDecoderModule DMABUF/VA-API Got one frame output with pts=133466dts=-9223372036854775808 duration=33367 opaque=-9223372036854775808    
[Child 113: MediaPDecoder #2]: D/PlatformDecoderModule Created new DMABufSurface UID = 1

I double checked ffmpeg-full 20.08 runtime is installed. I have AMD so I tested celluloid 's vaapi and it's working
Meanwhile on my arch linux box, Firefox's(flatpak) vaapi acceleration is working. This is really confusing. I wonder why firefox is unable to find the ffmpeg on my silverblue box whereas it can find it on arch linux box, both of which is running as flatpak(from flathub)!

Actually, the Firefox flatpak actually uses the 19.08 runtime (you can check this by using flatpak info org.mozilla.firefox), thus you'll want to get ffmpeg-full 19.08 for Firefox to make use of it.

@putr4.s I see, works now! Thank you so much!

We're likely going to bump that at some point in Q4/Q1 see bug 1677959.

See Also: → 1677959

I installed org.freedesktop.Platform.VAAPI.Intel and org.freedesktop.Platform.ffmpeg-full (both 19.08) and it doesn't work for VP9 videos but seems to work for h264 (intel_gpu_top shows activity in Video)
(logs on playing a 4k video here https://del.dog/actually-flatpak - see line 81).

@Akarshan Biswas did you get it to work on VP9 videos like https://www.youtube.com/watch?v=LXb3EKWsInQ ?

I'm using firefox on sway (wayland) MOZ_ENABLE_WAYLAND=1 and it works on the non-flatpak version

See Also: → 1722221

As of FF 94 we're now using the 21.08 runtime. Just gave it a quick go and it seems to work well, thus closing this bug. If you still see issues, please open a new bug with a fresh description.

Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.