Skype: Video

From OLPC
Revision as of 22:58, 13 January 2008 by Patrick.surry (talk | contribs) (Building gstfakevideo)
Jump to: navigation, search

These instructions outline what I did to get (two-way) video chat working after installing Skype (Public Beta 2.0.0.27). After the basic Skype installation you should already be able to receive video chat; these instructions allow you to send video from the OLPCs camera to the person you're talking to.

I haven't used it extensively but did get a video chat working between an XO and a Mac, although part way through I lost sound - maybe something to do with bandwidth or CPU? If so maybe we could dial down the framerate or something? Hopefully others who know more about all this stuff can contribute their thoughts. (My head is only barely above water at this point given my very limited knowledge of linux, skype, gstreamer, etc.)

Based on a suggestion in one of the OLPC forums, I found some code called 'gstfakevideo' (aka skype video hijacker) which uses the open source gstreamer framework (coincidentally the XO's multimedia platform) to stream an arbitrary video source into Skype.

Installation

The basic recipe is:

  • Install Skype
  • Obtain a compiled version of the gstfakevideo package for the OLPC (see below for details to build or download it)
  • Open a terminal window
  • Move /dev/video0 out of the way (as root):
 su
 mv /dev/video0 /dev/video1
  • Make sure the video pipeline is correct by editing the gstfakevideo script (e.g. vi gstfakevideo) and changing the 'export GST_PIPE=...' line to read:
 export GST_PIPE="v4l2src device=/dev/video1 ! ffmpegcolorspace ! videoscale"
  • Make sure 'skype' is on your path (which it will be if you installed correctly)
  • Run the gstfakevideo script :
 ./gstfakevideo
  • This launches skype normally (after forcing skype to first load the libgstfakevideo.so library which uses the GST_PIPE setting to provide a fake skype-compatible video source at /dev/video0)

At this point you should be able to use skype as usual, but video options are enabled, e.g. click the tiny camera icon once you start a chat to share your video, or modify the video preferences to start video automatically within calls (see Skype Video forum).

Discussion

You can test the video pipeline independently of Skype by trying things like this at a terminal prompt:

 gst-launch videotestsrc \! ffmpegcolorspace \! videoscale \! autovideosink

This should create a test pattern on your XO display. (To quit, press the 'home' button - the key in the top row with circle containing a single dot - and either stop the unnamed activity or return to terminal and press ctrl-C.) Note you need backslashes before the exclamation marks when executing directly in the terminal to escape them, but not in the gstfakevideo script itself. Also the 'autovideosink' element is only needed when testing (it routes the pipeline to your screen, instead of /dev/video0 for skype like the fakevideo library does).

To test your video camera, try a pipeline like this:

 gst-launch v4l2src device=/dev/video1 \! ffmpegcolorspace \! videoscale \! autovideosink

then you should see your own smiling visage. (Same instructions to quit.)

I'm not sure if you need to move /dev/video0 every time you boot the machine (probably?). It seems to be a requirement because the gstfakevideo library can only fake /dev/video0 (so you can't have your 'real' video source there). There is a setting in gstfakevideo to tell it what fake video device to provide but the doc says it doesn't work (I haven't actually tried).

A cleaner setup would probably be to install the gstfakevideo stuff alongside the skype install, and alias 'skype' to kick off the video stuff. But I haven't done that yet. It would also be good to sugarize the whole thing so you could kick off your video skype session from the toolbar. I might have a go at that if no one beats me to it.

Building gstfakevideo

Here's how you can build the gstfakelibrary from scratch. But note that all this work results in a library (libgstfakevideo.so ) that's only 14K in size. So I've posted a zip file on one of the forums which includes the compiled library; you should be able to get it from: http://olpcnews.com/forum/index.php?action=dlattach;topic=471.0;attach=172 (requires registration?). I'll happily post it elsewhere if there's somewhere more sensible, or can provide by email. To use it, get the zip file on to the XO (in my case I just copied it via a USB stick), and then just:

 unzip gstfakevideo.zip

If you do want to build it yourself, I recommend using doing so in a QEMU emulator, since it requires a bunch of dependencies that you probably don't want/need on your real XO:

 yum install subversion
 yum install make
 yum install gcc
 yum install gstreamer-devel

(and probably some others I forgot). Then get the source code and build:

 svn checkout http://gstfakevideo.googlecode.com/svn/trunk/ gstfakevideo
 cd gstfakevideo
 make