Help - Search - Members - Calendar
Full Version: how to use rgb camera on 64 bit w\out gstfakevideo
Skype Community > English > Skype for Linux
aplesch
Here are first quick announcement that it is possible to use and old

ID 046d:0840 Logitech, Inc. QuickCam Express

on 64bit linux (gentoo, 2.6.23 kernel) without gstfakevideo. gstfakevideo was too hard to get working because it requires all of gstreamer as 32bit libraries, and these are on gentoo and probably most other distros not offered as emul libraries for 64bit systems.

I had found

http://forum.skype.com/index.php?showtopic=108225

which mentions the kernel module avld as an alternative to gstfakevideo when used with mencoder. This works with a bit of patching also for 64 bit systems.

The problem is that the old quickcam express is rgb camera and skype only accepts the yuv color format for its video streaming. The idea then is to use mencoder to convert the quickcam device output to yuv420p aka i420 and pipe it back to a new video device provided by avld.

The main road block was to find out that avld module did not do ioctl32 compatibility.

Later more on how to modify the avld source code, and how the mencoder invocation works.

Andreas
aplesch
Here are more details.

as root:
1) get quickcam express working: use qc-usb driver

http://qce-ga.sourceforge.net/

install driver, this will make /dev/video0

[gentoo: $ emerge qc-usb]

test with: $ gqcam -v /dev/video0

enhance with

doublebuffer:
$ qcset /dev/video0 compat=2

better colors:
$ qcset /dev/video0 equalize=1

This helps a lot and is very recommended in low light situations.

2) get avld:

http://allonlinux.free.fr/Projets/AVLD/

This kernel module needs to modified and compiled. Both are easy to do. It was recently updated, so now only one line needs to added.

Unpack:

$ tar jxvf avld_0.1.3.tar.bz
$ cd avld_0.1.3

Edit video_device.c:
Toward the end of of the file, at the beginning of the LINUX KERNEL section there is this definition:

static struct file_operations v4l_fops = {
owner: THIS_MODULE,
open: v4l_open,
release: v4l_close,
read: v4l_read,
mmap: v4l_mmap,
write: v4l_write,
ioctl: v4l_ioctl,
llseek: no_llseek,
};

Add this line:

compat_ioctl: v4l_compat_ioctl32,

so it reads:

static struct file_operations v4l_fops = {
owner: THIS_MODULE,
open: v4l_open,
release: v4l_close,
read: v4l_read,
mmap: v4l_mmap,
write: v4l_write,
ioctl: v4l_ioctl,
compat_ioctl: v4l_compat_ioctl32,
llseek: no_llseek,
};

{Alternatively download patch attached to this note, and do

$ patch -p0 < AP032108.patch} cannot attach file

Then go ahead and compile, and install:

$ make
$ make install

Load the module with the palette parameter set to 1, so it does UYVY

$ modprobe avld palette=1
$ dmesg

Check if it loaded.

Finally, set the frame size which the module will accept and output:

$ echo "width=320 height=240 fps=10" > /dev/video1

It is static, eg. cannot be adjusted programmatically. However, if this is too large/slow just use 160:120 and skype should pick it up.

3) use mencoder to convert to uyvy:

Here is a possible invocation:

$ mencoder tv:// -tv driver=v4l:outfmt=rgb32:width=320:height=240:device=/dev/video0:noaudio:fps=9 -ovc raw -of rawvideo -vf format=uyvy -o /dev/video1 -quiet &> /dev/null &

This will clip the input window from the quickcam to 320:240. This size needs to be the same as accepted by avld. One could also use options to the -vf (videofilter) switch to scale but just clipping is ok for me. mencoder will just run in the background all the time. It does not take much cpu.

One could probably also use gstreamer, eg. a gst-launch pipe but I do not know enough about it. How does one clip or scale and what does ffmpegcolorspace exactly produce ? v4lsrc from /dev/video0 would be the input and filesink to /dev/video1 the output.

4) simply start skype

$ skype

The newest gold version seems to recognize also /dev/video1 if suitable, so it is not necessary to move around the device names.

In the options, the video device should appear as

Dummy video device (/dev/video1)

And the test button now works. As does actual transmission at a call.

Good luck, Andreas
aplesch
I do not seem to be able to attach the patch file but it is really a very simple edit anyways. A.
aplesch
BTW, this workaround should be recognized as what it is. All of this would not be an issue if there would be a native 64 bit version of skype, preferably with internal RGB to YUV support.

That being said, I thank much the skype developers to provide a useful linux version at all. Good job !
aplesch
Had anybody else success with that approach ? Right now I still remember in detail what is involved and may be able to quickly be of assistance. Later, I probably will not. A.
aplesch
Ok, I got a newer cheapo webcam on sale, the Zonet ZVC7100 because I saw mentioned that it works under linux. In fact, it does but it is also a RGB camera. Here are the details:

The latest gspca module recognizes it as:

ID 0ac8:305b Z-Star Microelectronics Corp. ZC0305 WebCam

and has the following to say:

gspca_core.c: USB GSPCA camera found.(ZC3XX)
gspca_core.c: [spca5xx_probe:4275] Camera type JPEG
Vimicro/zc3xx.h: [zc3xx_config:594] Sensor Tas5130 (VF0250)
gspca_core.c: [spca5xx_getcapability:1249] maxw 640 maxh 480 minw 160 minh 120
registered new interface driver gspca
gspca_core.c: gspca driver 01.00.20 registered
gspca_core.c: [gspca_set_isoc_ep:945] ISO EndPoint found 0x81 AlternateSet 7
gspca_core.c: [spca5xx_do_ioctl:2124] Bridge ZC301-2
gspca_core.c: [spca5xx_do_ioctl:2124] Bridge ZC301-2

So it uses the TAS5130 (aka VF0250) sensor, does max. 640x480 and has a ZC301 bridge.

The built-in microphone has to be connected to the microphone in port, it is not USB. But pretty good sound quality. The cables are bit short, just long enough for me to route to the Desktop underneath the desk, and have the webcam next to the screen.

Most troublesome is an extremely bright white LED activity indicator which needs to be covered with some tape, chewing gum, tooth paste or something.

There is a focus ring around the plastic lens.

It is supported by the gspca module, pretty well it seems. The module has the following parameters:

$ modinfo gspca
parm: autoexpo:Enable/Disable auto exposure (default=1: enabled) (PC-CAM 600/Zc03xx/spca561a/Etoms Only !!!) (int)
parm: debug:Debug level: 0=none, 1=init/detection, 2=warning, 3=config/control, 4=function call, 5=max (int)
parm: force_rgb:Read RGB instead of BGR (int)
parm: gamma:gamma setting range 0 to 7 3-> gamma=1 (int)
parm: OffRed:OffRed setting range -128 to 128 (int)
parm: OffBlue:OffBlue setting range -128 to 128 (int)
parm: OffGreen:OffGreen setting range -128 to 128 (int)
parm: GRed:Gain Red setting range 0 to 512 /256 (int)
parm: GBlue:Gain Blue setting range 0 to 512 /256 (int)
parm: GGreen:Gain Green setting range 0 to 512 /256 (int)
parm: compress:Turn on/off compression (not functional yet) (int)
parm: usbgrabber:Is a usb grabber 0x0733:0x0430 ? (default 1) (int)
parm: lightfreq:Light frequency banding filter. Set to 50 or 60 Hz, or 0 for NoFlicker (default=50) Zc03xx only (int)
parm: force_gamma_id:Forced assigning ID of contrast settings (0=default,1,2,3) Zc03xx only (int)
parm: force_sensor_id:Forced assigning ID sensor (Zc03xx only). Dangerous, only for experts !!! (int)

which can be modified when loading the module

$ modprobe gspca gamma=2

or by echoing

$ echo 2 > /sys/module/gspca/parameters/gamma

As mentioned, this a RGB camera, so being on AMD64 I used the avld workaround in the exact same way as above. Then skype did not have problems with it, except for the occasional hick-up, a tear in the video stream.

Possibly related, there is error message every 5 minutes or so when not used in a call but with skype open and every 30 s or so when used in a call:

Mar 25 15:48:09 gspca_core.c: [spca50x_move_data:1611] ISOC data error: [13] len=223, status=-70
Mar 25 15:53:10 gspca_core.c: [spca50x_move_data:1611] ISOC data error: [12] len=223, status=-70
Mar 25 15:59:18 gspca_core.c: [spca50x_move_data:1611] ISOC data error: [3] len=191, status=-70
Mar 25 16:03:13 gspca_core.c: [spca50x_move_data:1611] ISOC data error: [3] len=159, status=-70

This does not appear with skype closed, or mplayer playing the avld video device. So I think this is skype related although it never directly accesses the camera only the avld device.

It is not a major problem except that the log fills up slowly. The message appears also with the gspca parameter debug=0, the default.

Hope this helps somebody, I put in a lot of keywords so this should up on searches,

Cheers, Andreas
aplesch
I figured out how to use gstreamer to replace mencoder, with the zonet zvc7100. It seems to produce a slightly better result, and one does not need to get mplayer if one has gstreamer already. However, it seems to use up a bit more CPU. Instead of

QUOTE(aplesch @ Fri Mar 21 2008, 17:51) [snapback]509459[/snapback]

3) use mencoder to convert to uyvy:

Here is a possible invocation:

$ mencoder tv:// -tv driver=v4l:outfmt=rgb32:width=320:height=240:device=/dev/video0:noaudio:fps=9 -ovc raw -of rawvideo -vf format=uyvy -o /dev/video1 -quiet &> /dev/null &

This will clip the input window from the quickcam to 320:240. This size needs to be the same as accepted by avld. One could also use options to the -vf (videofilter) switch to scale but just clipping is ok for me. mencoder will just run in the background all the time. It does not take much cpu.

One could probably also use gstreamer, eg. a gst-launch pipe but I do not know enough about it. How does one clip or scale and what does ffmpegcolorspace exactly produce ? v4lsrc from /dev/video0 would be the input and filesink to /dev/video1 the output.


use

$ gst-launch-0.10 -v v4lsrc device=/dev/video0 ! video/x-raw-yuv,width=320,height=240,format=\(fourcc\)I420 ! ffmpegcolorspace ! video/x-raw-yuv,width=320,height=240,format=\(fourcc\)UYVY ! filesink location=/dev/video1 buffer-mode=2

The list of of defined gst video type is here:

http://gstreamer.freedesktop.org/data/doc/...ble-video-types

This, of course, still requires avld, the same way as with mencoder.

One could probably avoid the colorspace conversion from I420 to UYVY by editing avld source to replace occurrences of UYVY with I420.

I was surprised that gst v4lsrc element reports I420 format but perhaps that is its standard output format and it automatically does the first format conversion, from rgb to i420. v4l-info reports rgb24.

The greatest advantage of using gstreamer is probably that it has the great effecttv plugins.

chr
Thanks for the info in this thread. I (ab-)use it to use my nokia cell phone as a webcam via wifi, movian and avld. Works not that bad, just some 2-3 secs delay...
aplesch
QUOTE(chr @ Fri Mar 28 2008, 01:48) [snapback]511408[/snapback]

Thanks for the info in this thread. I (ab-)use it to use my nokia cell phone as a webcam via wifi, movian and avld. Works not that bad, just some 2-3 secs delay...


You are welcome. Sounds interesting. For the probably not too many who are in a similar situation, do you want to share how it is done ? A.
chr
QUOTE(aplesch @ Fri Mar 28 2008, 04:38) [snapback]511429[/snapback]

You are welcome. Sounds interesting. For the probably not too many who are in a similar situation, do you want to share how it is done ? A.


i made an outline, but i started a new thread in case really somebody is interested
aplesch
QUOTE(chr @ Fri Mar 28 2008, 06:39) [snapback]511445[/snapback]

i made an outline, but i started a new thread in case really somebody is interested

Cool. I think it demonstrates what is possible by using linux. A.
Sook_Nuz
Ok - followed guide exactly... am runnung Ubuntu hardy 8.04 64bit ... all went fine till i launched skype and went to "test" video.... skype just automatically quits..

am using a Logitech Quickcam express ID 046d:0840
kja
Hi,

I am so glad there is a solution for this!

I've been trying to get it to work but I keep getting this error when I run the gst-launch line:

gst-launch-0.10 -v v4lsrc device=/dev/video0 ! video/x-raw-yuv,width=320,height=240,format=\(fourcc\)I420 ! ffmpegcolorspace ! video/x-raw-yuv,width=320,height=240,format=\(fourcc\)UYVY ! filesink location=/dev/video1 buffer-mode=2
Setting pipeline to PAUSED ...
ERROR: Pipeline doesn't want to pause.
ERROR: from element /pipeline0/v4lsrc0: Could not negotiate format
Additional debug info:
gstbasesrc.c(2359): gst_base_src_start (): /pipeline0/v4lsrc0:
Check your filtered caps, if any
Setting pipeline to NULL ...
FREEING pipeline ...

Any ideas on how to sort the format error ?

Cheers
(Fedora 9 x86_64, 046d:0850 Logitech, Inc. QuickCam Web)
Sook_Nuz
QUOTE (Sook_Nuz @ Sun Jun 1 2008, 06:23)
Go to the original post
Ok - followed guide exactly... am runnung Ubuntu hardy 8.04 64bit ... all went fine till i launched skype and went to "test" video.... skype just automatically quits..

am using a Logitech Quickcam express ID 046d:0840


here's a output of what happens..

Skype V4L: Failed to query capabilities: Invalid argument
Starting the process...
Skype Xv: Xv ports available: 32
Skype XShm: XShm support enabled
Skype Xv: Using Xv port 280
Skype Xv: No suitable overlay format found
Aborted
aplesch
QUOTE (kja @ Sun Jun 1 2008, 16:48)
Go to the original post
Hi,

I am so glad there is a solution for this!

I've been trying to get it to work but I keep getting this error when I run the gst-launch line:

gst-launch-0.10 -v v4lsrc device=/dev/video0 ! video/x-raw-yuv,width=320,height=240,format=\(fourcc\)I420 ! ffmpegcolorspace ! video/x-raw-yuv,width=320,height=240,format=\(fourcc\)UYVY ! filesink location=/dev/video1 buffer-mode=2
Setting pipeline to PAUSED ...
ERROR: Pipeline doesn't want to pause.
ERROR: from element /pipeline0/v4lsrc0: Could not negotiate format
Additional debug info:
gstbasesrc.c(2359): gst_base_src_start (): /pipeline0/v4lsrc0:
Check your filtered caps, if any
Setting pipeline to NULL ...
FREEING pipeline ...

Any ideas on how to sort the format error ?

Cheers
(Fedora 9 x86_64, 046d:0850 Logitech, Inc. QuickCam Web)


There really is not too much info to be able to comment. Does the Quickcam work without skype ? Is it on /dev/video0 ? What does dmesg report after you load the kernel modules ?

Cheers, Andreas
aplesch
Here is my latest gstreamer pipe in case somebody finds it useful:
CODE
gst-launch-0.10 v4lsrc device=/dev/video1 ! videobalance saturation=1.5 ! ffmpegcolorspace ! video/x-raw-rgb ! ffmpegcolorspace ! video/x-raw-yuv,width=320,height=240,format=\(fourcc\)UYVY ! filesink location=/dev/video0 buffer-mode=2
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.