Jump to content

Testing hardware video decoding (rockchip, allwinner?)

Recommended Posts

Hello, recent upgrades to armbian are regarding kernel 5.15.

I noticed that many v4l2 fixes and enhancements went into this release, so I decided to compile ffmpeg using LibreELEC patched version and mpv over it.

mpv turns out to be statically linked with ffmpeg, so I propose it here for people who is interested in cutting edge kernel and wants to do some tests.


This has been tested on Debian Bullseye and Ubuntu Hirsute on following platforms:

  • Rockchip RK3228/9 (kernel 5.10, 5.14)
  • Rockchip RK3288 (kernel 5.14)
  • Rockchip RK3318/28 (kernel 5.15)


It should work on allwinner platforms too, but I didn't test it there.

Binaries are built by me on developing boards.


The binary for armhf is available here

The binary for arm64 is available here


Copy the binary into /usr/local/bin directory of your system (mpv-armhf for 32 bit systems, mpv-arm64 for 64 bit systems):

sudo cp mpv-armhf /usr/local/bin/mpv


Install dependencies for Debian Bullseye and Ubuntu Hirsute:

apt install libass9 libbluray2 librubberband2 libsdl2-2.0-0 libva-drm2 libva-wayland2 libva-x11-2 libva2 libvdpau1 libx264-160 libx265-192 libxss1 libxv1 libfdk-aac2


I have had issues with dependencies on Debian Buster/Ubuntu Focal, in particular libx264-160 and libx265-192 are not available there.

I Solved the issue downloading the packages from Debian Bullseye web page and manually installing them.

There may be the need for some other dependency depending upon your actual installation.


Run mpv in a virtual terminal (videos up to 4K) with this CLI:

mpv --vo=gpu --hwdec=drm --gpu-hwdec-interop=drmprime-drm --drm-draw-plane=overlay --drm-drmprime-video-plane=primary <video.mp4>


Mpv can be run in X11 with this other CLI, but due to buffer copying it requires a good CPU - rk3228 and rk3328 won't even play 720p, rk3288 do 720p fine:

 mpv --vo=gpu --hwdec=auto-copy --gpu-context=x11egl --gpu-hwdec-interop=drmprime-drm <video.mp4>


This is an experiment and your mileage may vary a lot:

  • H.264 codec should be well supported around the boards;
  • H.265 has more limited support
  • VP8 should be generally supported
  • VP9 seems to still require some work.
Link to comment
Share on other sites

Donate your old hardware to community. Start a giveaway Raffle!



I have been trying out hardware video decoding recently, running Debian bullseye, kernel 5.15.53-rk322x and the lima open-source drivers on my RK3229. Here are my conclusions (working only on a virtual terminal):

  • Using Debian's default ffmpeg and mpv installation, I am only able to get up to 720p with few frame skips. That is using software decoding (--hwdec=no) and SDL for rendering (--vo=sdl). Trying to use DRM (for either software decoding and / or rendering) will result in worse performance. Atomic modesetting needs to be turned off (--drm-atomic=no) in order for anything to appear on my screen (or else, I just get a gray screen). I found this issue of yours (https://github.com/mpv-player/mpv/issues/8522) but it applies to the LibreELEC build. In my case (repo build), --drm-atomic=no needs to be turned on in order for the video playback to work, but it is of no use, since you get better performance out of SDL. --hwdec=rkmpp was also tried but performance differences weren't observed.
  • When you say you built ffmpeg using LibreELEC's patches, are you referring to this? https://github.com/LibreELEC/LibreELEC.tv/tree/0e57a30916a3a88e0d4c595a5525d3c03156fcc6/packages/multimedia/ffmpeg/patches
  • Using your version of mpv, everything works as supposed! Some notes: YUV420 video works very well but RGB video doesn't (both hardware and software decoding). I know it isn't common, I tried it because it could possibly be faster if the CPU didn't have to convert colors between formats, but it ended up being slower.

I have tried to provide my help to the Armbian project previously, but what is needed isn't what I know how to provide. Though, I have an idea to help this community: maintaining ffmpeg packages that can take advantage of this hardware acceleration on these chips. This can be done externally of the Armbian project. What do you think of this idea?

Link to comment
Share on other sites

3 hours ago, Voidbert said:

What do you think of this idea?

I think this is a great idea!

Ideally having a repository for debian and/or ubuntu where latest development ffmpeg from LibreELEC repository is built and kept up-to-date would be a huge helper for multimedia advancement in armbian!

Something already happens, for example, right now with oibaf repository: oibaf ppa provides latest development mesa packages for current ubuntu distros, thus immediately enabling latest features for both lima and panfrost drivers.

Link to comment
Share on other sites

I tested on Ubuntu Jammy 5.15.80 (using mpv binary jammy in your folder) on H3 chip. It works like a charm. 

1080p (h264) was tested with 4 frame drops (10min video).


Using this command:

mpv --vo=gpu --hwdec=drm <video.mp4>



But, i want to use --script-opts, --ytdl-raw-options, --ytdl-format. I can use it in mpv from apt-get but your mpv can't parse.

Error parsing option ytdl-format (option not found)
Setting commandline option --ytdl-format= failed.


Can you compile again for jammy with that feature support, please? 


That's great for those who want to listen to music and videos from YouTube like me.


Thank you.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines