-
RPi Camera RTSP Setup
The
rpicam.cfgfile holding the parameters for the Raspberry Pi watching the Prusa MK 4 printer:bitrate=2000000 framerate=15 timeout=0 nopreview= codec=libav libav-format=mpegts width=1280 height=720 rotation=180 roi=0.00,0.00,1.0,1.0 hdr=auto
The RPi camera for the wren nest is just taped to the window, but has a configuration providing a bigger picture:
bitrate=2000000 framerate=15 timeout=0 nopreview= codec=libav libav-format=mpegts width=1920 height=1080 roi=0.00,0.00,1.0,1.0 hdr=auto
The useful pieces:
bitratesets the average data rate, which may be too high for comfort outside your immediate LANframerateneed not be as high as you thinknopreviewprevents a preview picture while startingwidthandheightdo the obvious thing, but don’t try to be too cleverroipicks the image from a specific part of the camera sensor, so you can adjust the image layout if you have a rigidly fixed camerahdrdoesn’t do anything for cheap RPi cameras
Putting all the fiddly config in a file reduces the command line invocation to a mere jawbreaker:
rpicam-vid --config rpicam.cfg -o - | cvlc stream:///dev/stdin --sout '#rtp{sdp=rtsp://:5886/wrens}' &Although you’d want to set that up to run automagically when the RPi starts up, for now I just fire it off as needed through an SSH session, with the ampersand letting it run after that terminal session closes.
The RTSP port (
5886) and stream (wrens) can be anything you like, which comes in handy when squirting streams through port-forwarded firewall pinholes using a router that cannot handle different external and internal port numbers.Useful background info: