XO webcam from the command line


The built-in webcam in the XO laptop fascinates me, in the same way parrots are fascinated by mirrors. I like to pick at it to see what I can do. I’ve been trying to find a simple command line invocation to take a picture and I have found it here:

gst-launch-0.10 v4l2src ! ffmpegcolorspace ! pngenc ! filesink location=foo.png

Please note that the first parameter in that list is in all caps V4L2SRC, not V412SRC, as this post points out. That typo caused no little end of annoyance for me.

This command snaps a photo and creates a PNG file called foo.png in the current directory.

The key to understanding video on the XO is learn about GStreamer, a Gnome multimedia interface that works on pipelines. That is, you build up commands with gstreamer like you uses command pipes in shell programming. Obviously, if you’re not familiar with shell programming, GStreamer is likely to be quite opaque for a while.

In any case, GStreamer can be used to capture pictures, video and audio. It can also play audio files and stream video to other servers. Pretty strong ju-ju.

Also see this python hack for making the XO into a spy camera.