10.11.2008

My skype for linux hack

I use skype for being in touch with my relatives in Hungary. It is not very unusual, but I do it on linux (actually now on fedora 8). In November of 2007 Skype released the first beta versions of their program for linux, which have supported the video transmissions. I started to experiment immediately, since before that we had really lacked this feature. Unfortunately I have an unsupported Logitech QuickCam Express webcam: ID 046d:0870. This old webcam uses the qc-usb driver, and gives picture format which is not suitable for the skype program. Luckily the trick has arrived soon, with the tool called gstfakevideo I can use the cam for video conferencing. So I had everything together, but there were tricks to be implemented.
First of all, the gstfakevideo is a gstreamer program, which redirect picture from /dev/video1 source and emulate a /dev/video0 device, which is then suitable for the skype. Unfortunately the gstfakevideo is not very flexible, so I had to solve, that the real devise to be created as /dev/video1 device, instead of video0 which is the default. It is possible to do by using a kernel module parameter: video_nr=1. To automate this I put a lint into the /etc/modprobe.conf file:

options quickcam compatible=2 video_nr=1


So it does the trick. Not I have the device file as /dev/video1, but I cannot read and write as a user, so I have to change the rights with the command:

chmod a+rw /dev/video1

I had to do it as root whenever I wanted to use skype with video. Plus I had to start skype with this command:

gstfakevideo v4lsrc device=/dev/video1 ! ffmpegcolorspace


Obviously not very convenient, but what is worse, my wife cannot repeat all the steps whenever she wants. So I looked for the simplification.
First I solved the case of the read/write permission of the device file. I have created the file: /etc/udev/rules.d/10-custom.rules and I put into that the following lines:

# for the webcam driver permissions

ATTR{name}=="QuickCam USB", MODE="0666", OPTIONS+="last_rule"


By this step udev now happy to create the device files with the permissions: crw-rw-rw-

Next step was a bit harder: I had to create a small shell script, which will start the gstfakevideo program with the correct parameters, and looks like the skype program. The problem with this, that the skype executable should be in the PATH for the wrapper, but if I will call the script also skype, I will confuse everything which one will be started. I have skype installed under the /usr/local/share/skype directory. The actual executabvle is the /usr/local/share/skype/skype file, and I had a symlink as /usr/local/bin/skype. I have removed the symlink and I have put my script called skype into the /usr/local/bin dir. The content of the script:

export PATH='/usr/local/share/skype/':$PATH
/usr/local/bin/gstfakevideo v4lsrc device=/dev/video1 ! ffmpegcolorspace


So nice, now everything works like I want. The skype executable is in the PATH for the gstfakevideo, but for the user the command skype calls the /usr/local/bin/skype, which is the wrapper. And what is even better, when I leave the skype open when log out, the next time I will log in, KDE will start automatically skype, but since in its PATH only the wrapper is available, I will have it with video support!
And great, there is not manual startings anymore, and also my wife can enjoy Skype for linux with video! And again, our parents can see us and our children without manual tricks.

1 comment:

Alex Gold said...

Thanks for the article friend. I found one more article useful to hack Skype over here: Skype Support and Call +1-800-231-4635 USA (Toll Free).