Sunday, February 15, 2009

PlayStation 3 Eye web cam working on Ubuntu 8.10!

When I heard about the PS3 Eye cam and what it's capable of, I immediately ordered one for my DIY multi touch table project! It can deliver a staggering 120 frames per second, and it's relatively cheap to other cameras that can do this. I ordered mine for 40 euros. The high frame rate allows for a smaller delay when processing (multi) touch input, see an example here. This beasty doesn't directly work out of the box, you need to get drivers first. In this post I'll be explaining how to get it working on Ubuntu and the problems I faced while installing the driver. If you are looking for drivers for the PS3 Eye on Windows or Mac, see this thread or this thread, respectively.

First, get the gspca modified driver from kaswy. Extract the source to a directory, e.g. ~/src/gspca-ps3eyeMT. Then issue the following command in a terminal:
$ lsmod | grep gspca
If this command gives you any output, you have to unload the module(s) first. The drivers loaded at the time gave me problems because my computer was running for a long time without rebooting. The loaded drivers were older, when I tried to load the new gspca driver, the two conflicted. So to be on the safe side, it's best you not skip this step. This is an example possible output:


(Columns are: Module, Size, Used by)

You want to unload the driver that has a 0 in the third column, this unloads the drivers recursively. It's done like this according to the example:
$ sudo modprobe -r gspca_pac207
Verify the driver is unloaded by doing a
$ lsmod | grep gspca
Now, there should be no output.

If you haven't already, get the build tools for Ubuntu with the following command:
$ sudo apt-get install build-essential
Next, we can start compiling, that's done like this:
$ cd ~/src/gspca-ps3eyeMT
$ make
$ sudo make install
The building process may contain some warnings, but it should finish without errors (some terminology: a warning isn't as bad as an error and warnings should not prevent a successful build).

Now we load the driver, the working modes for the web cam are:
00: 640x480@15
01: 640x480@30
02: 640x480@40
03: 640x480@50
04: 640x480@60
10: 320x240@30
11: 320x240@40
12: 320x240@50
13: 320x240@60
14: 320x240@75
15: 320x240@100 (added 15/02/09 V0.3)
16: 320x240@125 (added 15/02/09 V0.3)
Say we want to use the mode 640x480 pixels at 60 frames per second (mode 04), we issue the following command:
$ sudo modprobe gspca_ov534 videomode=04
This loads the driver and sets the desired video mode. Adjust the video mode to your own preference.

Next, we can plug in the PS3 Eye camera. We can verify that it has been plugged in by doing a
$ ls /dev/video*
before you plug in the camera, and then run it again after it's plugged in. It should display a(nother) video device, e.g. /dev/video0.

To preview the stream, we're going to use VLC, this is an excellent media player, if you don't have it installed, you can simply get it with:
$ sudo apt-get install vlc

Finally, we can open the web cam's video stream:
$ vlc v4l2:///dev/video0
(change /dev/video0 to the correct device if you have more than 1 video device plugged in.)
Voila, you should now have a video feed from the PS3 Eye on Ubuntu! Enjoy!

Update 18-feb-09: new driver V0.3 released by kaswy on 15-feb-09, new video modes added! See this post on how to update.

Side note #1: credit to kaswy for helping me install his drivers. This is the thread on nuigroup.com forums about the PS3 Eye drivers. There is another driver, but kaswy's is the most promising at the moment.

Side note #2: you may unload the drivers with the following command:
$ sudo modprobe -r gspca_ov534
And you may uninstall the drivers by running the following command from the source dir you installed from:
$ sudo make rminstall

25 comments:

  1. This is a great howto, but i keep getting this error in vlc

    [00000409] v4l2 demux error: Failed to wait (VIDIOC_DQBUF)

    any help would be appreciated

    ReplyDelete
  2. Are you able to view the webcam feed using another program, e.g. Skype or Ekiga? Just to verify it's not a VLC problem...

    ReplyDelete
  3. Camorama and skype give me a black screen, vlc is the only one that outputs a specific error message to terminal

    ReplyDelete
  4. Great Walkthrough walks like a charm. On my way to linux multi touch programming

    ReplyDelete
  5. Hello there,

    I get the same errors as AnswerHolder...any solution to this ?

    ReplyDelete
  6. Hi! Unfortenately, I haven't been able to reproduce the error and I don't know what could be causing it. Could you post the sequence of commands you are using? Also please include when you plug in your camera.

    ReplyDelete
  7. Hello there,

    I was able to debug it :) I removed totally the driver.
    I reinstalled and recompiled the driver..and now it works.
    One question remains..in flash cam based pages and in skype the camera image is either full of vertical lines or in skype green.
    How can I solve this ?
    In VLC or Ekiga it works like a charm (no matter what I give it at modeprobe as option for resolution).

    ReplyDelete
  8. Hi, I am trying to use the PS3eye as a cheap cam for capturing 120fps for my research. Do you know how I can record this video and save it as an .avi or another file? I don't use Ubuntu much, is there any program that will save the video from this camera?
    Thanks a lot!

    ReplyDelete
  9. Great instructions - it worked on the first try...

    ReplyDelete
  10. When I try and load the driver I receive this error,

    FATAL: Error inserting gspca_ov534 (/lib/modules/2.6.28-15-generic/kernel/drivers/media/video/gspca/gspca_ov534.ko): Unknown symbol in module, or unknown parameter

    Any ideas?

    ReplyDelete
  11. Great instructions.

    I've installed this driver on Ubuntu 9.04 and it appears to work fine.

    I had problems with stability at first, the camera would disconnect after a few seconds. Changing to a different USB port (on the back of my computer, not the front) fixed that up and it works fine now.

    ReplyDelete
  12. i also got the FATAL: Error inserting gspca_ov534 (/lib/modules/2.6.28-15-generic/kernel/drivers/media/video/gspca/gspca_ov534.ko): Unknown symbol in module, or unknown parameter (see dmesg)
    on ubuntu 9.04

    ReplyDelete
  13. i am trying to install this on a fresh fedora 11 and am getting this error...

    Preparing to compile for kernel version 2.6.29
    File not found: /lib/modules/2.6.29j.4-167.fc11.i586/build/ .config at ./scripts/make_kconfig.pl line 32,
    make[1]: *** No rule to make target '.myconfig' , needed by 'config-compat.h'. Stop
    make[1]: Leaving directory '/home/DANMSTudent/Documents/gspca-ps3eyeMT/v4l'
    make: *** [all] Error 2

    can anyone help with this?

    ReplyDelete
  14. http://bear24rw.blogspot.com/2009/11/ps3-eye-driver-patch.html

    ReplyDelete
  15. Compiled: check
    modules loaded and /dev/video0 appears: check
    upgrade from 8.04 to 8.10 to get vlc that works with v4l2: check
    camera detected by ekiga: check
    v4l2 apps read camera: fail

    all errors seem like this:

    $vlc v4l2:///dev/video0
    .
    .
    [00000410] v4l2 demux error: Failed to wait (VIDIOC_DQBUF)

    ttv has similar timeout error.

    ReplyDelete
  16. Hi, I've tested the video modes 0,1,10 and the work perfectly in Ubuntu 9.04 and 9.10. However, video modes 2,3,4, 11-16 display a "select timeout" message in terminal, in ucview the same modes display an image that changes every 10 seconds or more. Do you lnow how can I solve this problem? Thanks!

    ReplyDelete
  17. i also got the FATAL: Error inserting gspca_ov534 (/lib/modules/2.6.28-15-generic/kernel/drivers/media/video/gspca/gspca_ov534.ko): Unknown symbol in module, or unknown parameter (see dmesg)
    on ubuntu 10.04

    ReplyDelete
  18. Great tutorial! Have anyone successfully make it to work on Ubuntu 8.04 (kernel 2.6.24)?

    I can build and install the driver, but the driver_test and vlc program failed to capture the frame.

    ReplyDelete
  19. For anyone trying to setup the ps3-eye on an embedded board like CompuLab’s Fit-PC2 or Axiomtek's pico820, after installing the 2.6.31-34-fitpc2 from http://www.fit-pc2.com/wiki/index.php?title=Installing_Ubuntu_9.10

    I got it working after some headaches with the above tutorial and these changes:

    instead of:
    sudo apt-get install linux-source
    use:
    apt-get source linux-image-$(uname -r)
    (thanks to roman)

    after running:
    make oldconfig

    do:
    edit the file .config
    search for line: "#CONFIG_USB_GSPCA_OV534 is not set" and replace with "CONFIG_USB_GSPCA_OV534=m"
    save, exit and proceed with the next steps of the tutorial.

    I had to reboot to get the mode 04 (640x480@60fps) working (with some flickering though).

    Hope it helps!

    Regards

    Dasankir.

    ReplyDelete
  20. For the people getting the "Unknown symbol in module, or unknown parameter (see dmesg)" error, dmesg | tail told me that 'videomode' was the unknown parameter.

    I was running it as root. I dropped out of root and tried again using sudo successfully. HTH.

    ReplyDelete
  21. guies.. i want to use my PS3 camera in ubuntu to take photographs in my project. can any1 plz guide me??

    ReplyDelete
  22. halo 4forum is one of the most terrific games. but it has the pretty graphics on ps3 and as
    recovered as it looks surprising on the top of the connexion pc.it sounds are large.
    first person shooter

    ReplyDelete
  23. ps vita facility has lots of the large games that are commonly enjoyed by the gallinacean players beacause these games score a stressed tradition of innovation.
    vita forum

    ReplyDelete
  24. I reinstalled and recompiled the driver..and now it works.
    One question remains..in flash cam based pages and in skype the camera image is either full of vertical lines or in skype green. PS4 Bundle deals

    ReplyDelete