Page 1 of 1

H264 hardware decoding unavailable on Linux

Posted: 2019-01-05, 11:43
by ladnalo
I tried to force it by setting media.hardware-video-decoding.force-enabled to true in about:config. Unfortunately about:support still says No for Hardware H264 Decoding and I can see no video decoding activity either in intel_gpu_top.

I also tried to start Pale Moon with environment variable MOZ_USE_OMTC=1 which was completely ineffective.

My GPU info on about:support as follows.

Code: Select all

Active	Yes
Description	Intel Open Source Technology Center -- Mesa DRI Intel(R) Haswell Mobile 
Vendor ID	Intel Open Source Technology Center
Device ID	Mesa DRI Intel(R) Haswell Mobile 
Driver Version	3.0 Mesa 10.3.2
My OS info on about:support as follows.

Code: Select all

 Name 	Pale Moon
Version 	28.2.1 (64-bit)
Build ID 	20181118201445
User Agent 	Mozilla/5.0 (X11; Linux x86_64; rv:60.9) Gecko/20100101 Goanna/4.1 Firefox/60.9 PaleMoon/28.2.1
OS 	Linux 3.16.0-4-amd64
The output of vainfo as follows.

Code: Select all

libva info: VA-API version 0.36.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: Found init function __vaDriverInit_0_36
libva info: va_openDriver() returns 0
vainfo: VA-API version: 0.36 (libva 1.4.1)
vainfo: Driver version: Intel i965 driver for Intel(R) Haswell Mobile - 1.4.1
vainfo: Supported profile and entrypoints
      VAProfileMPEG2Simple            :	VAEntrypointVLD
      VAProfileMPEG2Simple            :	VAEntrypointEncSlice
      VAProfileMPEG2Main              :	VAEntrypointVLD
      VAProfileMPEG2Main              :	VAEntrypointEncSlice
      VAProfileH264ConstrainedBaseline:	VAEntrypointVLD
      VAProfileH264ConstrainedBaseline:	VAEntrypointEncSlice
      VAProfileH264Main               :	VAEntrypointVLD
      VAProfileH264Main               :	VAEntrypointEncSlice
      VAProfileH264High               :	VAEntrypointVLD
      VAProfileH264High               :	VAEntrypointEncSlice
      VAProfileH264MultiviewHigh      :	VAEntrypointVLD
      VAProfileH264MultiviewHigh      :	VAEntrypointEncSlice
      VAProfileH264StereoHigh         :	VAEntrypointVLD
      VAProfileH264StereoHigh         :	VAEntrypointEncSlice
      VAProfileVC1Simple              :	VAEntrypointVLD
      VAProfileVC1Main                :	VAEntrypointVLD
      VAProfileVC1Advanced            :	VAEntrypointVLD
      VAProfileNone                   :	VAEntrypointVideoProc
      VAProfileJPEGBaseline           :	VAEntrypointVLD
      VAProfileH264MultiviewHigh      :	VAEntrypointVLD
      VAProfileH264MultiviewHigh      :	VAEntrypointEncSlice
      VAProfileH264StereoHigh         :	VAEntrypointVLD
      VAProfileH264StereoHigh         :	VAEntrypointEncSlice
Upgrading to Stretch or any newer Debian is not an option for me right now. As media players based on ffmpeg can use hardware acceleration, there must be a way for Pale Moon as well.
  • Packages libgstreamer-vaapi1.0-0 gstreamer1.0-vaapi i965-va-driver are installed.
  • VLC Media Player works fine and plays 4K videos at 60 FPS that would be an impossible task for the CPU. It also generates a lot of HW video decoding activity that can be seen in intel_gpu_top.
Any help is appreciated.

Re: H264 hardware decoding unavailable on Linux

Posted: 2019-01-05, 14:15
by Moonchild
Pale Moon has not used gstreamer for quite a while now. ffmpeg is in use in the browser.
If your GPU decoding depends on gstreamer, then it will not work.

Re: H264 hardware decoding unavailable on Linux

Posted: 2019-01-05, 14:41
by ladnalo
I'm sure the Intel VA driver doesn't depend on gstreamer. I just installed those packages because I researched older threads which suggested to do so. I have removed packages libgstreamer-vaapi1.0-0 and gstreamer1.0-vaapi. VLC still works with proper VAAPI hardware acceleration, playing 4K videos smoothly. Pale Moon won't. :|

Re: H264 hardware decoding unavailable on Linux

Posted: 2019-01-05, 16:19
by vannilla
Does Pale Moon even use VAAPI to begin with?
ffmpeg and VAAPI are two different things, aren't they?

Re: H264 hardware decoding unavailable on Linux

Posted: 2019-01-05, 16:30
by yami_
Pale Moon does not use VA API, because it does not decode the video. FFmpeg does use VA API, because the FFmpeg decodes the video. VA API is a video decoding/encoding API provided by Intel. FFmpeg is the video decoding library used by Pale Moon. If FFmpeg was not build with VA API support it will not attempt to use it to decode the video.

Re: H264 hardware decoding unavailable on Linux

Posted: 2019-01-05, 17:50
by ladnalo
Pale Moon loads and starts using libavcodec when you open a H264 video on YouTube.

Code: Select all

palemoon   1132                ladnalo  mem       REG                8,3   170208    1977746 /usr/lib/x86_64-linux-gnu/libwavpack.so.1.1.5
palemoon   1132                ladnalo  mem       REG                8,3   452504    1968060 /usr/lib/x86_64-linux-gnu/libavutil.so.55.34.101
palemoon   1132                ladnalo  mem       REG                8,3 12855640    1968071 /usr/lib/x86_64-linux-gnu/libavcodec.so.57.64.101
The package ffmpeg doesn't even need to be installed. Pale Moon only uses the libavcodec part from it. Debian Jessie has no ffmpeg package by default but it can be installed from jessie-backports. So I installed it and upgraded all libavcodec packages as well. Didn't help. I even built and installed my own DEB packages of that jessie-backports ffmpeg using debuild and for which I specified --enable-vaapi among the flags for configure in debian/rules. It generated also some libavcodec packages like libavcodec55 libavcodec56. Removed all previous libavcodec packages from my system then installed Pale Moon dependencies from among my own freshly built packages. No succcess.

When building my own ffmpeg the configuration displayed by configure looked like this.

Code: Select all

Enabled hwaccels:
h263_vaapi		mpeg2_vaapi		vc1_vaapi
h264_vaapi		mpeg2_vdpau		vc1_vdpau
h264_vdpau		mpeg2_xvmc		wmv3_vaapi
mpeg1_vdpau		mpeg4_vaapi		wmv3_vdpau
mpeg1_xvmc		mpeg4_vdpau
FFmpeg also recognizes vaapi acceleration but I'm not sure this has anything to do with decoding (VAAPI can also encode H264).

Code: Select all

Hardware acceleration methods:
vdpau
vaapi
... and Pale Moon still says No for Hardware H264 Decoding. I have wasted 3 hours on trying to solve this. I'm completely out of ideas. Why isn't there some troubleshooting toolkit, debug logging or any command line tool bundled with Pale Moon to help solve issues like this? Even a hint would be helpful why Pale Moon thinks there is no H264 hardware acceleration available. It would also be good to know how it comes to this conclusion because libavcodec is not loaded at startup. It is only loaded when you start playing a H264 video. VLC also loads libavcodec.so and libavutil.so for decoding and it works fine with VAAPI acceleration.

Re: H264 hardware decoding unavailable on Linux

Posted: 2019-01-05, 21:15
by yami_
Well if Pale Moon still claims that it can not hardware decode AVC even if installed version of FFmpeg supports it then I am also out of ideas. Maybe trava90 could help?

Re: H264 hardware decoding unavailable on Linux

Posted: 2019-01-05, 21:24
by vannilla
I'm fairly confident Pale Moon uses an in-tree version of libavcodec, not the one installed externally, so installing libavcodec with va-api enabled likely means nothing.
You can compile Pale Moon to use system libraries, but that might create other problems.

Re: H264 hardware decoding unavailable on Linux

Posted: 2019-01-05, 21:38
by yami_
Hmm... I was always thinking that Pale Moon will use AVC decoder provided by the OS...

Re: H264 hardware decoding unavailable on Linux

Posted: 2019-01-07, 13:17
by Lucio Chiappetti
As I learned from thread viewtopic.php?f=37&t=21170, I guess it depends from the flavour of Linux (distro).
On opensuse neither palemoon nor firefox can view H264 although opensuse-bundled libavcodec are installed (I guess with H264 support replaced by a no-op stub).
On xubuntu a colleague was able to view H264 with vivaldi and firefox, but he was pretty sure to have chosen installation of extra components during OS installation (in fact the vivaldi installation page says something about it).

Since I needed H264 only for a work safety course, I installed chrome on opensuse (it is built with static support) just for that. A colleague instead tried the way described in https://en.opensuse.org/SDB:Firefox_MP4 ... eo_Support, i.e. replaced the suse-bundled libavcodec with the one from an external source: this way any dynamically-loaded browser should support H264

Re: H264 hardware decoding unavailable on Linux

Posted: 2019-01-07, 22:04
by stevenpusser
The OP was not about whether it will play the codec at all, but if Pale Moon supports hardware decoding for it.

I was under the impression that Firefox and thus Pale Moon won't support that at all in Linux. Does anyone have it working in Firefox, so that you can watch a 4K Youtube video without your CPU usage going up by more than a few %?

Re: H264 hardware decoding unavailable on Linux

Posted: 2019-01-07, 22:13
by Walter Dnes
It may be a bit more complex to add vaapi support. On my Gentoo system, I did a "--pretend" emerge with vaapi forced on. The proposed changes would involve...
  • rebuilding media-libs/mesa with vaapi support
  • rebuilding media-video/ffmpeg with vaapi support
  • building new lib x11-libs/libva
  • building new lib x11-libs/libva-intel-driver

Re: H264 hardware decoding unavailable on Linux

Posted: 2019-01-15, 21:26
by stevenpusser
Walter Dnes wrote:It may be a bit more complex to add vaapi support. On my Gentoo system, I did a "--pretend" emerge with vaapi forced on. The proposed changes would involve...
  • rebuilding media-libs/mesa with vaapi support
  • rebuilding media-video/ffmpeg with vaapi support
  • building new lib x11-libs/libva
  • building new lib x11-libs/libva-intel-driver
I ended up doing that and more for updated Mesa, ffmpeg, and players in the recently released MX 18. That was necessary because the updated Mesa we added for newer hardware support--so now 3.0.6 supports va-api hardware acceleration. The Debian packages from upstream already have va-api configured, I just had to make sure they were building against our newer packages. (I build the packages using schroot systems that I can add and remove MX repositories to just base Debian, so I have a lot of options. Mostly I build against just base Debian, but that breaks the va-api acceleration)