Video encoding on Rock Pi 4B

Hi,

I’m trying to encode USB camera video to H264 using mpphenc and gst-launch running on latest debian stretch build version
https://dl.radxa.com/rockpi4/images/debian/rockpi4-debian-stretch-desktop-arm64-20190730_2022-gpt.img.gz

root@linaro-sdcard:/usr/local/bin# uname -a
Linux linaro-sdcard 4.4.154-90-rockchip-ga14f6502e045 #22 SMP Tue Jul 30 10:32:28 UTC 2019 aarch64 GNU/Linux

I’m getting the following errors when I run my gst-launch pipeline too.

root@linaro-sdcard:/usr/local/bin# ./test_enc.sh
message: output to /home/linaro/2k.ts!
Setting pipeline to PAUSED ...
mpi: mpp version: 5ce1cb85 author: Caesar Wang debian: add rules for mpp with 20190626
mpp_rt: NOT found ion allocator
mpp_rt: found drm allocator
Pipeline is PREROLLING ...
h264e_api: h264e_config MPP_ENC_SET_RC_CFG bps 7776000 [7290000 : 8262000]
mpp_log: Assertion prep->ver_stride == (((prep->height)+(8)-1)&~((8)-1)) failed at h264e_vpu_update_hw_cfg:404
mpp_log: Assertion prep->ver_stride == (((prep->height)+(8)-1)&~((8)-1)) failed at h264e_vpu_update_hw_cfg:404
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
mpp_log: Assertion prep->ver_stride == (((prep->height)+(8)-1)&~((8)-1)) failed at h264e_vpu_update_hw_cfg:404
mpp_log: Assertion prep->ver_stride == (((prep->height)+(8)-1)&~((8)-1)) failed at h264e_vpu_update_hw_cfg:404
mpp_log: Assertion prep->ver_stride == (((prep->height)+(8)-1)&~((8)-1)) failed at h264e_vpu_update_hw_cfg:404

pipeline from test_enc.sh sample script

#!/bin/sh
export DISPLAY=:0.0
#export GST_DEBUG=*:5
#export GST_DEBUG_FILE=/tmp/2.txt

echo "message: output to /home/linaro/2k.ts!"

su linaro -c "gst-launch-1.0 videotestsrc num-buffers=512 ! video/x-raw,format=NV12,width=1920,height= 1080,framerate=30/1 \
    ! queue ! mpph264enc ! queue ! h264parse ! mpegtsmux ! filesink location=/home/linaro/2k.ts"

Found there is a fix for it in video driver 6 months ago,

Did this update make it to this debian build? If not any guidance on building and installing driver from source will be very helpful.

Thanks!

tags: gstreamer mali gst

I think the fix is in the kernel. Rockchip has the fix in the stable-4.4 branch but the ROCK Pi 4 current kernel is based on the release-4.4. We have rebased to the latest Rockchip stable-4.4 kernel, some functions are still in the porting(mainly the raspberry pi display) but I think we can release a package for you to test first.

You can download the kernel package from:

https://dl.radxa.com/users/dev/

Install and reboot, check the test_enc again.

Thanks for new packages and instructions.

I installed them with dpkg -i linux-* and rebooted. It still boots from old kernel.

root@linaro-alip:~# dpkg -i linux-*
Selecting previously unselected package linux-4.4.179-latest.
(Reading database ... 103049 files and directories currently installed.)
Preparing to unpack linux-4.4.179-latest_4.4.179-6-rockchip_arm64.deb ...
Unpacking linux-4.4.179-latest (4.4.179-6-rockchip) ...
Selecting previously unselected package linux-headers-4.4.179-6-rockchip-g246d1b34.
Preparing to unpack linux-headers-4.4.179-6-rockchip-g246d1b34_4.4.179-6-rockchip_arm64.deb ...
Unpacking linux-headers-4.4.179-6-rockchip-g246d1b34 (4.4.179-6-rockchip) ...
Selecting previously unselected package linux-image-4.4.179-6-rockchip-g246d1b34.
Preparing to unpack linux-image-4.4.179-6-rockchip-g246d1b34_4.4.179-6-rockchip_arm64.deb ...
Unpacking linux-image-4.4.179-6-rockchip-g246d1b34 (4.4.179-6-rockchip) ...
Setting up linux-headers-4.4.179-6-rockchip-g246d1b34 (4.4.179-6-rockchip) ...
Setting up linux-image-4.4.179-6-rockchip-g246d1b34 (4.4.179-6-rockchip) ...
update-initramfs: Generating /boot/initrd.img-4.4.179-6-rockchip-g246d1b34
Kernel configuration : earlyprintk console=ttyFIQ0,1500000n8 init=/sbin/init root=PARTUUID=b921b045-1d rw rootwait rootfstype=ext4

Creating new extlinux.conf...
Installing new extlinux.conf...
Setting up linux-4.4.179-latest (4.4.179-6-rockchip) ...
root@linaro-alip:~# clear

Reboot

linaro@linaro-alip:~$ uname -a
Linux linaro-alip 4.4.154-90-rockchip-ga14f6502e045 #22 SMP Tue Jul 30 10:32:28 UTC 2019 aarch64 GNU/Linux

Is there a way to change boot order? I couldn’t find grub menu.

edit your /boot/extlinux/extlinux.conf and check if you have linux-image-4.4.179-6-rockchip entry, make sure linux-image-4.4.179-6-rockchip entry is at the first place.

It does have latest kernel listed but it doesn’t boot from it.

timeout 10
menu title select kernel

label kernel-4.4.179-6-rockchip-g246d1b34
    kernel /vmlinuz-4.4.179-6-rockchip-g246d1b34
    devicetreedir /dtbs/4.4.179-6-rockchip-g246d1b34
    append earlyprintk console=ttyFIQ0,1500000n8 init=/sbin/init root=PARTUUID=b921b045-1d rw rootwait rootfstype=ext4

label kernel-4.4.154-90-rockchip-ga14f6502e045
    kernel /vmlinuz-4.4.154-90-rockchip-ga14f6502e045
    devicetreedir /dtbs/4.4.154-90-rockchip-ga14f6502e045
    append earlyprintk console=ttyFIQ0,1500000n8 init=/sbin/init root=PARTUUID=b921b045-1d rw rootwait rootfstype=ext4

label kernel-4.4.154-88-rockchip-00030-g90239a6
    kernel /vmlinuz-4.4.154-88-rockchip-00030-g90239a6
    devicetreedir /dtbs/4.4.154-88-rockchip-00030-g90239a6
    append earlyprintk console=ttyFIQ0,1500000n8 init=/sbin/init root=PARTUUID=b921b045-1d rw rootwait rootfstype=ext4