Skip to content
View in the app

A better way to browse. Learn more.

Armbian Community Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

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

Featured Replies

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?

  • Author

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?

  • Author

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

  • Author
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

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

  • Author
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.

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.

 

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

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.