Jump to content

RK3399: H.264 decoding not exposed in v4l2, only MPEG2 and VP8


Recommended Posts

I've compiled mainline kernel 6.6 which runs well on my OrangePi/RK3399. The only problem left is getting H.264 decoding working. Unfortunately, when I query /dev/video1 which is the node created by the hantro-vpu driver, only MPEG2 and VP8 are shown as supported codecs for decoding. No H.264, even though I've read many places that the mainline hantro driver supports H.264. Has anyone else had this problem? Is there something else I need to do to get this working?

Link to comment
Share on other sites

I'm using vl42-ctl to query the kernel directly through ioctls, so these decoders should show. The only other thing is no more than 2 nodes are created: /dev/video0 and /dev/video1. Could it be a udev thing?

Link to comment
Share on other sites

Turns out it was a device tree problem. After updating the device tree, I can see the nodes set up by the mainline Rockchip hantro-vpu and rkvdec modules:

/dev/video0: rockchip-rga

/dev/video1: hantro-vpu (encoder)

/dev/video2: hantro-vpu (decoder)

/dev/video3: rkvdec

Link to comment
Share on other sites

Posted (edited)
1 hour ago, usual user said:

Since userspace cannot sensibly select between two decoder instances of the same type, the H.264 hanto decoder is usually disabled for the rk3399 and the H.264 rkvdec is preferred.

Thanks. Just to be clear, that's the rkvdec from staging drivers, right? It overrides hantro for H.264?

 

Oh and I'm assuming the reason hantro H.264 is disabled is rkvdec offers better performance. Is that right?

Edited by McTurbo
Link to comment
Share on other sites

On 4/27/2024 at 8:44 AM, McTurbo said:

Thanks. Just to be clear, that's the rkvdec from staging drivers, right? It overrides hantro for H.264?

 

Oh and I'm assuming the reason hantro H.264 is disabled is rkvdec offers better performance. Is that right?

rkvdec does not technically "override" hantro h.264: hantro and rkvdec are two totally different devices and both are exposed by v4l2 framework to userspace. It's up to the user application to choose the preferred device. Ffmpeg, which is perhaps the most common user application around, has no way to choose the v4l2 device for h.264. The workaround to force ffmpeg to use rkvdec (yes, because it is more performant) was to avoid declaring hantro as capable of h.264, sto the only left h.264 decoder is rkvdec.

 

edit: and yes, rkvdec is in the kernel staging directory, plus armbian has a patch to enable h.265 decoding too

Link to comment
Share on other sites

On 5/1/2024 at 5:34 AM, jock said:

avoid declaring hantro as capable of h.264, sto the only left h.264 decoder is rkvdec.

Where is this done? Is this done in the source for the hantro module? If I wanted to experiment by enabling the hantro H.264 decoder, how would I do that?

 

On 5/1/2024 at 5:34 AM, jock said:

armbian has a patch to enable h.265 decoding too

Is this the same patch used by LibreELEC? I have H.264 decoding working, so I definitely want to try this.

Link to comment
Share on other sites

17 hours ago, McTurbo said:

Where is this done? Is this done in the source for the hantro module? If I wanted to experiment by enabling the hantro H.264 decoder, how would I do that?

Definitely, if you look at the kernel source code you can enable the codec

 

17 hours ago, McTurbo said:

Is this the same patch used by LibreELEC? I have H.264 decoding working, so I definitely want to try this.

Yes, it is. I think it is in the kernel mailing list, so it is something that is already floating around and eventually will be merged.

 

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.

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...
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines