Zero 3W Hardware Decoding and Encoding (Wayland / KMS)

I have been testing HW decoding / encoding on Zero 3W, and pushing it to the limits.
My goal was to decode a video and make a screencast simultaneously.
Initially, pushing rkenc to max freq, hanged the board while encoding, so i only pushed rkdec, GPU, and CPU to max freq, and then I got the expected results with Wayland but not KMS (for a reason below).

The test was done with HDMI 1920x1080.

Decoding file: Beauty_3840x2160_120fps_420_8bit_HEVC_MP4.mp4

wget http://ultravideo.fi/video/Beauty_3840x2160_120fps_420_8bit_HEVC_MP4.mp4

Decoding:

gst-launch-1.0 filesrc location=Beauty_3840x2160_120fps_420_8bit_HEVC_MP4.mp4 ! qtdemux ! h265parse ! mppvideodec ! waylandsink

Result:

So, i had to rescale it to 1920x1080 (using hw):

gst-launch-1.0 filesrc location=Beauty_3840x2160_120fps_420_8bit_HEVC_MP4.mp4 ! qtdemux ! h265parse ! mppvideodec ! waylandsink render-rectangle=‘<0,0,1920,1080>’

Result:

Encoding:

sudo ffmpeg -device /dev/dri/card0 -framerate 30 -f kmsgrab -i - -vf ‘hwdownload,format=bgr0’ -c:v hevc_rkmpp -y screencast_30fps_3.mkv

screencast result here:

Recording KMS session did not work, looks like i need to change planeid. KMS decoding worked fine.

Result:

@nyanmisaka @boogiepop
How to record a specific planeid and how to change bitrate?

I tried the cnx trick but did not work for any other plane.

cat /sys/kernel/debug/dri/0/state | grep 'plane\['
plane[54]: Smart0-win0
plane[76]: Esmart0-win0
plane[90]: Cluster0-win0

ffmpeg -device /dev/dri/card0 -framerate 30 -plane_id 90 -f kmsgrab -i - -vf ‘hwdownload,format=bgr0’ -c:v hevc_rkmpp -y screencast_30fps_4.mkv

Resurrecting an old topic here, which OS image and linux version are you using?
I’m trying to understand the RK3566 video encoding software support.

Cheers!

I used a custom OS image, based on Ubuntu 22.04 CLI, kernel 5.10, I think it was an old, stripped-down image since i built everything manually and reused it for other boards. It’s a Frankie, but Frankie works and beats rpi anytime.

The board is hard to find these days (3W), but i managed to buy one at a higher price but not yet tested. I wish radxa had some LTS but reading here and there it’s EOL

Good luck!

Hey thank you for your answer,
the most important part to me is that you found a way to get x265 encoding working on the RK3566.
Do you remember if you had any particular things to do, or repo to use to get the ffmpeg HW encoder working?

Here you find everything you need:

https://forum.radxa.com/t/ffmpeg-introduce-ffmpeg-rockchip-for-hyper-fast-video-transcoding-via-cli

1 Like