ROCK 5B Camera streaming with RTSP / RTMP – 5B

Here are the basic instructions to stream a video from the imx415 camera using rtsp protocol.
For the instructions, i am using Debian 11.5 with X11, but it really does not matter which distro.

ROCK 5B IP: (our server)
Client IP: (our client where we display the camera content)


  • rkmpp encoding capabilities (hw encode enabled)
  • imx477 camera
  • gstreamer with the rkmpp plugin

For learning purposes, i have built the gstreamer rtsp server.

Checking gstreamer encoder:

sudo gst-inspect-1.0|grep -i rock
rockchipmpp:  mppjpegdec: Rockchip's MPP JPEG image decoder
rockchipmpp:  mppvideodec: Rockchip's MPP video decoder
rockchipmpp:  mppjpegenc: Rockchip Mpp JPEG Encoder
rockchipmpp:  mppvp8enc: Rockchip Mpp VP8 Encoder
rockchipmpp:  mpph265enc: Rockchip Mpp H265 Encoder
rockchipmpp:  mpph264enc: Rockchip Mpp H264 Encoder

Build gstreamer rtsp server:

mkdir rockchip/gstreamer/rtsp-server
cd rockchip/gstreamer/rtsp-server/
tar -xf gst-rtsp-server-1.18.4.tar.xz
cd gst-rtsp-server-1.18.4
mkdir build && cd build
meson --prefix=/usr --wrap-mode=nofallback -D buildtype=release -D package-origin= -D package-name="GStreamer 1.18.4" ..
ninja -j4
sudo ninja install
sudo ldconfig

Testing our rtsp server with videotestsrc:

cd example
sudo ./test-launch "( videotestsrc ! video/x-raw,format=NV12,width=1920,height=1080 ! mpph264enc ! rtph264pay name=pay0 pt=96 )"
    stream ready at rtsp://
    rga_api version 1.8.1_[0]

From our client, we check if it is OK, here we use ffplay:

ffplay -rtsp_transport tcp rtsp://

Now we have the video displayed with some patterns.
We can now stream our video:

sudo ./test-launch "( v4l2src device=/dev/video11 io-mode=dmabuf ! video/x-raw,format=NV12,width=1920,height=1080,framerate=30/1 ! mpph264enc ! rtph264pay name=pay0 pt=96 )"
stream ready at rtsp://
rga_api version 1.8.1_[0]

Again, we display the content using ffplay with the same URI:

ffplay -rtsp_transport tcp rtsp://
ffplay version 5.0 Copyright (c) 2003-2022 the FFmpeg developers
  built with gcc 8 (Ubuntu 8.4.0-1ubuntu1~18.04)
  configuration: --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libmp3lame --enable-libopus --enable-libpulse --enable-librsvg --enable-librtmp --enable-libv4l2 --enable-libvorbis --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxcb --enable-libxcb-shm --enable-libxcb-xfixes --enable-libxcb-shape --enable-libxvid --enable-libxml2 --enable-opengl --enable-openssl --enable-gpl --enable-nonfree --disable-librga
  libavutil      57. 17.100 / 57. 17.100
  libavcodec     59. 18.100 / 59. 18.100
  libavformat    59. 16.100 / 59. 16.100
  libavdevice    59.  4.100 / 59.  4.100
  libavfilter     8. 24.100 /  8. 24.100
  libswscale      6.  4.100 /  6.  4.100
  libswresample   4.  3.100 /  4.  3.100
  libpostproc    56.  3.100 / 56.  3.100
Input #0, rtsp, from 'rtsp://': 0B f=0/0   
    title           : Session streamed with GStreamer
    comment         : rtsp-server
  Duration: N/A, start: 0.034367, bitrate: N/A
  Stream #0:0: Video: h264 (High), yuv420p(progressive), 1920x1080, 30 fps, 30 tbr, 90k tbn
  72.28 M-V: -0.005 fd=   2 aq=    0KB vq=  360KB sq=    0B f=0/0 

Have fun!

CPU usage:

Read more here: Source link