Rock64: Hardware acceleration with FFmpeg


Gustavo A. Díaz
 Share

2 2

Recommended Posts

Armbianmonitor:

Hi,

 

I need some guide and steps required (and if possible) to enable hardware acceleration using FFmpeg. Is the only thing I need since the idea is to use this SBC as Surveillance platform (for example, with Motion+Motioneye or Shinobi). Currencly without hardware accel, using 3 rtsp cams uses each 100% of a core (which translate to 300%).

 

I've searching a lot, but I saw hwaccel with others apps, but not in particular with ffmpeg. I already managed to compile it with --enable-rkmpp (h264_rkmpp hevc_rkmpp vp8_rkmpp vp9_rkmpp) and available hwaccels: vdpau cuda vaapi drm opencl.

Any help will be much appreciated.

 

Currently fresh installed OS: Armbian Focal

 

Thanks in advance.

Edited by Gustavo A. Díaz
Link to post
Share on other sites

Donate and support the project!

Currently, FFmpeg only supports HW decoding for rockchips, not encoding. Acceleration on mainline kernel is a work in progress, so I still recommend the legacy 4.4 kernel for video tasks.

 

 

17 hours ago, Gustavo A. Díaz said:

I already managed to compile it adding encoders h264_rkmpp hevc_rkmpp vp8_rkmpp vp9_rkmpp

You need the legacy kernel for these codecs to work. And, again, they are only for decoding.

 

If you want HW encoding, then you need to use gstreamer with the rockchip plugin.

Link to post
Share on other sites

47 minutes ago, Gustavo A. Díaz said:

I can install linux-image-legacy-rockchip (4.4.213) to avoid reinstall all again, right?

Yes, you can do that. Besides, you will probably also need to sort out the permissions for the VPU kernel nodes. Better try first to run FFmpeg/gstreamer as root, to make sure everything is working.

 

In any case, you can also try a legacy Bionic image, and install my media script, which will configure everything automatically in a few minutes.

Link to post
Share on other sites

@JMCC Hi! Thanks for the tips.

 

Quote

you will probably also need to sort out the permissions for the VPU kernel nodes

 

How I can do that?

 

Actually I would to prefer to compile all by hand, so what I need is:

- libmali

- rockchip-vcodec (https://github.com/Miouyouyou/rockchip-vcodec -> this is the right repository? )

- mpp (https://github.com/rockchip-linux/mpp)
- gstreamer-rockchip (https://github.com/rockchip-linux/gstreamer-rockchip)
- gstreamer-rockchip-extras (https://github.com/rockchip-linux/gstreamer-rockchip-extra)

- ffmpeg (compiled with --enable-rkmpp and what else?)
 

Anything else I am missing (or not necessary from this list)?

 

BTW, last time I've compiled gstreamer-rockchip, I don't know why the compiled version does not include mpph264enc.

Thanks in advance.

Link to post
Share on other sites

2 hours ago, Gustavo A. Díaz said:

How I can do that?

By checking the rules in /etc/udev/rules.d . I think there is something broken for rk3328 until you use my script. More specifically, I think Armbian defines the mali node as "/dev/mali0", as for rk3399, while rk3328 uses "/dev/mali". I want to find some time to check it out.

 

2 hours ago, Gustavo A. Díaz said:

Anything else I am missing (or not necessary from this list)?

 

You can look in my script, there is info about the sources on each directory.

 

Link to post
Share on other sites

Did you ever try H.264 hardware encoding on the Rock64? What was your experience with the quality?

On my Raspberry Pi 4 I did hardware encode my webcam stream for a while, but the quality was so much worse at similar bitrate than libx264, that I ended up using software encoding after all.

 

 

Edited by Kwinz
Link to post
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.

Guest
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.

Loading...
 Share

2 2