H/W Accelerated H264 Decode / Encode (V4L2)

Hi there, could anyone please tell if is there any news about h264 encoding on Linux for the Radxa zero or CM3 board?

We’re trying to move away from our Raspberry Pi Zero 2 product in lieu of the Radxa, but we need h264 hardware encoding support. Any help is appreciated.

@spikerguy Is there any update or trackable link yet? Thanks

Regarding VPU support ?
No there is nothing for this.

@spikerguy Thanks. So if HW accelerated Decode / Encode is needed. Will Rockchip boards you guys make be a much better choice? I figured it has vendor provided libraries to do so.

1 Like

I’m a little surprised by this statement because the RZ wiki mentions 4k@60fps decoding capabilities. I actually bought this platform because I needed these capabilities as they were advertised. @RadxaYuntian do you confirm that there is no way to use hardware decoding on this platform ?

Under ArchlinuxArm the Panfrost mesa driver claims OpenGL 3.1 support with the Mali-G31 GPU, but no Vulkan or OpenCL support. Would that be enough to get h264 decoding ?

Otherwise, do the Android/LineageOS images use the legacy amlvdec ? That could be an option, even if it’d be silly to regress back to the Android ecosystem.

Android image uses the legacy kernel with the legacy driver. We tried to boot Linux with the Android kernel but it is currently not working. We are still working on that.

In arm architecture, gpu doesn’t not handle h264 decoding/encoding.
It is handled by the vpu. There are drm driver for vpu. You can look at Libreelec’s work on drm/vpu drivers needed for decoding.

You can do h264 decoding using their patches in linux kernel, ffmpeg and playback application (kodi/mpv) etc

Great ! I tested the LineageOS AndroidTV image and it bears the same legacy kernel and driver. At least there’s a reference to showcase the video decoding capabilities.

Amazing ! I booted LibreELEC, it runs the latest kernel with a brand new (probably beta) H264 hardware decoder ! The result video display is very convincing. We still experienced contrast issues in the first 2 seconds of playback. I’m afraid I’ll have to stick to legacy drivers for now …

1 Like

BTW I had to recompile u-boot to add LZO decompression support, needed for the latest LibreELEC images. Other than that, worked like a charm.

Hi la_fleur,

Any news on the LibreELEC driver?

Is there a place where we can download it?

It would great to unleash the video power of the Zero. Right now a you know it is very choppy.

Thanks! :slightly_smiling_face:

Have you tried test images from here

If you want to use it as media center, CoreELEC is fully running on this device.

www.coreelec.org

Nexus stable release:

https://github.com/CoreELEC/CoreELEC/releases/download/20.0-Nexus/CoreELEC-Amlogic-ng.arm-20.0-Nexus-Radxa_Zero.img.gz

Latest nightly with Nexus:
https://relkai.coreelec.org/Amlogic-ng/ce-20/CoreELEC-Amlogic-ng.arm-20.1-Nexus_nightly_20230129-Radxa_Zero.img.gz

Hi,

Thanks for your fast answers spikerguy and Vasco.

No CoreELEC, here. I’m using Manjaro on my zero. By the way, congratulations to the Manjaro hackers that maintain the Zero repositories. Thanx to this distribution I can use the Zero most of the time as a daily driver, for browsing and coding. Always up to date, with the latest versions of the kernel (6.1.8 now), libraries and tools I use.

Back to the video acceleration issue… Could we extract the driver from CoreELEC and install it in Manjaro? How?

Or is it possible to compile it and try it in Manjaro (and other linuxes)?

It is sad to see this vpu sitting idle, unused… :pensive:

Thanx! :slightly_smiling_face:

CoreElec uses kernel 4.9 (vendor kernel) which has all the GPU/VPU features included. Same time ago I ported CE media drivers to a “similar” Ubuntu kernel (Odroid N2+, https://github.com/beta68/linux). This was already a huge stunt and I “only” was able to use KODI within UBUNTU in a chroot environment due to missing libMali sources. To my opinion it does not make sense to port 4.9 CE media extensions Radxa to a mainline kernel. This would take years and this Mali GPU will be old before any new kernel release date.

The only way I found I described here: HOWTO: KODI, VDR, ambilight, UBUNTU and X11

Kind regards,
beta

Some comments:

The Mali G31 GPU used with S905Y2 has excellent support in the upstream kernel, but that has nothing to do with H264/HEVC/VP9/etc. as Mali is purely a 2D (GUI) accelerator, it doesn’t process video.

There is reasonable upstream support for 8-bit/1080p H264/HEVC/VP9 if you use the right kernel and ffmpeg sources, and S905Y2 will happily software decode those and all legacy formats to the same specs. Decoding 10-bit and 4K is not possible right now due to unresolved bugs. Fixing issues in the current upstream (and submitted) code will be considerably quicker then attempting to port the vendor code (which is written around Amlogics homebrew DRM frameworks).

There is no support for Anlogic V4L2 encoding in the upstream kernel, but Amlogic’s encoders aren’t that good so it’s not a big loss. You will get better results software encoding with ffmpeg or gstreamer.

Thank you, @chewitt for the clarification.

Hey guys, I stumbled upon your replies just a moment ago. From my experience :

  • CoreELEC 20 provides the best video reproduction, obviously because it’s the only OS that still ships with the initial proprietary video drivers
  • CoreELEC 21 ships with the bleeding-edge open-source video drivers that aim at replacing the former
  • H264 decoding and display is far better with CoreELEC 21 than with Manjaro (or at least was a few months back). But it’s still not on par with CoreELEC 20 - frame drops still occur from time to time, and the beginning of sequences can be noisy

That’s about it for what I can say !

You can try libreElec.

Its still not perfect though.

Oh I tried LibreElec at the same time, and it wasn’t as advanced as CoreElec specifically on the hardware video decoding subject. Nevertheless, excellent distro for its specific usecase. I have seen that the relations between the two teams are not totally fluid. Still I’m very grateful to both projects, as CoreElec managed the best open-source distro using the video drivers of this processor, and it could not have existed as such if there wasn’t LibreElec to build upon. Hail to both projects ! Keep it up guys !

1 Like