rk3588-gstreamer-encoder

RK3588 MPP/NPU-friendly H.264/H.265 hardware encoder + RTSP

arm64
RK3588GStreamerRTSPrkmpparm64
Overview
Primary hardware
ROC-RK3588 / Orange Pi 5 (arm64)
What it does

Uses Rockchip MPP (rkmpp) via GStreamer to encode camera/video to RTSP with low CPU.

Why it saves time

Avoids manual rkmpp plumbing and kernel driver quirks; one env-config to stream reliably.

Get access

Use StreamDeploy to manage OTA updates, versioned configs, and rollbacks across fleets.

Request access
Dockerfile
ARG BASE_IMAGE
FROM ${BASE_IMAGE:-"ubuntu:22.04"}
ENV DEBIAN_FRONTEND=noninteractive LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8

# Basic deps + GStreamer + MPP userspace
RUN apt-get update && apt-get install -y --no-install-recommends \
    gstreamer1.0-tools gstreamer1.0-plugins-base gstreamer1.0-plugins-good \
    gstreamer1.0-plugins-bad gstreamer1.0-libav v4l-utils curl ca-certificates \
    && rm -rf /var/lib/apt/lists/*

# Expect host to provide /dev/video* and /dev/mpp_service; pass with --device
WORKDIR /app
COPY entrypoint.sh /app/entrypoint.sh
RUN chmod +x /app/entrypoint.sh

ENV CAMERA_DEV=/dev/video0 \
    WIDTH=1280 HEIGHT=720 FPS=30 \
    CODEC=h264 \
    RTSP_PORT=8554 \
    EXTRA_PIPELINE=""

EXPOSE 8554
HEALTHCHECK --interval=30s --timeout=5s --start-period=20s \
  CMD bash -lc 'nc -z localhost $RTSP_PORT'

ENTRYPOINT ["/app/entrypoint.sh"]
entrypoint.sh
#!/usr/bin/env bash
set -euo pipefail
: "${CODEC:=h264}"
if [[ "${CODEC}" == "h265" ]]; then
  ENC="mpph265enc"
  RTP="rtph265pay pt=96"
else
  ENC="mpph264enc"
  RTP="rtph264pay pt=96 config-interval=1"
fi

exec gst-launch-1.0 -v v4l2src device="${CAMERA_DEV}" ! \
  video/x-raw,width=${WIDTH},height=${HEIGHT},framerate=${FPS}/1 ! \
  videoconvert ! ${ENC} ! ${RTP} name=pay0 ${EXTRA_PIPELINE} \
  ! rtspclientsink location=rtsp://127.0.0.1:${RTSP_PORT}/stream