Firefox VAAPI Decoding on Leap 15.4

I can’t get hardware video decoding (H.264 or VP9) to work in Firefox on Leap 15.4 KDE. This is a fresh Leap install less than a month only (not upgraded from previous versions). This is a i7-1260P in a laptop, no other GPUs are present.

I have installed and vendor-switched to Packman to the best that I know (but maybe I did something wrong?).

I can see HW decoding working properly in apps like VLC when I run intel_gpu_top, but Firefox cranks up the CPU usage and does not make use of the hardware video decoding.

I did see this thread: firefox having problems with codecs - #23 by oliviercalle. Is purely because libavcodec59 is missing and there is no workaround? Or does that only apply to systems that have upgraded from Leap to TW?

Kernel (I am using the backported kernel):

# uname -a
Linux localhost.localdomain 6.1.12-lp154.2.g373f017-default #1 SMP PREEMPT_DYNAMIC Wed Feb 15 05:31:41 UTC 2023 (373f017) x86_64 x86_64 x86_64 GNU/Linux

Packages:

# zypper se -si gstreamer-plugins ffmpeg ffmpeg-4 ffmpeg-5 libva vaapi firefox libav intel-media libavcodec
Loading repository data...
Reading installed packages...

S  | Name                             | Type    | Version                              | Arch   | Repository
---+----------------------------------+---------+--------------------------------------+--------+-------------------------------------------------------------
i+ | ffmpeg-4                         | package | 4.4-pm154.3.14.2                     | x86_64 | packman
i  | ffmpegthumbs                     | package | 21.12.3-bp154.1.35                   | x86_64 | openSUSE-Leap-15.4-1
i  | ffmpegthumbs                     | package | 21.12.3-bp154.1.35                   | x86_64 | Main Repository
i+ | gstreamer-plugins-bad            | package | 1.20.1-lp154.1.1                     | x86_64 | openSUSE-Leap-15.4-1
i+ | gstreamer-plugins-bad            | package | 1.20.1-lp154.1.1                     | x86_64 | Main Repository
i  | gstreamer-plugins-bad-lang       | package | 1.20.1-lp154.1.1                     | noarch | openSUSE-Leap-15.4-1
i  | gstreamer-plugins-bad-lang       | package | 1.20.1-lp154.1.1                     | noarch | Main Repository
i  | gstreamer-plugins-base           | package | 1.20.1-150400.1.9                    | x86_64 | openSUSE-Leap-15.4-1
i  | gstreamer-plugins-base           | package | 1.20.1-150400.1.9                    | x86_64 | Main Repository
i  | gstreamer-plugins-base-lang      | package | 1.20.1-150400.1.9                    | noarch | openSUSE-Leap-15.4-1
i  | gstreamer-plugins-base-lang      | package | 1.20.1-150400.1.9                    | noarch | Main Repository
i  | gstreamer-plugins-good           | package | 1.20.1-150400.3.3.1                  | x86_64 | Update repository with updates from SUSE Linux Enterprise 15
i  | gstreamer-plugins-good-gtk       | package | 1.20.1-150400.3.3.1                  | x86_64 | Update repository with updates from SUSE Linux Enterprise 15
i  | gstreamer-plugins-good-lang      | package | 1.20.1-150400.3.3.1                  | noarch | Update repository with updates from SUSE Linux Enterprise 15
i+ | gstreamer-plugins-libav          | package | 1.20.1-bp154.1.48                    | x86_64 | openSUSE-Leap-15.4-1
i+ | gstreamer-plugins-libav          | package | 1.20.1-bp154.1.48                    | x86_64 | Main Repository
i+ | gstreamer-plugins-ugly           | package | 1.20.1-150400.1.7                    | x86_64 | openSUSE-Leap-15.4-1
i+ | gstreamer-plugins-ugly           | package | 1.20.1-150400.1.7                    | x86_64 | Main Repository
i+ | gstreamer-plugins-ugly-codecs    | package | 1.20.1-pm154.1.5                     | x86_64 | packman
i  | gstreamer-plugins-ugly-lang      | package | 1.20.1-150400.1.7                    | noarch | openSUSE-Leap-15.4-1
i  | gstreamer-plugins-ugly-lang      | package | 1.20.1-150400.1.7                    | noarch | Main Repository
i+ | gstreamer-plugins-vaapi          | package | 1.20.1-bp154.1.51                    | x86_64 | openSUSE-Leap-15.4-1
i+ | gstreamer-plugins-vaapi          | package | 1.20.1-bp154.1.51                    | x86_64 | Main Repository
i  | intel-media-driver               | package | 21.3.4-150400.2.7                    | x86_64 | openSUSE-Leap-15.4-1
i  | intel-media-driver               | package | 21.3.4-150400.2.7                    | x86_64 | Main Repository
i  | intel-vaapi-driver               | package | 2.4.1-150400.6.9                     | x86_64 | openSUSE-Leap-15.4-1
i  | intel-vaapi-driver               | package | 2.4.1-150400.6.9                     | x86_64 | Main Repository
i  | libavahi-client3                 | package | 0.8-150400.5.73                      | x86_64 | openSUSE-Leap-15.4-1
i  | libavahi-client3                 | package | 0.8-150400.5.73                      | x86_64 | Main Repository
i  | libavahi-common3                 | package | 0.8-150400.5.73                      | x86_64 | openSUSE-Leap-15.4-1
i  | libavahi-common3                 | package | 0.8-150400.5.73                      | x86_64 | Main Repository
i  | libavahi-core7                   | package | 0.8-150400.5.73                      | x86_64 | openSUSE-Leap-15.4-1
i  | libavahi-core7                   | package | 0.8-150400.5.73                      | x86_64 | Main Repository
i  | libavahi-glib1                   | package | 0.8-150400.5.9                       | x86_64 | openSUSE-Leap-15.4-1
i  | libavahi-glib1                   | package | 0.8-150400.5.9                       | x86_64 | Main Repository
i  | libavc1394-0                     | package | 0.5.4-1.27                           | x86_64 | openSUSE-Leap-15.4-1
i  | libavc1394-0                     | package | 0.5.4-1.27                           | x86_64 | Main Repository
i  | libavcodec57                     | package | 3.4.9-pm154.1.13                     | x86_64 | packman
i  | libavcodec58_134                 | package | 4.4-pm154.3.14.2                     | x86_64 | packman
i+ | libavdevice57                    | package | 3.4.9-pm154.1.13                     | x86_64 | packman
i  | libavdevice58_13                 | package | 4.4-pm154.3.14.2                     | x86_64 | packman
i  | libavfilter6                     | package | 3.4.9-pm154.1.13                     | x86_64 | packman
i  | libavfilter7_110                 | package | 4.4-pm154.3.14.2                     | x86_64 | packman
i  | libavformat57                    | package | 3.4.9-pm154.1.13                     | x86_64 | packman
i  | libavformat58_76                 | package | 4.4-pm154.3.14.2                     | x86_64 | packman
i  | libavif13                        | package | 0.9.3-150400.1.9                     | x86_64 | openSUSE-Leap-15.4-1
i  | libavif13                        | package | 0.9.3-150400.1.9                     | x86_64 | Main Repository
i  | libavresample3                   | package | 3.4.9-pm154.1.13                     | x86_64 | packman
i  | libavresample4_0                 | package | 4.4-pm154.3.14.2                     | x86_64 | packman
i  | libavtp0                         | package | 0.1.0+git20200527.9482c11-150400.1.5 | x86_64 | openSUSE-Leap-15.4-1
i  | libavtp0                         | package | 0.1.0+git20200527.9482c11-150400.1.5 | x86_64 | Main Repository
i  | libavutil55                      | package | 3.4.9-pm154.1.13                     | x86_64 | packman
i  | libavutil56_70                   | package | 4.4-pm154.3.14.2                     | x86_64 | packman
i  | libva-drm2                       | package | 2.13.0-150400.1.6                    | x86_64 | openSUSE-Leap-15.4-1
i  | libva-drm2                       | package | 2.13.0-150400.1.6                    | x86_64 | Main Repository
i  | libva-glx2                       | package | 2.13.0-150400.1.10                   | x86_64 | openSUSE-Leap-15.4-1
i  | libva-glx2                       | package | 2.13.0-150400.1.10                   | x86_64 | Main Repository
i+ | libva-utils                      | package | 2.13.0-bp154.1.31                    | x86_64 | openSUSE-Leap-15.4-1
i+ | libva-utils                      | package | 2.13.0-bp154.1.31                    | x86_64 | Main Repository
i+ | libva-vdpau-driver               | package | 0.7.4-bp154.2.25                     | x86_64 | openSUSE-Leap-15.4-1
i+ | libva-vdpau-driver               | package | 0.7.4-bp154.2.25                     | x86_64 | Main Repository
i  | libva-wayland2                   | package | 2.13.0-150400.1.10                   | x86_64 | openSUSE-Leap-15.4-1
i  | libva-wayland2                   | package | 2.13.0-150400.1.10                   | x86_64 | Main Repository
i  | libva-x11-2                      | package | 2.13.0-150400.1.6                    | x86_64 | openSUSE-Leap-15.4-1
i  | libva-x11-2                      | package | 2.13.0-150400.1.6                    | x86_64 | Main Repository
i  | libva2                           | package | 2.13.0-150400.1.6                    | x86_64 | openSUSE-Leap-15.4-1
i  | libva2                           | package | 2.13.0-150400.1.6                    | x86_64 | Main Repository
i  | Mesa-libva                       | package | 21.2.4-150400.68.9.1                 | x86_64 | Update repository with updates from SUSE Linux Enterprise 15
i  | MozillaFirefox                   | package | 102.7.0-150200.152.73.1              | x86_64 | Update repository with updates from SUSE Linux Enterprise 15
i  | MozillaFirefox-branding-openSUSE | package | 68-lp154.5.1                         | x86_64 | openSUSE-Leap-15.4-1
i  | MozillaFirefox-branding-openSUSE | package | 68-lp154.5.1                         | x86_64 | Main Repository

Repos:

# zypper lr --uri
Repository priorities are without effect. All enabled repositories share the same priority.

#  | Alias                                | Name            | Enabled | GPG Check | Refresh | URI
---+--------------------------------------+-----------------+---------+-----------+---------+-----------------------------------------------------------------------------------
 1 | devel:languages:ruby:extensions      | devel:languag-> | Yes     | ( p) Yes  | Yes     | https://download.opensuse.org/repositories/devel:/languages:/ruby:/extensions/15.4
 2 | dvd                                  | dvd             | Yes     | (r ) Yes  | Yes     | http://opensuse-guide.org/repo/openSUSE_Leap_15.4/
 3 | openSUSE-Leap-15.4-1                 | openSUSE-Leap-> | Yes     | (r ) Yes  | Yes     | http://download.opensuse.org/distribution/leap/15.4/repo/oss/
 4 | packman                              | packman         | Yes     | (r ) Yes  | Yes     | http://ftp.gwdg.de/pub/linux/misc/packman/suse/openSUSE_Leap_15.4/
 5 | repo-backports-debug-update          | Update reposi-> | No      | ----      | ----    | http://download.opensuse.org/update/leap/15.4/backports_debug/
 6 | repo-backports-update                | Update reposi-> | Yes     | (r ) Yes  | Yes     | http://download.opensuse.org/update/leap/15.4/backports/
 7 | repo-debug                           | Debug Reposit-> | No      | ----      | ----    | http://download.opensuse.org/debug/distribution/leap/15.4/repo/oss/
 8 | repo-debug-non-oss                   | Debug Reposit-> | No      | ----      | ----    | http://download.opensuse.org/debug/distribution/leap/15.4/repo/non-oss/
 9 | repo-debug-update                    | Update Reposi-> | No      | ----      | ----    | http://download.opensuse.org/debug/update/leap/15.4/oss/
10 | repo-debug-update-non-oss            | Update Reposi-> | No      | ----      | ----    | http://download.opensuse.org/debug/update/leap/15.4/non-oss/
11 | repo-kernel-stable-backport-standard | repo-kernel-s-> | Yes     | (r ) Yes  | Yes     | https://download.opensuse.org/repositories/Kernel:/stable:/Backport/standard/
12 | repo-non-oss                         | Non-OSS Repos-> | Yes     | (r ) Yes  | Yes     | http://download.opensuse.org/distribution/leap/15.4/repo/non-oss/
13 | repo-oss                             | Main Repository | Yes     | (r ) Yes  | Yes     | http://download.opensuse.org/distribution/leap/15.4/repo/oss/
14 | repo-sle-debug-update                | Update reposi-> | No      | ----      | ----    | http://download.opensuse.org/debug/update/leap/15.4/sle/
15 | repo-sle-update                      | Update reposi-> | Yes     | (r ) Yes  | Yes     | http://download.opensuse.org/update/leap/15.4/sle/
16 | repo-source                          | Source Reposi-> | No      | ----      | ----    | http://download.opensuse.org/source/distribution/leap/15.4/repo/oss/
17 | repo-update                          | Main Update R-> | Yes     | (r ) Yes  | Yes     | http://download.opensuse.org/update/leap/15.4/oss
18 | repo-update-non-oss                  | Update Reposi-> | Yes     | (r ) Yes  | Yes     | http://download.opensuse.org/update/leap/15.4/non-oss/

Searching for libavcodec:

# zypper se libavcodec
Loading repository data...
Reading installed packages...

S | Name                       | Summary                                        | Type
--+----------------------------+------------------------------------------------+--------
  | ffmpeg-3-libavcodec-devel  | Development files for FFmpeg's codec library   | package
  | ffmpeg-4-libavcodec-devel  | Development files for FFmpeg's codec library   | package
  | libavcodec-devel           | Development files for FFmpeg's codec library   | package
i | libavcodec57               | FFmpeg codec library                           | package
  | libavcodec57-32bit         | FFmpeg codec library                           | package
  | libavcodec57-debuginfo     | Debug information for package libavcodec57     | package
i | libavcodec58_134           | FFmpeg codec library                           | package
  | libavcodec58_134-32bit     | FFmpeg codec library                           | package
  | libavcodec58_134-debuginfo | Debug information for package libavcodec58_134 | package

vainfo:

libva info: VA-API version 1.13.0
libva info: User environment variable requested driver 'iHD'
libva info: Trying to open /usr/lib64/dri/iHD_drv_video.so
libva info: Found init function __vaDriverInit_1_13
libva info: va_openDriver() returns 0
vainfo: VA-API version: 1.13 (libva 2.13.0)
vainfo: Driver version: Intel iHD driver for Intel(R) Gen Graphics - 21.3.4 ()
vainfo: Supported profile and entrypoints
      VAProfileNone                   : VAEntrypointVideoProc
      VAProfileNone                   : VAEntrypointStats
      VAProfileMPEG2Simple            : VAEntrypointVLD
      VAProfileMPEG2Simple            : VAEntrypointEncSlice
      VAProfileMPEG2Main              : VAEntrypointVLD
      VAProfileMPEG2Main              : VAEntrypointEncSlice
      VAProfileH264Main               : VAEntrypointVLD
      VAProfileH264Main               : VAEntrypointEncSlice
      VAProfileH264Main               : VAEntrypointFEI
      VAProfileH264Main               : VAEntrypointEncSliceLP
      VAProfileH264High               : VAEntrypointVLD
      VAProfileH264High               : VAEntrypointEncSlice
      VAProfileH264High               : VAEntrypointFEI
      VAProfileH264High               : VAEntrypointEncSliceLP
      VAProfileVC1Simple              : VAEntrypointVLD
      VAProfileVC1Main                : VAEntrypointVLD
      VAProfileVC1Advanced            : VAEntrypointVLD
      VAProfileJPEGBaseline           : VAEntrypointVLD
      VAProfileJPEGBaseline           : VAEntrypointEncPicture
      VAProfileH264ConstrainedBaseline: VAEntrypointVLD
      VAProfileH264ConstrainedBaseline: VAEntrypointEncSlice
      VAProfileH264ConstrainedBaseline: VAEntrypointFEI
      VAProfileH264ConstrainedBaseline: VAEntrypointEncSliceLP
      VAProfileVP8Version0_3          : VAEntrypointVLD
      VAProfileHEVCMain               : VAEntrypointVLD
      VAProfileHEVCMain               : VAEntrypointEncSlice
      VAProfileHEVCMain               : VAEntrypointFEI
      VAProfileHEVCMain               : VAEntrypointEncSliceLP
      VAProfileHEVCMain10             : VAEntrypointVLD
      VAProfileHEVCMain10             : VAEntrypointEncSlice
      VAProfileHEVCMain10             : VAEntrypointEncSliceLP
      VAProfileVP9Profile0            : VAEntrypointVLD
      VAProfileVP9Profile0            : VAEntrypointEncSliceLP
      VAProfileVP9Profile1            : VAEntrypointVLD
      VAProfileVP9Profile1            : VAEntrypointEncSliceLP
      VAProfileVP9Profile2            : VAEntrypointVLD
      VAProfileVP9Profile2            : VAEntrypointEncSliceLP
      VAProfileVP9Profile3            : VAEntrypointVLD
      VAProfileVP9Profile3            : VAEntrypointEncSliceLP
      VAProfileHEVCMain12             : VAEntrypointVLD
      VAProfileHEVCMain12             : VAEntrypointEncSlice
      VAProfileHEVCMain422_10         : VAEntrypointVLD
      VAProfileHEVCMain422_10         : VAEntrypointEncSlice
      VAProfileHEVCMain422_12         : VAEntrypointVLD
      VAProfileHEVCMain422_12         : VAEntrypointEncSlice
      VAProfileHEVCMain444            : VAEntrypointVLD
      VAProfileHEVCMain444            : VAEntrypointEncSliceLP
      VAProfileHEVCMain444_10         : VAEntrypointVLD
      VAProfileHEVCMain444_10         : VAEntrypointEncSliceLP
      VAProfileHEVCMain444_12         : VAEntrypointVLD
      VAProfileHEVCSccMain            : VAEntrypointVLD
      VAProfileHEVCSccMain            : VAEntrypointEncSliceLP
      VAProfileHEVCSccMain10          : VAEntrypointVLD
      VAProfileHEVCSccMain10          : VAEntrypointEncSliceLP
      VAProfileHEVCSccMain444         : VAEntrypointVLD
      VAProfileHEVCSccMain444         : VAEntrypointEncSliceLP
      VAProfileAV1Profile0            : VAEntrypointVLD
      VAProfileHEVCSccMain444_10      : VAEntrypointVLD
      VAProfileHEVCSccMain444_10      : VAEntrypointEncSliceLP

I have tried combinations of the following settings in Firefox:

gfx.webrender.all: true
media.ffmpeg.vaapi.enabled : true
media.ffvpx.enabled : false
media.rdd-vpx.enabled: false
media.navigator.mediadatadecoder_vpx_enabled : true

I have tried launching Firefox with MOZ_DISABLE_RDD_SANDBOX=1 (but the issue that required this appears to have been fixed) and MOZ_X11_EGL=1 (I am in X11).

When running Firefox I see:

ATTENTION: default value of option mesa_glthread overridden by environment.
libva info: VA-API version 1.13.0
libva info: User environment variable requested driver 'iHD'
libva info: Trying to open /usr/lib64/dri/iHD_drv_video.so
libva info: Found init function __vaDriverInit_1_13
libva info: va_openDriver() returns 0


I’m really stumped. Any help is greatly appreciated!

Correct –

  • libavcodec59 is currently only available in the Packman repositories for Tumbleweed.
    Whether or not, it’ll be made available in the Leap 15.4 Packman repository at some time in the future – I don’t know.

It is available in the Multimedia openSUSE Leap 15.4 repository but, for licensing reasons, that version doesn’t have all the codecs included it.
Therefore, we’re left with a “not currently available in the Packman repository” situation …

Thanks for your response! That’s quite…frustrating.

Just to confirm my understanding:

  • Firefox v102 can use multiple versions of libavcodec for decoding, including libavcodec58 and libavcodec59
  • Firefox v102 requires libavcodec59 for hardware accelerated decoding (which is really confusing because it opens VAAPI but then chooses not to use it)
  • Since Firefox v102 doesn’t explicitly require libavcodec59, it is not in the main repo (even without patented codecs) and it is not an explicit/required dependency of the MozillaFirefox package
  • The Packman maintainers don’t seem to have responded about why libavcodec59 was removed from the 15.4 repo (even though it was once there, which is strange): [packman] [PM] ffmpeg-5 missing on openSUSE Leap 15.4
  • I can’t wait for the H.264 patents to expire in full and for widespread adoption of AV1

Temporary workaround: Flatpak

# flatpak install flathub org.mozilla.firefox org.freedesktop.Platform.ffmpeg-full

I specifically went with runtime/org.freedesktop.Platform.ffmpeg-full/x86_64/22.08.

In Firefox go to about:config and set media.hardware-video-decoding.force-enabled to true. It just works. This was from a fresh FF profile, so that’s all you have to do! Confirmed working by lower CPU usage and intel_gpu_top.

This did break the Plasma integration addon, probably because it needs access to some directory or dbus outside the Flatpak sandbox, but I’m sure it could be fixed with Flatseal.

I do already install most GUI apps through Flatpak already, excluding things that come with openSUSE/Plasma by default, so this isn’t a major inconvenience to me. However, it is unfortunate that this is currently broken natively.