Yes i can finally play VP9, VP8 hardware accelerated on Librem 5.
Big thanks to Purism team Programmers.
Do I need to install anything in order to get the best HW video acceleration support?
I reflashed today and got regression from my previous performance.
Btw. I am willing to install non-free drivers if this gets me better video performance on the Librem 5.
Might be that the Build #12162 wasn’t the best choice (if so and because of some to us unfamiliar reason) to be put on your Librem 5? Therefore and in order to reflash it again (to get back on track, getting back environment you are familiar with), I would wait (few hours?) until some newer image available. Optionally (in another reliable current build file transfer terms), this semiautomated reflash method might be chosen as well:
I selected from the Preferences in Clapper -> GStreamer -> Plugin Ranking -> vpx -> activated vp8dec and vp9dec.
This was pure guessing, but helped.
As I am still not sure what is the root, maybe someone has an idea on how is HW acceleration activated and how one can test that it is indeed used.
It not need change anything in Clapper, Clapper autodetect when a video format is HW acceleration supported on Librem 5.
To check if a video is being HW acceleration played on Librem 5 the decode box is showing:
v4l2slvp8dec if it is VP8 video format
v4l2slvp9dec if it is VP9 video format —> some bad artifacts on playing. @dos tell to Martin.
v4l2slh264dec if it is H.264 video format
v4l2slh265dec if it is H.265 video format ----> not yet supported on userland, almost.
Enjoy your Purism GNU+Linux mobile!
Which decode box do you mean?
When the video is playback on Clapper , the are 2 options on right to bottom, 1 is audio and 2 is for video, this 2 options just is telling what libs is using to decode the audio y video.
how did you do that?
i am also trying to playback hw accelerated h264 videos but with no luck.
gstreamer 1.18.4
purism@pureos:~$ gst-launch-1.0 playbin uri=file:/home/purism/Videos/Appleseed\ Alpha\ (2014).mp4
Setting pipeline to PAUSED …
Pipeline is PREROLLING …
gst-launch-1.0: …/src/wayland-client.c:2339: wl_proxy_set_queue: Assertion `proxy->display == queue->display’ failed.
Aborted
looks like bug (not related to hw accel):
i guess it was not backported to 1.18
with ffmpeg it’s a different error:
[h264_v4l2m2m @ 0xaaab115f8900] Could not find a valid device
[h264_v4l2m2m @ 0xaaab115f8900] can’t configure decoder
do you have a command handy that works with gstreamer?
i am also trying to playback hw accelerated h264 videos but with no luck.
I am running PostmarketOS edge these days and I am able to run gst-launch-1.0 playbin uri=...
without issues. Providing the -v
flag shows that it’s using the v4l2slh264dec
plugin. I am using GStreamer 1.22.3.
Perhaps you can try using Clapper on Flatpak instead? It should decode the video using hardware acceleration out of the box. You can see the GStreamer plugin used by pressing the video icon next to the seek bar.
I also get the same ffmpeg error when trying to play media with mpv, which results in an increase in heat and reduced battery life when comparing it with Clapper:
$ mpv --hwdec=auto h264.mp4
(+) Video --vid=1 (*) (h264 1280x720 24.000fps)
(+) Audio --aid=1 (*) (aac 2ch 48000Hz)
[vo/gpu/wayland] GNOME's wayland compositor lacks support for the idle inhibit protocol. This means the screen can blank during playback.
Failed to open VDPAU backend Error loading shared library libvdpau_nvidia.so: No such file or directory
[ffmpeg/video] h264_v4l2m2m: Could not find a valid device
[ffmpeg/video] h264_v4l2m2m: can't configure decoder
Could not open codec.
There is also a thread about H.265 playback which I didn’t manage to resolve yet: Librem 5 support H.265 on NXP i.MX8M
I’ve installed gstreamer1.0-plugins-base-apps and gst-play throws the same error:
purism@pureos:~/bin$ gst-play-1.0 …/Videos/Appleseed\ Alpha\ (2014).mp4
Press ‘k’ to see a list of keyboard shortcuts.
Now playing /home/purism/Videos/Appleseed Alpha (2014).mp4
gst-play-1.0: …/src/wayland-client.c:2339: wl_proxy_set_queue: Assertion `proxy->display == queue->display’ failed.
Aborted
hw decoder seems to be in place:
purism@pureos:~/bin$ gst-inspect-1.0 --plugin | grep -i v4l
video4linux2: v4l2src: Video (video4linux2) Source
video4linux2: v4l2sink: Video (video4linux2) Sink
video4linux2: v4l2radio: Radio (video4linux2) Tuner
video4linux2: v4l2deviceprovider (GstDeviceProviderFactory)
v4l2codecs: v4l2slh264dec: V4L2 Stateless H.264 Video Decoder
v4l2codecs: v4l2slvp8dec: V4L2 Stateless VP8 Video Decoder
reading on Clapper:
it states:
V4L2 stateless decoders are available since GStreamer 1.20 and are used by default on mobile/embedded devices (mainly on Allwinner, Rockchip and i.MX).
i think the gstreamer version (1.18.4) provided by Purism repo is not able to utilize v4l2 hw accel.
i just tried to compile gstreamer latest branch but could not because meson version (0.56.2) from Purism repo is not recent enough.
looks like, i have to compile meson first!
also, ffmpeg does not decodes in hardware:
purism@pureos:~/bin$ ./ffmpeg -c:v h264_v4l2m2m -i …/Videos/Appleseed\ Alpha\ (2014).mp4 out.ts
[h264_v4l2m2m @ 0xaaaaef2ef900] Could not find a valid device
[h264_v4l2m2m @ 0xaaaaef2ef900] can’t configure decoder
[vist#0:0/h264 @ 0xaaaaef0bad00] Error while opening decoder: Invalid argument
Invalid argument
i compiled ffmpeg from latest branch resulting in same error.
with above error i went to #ffmpeg IRC channel and i was told, that:
“v4l2 is currently a mess and it’s the vendors responsibility to provide good patches. one that do not break previous implementations.”
gstreamer and ffmpeg are key to many other Apps/Software.
i’ve tried
- Firefox, mpv, totem, vlc - no hw accel
- Clapper - using gstreamer 1.2 in a container(flatpak) is the only one i’ve found so far!
@dos, when do we get hw accel straight out of Purism repo?
i am foremost interested in ffmpeg as Kodi’s internal VideoPlayer uses it for v4l2 hw accel!
i could install gstreamer 1.22.
what i did:
- compiling mesa 22.3.7 and installing it.
- configuring debian testing repo having gstreamer in a recent version
deb http://ftp.us.debian.org/debian testing main
- installing/upgrading from debian testing repo the packages from below link
https://gstreamer.freedesktop.org/documentation/installing/on-linux.html?gi-language=c#install-gstreamer-on-ubuntu-or-debian
this installs GStreamer 1.22.0
from verbose logging i can see it’s using a v4l2slh264dec sink.
Unfortunately, it has major drawbacks and is not suitable as a replacement.
It breaks other things!
but it proofed that hw accel works with a newer version of gstreamer!
i also installed ffmpeg 5.1.2 from debian testing but it changed nothing.
may somebody from purism (@dos ? @guido.gunther ?) can comment on the hw accel status of ffmpeg?
adamk, this thread is about VP8 and VP9 Hardware acceleration by Librem5 CPU support. Others and you claim about not working hardware acceleration of the not open sourcen, have to licence h264 Support.
I think the cpu manufacturer did not pay that license and use instead the free, faster version of VP8 and VP9.
So the solution is: Do not use h264 Videos. Select if you can VP9. Or if the Videosource is only available as h264 and you have another faster CPU online (maybe with h264 build in support), use that to transcript the Video to VP8/VP9 before watching and send after requesting a transcode for some URL, just Link to the stream for that file on your server to your Phone. Comfortable via RSS.
Yes, I kind of hijacked this thread.
But for me, it’s all about video acceleration in hardware.
The built-in Vivante VPU supports decoding in hardware of h264, h265, vp8 or vp9.
vpx is more efficient and actually comes from Google. With your Librem5 go to YouTube, play a video and check the CPU usage.
Regardless of the codec, there is no video software I’ve tried from the Purism repo that speeds up in hardware.
The way I see it at the moment, acceleration works only with Gstreamer and with a newer version >1.20 that you can not install. With debian11/pureos11, I think, gestreamer will work (out of the box).
More important than Gstreamer is FFMPEG.
With ffmpeg the acceleration doesn’t work at all, regardless of the version!
ffmpeg is used e.g. in VLC and Kodi
gstreamer e.g. in Totem
some comment from purism on this is very appreciated!
please update on statuts of ffmpeg hw accel!
h264 is available in Byzantium’s gstreamer since some time https://source.puri.sm/pureos/packages/gst-plugins-bad1.0/-/merge_requests/1 - everything else will come past Byzantium.
Clapper has hardware acceleration on my L5, or so it claims.
Flatpaks have newer gstreamer anyway. E.g. µPlayer also accelerates h264. I added the gstreamer bits to Byzntium for GNOME Web mostly (which might need an update to its sandboxing again (now that cameras are enabled) for this work.
If you use µPlayer from flathub it has a little green accelerometer in the OSDs top right corner to indicate hardware acceleration:
It also has --h264-demo
and --vp8-demo
command line options to check for support easily.
Oh just for the record: I mixed something up in my Memory. In the past i tried to encode a video (transcode with ffmpeg) from a different codec into h264 and there was the issue without license. Decode should be of course available.
and ffmpeg?
sorry, i’ve ask this question multiple times without an answer!
any hw accel with ffmpeg (any codec) in the future?
Gnu core v6.10
- A clean-up in the V4L2 in the previous release, Benjamin Gaignard’s quest to create an IOCTL to remove buffers from a V4L2 queue has been merged, allowing new use cases in V4L2 like VP9 dynamic resolution change and memory usage optimizations. The first driver to make use of this evolution is VeriSilicon’s Hantro decoder.