Has anyone actually succeeded in getting hardware video encoding working?

I know the Rock5B is still relatively new (not that new now, let’s be honest) but with hardware video encode and decode being a massive part of the sales pitch for this SBC, actually being able to leverage the hardware to encode video should be a lot easier.

I’ve been attempting to get hardware accelerated video encoding working for quite a few weeks now, but with no success thus far. Documentation on getting this to work seems very sparse - basically non existent, and I just don’t have time (or inclination tbh) to spend endless days on trial and error until I finally work it out.

So far installation of MPP appears to be fine, following this guide, although the demo fails so it seems this is not actually entirely successful. Then my understanding is that I need to add MPP hardware encoding support to the recording software - so ffmpeg or gstreamer seem to be the primary choices.

However I believe I’m right in saying that ffmpeg is no longer a possibility due to licensing issues, and the repo to add rockchip support to gstreamer has long since been archived with no apparent replacement. So how exactly can I add encoding support? This is on Armbian.

I would love it if someone could tell me I’ve missed this or that resource and actually it’s really easy - but I suspect that won’t be what happens. Either way if anyone actually has this working can they give some insight and instruction on how to get it working that would certainly be appreciated. I don’t mind which OS I use, doesn’t have to be Armbian, and also I don’t have a problem with totally wiping the storage and starting again.

Looking forward to an answer!

1 Like

I use Reborn OS.
They have in their repo ffmpeg-mpp and mpp-git ,which works nicely with mplayer and vlc.
Up to 8k videos with hw acceleration.
regards

I thought Reborn OS was just hardware decoding built in, does it also support encoding?

Encoding is done by gstreamer , there is a ffmpeg (posted by a user in the forum) that can do hw encoding (DRM_PRIME).

Basic encoding example with gstreamer:

For the newbies and users @amazingfate has integrated OBS and HW encoder, please search the forum for his instructions. I think he uses Wayland and i am currently using X11.

1 Like

I haven’t written a guide on how to use obs for video recording. Here is a brief one:
0, flash a jammy image, armbian jammy is recommended.
1, add my two ppa and do a system upgrade:


2, install related packages
a, install rockchip-multimedia-config for basic permssion settings
b, install obs-studio and obs-plugins for obs app
c, install obs-gstreamer for obs’s gstreamer encoding plugin
d, iinstall gstreamer1.0-plugins-bad and gstreamer1.0-rockchip1 for gstreamer rockchip encoding/decoding support
e, install qtwayland5 for qt wayland support
f, install xdg-desktop-portal-gnome for obs pipewire screen capture support

3, do a reboot, login to a wayland session, and launch obs from the app menu, use pipewire to capture the screen, and use rkmpp encoder to encode the video.

2 Likes

Thanks for the replies, I appreciate it! So I’ve actually got encoding working now via gstreamer which is great. Unfortunately on playback I see lines of corruption in the image very much the same as the screenshots in this thread (you can ignore the rest of the thread, it’s just visually what you can see in the images I’m referring to. This is with both H264 and H265 hardware encoding.

Any ideas on that one?

At least it does not happen with NV12 pixel format. I know there are some issues with YUYV and I will try with that later.

Running the same test with Radxa Camera (200 frames):
mpi_enc_test -i /dev/video11 -f 0 -w 1920 -h 1080 -o out_200frames_1920x1080.h264 -t 7 -n 200 -d 1

Result here:
https://mega.nz/file/VC4RCS5J#yCSIZy4Ehe3TOvAbbqEfPM7U9cBTWzbHiU8PzFR0kio

Output:

Apr 11 08:48:18 rock5b mpp[2135]: mpp_opt: invalid option d
Apr 11 08:48:18 rock5b mpp[2135]: mpi_enc_utils: cmd parse result:
Apr 11 08:48:18 rock5b mpp[2135]: mpi_enc_utils: input  file name: /dev/video11
Apr 11 08:48:18 rock5b mpp[2135]: mpi_enc_utils: output file name: out_200frames_1920x1080.h264
Apr 11 08:48:18 rock5b mpp[2135]: mpi_enc_utils: width      : 1920
Apr 11 08:48:18 rock5b mpp[2135]: mpi_enc_utils: height     : 1080
Apr 11 08:48:18 rock5b mpp[2135]: mpi_enc_utils: format     : 0
Apr 11 08:48:18 rock5b mpp[2135]: mpi_enc_utils: type       : 7
Apr 11 08:48:18 rock5b mpp[2135]: mpi_enc_test: mpi_enc_test start
Apr 11 08:48:18 rock5b mpp[2135]: mpi_enc_test: open camera device
Apr 11 08:48:18 rock5b mpp[2135]: camera_source: get width 1920 height 1080
Apr 11 08:48:18 rock5b mpp[2135]: camera_source: get dma buf(0)-fd: 5
Apr 11 08:48:18 rock5b mpp[2135]: camera_source: get dma buf(1)-fd: 6
Apr 11 08:48:18 rock5b mpp[2135]: camera_source: get dma buf(2)-fd: 7
Apr 11 08:48:18 rock5b mpp[2135]: camera_source: get dma buf(3)-fd: 8
Apr 11 08:48:18 rock5b kernel: rkisp_hw fdcb0000.rkisp: set isp clk = 594000000Hz
Apr 11 08:48:18 rock5b kernel: rkcif-mipi-lvds2: sditf_reinit_mode, mode->rdbk_mode 0, mode->name rkisp0-vir0, link_mode 1
Apr 11 08:48:18 rock5b rkaiq[426]: DBG: /dev/media1: wait stream start event success ...
Apr 11 08:48:18 rock5b rkaiq[426]: DBG: device manager start
Apr 11 08:48:18 rock5b rkaiq[426]: DBG: rkisp_init engine succeed
Apr 11 08:48:18 rock5b rkaiq[426]: DBG: /dev/media1: wait stream stop event...
Apr 11 08:48:18 rock5b kernel: rkisp rkisp0-vir0: first params buf queue
Apr 11 08:48:18 rock5b kernel: rkcif-mipi-lvds2: stream[0] start streaming
Apr 11 08:48:18 rock5b kernel: rockchip-mipi-csi2 fdd30000.mipi2-csi2: stream on, src_sd: 00000000208ea651, sd_name:rockchip-csi2-dphy0
Apr 11 08:48:18 rock5b kernel: rockchip-mipi-csi2 fdd30000.mipi2-csi2: stream ON
Apr 11 08:48:18 rock5b kernel: rockchip-csi2-dphy0: dphy0, data_rate_mbps 892
Apr 11 08:48:18 rock5b kernel: rockchip-csi2-dphy csi2-dphy0: csi2_dphy_s_stream stream on:1, dphy0
Apr 11 08:48:18 rock5b kernel: rockchip-csi2-dphy csi2-dphy0: csi2_dphy_s_stream stream on:1, dphy0
Apr 11 08:48:18 rock5b kernel: imx415 3-001a: s_stream: 1. 3864x2192, hdr: 0, bpp: 10
Apr 11 08:48:18 rock5b kernel: imx415 3-001a: set vblank 0x3a vts 2250
Apr 11 08:48:18 rock5b kernel: imx415 3-001a: set exposure(shr0) 900 = cur_vts(2250) - val(1350)
Apr 11 08:48:18 rock5b kernel: imx415 3-001a: set analog gain 0x23
Apr 11 08:48:18 rock5b rkaiq[426]: [08:48:18.263533][CAMHW]:XCAM ERROR Isp20Params.cpp:4036: get blc params failed!
Apr 11 08:48:18 rock5b rkaiq[426]: 
Apr 11 08:48:18 rock5b kernel: imx415 3-001a: set analog gain 0x1e
Apr 11 08:48:18 rock5b mpp[2135]: mpi_enc_test: new framecap ok
Apr 11 08:48:18 rock5b mpp[2135]: mpp_info: mpp version: 7b7bca6 author: Yandong Lin    2023-02-22 [av1d]: fix loss frame when eos packet has one more frame
Apr 11 08:48:18 rock5b mpp[2135]: mpi_enc_test: 0x7f9c002400 encoder test start w 1920 h 1080 type 7
Apr 11 08:48:18 rock5b mpp[2135]: mpp_enc: MPP_ENC_SET_RC_CFG bps 7776000 [486000 : 8262000] fps [30:30] gop 60
Apr 11 08:48:18 rock5b mpp[2135]: h264e_api_v2: MPP_ENC_SET_PREP_CFG w:h [1920:1080] stride [1920:1080]
Apr 11 08:48:18 rock5b mpp[2135]: mpp_enc: mode vbr bps [486000:7776000:8262000] fps fix [30/1] -> fix [30/1] gop i [60] v [0]
Apr 11 08:48:18 rock5b kernel: imx415 3-001a: set analog gain 0x1f
Apr 11 08:48:18 rock5b kernel: imx415 3-001a: set analog gain 0x20
Apr 11 08:48:18 rock5b kernel: imx415 3-001a: set analog gain 0x21
Apr 11 08:48:18 rock5b kernel: imx415 3-001a: set analog gain 0x22
Apr 11 08:48:18 rock5b kernel: imx415 3-001a: set analog gain 0x23
Apr 11 08:48:18 rock5b kernel: imx415 3-001a: set analog gain 0x24
Apr 11 08:48:18 rock5b kernel: imx415 3-001a: set analog gain 0x25
Apr 11 08:48:18 rock5b kernel: imx415 3-001a: set analog gain 0x26
Apr 11 08:48:19 rock5b kernel: imx415 3-001a: set analog gain 0x25
Apr 11 08:48:19 rock5b kernel: imx415 3-001a: set analog gain 0x24
Apr 11 08:48:19 rock5b kernel: imx415 3-001a: set analog gain 0x23
Apr 11 08:48:19 rock5b kernel: imx415 3-001a: set analog gain 0x22
Apr 11 08:48:19 rock5b kernel: imx415 3-001a: set analog gain 0x21
Apr 11 08:48:20 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 0    size 388353  qp 20
Apr 11 08:48:20 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 1    size 96563   qp 23
Apr 11 08:48:20 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 2    size 41940   qp 26
Apr 11 08:48:20 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 3    size 45172   qp 26
Apr 11 08:48:20 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 4    size 37635   qp 27
Apr 11 08:48:20 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 5    size 37642   qp 27
Apr 11 08:48:20 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 6    size 36011   qp 27
Apr 11 08:48:20 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 7    size 30015   qp 27
Apr 11 08:48:20 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 8    size 29452   qp 27
Apr 11 08:48:20 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 9    size 28800   qp 27
Apr 11 08:48:20 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 10   size 28473   qp 27
Apr 11 08:48:20 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 11   size 26594   qp 27
Apr 11 08:48:20 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 12   size 25630   qp 27
Apr 11 08:48:20 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 13   size 26174   qp 27
Apr 11 08:48:20 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 14   size 26859   qp 27
Apr 11 08:48:20 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 15   size 26858   qp 27
Apr 11 08:48:20 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 16   size 20814   qp 27
Apr 11 08:48:20 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 17   size 21393   qp 27
Apr 11 08:48:20 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 18   size 20629   qp 27
Apr 11 08:48:20 rock5b kernel: imx415 3-001a: set analog gain 0x22
Apr 11 08:48:20 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 19   size 21283   qp 27
Apr 11 08:48:20 rock5b kernel: imx415 3-001a: set analog gain 0x23
Apr 11 08:48:20 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 20   size 20662   qp 27
Apr 11 08:48:20 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 21   size 21809   qp 27
Apr 11 08:48:20 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 22   size 30417   qp 29
Apr 11 08:48:20 rock5b kernel: imx415 3-001a: set analog gain 0x24
Apr 11 08:48:20 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 23   size 32982   qp 30
Apr 11 08:48:20 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 24   size 29775   qp 28
Apr 11 08:48:20 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 25   size 22608   qp 29
Apr 11 08:48:20 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 26   size 30996   qp 30
Apr 11 08:48:21 rock5b kernel: imx415 3-001a: set analog gain 0x25
Apr 11 08:48:21 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 27   size 23697   qp 29
Apr 11 08:48:21 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 28   size 22893   qp 29
Apr 11 08:48:21 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 29   size 22096   qp 29
Apr 11 08:48:21 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 30   size 31344   qp 30
Apr 11 08:48:21 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 31   size 24576   qp 29
Apr 11 08:48:21 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 32   size 16176   qp 29
Apr 11 08:48:21 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 33   size 22545   qp 28
Apr 11 08:48:21 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 34   size 20733   qp 28
Apr 11 08:48:21 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 35   size 20793   qp 28
Apr 11 08:48:21 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 36   size 19082   qp 28
Apr 11 08:48:21 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 37   size 18598   qp 28
Apr 11 08:48:21 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 38   size 18390   qp 28
Apr 11 08:48:21 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 39   size 17966   qp 28
Apr 11 08:48:21 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 40   size 17639   qp 28
Apr 11 08:48:21 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 41   size 17134   qp 28
Apr 11 08:48:21 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 42   size 17401   qp 28
Apr 11 08:48:21 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 43   size 17267   qp 28
Apr 11 08:48:21 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 44   size 24351   qp 28
Apr 11 08:48:21 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 45   size 15483   qp 28
Apr 11 08:48:21 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 46   size 22702   qp 28
Apr 11 08:48:21 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 47   size 21695   qp 27
Apr 11 08:48:21 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 48   size 20864   qp 27
Apr 11 08:48:21 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 49   size 19855   qp 27
Apr 11 08:48:21 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 50   size 19071   qp 27
Apr 11 08:48:21 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 51   size 20349   qp 27
Apr 11 08:48:21 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 52   size 19703   qp 27
Apr 11 08:48:21 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 53   size 19293   qp 27
Apr 11 08:48:21 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 54   size 19811   qp 27
Apr 11 08:48:21 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 55   size 27908   qp 26
Apr 11 08:48:21 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 56   size 18217   qp 27
Apr 11 08:48:22 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 57   size 25680   qp 26
Apr 11 08:48:22 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 58   size 24849   qp 26
Apr 11 08:48:22 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 59   size 26375   qp 26
Apr 11 08:48:22 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 60   size 363462  qp 21
Apr 11 08:48:22 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 61   size 22488   qp 26
Apr 11 08:48:22 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 62   size 26360   qp 27
Apr 11 08:48:22 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 63   size 27508   qp 27
Apr 11 08:48:22 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 64   size 27255   qp 26
Apr 11 08:48:22 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 65   size 26774   qp 26
Apr 11 08:48:22 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 66   size 18061   qp 27
Apr 11 08:48:22 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 67   size 27091   qp 26
Apr 11 08:48:22 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 68   size 27019   qp 26
Apr 11 08:48:22 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 69   size 20339   qp 27
Apr 11 08:48:22 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 70   size 25605   qp 27
Apr 11 08:48:22 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 71   size 26238   qp 27
Apr 11 08:48:22 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 72   size 22637   qp 28
Apr 11 08:48:22 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 73   size 28244   qp 27
Apr 11 08:48:22 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 74   size 22625   qp 28
Apr 11 08:48:22 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 75   size 23692   qp 28
Apr 11 08:48:22 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 76   size 28620   qp 28
Apr 11 08:48:22 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 77   size 22830   qp 28
Apr 11 08:48:22 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 78   size 24919   qp 28
Apr 11 08:48:22 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 79   size 28836   qp 27
Apr 11 08:48:22 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 80   size 22940   qp 28
Apr 11 08:48:22 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 81   size 23631   qp 28
Apr 11 08:48:22 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 82   size 28662   qp 27
Apr 11 08:48:22 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 83   size 21926   qp 27
Apr 11 08:48:22 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 84   size 28461   qp 27
Apr 11 08:48:22 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 85   size 27164   qp 27
Apr 11 08:48:22 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 86   size 27930   qp 27
Apr 11 08:48:23 rock5b kernel: imx415 3-001a: set analog gain 0x26
Apr 11 08:48:23 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 87   size 27743   qp 27
Apr 11 08:48:23 rock5b kernel: imx415 3-001a: set analog gain 0x27
Apr 11 08:48:23 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 88   size 27600   qp 27
Apr 11 08:48:23 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 89   size 18773   qp 27
Apr 11 08:48:23 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 90   size 37611   qp 29
Apr 11 08:48:23 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 91   size 32645   qp 30
Apr 11 08:48:23 rock5b kernel: imx415 3-001a: set analog gain 0x28
Apr 11 08:48:23 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 92   size 29042   qp 28
Apr 11 08:48:23 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 93   size 26085   qp 28
Apr 11 08:48:23 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 94   size 25487   qp 28
Apr 11 08:48:23 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 95   size 36267   qp 29
Apr 11 08:48:23 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 96   size 26550   qp 28
Apr 11 08:48:23 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 97   size 30644   qp 28
Apr 11 08:48:23 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 98   size 30576   qp 28
Apr 11 08:48:23 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 99   size 29176   qp 28
Apr 11 08:48:23 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 100  size 30314   qp 28
Apr 11 08:48:23 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 101  size 28797   qp 28
Apr 11 08:48:23 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 102  size 29536   qp 28
Apr 11 08:48:23 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 103  size 28799   qp 27
Apr 11 08:48:23 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 104  size 27941   qp 28
Apr 11 08:48:23 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 105  size 29887   qp 27
Apr 11 08:48:23 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 106  size 26976   qp 27
Apr 11 08:48:23 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 107  size 29005   qp 27
Apr 11 08:48:23 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 108  size 27745   qp 27
Apr 11 08:48:23 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 109  size 28888   qp 27
Apr 11 08:48:23 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 110  size 28162   qp 27
Apr 11 08:48:23 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 111  size 30565   qp 27
Apr 11 08:48:23 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 112  size 29671   qp 27
Apr 11 08:48:23 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 113  size 30248   qp 27
Apr 11 08:48:23 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 114  size 29854   qp 27
Apr 11 08:48:23 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 115  size 29492   qp 27
Apr 11 08:48:23 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 116  size 29804   qp 27
Apr 11 08:48:24 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 117  size 28045   qp 27
Apr 11 08:48:24 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 118  size 30178   qp 27
Apr 11 08:48:24 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 119  size 28655   qp 27
Apr 11 08:48:24 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 120  size 267163  qp 23
Apr 11 08:48:24 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 121  size 30337   qp 26
Apr 11 08:48:24 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 122  size 30358   qp 27
Apr 11 08:48:24 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 123  size 30531   qp 27
Apr 11 08:48:24 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 124  size 30190   qp 27
Apr 11 08:48:24 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 125  size 30160   qp 27
Apr 11 08:48:24 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 126  size 30008   qp 27
Apr 11 08:48:24 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 127  size 30040   qp 27
Apr 11 08:48:24 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 128  size 31008   qp 27
Apr 11 08:48:24 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 129  size 31604   qp 27
Apr 11 08:48:24 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 130  size 31410   qp 27
Apr 11 08:48:24 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 131  size 32710   qp 27
Apr 11 08:48:24 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 132  size 33465   qp 27
Apr 11 08:48:24 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 133  size 31689   qp 27
Apr 11 08:48:24 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 134  size 30935   qp 27
Apr 11 08:48:24 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 135  size 30907   qp 27
Apr 11 08:48:24 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 136  size 31763   qp 27
Apr 11 08:48:24 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 137  size 28598   qp 27
Apr 11 08:48:24 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 138  size 29336   qp 27
Apr 11 08:48:24 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 139  size 29176   qp 27
Apr 11 08:48:24 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 140  size 29172   qp 27
Apr 11 08:48:24 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 141  size 29863   qp 27
Apr 11 08:48:24 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 142  size 29157   qp 27
Apr 11 08:48:24 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 143  size 28312   qp 27
Apr 11 08:48:24 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 144  size 28784   qp 27
Apr 11 08:48:24 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 145  size 29995   qp 27
Apr 11 08:48:24 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 146  size 30976   qp 27
Apr 11 08:48:25 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 147  size 30926   qp 27
Apr 11 08:48:25 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 148  size 30924   qp 27
Apr 11 08:48:25 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 149  size 31104   qp 27
Apr 11 08:48:25 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 150  size 31414   qp 27
Apr 11 08:48:25 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 151  size 30871   qp 27
Apr 11 08:48:25 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 152  size 30681   qp 27
Apr 11 08:48:25 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 153  size 30723   qp 27
Apr 11 08:48:25 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 154  size 30698   qp 27
Apr 11 08:48:25 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 155  size 30645   qp 27
Apr 11 08:48:25 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 156  size 30139   qp 27
Apr 11 08:48:25 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 157  size 31777   qp 27
Apr 11 08:48:25 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 158  size 29911   qp 27
Apr 11 08:48:25 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 159  size 31825   qp 27
Apr 11 08:48:25 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 160  size 30433   qp 27
Apr 11 08:48:25 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 161  size 30803   qp 27
Apr 11 08:48:25 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 162  size 30007   qp 27
Apr 11 08:48:25 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 163  size 30702   qp 27
Apr 11 08:48:25 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 164  size 30573   qp 28
Apr 11 08:48:25 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 165  size 30544   qp 28
Apr 11 08:48:25 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 166  size 30981   qp 28
Apr 11 08:48:25 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 167  size 31704   qp 28
Apr 11 08:48:25 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 168  size 31960   qp 28
Apr 11 08:48:25 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 169  size 32708   qp 28
Apr 11 08:48:25 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 170  size 31006   qp 28
Apr 11 08:48:25 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 171  size 25863   qp 28
Apr 11 08:48:25 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 172  size 30637   qp 28
Apr 11 08:48:25 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 173  size 28968   qp 28
Apr 11 08:48:25 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 174  size 29715   qp 28
Apr 11 08:48:25 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 175  size 29976   qp 28
Apr 11 08:48:25 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 176  size 30323   qp 27
Apr 11 08:48:26 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 177  size 31029   qp 28
Apr 11 08:48:26 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 178  size 27676   qp 28
Apr 11 08:48:26 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 179  size 31630   qp 28
Apr 11 08:48:26 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 180  size 247914  qp 24
Apr 11 08:48:26 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 181  size 25344   qp 28
Apr 11 08:48:26 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 182  size 34488   qp 28
Apr 11 08:48:26 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 183  size 29324   qp 28
Apr 11 08:48:26 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 184  size 30046   qp 28
Apr 11 08:48:26 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 185  size 30677   qp 28
Apr 11 08:48:26 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 186  size 29632   qp 28
Apr 11 08:48:26 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 187  size 30494   qp 28
Apr 11 08:48:26 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 188  size 30403   qp 28
Apr 11 08:48:26 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 189  size 31253   qp 28
Apr 11 08:48:26 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 190  size 29348   qp 28
Apr 11 08:48:26 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 191  size 29460   qp 28
Apr 11 08:48:26 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 192  size 28889   qp 28
Apr 11 08:48:26 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 193  size 27579   qp 28
Apr 11 08:48:26 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 194  size 27139   qp 28
Apr 11 08:48:26 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 195  size 27557   qp 28
Apr 11 08:48:26 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 196  size 26721   qp 28
Apr 11 08:48:26 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 197  size 26753   qp 28
Apr 11 08:48:26 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 198  size 26452   qp 28
Apr 11 08:48:26 rock5b mpp[2135]: mpi_enc_test: chn 0 encoded frame 199  size 25617   qp 28
Apr 11 08:48:26 rock5b kernel: rkcif-mipi-lvds2: stream[0] start stopping, total mode 0x2, cur 0x2
Apr 11 08:48:26 rock5b kernel: rockchip-mipi-csi2 fdd30000.mipi2-csi2: stream off, src_sd: 00000000208ea651, sd_name:rockchip-csi2-dphy0
Apr 11 08:48:26 rock5b kernel: rockchip-mipi-csi2 fdd30000.mipi2-csi2: stream OFF
Apr 11 08:48:26 rock5b kernel: rockchip-csi2-dphy csi2-dphy0: csi2_dphy_s_stream_stop stream stop, dphy0
Apr 11 08:48:26 rock5b kernel: rockchip-csi2-dphy csi2-dphy0: csi2_dphy_s_stream stream on:0, dphy0
Apr 11 08:48:26 rock5b kernel: rockchip-csi2-dphy csi2-dphy0: csi2_dphy_s_stream stream on:0, dphy0
Apr 11 08:48:26 rock5b kernel: imx415 3-001a: s_stream: 0. 3864x2192, hdr: 0, bpp: 10
Apr 11 08:48:26 rock5b kernel: rkcif-mipi-lvds2: stream[0] stopping finished, dma_en 0x0
Apr 11 08:48:26 rock5b rkaiq[426]: DBG: /dev/media1: wait stream stop event success ...
Apr 11 08:48:26 rock5b rkaiq[426]: [08:48:26.809388][CAMHW]:XCAM ERROR SensorHw.cpp:1291: failed to set sync mode 0
Apr 11 08:48:26 rock5b rkaiq[426]: DBG: subscribe events from /dev/video19 success !
Apr 11 08:48:26 rock5b rkaiq[426]: DBG: subscribe events from /dev/video19 success !
Apr 11 08:48:26 rock5b rkaiq[426]: DBG: /dev/media1: wait stream start event...
Apr 11 08:48:26 rock5b mpp[2135]: mpi_enc_test: chn 0 encode 200 frames time 8327 ms delay   8 ms fps 24.02 bps 8092519
Apr 11 08:48:26 rock5b mpp[2135]: mpi_enc_test: mpi_enc_test average frame rate 24.02
Apr 11 08:48:26 rock5b mpp[2135]: mpp_buffer: ~MppBufferService cleaning misc group
Apr 11 08:48:54 rock5b mpp[2175]: mpp_info: mpp version: 7b7bca6 author: Yandong Lin    2023-02-22 [av1d]: fix loss frame when eos packet has one more frame
Apr 11 08:48:54 rock5b mpp[2175]: hal_h264d_vdpu34x: control info: fmt 0, w 1920, h 1080
Apr 11 08:48:54 rock5b mpp[2175]: mpp_buf_slot: set frame info: w 1920 h 1080 hor 1920 ver 1088
Apr 11 08:48:54 rock5b mpp[2175]: mpp_dec: setting default w 1920 h 1080 h_str 1920 v_str 1088

YUY2 has the issues described above.

mpi_enc_test -i /dev/video21 -f 8 -w 1920 -h 1080 -o out_YUY2_200frames_1920x1080.h264 -t 7 -n 200 -d 1

Result here:
https://mega.nz/file/5OJgFaBL#rtCtEdWUYbjX2Jhq9KhHzufFdz7296kFTcc-LEW2jdo

This was actually NV12, couldn’t even get YUYV to record at all with gstteamer this is. One difference is that this is from a webcam source (which outputs both NV12 and YUYV), also haven’t tested using mpi_enc_test which I’m guessing is from here?

https://wiki.radxa.com/Rock5/guide/rockchip-mpp

I’ll have to test it to see if there is any difference.

Yes, rockchip-mpp. (https://github.com/rockchip-linux/mpp)

I have never seen a web cam with NV12 (always wanted one, but never found it), anyway, you need to match MPP userland portion with MPP kernel (don’t ask me how…)

This is the logitech brio that has NV12 and YUYV if you want to look at it. I’ll give that a go and ser what I find.

Unfortunately getting the same result with corrupt lines using mpi_enc_test as well…

Although I have now just managed to get a clean output without lines of corruption on the video using this command:

gst-launch-1.0 v4l2src device=/dev/video1 io-mode=mmap ! 'video/x-raw,format=NV12,width=1920,height=1080,framerate=30/1' ! mpph265enc ! filesink location=video.mp4

The only difference is that I defined the io-mode. I thought mmap was the default, but doing a side by side test one not setting io-mode to anything:

gst-launch-1.0 v4l2src device=/dev/video1 ! 'video/x-raw,format=NV12,width=1920,height=1080,framerate=30/1' ! mpph265enc ! filesink location=video.mp4

and the first command, the one where io-mode is declared is clean, the one where it’s missed out is not clean. Looking at CPU usage suggests gstreamer is doing some CPU rather than just GPU work in both cases, but CPU usage is similar between the 2 with a max of around 35% usage on 2 cores, and low usage on one or two more cores.

Despite thos I think I’m going to take the “it’s not broken so don’t fix it” approach and do no more lest it breaks…

2 Likes