After a long painful time I finally got my Logitech Quickcam Pro 5000 running for streaming on my Ubuntu Intrepid server. As streaming software I used Motion, an intelligent streaming server that is able to detect motion and only stores images if something happens that is worth imaging.
I myself had a hard time to get it running. I first tried to run it on SuSE Linux 10. But failed because of a series of problems. Then I tried running it on Ubuntu Linux 8.10. Ubuntu has a precompiled package for Motion. The tool is V4L2 aware and is known to work with the uvc-video driver, which is needed for the Quickcam.
After installing and starting motion with
> apt-get install motion
> /etc/init.d/motion start
I
immediately got some first results. But my first feelings of euphoria
quickly vanished, when I tried to increase the tiny resolution from
176x144 to 320x240.
Nothing changed and in the /var/log/syslog I found the following result:
motion: [1] Supported palettes:
motion: [1] 0: MJPG (MJPEG)
motion: [1] 1: YUYV (YUV 4:2:2 (YUYV))
motion: [1] Test palette YUYV (320x240)
motion: [1] Adjusting resolution from 320x240 to 176x144.
The logfile shows that Motion is not using the MJPEG palette which would allow much higher resolutions than the YUYV, which has 176x144 at maximum.
After digging around I figured out that Ubuntu packages of Motion are pretty much outdated. The Ubuntu package is of version 3.2.9-7. Here http://www.lavrsen.dk/twiki/bin/view/Motion/WebHome you can find a newer version 3.2.11 of Motion that claims to fix the palette problem above. There is a new config item in /etc/motion/motion.conf that allows to predefine the MJPEG palette:
v4l2_palette 2
So I compiled the new version from source and restarted Motion with the new settings. But this time it stopped working at all. In the logfile I found the following problem:
motion: [1] Supported palettes:
motion: [1] 0: MJPG (MJPEG)
motion: [1] Selected palette MJPG
motion: [1] index_format 2 Test palette MJPG (320x240)
motion: [1] Using palette MJPG (320x240) bytesperlines 0 sizeimage 42666 colorspace 00000008
motion: [1] VIDIOC_G_JPEGCOMP not supported but it should
motion: [1] found control 0x00980900, "Brightness", range 0,255
... cut off ...
motion: [1] Resizing pre_capture buffer to 1 items
motion: [1] Started stream webcam server in port 8081
motion: [0] Thread 1 - Watchdog timeout, trying to do a graceful restart
motion: [0] Thread 1 - Watchdog timeout, did NOT restart graceful,killing it!
motion: [0] Calling vid_close() from motion_cleanup
motion: [0] Closing video device /dev/video0
motion: [0] Motion thread 1 restart
After digging again I found out that the actual uvc-driver does not support the VIDIOC_G_JPEGCOMP ioctl request. You can find the details here:
http://www.lavrsen.dk/twiki/bin/view/Motion/UvcvideoMjpegPatch
There is no need to patch Motion
itself since the patch is already part of the latest release. But as
stated there the uvc patch still did not find its way into the uvc
sources, so I had to download and patch the uvc sources on my own.
I downloaded the sources from here and applied the uvc patch from above:
http://linux-uvc.berlios.de/#download
Unfortunately the patch did not compile immediately. I also had to tweak the uvcvideo.h header file in the v4l directory. Since the uvc_set_video_ctrl function was not visible to the uvc_v4l2.c code, I added it to the header file and removed the static modifier in the uvc_video.c file.
int uvc_set_video_ctrl(struct uvc_video_device *video,
struct uvc_streaming_control *ctrl, int probe);
I'm not a kernel hacker so I don't know if this is a good fix to
that problem, but at least on my system it was working.
So finally I had to reload the uvcdriver and v4l modules into the kernel. You need to reload all the modules below. In case that you want to replace the official kernel modules, make sure that you replace all of them. But first check the modules manually by loading them in this order:
> insmod v4l1-compat.ko
> insmod videodev.ko
> insmod v4l2-compat-ioctl32.ko
> insmod uvcvideo.ko
I restarted Motion and you will not believe it, it started streaming at the right resolution.
Thanks to all those who made it possible!
Hope this helps everybody, who are struggeling the same way as I did.
Jörn
I can start my Logitech 3000 CAAAm on Linux Ubuntu and I can also see myself on the screen while running Kepote messenger.
I can also type webcam or run XawTV and the camera starts working and showing myself on the scree.
BUT - when I type: /etc/init.d/motion start
the Camera starts working but I don't see myself on the screen!?
How can I get this fixed? what have I missed?
I am not that good in Linux but know my way around it.
Please advise.
Thanks,
Masood
motion is a streaming server. This means it is not meant for viewing the image directly on your screen. Instead you can use it to create videos on disk or you can use a web browser to watch it remotely.
Try to open a web browser with this url "http://localhost:8081"
Then you hopefully will see yourself in the browser. You can enable motion so that you can connect remotely. Look for the "webcam_localhost" config item in motion.conf and set it to "off". After restarting motion you can watch the stream from any computer.
it seems that I have a similar problem with my logitech quickcam Pro 9000. I tried to get it running with fswebcam and this didn't work with the mjpeg-palette. So I tried your workaround and built a new uvcvideo.ko which replaced the original one. But now there is no /dev/video0 anymore
Chris
no problem. There is always a way back
Next time better do not replace the modules until your sure that they are working!</br>
Ok. Now lets see whats wrong? Please do a "lsmod |grep uvc" and see if the module was loaded at all.
My first guess is that you did not replace all the modules listed above. They all are rebuild and needed to make uvcvideo running.
If you replaced all the files or the driver was not loaded successfully, unloaded all the modules again (rmmod). Then go to the directory where you compiled the uvcdriver and there into the subdirectory v4l. Now load all the modules as listed above, but load the uvcvideo module with this command: "insmod uvcvideo.ko trace=15".
Now you can see more detailed information in our syslog. Perhaps this gives us a hint whats going wrong.
Don't know how it behaves today, but I had a Quickcam Pro under Windows some years ago and it was the same behaviour there. So before you buy Windows make sure that this has changed - but I doubt it.
If this still does not work. Look into your syslog if there is a hint that helps to understand the problem.
I was using an old 1.1 USB port. After installing a USB 2.0 PCI card things improved, but would still occasionally drop picture quality.
I noticed that if I stopped motion, played around with another app (e.g. 'cheese' or 'luvcview') then the resolution would be reduced.
Finally, and not very scientific, but I found on several occasions just rebooting, or sometimes removing and re-inserting the cable, fixed things!
(particularly from "After digging again I found out that the actual uvc-driver does not support the VIDIOC_G_JPEGCOMP ioctl request. You can find the details here:"
I can't seem to figure out how to patch the file (then subsequently compile a new uvc. Thanks.
If you still try to find a solution. It might be good news to you that the latest Ubuntu versions (at least 9.10) seem to work without any modifications of the uvc driver.