RTSP Server

Set up a Real-time Streaming Server (RTSP)

Install the required packages:

raspberrypi ~ $ sudo apt-get install vlc

Run UV4L with the raspicam driver:

raspberrypi ~ $ uv4l --driver raspicam --auto-video_nr --framerate 25
 [core] Device detected!
 [core] Registering device node /dev/video0

Give a real-time scheduling policy to the driver process for better performance (which is the same as running uv4l with sudo uv4l –sched-rr):

raspberrypi ~ $ sudo chrt -a -r -p 99 `pgrep uv4l`

Run the real-time Streaming Server on your Raspberry Pi with the preferred resolution:

raspberrypi ~ $ LD_PRELOAD='' cvlc v4l2:///dev/video0 --v4l2-width 640 --v4l2-height 480 --v4l2-chroma h264 --sout '#rtp{sdp=rtsp://:8554/}'

Now you can connect to your Raspberry Pi from the client, for example (don’t forget the final slash):

mypc ~ $ vlc rtsp://raspberrypi:8554/

where raspberrypi is the host name or IP of your RaspberryPi.

You can set any image property on the fly (while the camera is streaming). For example, to list all the available controls and change the brightness:

raspberrypi ~ $ sudo apt-get install v4l-utils
raspberrypi ~ $ v4l2-ctl --list-ctrls --device /dev/video0
 brightness (int) : min=0 max=100 step=1 default=50 value=50
 contrast (int) : min=-100 max=100 step=1 default=0 value=0
 saturation (int) : min=-100 max=100 step=1 default=0 value=0
 iso (int) : min=0 max=1200 step=1 default=400 value=400
 horizontal_mirror (bool) : default=0 value=0
 vertical_mirror (bool) : default=0 value=0
 sharpness (int) : min=-100 max=100 step=1 default=0 value=0
raspberrypi ~ $ v4l2-ctl --set-ctrl=brightness=50 --device=/dev/video0

A more user-friendly interface for changing the image properties while streaming with this/any method is the Conrol Panel web page coming along with the HTTP Streaming Server plug-in for UV4L.