Raspberry Pi update

It has taken considerably longer than first estimated for Raspberry Pi computers to finally be delivered to customers. Logistics, manufacturing errors and other factors delayed the highly anticipated device time and again, but I’m happy to report that mine arrived a couple of weeks ago. This was around the same time things started to get really busy at work, so I’ve only played with it a little so far. Nevertheless, I wanted to post a progress update.


Command line vs. GUI

The recommended Debian image for the Pi comes with a Graphical User Interface. I’ve played with it a bit, but to be honest, I didn’t like it much. The Pi is just too slow to run a GUI at usable speeds (unless someone manages to use the GPU’s power more). The real fun is in getting the Pi to focus on one task. If you’re looking to get decent performance out of the 700 MHz CPU, I’d recommend sticking to the command line.

Raspberry Spi

Ever since my office got burglarized last year, I’ve been looking into low-end camera security systems. So I decided to find out whether the Pi could serve as a webcam server with motion detection, project “Raspberry Spi”. While the main purpose of these little machines is to get people programming, for me it’s more about learning Linux, and discovering new software. This seemed like a really nice thing to try and set up.

Arch Linux

I hooked up my UVC-compatible webcam to the Pi and found that the default Debian Linux setup lacked support for UVC. By now, there’s a firmware updater by Hexxeh that lets you update to a newer version with proper UVC support, but I decided to try Arch instead. And not only does Arch support UVC, it turned out to be a Linux distribution I really like. I’ve been using Ubuntu/Debian almost exclusively for years now, and getting to know Arch was refreshing.

Ffmpeg and Motion

When you start browsing the web for linux webcam software, these two names keep coming up. Ffmpeg, should you somehow be unfamiliar with it, is a command line video and audio converter that does absolutely everything. It converts AVI files to OGV, and it captures webcam video and offers it as a stream. It’s a jack of all trades, and although hard to operate (lost of command line options), it’s the place to start.

Motion uses Ffmpeg, but wraps it in a more user friendly interface (still command line, but with a well-commented configuration file) and adds motion detection. You can set it up in minutes, and I got far better streaming video with it than I got with just Ffmpeg. The downside to this was that it completely fits the needs of my “Raspberry Spi” project. I now have several configs that let the Pi stream live video, capture stills upon movement, or even short videos of said movements. All without really having to get creative.

I’m currently looking into another program, uvccapture, that’s aimed at taking single images from a webcam, and I’m hoping to make it take pictures on demand, through a small website, hosted on the Raspberry Pi itself (Apache runs quite well!). Future projects may well include setting up the Pi as a music jukebox, an OpenELEC or Raspbmc media center, or just to play Quake III :).

21 Comments

  1. The Raspberry Spi is exactly why I bought a RaspberryPi (yet to receive mine). Have you had any success on this?

    Comment by Ali — July 11, 2012 @ 1:47 pm

    • Yes, I’ve got it up and running, giving me a live video feed, and taking series of still pictures upon detected motion. All this is very easy to set up. Motion is an excellent tool. I’ve also installed Apache and created a small web page that shows the last couple of images. Very easy to do, and lots of fun.

      The feed maxes out at 3-4 frames per second (800*448 pixels, MJPEG compression), but looks great.

      If I decide to really use this as a security system (which would require me to basically give up all other projects I have in my head for the Pi and permanently install it in my office), I’d also want to figure out how to upload images and video to a server, and send alarm emails. I haven’t gotten to that yet, but it’s definitely possible.

      Comment by Roy — July 11, 2012 @ 3:53 pm

      • If possible I would like to see your motion.conf. I plan on a lightweight ip network camera setup. Any help would be appreciated. thanks, Mark

        Comment by Mark — December 14, 2012 @ 1:51 pm

        • Hi Mark, I’ve unfortunately misplaced my motion.conf file. I seem to have inadvertently overwritten the SD card with Arch on it. Oops. Basically I experimented quite a bit with different resolutions and frame rates until I got it right for my cam. Right now, I’d consider waiting for the official camera module to become available, and see if 1080p streaming is an option then.

          Comment by Roy — December 14, 2012 @ 6:35 pm

  2. Wow the Spi project looks great! If you manage to save the data on a SDcard or server I would be interested how you have done it.

    Ciao
    Bas

    Comment by Bas — August 6, 2012 @ 7:29 pm

    • Motion saves data on the SD card by default (as it is the Pi’s hard drive). In my case, that means the still images are on the (web) server as well, since I’m running Apache on the Pi. I still have to look into sending out alerts (optionally with attachments) or FTP uploads.

      Comment by Roy — August 8, 2012 @ 12:18 pm

  3. this is probably one of the most amazing product
    look at the size and more important the price
    you can do nearly anything with it, I used mine to make a personal http/ftp/sql/svn/samba server

    Comment by john — August 24, 2012 @ 5:44 pm

  4. Hi Roy,

    Is it possible for you to share you source code, i am interested in a similar project to this. I am using Arch Linux OS in the Raspberry Pi.

    Comment by tester — September 6, 2012 @ 5:05 pm

    • I haven’t really written any source code, but I’ll happily share the motion config file I’m using.

      Comment by Roy — September 10, 2012 @ 1:30 pm

  5. Roy, does motion allow for recording at 15 (or more) fps?

    Comment by Crazy Dave — September 12, 2012 @ 2:28 am

    • I think so, but not at decent resolutions. I’m getting 3-4 fps at 800*440 pixels. I hope someone will soon get the hardware h264 encoding working, so we can get HD streams at high fps rates.

      Comment by Roy — September 13, 2012 @ 1:28 pm

  6. Btw, thx for the great guide!

    Comment by Crazy Dave — September 12, 2012 @ 2:29 am

  7. I got previously good results with http://www.zoneminder.com/ did you test it as well?

    Comment by daevu — September 12, 2012 @ 11:42 am

    • No, I haven’t. Definitely worth a try. Thanks!

      Comment by Roy — September 13, 2012 @ 1:26 pm

  8. hii..

    sry if i am posting in wrong thread..
    i am trying to setup my usb web cam with raspberry pi on wheezy raspbain ..but i am unable to do tha.. m getting an error

    No input was specified,using first.
    unable to find compatible palette format.

    any help…

    Comment by jack — September 17, 2012 @ 1:41 pm

    • Are you using a UVC compatible camera? Linux can be picky.

      Comment by Roy — September 20, 2012 @ 12:05 pm

  9. Roy.

    How has your camera been running the past few days?

    I just got my RPi, installed Arch, installed motion and it starts fine. But it conks out after a minute or 2. In the RaspberryPi.org forum, other users are saying some kind of bug was introduced in a recent kernel update.

    http://www.raspberrypi.org/phpBB3/viewtopic.php?f=38&t=17308

    Just wondering if you were experiencing the same sort of problem.

    Thanks for the post. Arch on the RPi rocks!

    Comment by whatshisname — September 21, 2012 @ 4:26 am

    • Following up on my post and for general posterity’s sake. I failed to mention I’m using a Logitech C260 web cam. I think my problem revolves around that one particular web cam. I fired it up again today to see if it would work. It starts fine. Then crashes in 5 minutes.

      Comment by whatshisname — September 29, 2012 @ 8:01 pm

  10. Hi Roy,

    Yes i am using UVC compatible camera, I solved the problem, this was coming because some packages were missing, i upgraded my kernel using
    > apt-get upgrade -y
    and after rebooting it works properly…
    Thank u for ur comment…:)

    Comment by jack — September 21, 2012 @ 11:20 am

  11. Hi Roy,

    I was wondering if you could use the RPi and a standard UVC compatible HD camera just to stream the camera feed over the network? Essentially, nothing done in the Raspberry PI except for forwarding that data stream from USB to Ethernet.

    Comment by Arno — October 21, 2012 @ 1:24 am

  12. I did something similar to your spi project but instead of using a webcam I’m using an old Android phone as an ip camera. This has worked out really good.

    As a side not I first tried Zoneminder but could not get good performance on the pi.

    Comment by saltcreep — March 26, 2013 @ 6:26 pm