Friday 19 November 2010

Webcam videowall

So - a new project. Actually an old one (circa 2008) that I'm making a new start on - a webcam videowall:


When I saw Radiohead at Victoria Park as part of their In Rainbows tour, I was quite taken by their visual show - a big rig of LED columns, and video screens. "It'd be cool to do something like that for a Witches gig", I thought.

I'd messed around a bit with freej, and made some progress, but the interface was a bit of a hassle (or rather;I was too lazy to learn it), and I only had one webcam, so that stalled.


Fast-forward to a couple of weeks back, and using the magic of the GStreamer framework on Linux, a couple of cameras borrowed from work, and some essential help from the GStreamer mailing list, I can feed four webcams into one video stream, using this command:

gst-launch-0.10 v4l2src device=/dev/video0 ! video/x-raw-yuv,width=320,height=240,framerate=30/1 ! alpha ! queue ! videomixer name=mix ! ffmpegcolorspace ! \
  xvimagesink sync=false \
  v4l2src device=/dev/video1 ! video/x-raw-yuv,width=320,height=240,framerate=30/1 ! alpha ! videobox left=-320 border-alpha=0 ! queue ! mix. \
  v4l2src device=/dev/video2 ! video/x-raw-yuv,width=320,height=240,framerate=30/1 ! alpha ! videobox top=-240 border-alpha=0 ! queue ! mix. \
  v4l2src device=/dev/video3 ! video/x-raw-yuv,width=320,height=240,framerate=30/1 ! alpha ! videobox left=-320 top=-240 border-alpha=0 ! queue ! mix.

All the programs needed to make this work are available through Ubuntu's package management, so it was dead easy to install.

The Scene:


The Stream:


The cameras producing the top two corners are much older than the bottom two, hence the poorer quality picture.

I found GStreamer to be a bit of a pain to get started with - it's easy to get something simple running by following examples in the documentation (like showing one webcam), but more complicated pipelines are tricky for the newbie as it can be hard to work out why a pipeline won't run.

Still, that's what learning is all about, and there is plenty of documentation, and a very helpful mailing list (thanks!) - it's just quite complex, so don't expect to pick it up straight away.

Next steps will involve looking at:
  • Performance (some cameras are very laggy, which might be due to the cameras, or might be GStreamer - I don't know yet)
  • Different layouts
  • Filtering the videos to make them look more interesting.

No comments:

Post a Comment