A Better Raspberry Pi Streaming Solution

In the June 2016 issue, I described my Raspberry Pi outdoor camera build. Since then, however, I've discovered a different way to stream video from it. Although capturing images with "raspistill" and serving them out via Web server is perfectly fine, I'd prefer to have an actual video stream coming from the little RPi. Thankfully, there's UV4L.

I had to add a line to my sources.list file in order to download the software, but it was well worth it. Add this to your /etc/sources.list file:


deb http://www.linux-projects.org/listing/uv4l_repo/raspbian/
 ↪wheezy main

And then you'll need to add the key:


curl http://www.linux-projects.org/listing/uv4l_repo/lrkey.asc
 ↪| sudo apt-key add -

Once that is done, simply install the program:


sudo apt-get update && sudo apt-get install uv4l uv4l-raspicam \
uv4l-raspicam-extras uv4l-server uv4l-uvc uv4l-xscreen \
uv4l-mjpegstream uv4l-dummy

And finally, you can add a line like this to your crontab that will turn your RPi into a streaming IP camera! These are just the settings I use; check out the man pages for your options:


@reboot /usr/bin/uv4l -nopreview --auto-video_nr --driver
 ↪raspicam --encoding jpeg --quality 90 --metering matrix
 ↪--drc low --width 1280 --height 720 --framerate 10
 ↪--server-option '--port=9090' --server-option
 ↪'--max-queued-connections=10' --server-option
 ↪'--max-streams=5' --server-option '--max-threads=15'

Go to this site to see the various things UV4L provides.

Shawn is Associate Editor here at Linux Journal, and has been around Linux since the beginning. He has a passion for open source, and he loves to teach. He also drinks too much coffee, which often shows in his writing.

Load Disqus comments