Sunday, January 22, 2012

Skype webcam tip on Ubuntu 10.04

Happy Sunday!

I was messing around with Skype on Ubuntu this morning and realized my webcam didn't produce any video for Skype! I did a little research and got it working and wanted to share the tip.

Note that my webcam *did* work with the "cheese" application. If yours does not, you may need to do some additional research.

The issue seems to be that my webcam is only supported on V4L2 (That's Video-For-Linux-Two), not V4L (Video-For-Linux). Apparently Skype by default only supports V4L.

I found this out with the gstreamer-properties utility (use the video tab).

But, it turns out there is a shared library you can preload with skype which will allow it to use this webcam.

For testing purposes, we're going to run skype from the command line, so fire up a terminal!

You can run skype with the "skype" command, no strange magic there.

To load a separate shared library, we use the "LD_PRELOAD" environment variable.

(Warning: Background ahead)

Linux executables make use of something called dynamically linked libraries. These are often called shared objects or "SO"'s. Not all of the code the executable uses is in the executable itself, for code reuse, we can put it in common libraries that multiple applications share.

When the application is build, it usually specifies what shared libraries it wants to use. When the application is run, the OS will know what libraries to provide it (try it yourself, the "ldd" tools shows you the shared libraries, e.g. ldd /usr/bin/skype).

When the OS goes to look for the shared libraries, it looks in the default location. But, you can over-rule this if you want to using the "LD_PRELOAD" environement variable.

(Background done)

So, to make skype use the webcam, we're going to modify how it's run. Instead of just running the skype command, try this:

32-bit Ubuntu: env LD_PRELOAD=/usr/lib/libv4l/v4l1compat.so skype
64-bit Ubuntu: env LD_PRELOAD=/usr/lib32/libv4l/v4l1compat.so skype

After that, go into the Skype webcam settings and give it a test! Hopefully you'll see your picture. You can also try making a few calls and seeing if it's handled properly.

If it works for you, make it a permanent change by right clicking on the Ubuntu-menu and saying "Edit menu". Find the skype entry, and modify the "Command" (under Properties") to have the environment preload variable set.

After that, run Skype from the menu as usual and hopefully your video works!

To be fair, it's still not the best picture in the world. The lighting goes from dark to washed out periodically and fellow Skypers have told me my video is choppy (even when theirs is smooth on my end). Not sure if there's anything I can do about this on my end yet (the web cam was pretty cheap). Here's hoping you get better picture.

Best of luck!

References:

https://wiki.ubuntu.com/SkypeWebCams
http://ubuntuforums.org/archive/index.php/t-914952.html

4 comments:

  1. Thanks!

    Ever since I upgraded my skype my video stopped working, this fixed it

    ReplyDelete
  2. It can not find the preload. I have installed libv4l-0 but it is not in the location as indictaed by your documentation.

    ReplyDelete
  3. Hi Idso,

    What version of Ubuntu are you running?
    Try searching Google for other possible locations of v4l1compat.so depending on your version.

    Or, in a Terminal, go to the Root level directory and search for the file "v4l1compat.so", e.g:

    find . -name "v4l1compat.so"

    and see if you can find it. This search may take some time, depending on the size of your file system. Best of luck!

    ReplyDelete
  4. Recently installed Ubuntu 12.04...

    First, I had to install the 32-bit version of v4l:

    sudo apt-get install lib32v4l-0

    Then, I found v4l1compat.so here:

    /usr/lib/i386-linux-gnu/libv4l/v4l1compat.so

    so try:

    LD_PRELOAD=/usr/lib/i386-linux-gnu/libv4l/v4l1compat.so skype

    and hopefully that'll work!

    Jason

    ReplyDelete