video capture in OF v0.06

Hey I hadn’t had a chance to congratulate you guys on thew new release.
A lot of the new changes are great. I’ve got a couple of problems with video capture in linux though.

  1. Using the unicap libraries I am no longer able to capture from a firewire camera that was recognized in OF 0.05 with the unicap libraries.

  2. I have a usb webcam that was not recognized by unicap before but was recognized by V4L in OF 0.05. Now if try to comment out #define OF_SWITCH_TO_UNICAP_FOR_LINUX_VIDCAP I get a strange error “ofUtils.cpp|44|error: ‘gettimeofday’ was not declared in this scope|”
    This line of code is inside the ofGetSystemTime( ) method of ofUtils.cpp. Wierd. :?

hi jaime

can you add this line at the beginning of the setup:


and post the output of the camera.

also can you try if it works with the last release of ucview

going to take a look at v4l problems

on the output I see.

listing available capture devices

Video device 0:
Video device 1:
Video device 2:
Video device 3:
Video device 4:
…(goes on to device 63)

OF_ERROR: ofUCUtils: Error opening device 0:
OF_VERBOSE: GLUT OF app is being terminated!

That’s all I get.
I can see the firewire webcam with the latest ucview.
I cannot see the usb webcam with ucview but I do see it with camorama and other v4l viewers.

I am doing these particular tests this with Ubuntu 8.10 by the way.

hey jaime so somenone told me about this same error some days ago, don’t know exactly what it’s related but it was solved by substituting the libraries in libs/unicap with the ones in 0.05

Ok. Changed name of OF_0.06 libs/unicap folder to libs/bad_unicap and copied the OF_0.05 libs/unicap folder in.
That definitely fixed my problem with unicap. I can see my my firewire camera fine now.
I still get that strange error when I try to use v4l though.

ofUtils.cpp|44|error: ‘gettimeofday’ was not declared in this scope|

hey jaime

to solve this, in ofUtils.cpp line 4 substitute:

#if defined(TARGET_OF_IPHONE) || defined(TARGET_OSX )   


#if defined(TARGET_OF_IPHONE) || defined(TARGET_OSX ) || defined(TARGET_LINUX)  

also in ofVideoGrabber.cpp line 1070, substitute:

ofLog(OF_LOG_NOTICE, "choosing device "+dev_name+"");  


ofLog(OF_LOG_NOTICE, "choosing device %s",dev_name);  

will solve this for 0.061

Perfect. Those changes fix it. Video cature is working for me both with unicap and v4l again. Thanks! :smiley:


I have changed the folder unicap (Changed name of OF_0.06 libs/unicap folder to libs/bad_unicap and copied the OF_0.05 libs/unicap folder in. That definitely fixed my problem with unicap.) and now I have video in OF, but only with the web cam that comes with the Laptop.

I have an HP Pavillion dv6000. Its web cam works fine, but when I try to connect and set up another web cam I got an error: OF_ERROR: ofUCUtils : Format not suported

This is the output I have using device 0 or 1:

listing available capture devices

Video device 0: CIF Single Chip (0000:00:02.0)
Video device 1: USB Camera (093a:2624) (0000:00:02.0)
Video device 2: HP Webcam (0000:00:04.1)

enumerate: 8000000
Total count method 1: 4 Brightness exposure Auto Gain gain
Total count method 2: 4
OF_NOTICE: ofUCUtils: Using device /dev/video2
OF_NOTICE: ofUCUtils: Using module v4l2
OF_NOTICE: choosing device 0: CIF Single Chip (0000:00:02.0)
OF_NOTICE: ofUCUtils : Available formats for this device:
OF_NOTICE: ofUCUtils : 0: P207 ( P207 ), min size: 176x144, max size:352x288, de
fault size: 640x480
OF_VERBOSE: ofUCUtils: available sizes for this format:
OF_VERBOSE: 176x144
OF_VERBOSE: 352x288
OF_ERROR: ofUCUtils : Format not suported

I test the cameras in Windows and they work fine.

Any advise?


hi fer

can you test your camera with ucview:

if it doesn’t work with ucview it won’t work with oF. also your camera seems to be reporting really weird sizes. can you try changing the capture size from 320x240 to 640x480. i’m suspecting the problem can be there.


Hi, arturo.

thanks for your reply.

I changed the capture size with the same results.

Then, I tried to install the ucview in Ubuntu 9.04, but I had some problems. So, instead of compile the source I looked at the repos and I found the ‘luvcviwe’.

Runing luvcview I have the following:

$ luvcview -d /dev/video1

SDL information:
Video driver: x11
A window manager is available
Device information:
Device path: /dev/video1
ERROR opening V4L interface: Permission denied

And with a python script I have to use the camera:

HIGHGUI ERROR: V4L: index 1 is not correct!
Error opening capture device

:- I have an old logictech web cam and a Genius Messenger 310.

hey fer

there’s instrctions on how to setup ubuntu repositories for unicap and ucview here:

Thanks, I have ucview in the repositories, but with the Genius camera I have this…

$ ucview

(ucview:21920): GConf-CRITICAL **: gconf_client_set_string: assertion `val != NULL’ failed

** (ucview:21920): WARNING **: Failed to create ‘/home/labdielcom/.ucview/plugins’

** Message: Could not convert format: PJPG 47504a50 to RGB3 33424752

** Message: Could not convert format: PJPG 47504a50 to RGB3 33424752

With the camera of my laptop works fine, but with the others I have that error message, meaning that the camera won’t work in mi linux apps, so I’ve lost my money. I’ll test cameras with this ucview program in the future.

The curious thing is that the camera works with the ‘cheese’ program, that’s why I bought this camera.

Thanks, Arturo.


the problem is your camera uses a compressed format that is not supported by the linux version of the videoGrabber.

there’s a way to make it work. you need a library called libv4l if you have a version of ubuntu greater that 8.04 just:

sudo apt-get install libv4l

or download it from

then you’ll need to compile unicap with libv4l support. from the unicap forums:

…you can configure unicap like this: ./configure --enable-libv4l and install it. This should give you additional YUV and RGB formats in UCView and allow you to get an image.


I’ve got my video input working in UCView, Cheese and TV Time (Ubuntu 9,04 32x), but I still get

OF_ERROR: ofUCUtils: Error opening device 0:

when I run movieGrabberExample. I’ve tried most of the above, and suggestions?


can you post the output if you add:


in setup()

also you can try this:

it’s not an official package but surely it will work. and gstreamer is meant to be the library that will substitute unicap in 007.


I got the same “opening device” error although my camera works with ucview. Gstreamer version seems to work perfectly. Running on ASUS EEE 1000HE w/ built-in webcam. More info:

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 9.04
Release: 9.04
Codename: jaunty

$ uname -a
Linux pikkumusta 2.6.28-12-netbook-eeepc #43 SMP Mon Apr 27 16:06:05 MDT 2009 i686 GNU/Linux