Jump to content

Can't use FFmpeg hardware accelration (v4l2) - Orange Pi 4 LTS


Recommended Posts

Hello everyone,


Thank you for stopping buy and reading this thread. I have Orange Pi 4 LTS with the latest Armbian Jammy image (Armbian_23.8.1_Orangepi4-lts_jammy_current_6.1.50). But I also want to mention that I've tried the same thing on the "official" Ubuntu image from OrangePi website and it was the same.

I need to decode and show RTSP video stream, h264 encoded. First of all, I've tried gstreamer with v4l2 codecs. I was using v4l2slh264dec from gst_plugins_bad. This is the only hardware codec in gstreamer for my device (at least available by default) and it worked fine until I started encountering a strange bug when my video getting stuck into 0.5-1 second loop forever. Anyway, I thought that I could bypass this issue by building libav/FFmpeg with v4l2 features and using it instead. However, I couldn't, and this is my problem.
I am building FFmpeg from source like this:
First of all, I made sure that there is no FFmpeg on my system.


sudo apt install libv4l-dev libsdl2-dev -y
git clone https://github.com/FFmpeg/FFmpeg.git
cd FFmpeg/
./configure --enable-libv4l2 --enable-libdrm

No errors/warnings. h264_v4l2m2m is in "Enabled decoders".

make -j6
sudo make install
sudo ldconfig
ffplay -vcodec h264_v4l2m2m rtsp://

It gives me the following error:

If I do not specify v4l2m2m decoder - it works just fine, but with software decoding.

Drivers are present:

And I have no idea how to fix this issue :(
I will appreciate a lot any help!

Edited by Marc512
Link to comment
Share on other sites

hardware video decoding is still a complex beast, mostly because ffmpeg is still missing the necessary bits which are available as separate patches.

v4l2m2m is not the right codec: those are suitable for stataful decoders (rpi and amlogic), but rockchip has a stateless decoder and you have to use v4l2_request decoders.


I'm currently working on bringing a ubuntu and debian apt repository which should ease the pain with ffmpeg. It is in an early state and works better in debian bookworm rather than ubuntu jammy currently. I would not disclose the repository yet because it is very early and hosted in my personal lan, but if you're interested in give it a chance I may give you some instructions via private message.

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