Video Encoding on Rock 4C+

Does anyone know if it is possible to do hardware accelerated video encoding on the Rock 4C+ board?

I have a Rock 4C+. For my project with it I need to use ffmpeg to capture video from a webcam and write that to a file. I.e., I am making a video recorder. To make this work effectively I need to be able use the mali GPU to hardware encode the video stream from the webcam. I have been successful in capturing and writing the webcam’s video stream using ffmpeg with software encoding. But I have not been able to get hardware encoding to work. (Software encoding can’t keep up - degrades the video too much.)

My questions are:

  1. Can the Rock 4C+ do video hardware encoding on any of available OS image? (I am currently using this image: rock-4c-plus_ubuntu_focal_kde_b60.img)

  2. If so, are the necessary GPU drivers already part of this, or one of the other, images?

  3. If not, is it feasible to obtain, compile, install the necessary drivers or libraries? Like, e.g., VA-API (vaapi)? (I am quite comfortable working from the command line.)

The version of ffmpeg I installed from your repo was apparently compiled with the switches enabled to support the vaapi encoding codecs; but when trying to invoke them for use ffmpeg says it can’t find the actual drivers on my system. So either none of them are present or perhaps I don’t know how to properly tell ffmpeg how to use them? (I have been able to use vaapi on my intel desktop fedora linux PC, so I’m somewhat familiar with the command line string to use the VA-API interface; not so much with the others.)

If anyone has any insight about hardware video encoding on these boards - I’m all ears.

You can’t use vaapi on arm platforms. On rockchip platforms it is mpp.

MPP, ok. That will be all new to me. From my initial googling about it appears that I will need to use Nyan Misaka’s git repo @ https://github.com/nyanmisaka/ffmpeg-rockchip to build both the MPP environment and a version of ffmpeg that will be able to use it on my 4C+

If I’m heading down the wrong track with that I’d appreciate a correction.

I think you might be heading down the wrong track.

Not an authority on this by a long stretch and I kinda gave up where I was going so I didn’t learn all the ins and outs and I could always be wrong but ultimately you need to use gstreamer for any hardware encoding/decoding on 4s.

Don’t get lost in a mali gpu rabbit hole. It’s a dead end.

Pretty much gstreamer or nothing as far as I’m aware. It should at least work (on radxa distros).

Mathew: I have seen other comments to that effect as well. I’ve not actually taken any further steps with this project as yet since it clearly is going to be a rabbit-hole, so for the moment I’ve set it aside to work on another, simpler, project.

I think a challenge I’d have with gstreamer is that I need to wrap it with a C++ program; and the gstreamer project page says this: “The GStreamer API C++ bindings are based on gtkmm. They are currently not actively developed and won’t compile with the latest GStreamer and glibmm versions.

I am pretty well familiar with FFmpeg and it won’t be a problem building my intended application with it.

So it’s truly a rabbit hole - either struggling to get FFmpeg to work on this device; or taking on gstreamer as a whole domain of knowledge.

OR…selling the Rock 4C+ on eBay and shifting over to Raspberry Pi now that they are once again available. I may still have challenges there, based on some initial googling about; but it’s a huge community and clearly many folks have, in fact, got FFmpeg to work on the Pi boards.