Stream from your #RaspberryPi camera module using mjpg_streamer

After many hours trying to get streaming working with the PiCam, I found this solution on Miguel Grinberg’s blog. It uses mjpg_streamer to stream stills from the camera. You basically set up your camera to write single pictures to /tmp in timelapse mode and then mjpg_streamer pseudo-streams from the single image file.

You can read how to do it here.

When I did it, I ended up with a black picture. I believe this has to do with the speed at which the photographs were taken. My eventual script to start the stream was as follows:

mkdir /tmp/stream 2>/dev/null
nohup raspistill --nopreview -w 640 -h 480 -q 5 -o /tmp/stream/pic.jpg -tl 500 -th 0:0:0 -t 9999999 &
LD_LIBRARY_PATH=/usr/local/lib mjpg_streamer -i " -f /tmp/stream -n pic.jpg" -o " -w /usr/local/www" &

I teamed this streaming solution up with my PiRingo Christmas decoration so that people controlling the decoration could see it in action. I’ve yet to open this up to the public as I need a way of fixing the camera above the decoration. The cable is being a bit of a sod as it’s terribly springy!

3 comments for “Stream from your #RaspberryPi camera module using mjpg_streamer

  1. 21 December 2013 at 9:46 am

    Interesting idea. You could get some of that white flat cat 5 cable and dye it a color to match, and it should cure your springy cable dilemma.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.