RTSP Raspberry Pi Camera
raspberry pi stream rtsp
Builds the absolutely wonderful
v4l2rtspserver project (https://github.com/mpromonet/v4l2rtspserver) for the Raspberry PI.
The build is fully self-contained in a docker environment and the resulting binary pulled out for use on the host.
Install Docker as described here: https://www.raspberrypi.org/blog/docker-comes-to-raspberry-pi/
curl -sSL https://get.docker.com | sh
Statically compiled binary will appear in the
Enable module to create the
/dev/video0 device for the camera
modprobe bcm2835-v4l2 echo bcm2835-v4l2 >> /etc/modules
ALSA device ID
arecord -L to see device ID for alsa device. In my case it's
My device requires channel count 1
-C 1. It was pretty clear in the logs when that wasn't set
/opt/rtsp-raspi/bin/v4l2rtspserver -C 1 /dev/video0,hw:1
Run as Service
Customize args for
v4l2rtspserver as appropriate.
-C 1 sets audio device to 1 channel which is required for my specific mic. Username and password should probably be set as well.
#!/bin/sh exec /opt/rtsp-raspi/bin/v4l2rtspserver -C 1 /dev/video0,hw:1
[Unit] Description=RTSP Camera Service [Service] User=pi ExecStart=/opt/stream.sh Restart=always RestartSec=30s [Install] WantedBy=multi-user.target
Load the SystemD module
sudo systemctl enable stream sudo systemctl daemon-reload sudo systemctl start stream sudo systemctl status stream
Check logs with
sudo journalctl -u stream
Connect to the stream on another machine with
ffplay -sync ext -fflags nobuffer -framedrop rtsp://192.168.56.31:8554/unicast
See STLs for a case mounting option