Skip to Content

Linux Camera Plug-In Information

 The Camera Plug-in for Scratch on Linux is designed to work with a wide range of USB webcams including those integrated into notebooks. In most cases a webcam should simply work without requiring any further configuration. You cannot break anything by trying any available camera so go ahead and plug one in ("enable" if using an integrated type) and try the "camera" button on the "costumes" tab of any sprite. The "camera" dialog should be displayed showing live video. If the video display is completely black then something is wrong so first a few quick tips that may help...

- Check there is no physical cover on the camera!

- Click "done", unplug the webcam, plug it back in and try again (if you are using an integrated webcam then disable/enable).

- If there is still no video then skip to "Problem Solving" below.

- Wrong video source: disable/unplug all cameras and other video devices then replug/re-enable only the one you want to use.

 

Problem Solving 

Most of what follows does not require expert Linux knowledge but is still best done by whoever is responsible for maintaining Linux on your computer. If you feel confident with Linux then continue reading and check after each step if your camera is now working before moving to the next step...

0. How much is your time worth?

First a little advice from personal experience: Ubuntu forums are a good source of help regardless of your particular Linux distribution and most cameras should work but if you find yourself spending more than an hour trying to get a webcam working then ask yourself how much your time is worth? Then consider spending a few ten's of dollars to get a UVC compliant camera so you can quickly get back to Scratching! Tip: always double check on the Internet that a camera is Linux compatible and problem free before purchasing.

1. Check Linux Video Device

The Camera Plug-in defaults to /dev/video0 (this may change in the future). Other devices such as TV receivers may already be assigned to this device so unplug/disable all video devices and connect/enable just the camera you want to use. Check the output of "lsusb" to see if your camera is mentioned and "dmesg" to see if any problems were encountered. If there are camera related errors or "lsusb" does not show your camera then skip to step # 3.

2. Check Installed Libraries

Scratch uses "Video4Linux" (V4L) to access web cameras. V4L provides a standardised way for applications to communicate with multimedia hardware and is included in recent desktop Linux distributions. To support a wide range of cameras Scratch also relies on a library package called "libv4l" (lowercase "L" at the end!) and this should also be included in recent distributions. You can check if libv4l is installed using Synaptic (or similar) or by using the following command:

dpkg-query -W "libv4l*"

Even if libv4l is already installed it may need updating to support newer cameras and/or resolve issues with older cameras. Installing or updating is best done via Synaptic (or similar) or by using the following command:

sudo apt-get install libv4l-0

If there is no libv4l package for your distribution or particular release then check other repositories (for Ubuntu there are also "updates" and "backports" repositories per release). To avoid dependency problems it is generally best to install/update from release-specific online repositories. However, libv4l has few dependencies so repositories for later releases of some distributions may contain a compatible version of libv4l that can be downloaded and installed locally (reportedly true for Ubuntu Hardy 8.04 LTS, check http://packages.ubuntu.com/<RELEASE>/libs/libv4l-0). The following command can be used to install a local package:

sudo dpkg -i localfile.deb

Finally, if you are familiar enough with Linux then consider building from libv4l from source. This has the advantage of getting the latest fixes and camera support but note that the latest version of any software may not always be the most stable!

For more detailed instructions on any of the above consult the documentation for your particular distribution.

3. Check Driver Support

As of August 2009 most desktop Linux distributions include support for literally hundreds of cameras and no additional installation should be required. The two main types of camera driver are "UVC" and "GSPCA" although there are others. Newer cameras are increasingly certified "UVC Compatible" and are relatively inexpensive so check product packaging when buying. Older cameras are often supported via GSPCA drivers but some additional configuration may be necessary. The most useful information to have when checking for driver compatibility is the "Vendor ID" and "Product ID" of your camera, commonly referred to as VID:PID and quoted in colon-separated hex-notation, eg, "0x046d:0x092a". Use "lsusb" with the camera plugged in to get the VID:PID and then use it to do an Internet search to get the latest information for your camera. Sometimes, immediately after plugging a camera in, the output of "dmesg" is needed to help driver developers resolve problems.

4. Further Information

* UVC and GSPCA drivers (and possibly others) are included in recent Linux kernels so manual installation should *not* be required. One source of confusion is that most Linux distributions offer "desktop" and "server" versions but only "desktop" includes such drivers. If you started with a "server" version then later added X and a window manager you may *appear* to have a "desktop" version but this will not be true unless you have also updated the kernel itself to one that includes additional options required by a typically desktop user.

In no particular order..

- Good source of help but may be out of date for your Linux release: 

https://help.ubuntu.com/community/Webcam

 

- More general information and other drivers:

http://www.linuxtv.org/wiki/index.php/Webcams

 

- To check libv4l availability for various Ubuntu releases use:

http://packages.ubuntu.com/ 

...or use:

http://packages.ubuntu.com/<RELEASE>/libs/libv4l-0

...by replacing <RELEASE> with one of the following:

 

hardy 

hardy-updates

hardy-backports

intrepid

intrepid-updates

intrepid-backports

jaunty

 

...also try same using http://packages.ubuntu.com/<RELEASE>/desktop/

 

- libv4l, started by Hans de Goede originally as a Fedora project "Better Webcam Support":

http://fedoraproject.org/wiki/Features/BetterWebcamSupport

- libv4l, first release information from creator Hans de Goede:

http://hansdegoede.livejournal.com/3636.html

- libv4l, developers blog:

http://hansdegoede.livejournal.com/

- libv4l, latest source code:

http://people.atrpms.net/~hdegoede/

 

...while you are there check out: http://people.atrpms.net/~hdegoede/webcams.jpg

- UVC:

http://linux-uvc.berlios.de/ (off-line atm, use google cache)

http://openfacts.berlios.de/index-en.phtml?titleLinux+UVC

 

- GSPCA:

Original home: http://mxhaard.free.fr/index.html

Original camera list: http://mxhaard.free.fr/spca5xx.html

New V4L2 version: http://moinejf.free.fr/