Friday, February 4, 2011

Virtual webcam for Skype Linux

For two nights I've been smoking on how to use my archaic Logitech Messenger Quickcam with Skype in Linux...

For the complete picture, it has to be mentioned that it works well in XP but there are no drivers for Vista or W7. Either because of this or whatever I did not bother to use it for a couple of years. (Ok, maybe 7.)

I was impressed when I plugged it into my xubuntu laptop and could immediately play with various effects Cheese offered to apply to the video.

Sure enough, Skype did not see the camera input.

SkypeWebCams said that I have to 'fiddle to get the camera working'.
The described 'fiddling' did not work though:
The webcam works automatically in 9.10 (the 2.6.30+ kernels) with the gspca_stv06xx driver, to run Skype with this driver type "LD_PRELOAD=/usr/lib/libv4l/v4l1compat.so skype".


The same page proposed gstfakevideo, which uses gstreamer, virtual camera emulator and some Skype "hijacking". It did not work for me either. But virtual camera was a good idea.

...
...

I found and tried WebcamStudio, which seems to be quite a nice thing but still does not do what I need.

...
...
???

Finally I settled on v4l2loopback - a working! webcam emulator,
and gstreamer plain console utils - incredibly cool stuff!

HOW IT WORKS:
1. Install v4l2loopback kernel modul from (according to README).
https://github.com/umlaeute/v4l2loopback
This will create a virtual camera device (probably /dev/video0).

2. Install necessary gstreamer utils and plugins. (See 3.)

3.
Plug your camera (say it will be located at /dev/video1)
Run:
gst-launch v4l2src device=/dev/video1 ! ffmpegcolorspace ! video/x-raw-yuv,format=\(fourcc\)YUY2 ! v4l2sink device=/dev/video0

(4. If necessary, choose virtual cam in Skype).

The format conversion (format=\(fourcc\)YUY2) is essential here. YUY2 is good for Skype while e.g. YVYU and UYVY are not.

This setup should be the same with any webcam that works with Cheese but fails to work with skype but you may need to use "! videoscale" and "! videorate"
in addition to "! ffmpegcolorspace".

Actually gstreamer allows for much more flexibility when using this approach, i.e.
you may stream movies, desktop, even a combination of several inputs to a virtual cam.

4 comments:

jerous said...

Just for anyone who wants to try this these days. I haven't got it working with skype 2.2 (it happens more, check http://community.skype.com/t5/Linux/New-version-doesn-t-work-with-v4l2loopback/td-p/176764). I found an old Skype 2.0 where this method works. I don't know up until what version it's flakey, though.

moshebagelfresser said...

I too have the same camera and got it to work successfully in Linux Mint 13 Maya 64 Bit. I downloaded and installed Skype 4.0.0.7.1 via http://www.noobslab.com/2012/06/install-skype-40-in-ubuntulinux-mint.html

I made a launcher and used this script in the Command:

bash -c 'LD_PRELOAD=/usr/lib32/libv4l/v4l1compat.so skype'

Unknown said...

My virtual webcam works with some modifications :
http://lebuste.blogspot.fr/2012/10/v4l2loopback-on-skype.html

Unknown said...

yes yes yes....thanks from Italy....you are the best, simply the best... Visit :- Skype Technical Support Also Call +1-800-231-4635 USA (Toll Free).