Joe Williams home

I recently went on vacation and while we have a cat sitter I wanted to keep an eye on our two cats Mira and Motorboat. This seemed like a perfect use for the RaspberryPi I aquired a few months back. To get this going you only need a few things:

* RaspberryPi (running Raspbian “wheezy”)
* USB video camera (I used this one)
* A working installation of ffmpeg, I built mine from source but that might not be required

Once you have these things, plug in the camera to the RaspberryPi. Afterwards you should see a device at '/dev/video0' or similar. 'dmesg' will likely tell you. First you need to start the server which needs a configuration file like the following:
Using that config run the following command:

'ffserver -f ./ffserver.conf'

Once that is running, you can start the stream using this command:

'ffmpeg -v verbose -r 5 -s 640x480 -f video4linux2 -i /dev/video0 http://localhost:9999/webcam.ffm -an'

Note that '/dev/video0' will need to match what you have on your system. Additionally, to help your RaspberryPi survive streaming video I found prepending a 'nice -n 19' to those commands seems to help system interactivity. Lastly you may also need to 'chmod' the video device or run those commands using 'sudo' to make things work properly.

Now that both those commands are running simultaneously you can open VLC or a different video application and open a video source, specifically a network source. Use a URL like 'http://RASPIPADDR:9999/webcam.mjpeg'. It'll take a second but you should see video from your camera pop up. In my case the video is a little choppy but good enough. That's it!

Helpful link: ffmpeg streaming guide
Fork me on GitHub