Feb 13, 2011

Linux Webcam Problems

I have recently changed my operating system from windows 7 to ubuntu 10.10 . Everything was great until I tried to install my webcam. I am using an Omega webcam, it was automatically installed, but it doesn't work with skype. I will show you how to do it.



Most webcams use the kernel gspca mod. It could work in cheese or other programs but it could happed that in other programs like skype to fail.
First we have to check if the webcam is recognized by the system. Open your terminal and type: lsusb


poweron@poweron-P5QL-PRO:~$ lsusb
Bus 008 Device 002: ID 09da:0080 A4 Tech Co., Ltd 
Bus 008 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 007 Device 002: ID 0ac8:307b Z-Star Microelectronics Corp. USB 1.1 Webcam
Bus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub


How we can see, the webcam is recognized. Now let's find out what drivers does it use. Here I just guessed that it use gspca.

poweron@poweron-P5QL-PRO:~$ lsmod|grep gspca
gspca_zc3xx            43366  0 
gspca_main             23644  1 gspca_zc3xx
videodev               43098  1 gspca_main
If you get something like this, we can move on. First we have to install libv4l

sudo apt-get install libv4l-0


Now let's type the following command to make a test if the webcam works in skype (skype should be closed before executing this)

LD_PRELOAD="/usr/lib/libv4l/v4l1compat.so" skype 


Skype should start and the webcam should work.
If the test succeed and the webcam works in skype all we have to do is to make this command to work automatically. The easiest way is with a bash script.


sudo touch skype-compat - creates a file called skype-compat
sudo gedit skype-compat - edit the file (do not forget to save before closing)
 
Copy this, save and exit:

#!/bin/bash
SKYPE_BIN_PATH="/usr/bin"
LIBV4L="/usr/lib/libv4l/v4l1compat.so"
LD_PRELOAD=${LIBV4L} skype
exit 0[/b]


Now type the following commands:

sudo cp skype-compat /usr/bin - copy the file in /usr/bin
sudo chown root:root /usr/bin/skype-compat - change the owner to root (not mendatory, 
but all files under /usr/bin have the owner root I recommend this step )
sudo chmod 755 /usr/bin/skype-compat - change the permission so the file can be edited 
 only by root but it can be executed by everyone 
Now left click on Applications -> Edit Menus . Choose Internet and now right click on Skype and choose Properties. In the command line erase all and type : /usr/bin/skype-compat . Click close and that's all.

Now, the webcam works in skype but I have a new problem: it is to dark!
All you have to do is to install Video4Linux. Now go to Video4Linux Control  Panel and play with that values. Do not forgot to change light frequency.

No comments:

Post a Comment