Low frame rate ( Zero 3w and 8m 219)

I’ve been trying to get the advertised framerate out of a Radxa 8m 219 camera with hardware acceleration.

With ffmpeg installed as described here

https://docs.radxa.com/en/zero/zero3/app-development/rtsp?target=ffmpeg

ffmpeg -re -i /dev/video0 output.mkv

This gives me 20fps, without re i get 30 fps which drops to 20 fps.

Stream mapping:
Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (h264_rkmpp_encoder))
Press [q] to stop, [?] for help
[h264_rkmpp_encoder @ 0xaaab18294ef0] Picture format is yuv420p.
[h264_rkmpp_encoder @ 0xaaab18294ef0] Rate Control mode is set to CBR
[h264_rkmpp_encoder @ 0xaaab18294ef0] Bitrate Target/Min/Max is set to 6000000/5625000/6375000
[h264_rkmpp_encoder @ 0xaaab18294ef0] Profile is set to HIGH
[h264_rkmpp_encoder @ 0xaaab18294ef0] 8x8 Transform is enabled
[h264_rkmpp_encoder @ 0xaaab18294ef0] Level is set to 0
[h264_rkmpp_encoder @ 0xaaab18294ef0] Coder is set to CABAC
[h264_rkmpp_encoder @ 0xaaab18294ef0] Quality Min/Max is set to 50%(Quant=30) / 100%(Quant=10)
Output #0, matroska, to ‘output.mkv’:
Metadata:
encoder : Lavf60.3.100
Stream #0:0: Video: h264 (High) (H264 / 0x34363248), yuv420p(progressive), 1920x1080, q=2-31, 6000 kb/s, 1000k fps, 1k tbn
Metadata:
encoder : Lavc60.3.100 h264_rkmpp_encoder
[h264_rkmpp_encoder @ 0xaaab18294ef0] Reconfigured with w=1920, h=1080, format=yuv420p.
frame= 401 fps= 19 q=-0.0 Lsize= 1885kB time=00:00:20.62 bitrate= 748.4kbits/s speed= 1x

It appears to be using the rkmpp encoder so should be hardware accelerated.

Gstreamer gives me blit errors.

Has anyone got higher framerates on this setup ?

Thanks

The tutorial has been updated (https://docs.radxa.com/en/zero/zero3/app-development/rtsp?target=ffmpeg), please try re-flash the image to try

After my testing this tutorial is not compatible with our rk356x series systems, you can follow this tutorial to compile ffmpeg https://github.com/nyanmisaka/ffmpeg-rockchip/wiki/Compilation

1 Like

Thanks @ChenJaly.
It turns out to be the other ways around , if I compile with instructions from GitHub page I get 20 FPS max , using the trap tutorial I can get 60 FPS by setting -s 1920x1080 before input or 15fps at full resolution, which goes against all advise I have received but seems to work.

3 Likes

Can you write a full tutorial on how you got 60 FPS?
I’m still experimenting with Android.

Hi @Viktor_Nikitin ,

I’m using the debian variant of radxaos on a zero 3w. I guess if ffmpeg-rockchip will compile on android then it may work.

All did was follow the

https://docs.radxa.com/en/zero/zero3/app-development/rtsp?target=ffmpeg

tutorial and add -s 1920x1080 befer the input ( as in before -i /dev/video0 ) and up the framerate before the output ( as in -vf "fps=60 after the input ). If i use 4k res i get 15 fps ( which i guess will be the limits of the h264/hevc_rkmpp encoder .

I’ve not looked at running android on any of these sbc’s so have no experience there.

Good luck.

I look at Android as an alternative to Debian and conduct tests in parallel, but it has its own applications. This manual:
https://docs.radxa.com/en/zero/zero3/app-development/rtsp?target=ffmpeg
didn’t help me
(my system is updated via rsetup)

The following manual helped me:

as well as the command:

nohup ./mediamtx &
ffmpeg -f v4l2 -i /dev/video-camera0 -vf “fps=60” -s 1920x1080 -c:v h264_rkmpp -rc_mode AVBR -b:v 20M -minrate 10M -maxrate 40M -profile:v main -level 5.1 -f rtsp rtsp://0.0.0.0:8554/stream

Although it seems like our sensor fps=60 at 1920x1080 does not support, but everything seems to work, which is strange.

I had similar results using that tutorial.
I’m using the 8m 219 camera (imx 219 sensor) .

The only difference between this and the radxa rtsp tutorial seems to be the rga lib, so maybe this was an issue for me.

Clean os install and the rstp tutorial worked for me, or at least appears to work.

The way you describe gave me between 7 and 15 fps with ffmpeg , i get up to 20 fps with gstreamer.
rstp tutorial gave me 60 fps at 1080 , 15 at 4k.

Good luck.


have you tried this

ffmpeg -f v4l2 -s 1920x1080 -i /dev/video-camera0 -vf “fps=60” -pix_fmt yuv420p -c:v h264_rkmpp -rc_mode AVBR -b:v 20M -minrate 10M -maxrate 40M -profile:v main -level 5.1 -f rtsp rtsp://0.0.0.0:8554/stream

which is closer to what i have been using.

@Viktor_Nikitin and @ChenJaly

I had to install a similar setup on another box and have realized that you have to mix and match both tutorials to get this working … ?

If you install mpp by following the first part of this tutorial

i.e.

Build MPP

mkdir -p ~/dev && cd ~/dev
git clone -b jellyfin-mpp --depth=1 https://github.com/nyanmisaka/mpp.git rkmpp
pushd rkmpp
mkdir rkmpp_build
pushd rkmpp_build
cmake
-DCMAKE_INSTALL_PREFIX=/usr
-DCMAKE_BUILD_TYPE=Release
-DBUILD_SHARED_LIBS=ON
-DBUILD_TEST=OFF

make -j $(nproc)
make install

DO NOT INSTALL DRM from this tutorial ( well , it didn’t work when i did it this way )

Then follow this

It works for me on zero 3w, if I dont do the mpp compilation I get seg faults from ffmpeg, if I use the rockchip-ffmpeg drm compilation I dont get more than 20fps.

Russ

You may need to install the compilation dependencies at https://docs.radxa.com/en/rock5/rock5b/app-development/rtsp#installation-of-compilation-dependencies first, then compile rkmpp and rga according to https://github.com/nyanmisaka/ffmpeg-rockchip/wiki/Compilation Compile rkmpp and rga to override the dependencies we just installed, then proceed to compile ffmpeg using our tutorials