H/W Accelerated H264 Decode / Encode (V4L2)

Hi Radxa, thanks for making Radxa board possible!

I have been testing the emmc version, with Ubuntu 20.04 image provided here.

I understand the HW acceleration of H264 decode and encode is provided by the chip hardware through Amlogic Video Engine. May I know if Radxa already has firmware support for this engine, and support through v4l2?

In the current OS image, i can see a /dev/video0 device and seems to be a decoder, but only supports NV12 format. I don’t see any encoder.

Would be really nice if we can use the v4l2 h/w decode / encode fully in radxa zero, like what raspi supports by now!

I also found this link. Seems on Andriod it supports H265 HW decode pretty well, and H264 also decent.

Are we able to get this up on a ordinary Linux headless system as well?

1 Like

Only with legacy kernel with amlvdec blobs,

There is amlvdec driver in mainline kernel but it not stable yet still on staging.

Thanks! Great to know amlvdec driver is being developed in mainline kernel, do you happen to know when we will have access to that in mainline? Or is there any link to track the progress / status? Thanks!

1 Like

hey, I’m curious if you got this working. I’m considering buying this instead of a raspberry pi zero 2 w but I need the GPU acceleration for h264 encoding under linux. Also it’s not clear to me if the amlvdec driver you both mention also handles acceleration for encoding, or is it just decoding?

1 Like

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