ofGstUtils error on Linux

I’m trying to port an app that I built in oF 0.9.4 on OSX to oF 0.11.0 on Linux.

I get this error and I don’t have a clue where it comes from. I see it has something to do with video grabber, but I can’t find a way to see where it comes from.

[ error ] ofGstUtils: setPipelineWithSink(): couldn't create pipeline: could not set property "caps" in element "ofappsink" to "video/x-raw, format=RGB, width=1,024, height=768"`

\\ ...

[ error ] ofGstUtils: error getting device data; module source reported: Device '/dev/video5' is not a capture device.

The devices seem to be detected properly and I have tried different resolutions. I have also tried both integrated camera and USB external cam.

ofVideoGrabberExample runs fine. So I know it comes from my code but it’s too long and complex to post here. The VideoGrabber initializing part is exactly as in the example.

Any ideas on where this may be coming from? Or where to start looking?

I’m on a Thinkpad P53 running Manjaro Linux with NVIDIA RTX 3000.

Cheers!

Hi.
Looks like you’re using the wrong video device…

maybe with /dev/video0 ? Or take a look at your syslog (dmesg -T) to find at which device your webcam is assigned. You can also try with lsusb, to inspect the usb subsystem

HTH

Thanks.
Checking the full log output, I found this:

[verbose] ofGstVideoGrabber: listDevices(): device 0: /dev/video0: Integrated Camera: Integrated C
[verbose] ofGstVideoGrabber: listDevices(): device 1: /dev/video1: Integrated Camera: Integrated C
[verbose] ofGstVideoGrabber: listDevices(): device 2: /dev/video2: Integrated Camera: Integrated I
[verbose] ofGstVideoGrabber: listDevices(): device 3: /dev/video3: Integrated Camera: Integrated I

Not sure why devices are repeated, but it seems like the second instance is the one giving the problem. I checked the ofVideoGrabberExample output log and they are also duplicated there, although it works. So this doesn’t seem to be the problem.

Here’s the full output of the log initializing ofVideoGrabber:

[verbose] ofGstUtils: gstreamer inited
[notice ] ofGstVideoGrabber: Probing devices with udev...
[notice ] ofGstVideoGrabber: Found device 13d3:56bc, getting capabilities...
[notice ] ofGstVideoGrabber: detected v4l2 device: Integrated Camera: Integrated C
[notice ] ofGstVideoGrabber: driver: uvcvideo, version: 329,746
[notice ] ofGstVideoGrabber: Capabilities: 0x84A00001
[notice ] ofGstVideoGrabber: Found device 13d3:56bc, getting capabilities...
[notice ] ofGstVideoGrabber: detected v4l2 device: Integrated Camera: Integrated C
[notice ] ofGstVideoGrabber: driver: uvcvideo, version: 329,746
[notice ] ofGstVideoGrabber: Capabilities: 0x84A00001
[notice ] ofGstVideoGrabber: Found device 13d3:56bc, getting capabilities...
[notice ] ofGstVideoGrabber: detected v4l2 device: Integrated Camera: Integrated I
[notice ] ofGstVideoGrabber: driver: uvcvideo, version: 329,746
[notice ] ofGstVideoGrabber: Capabilities: 0x84A00001
[notice ] ofGstVideoGrabber: Found device 13d3:56bc, getting capabilities...
[notice ] ofGstVideoGrabber: detected v4l2 device: Integrated Camera: Integrated I
[notice ] ofGstVideoGrabber: driver: uvcvideo, version: 329,746
[notice ] ofGstVideoGrabber: Capabilities: 0x84A00001
[verbose] ofGstVideoGrabber: listDevices(): device 0: /dev/video0: Integrated Camera: Integrated C
[verbose] ofGstVideoGrabber: listDevices(): device 1: /dev/video1: Integrated Camera: Integrated C
[verbose] ofGstVideoGrabber: listDevices(): device 2: /dev/video2: Integrated Camera: Integrated I
[verbose] ofGstVideoGrabber: listDevices(): device 3: /dev/video3: Integrated Camera: Integrated I
[verbose] Initializing Cameras...: 
[notice ] ofGstVideoGrabber: Probing devices with udev...
[notice ] ofGstVideoGrabber: Found device 13d3:56bc, getting capabilities...
[notice ] ofGstVideoGrabber: detected v4l2 device: Integrated Camera: Integrated C
[notice ] ofGstVideoGrabber: driver: uvcvideo, version: 329,746
[notice ] ofGstVideoGrabber: Capabilities: 0x84A00001
[notice ] ofGstVideoGrabber: Found device 13d3:56bc, getting capabilities...
[notice ] ofGstVideoGrabber: detected v4l2 device: Integrated Camera: Integrated C
[notice ] ofGstVideoGrabber: driver: uvcvideo, version: 329,746
[notice ] ofGstVideoGrabber: Capabilities: 0x84A00001
[notice ] ofGstVideoGrabber: Found device 13d3:56bc, getting capabilities...
[notice ] ofGstVideoGrabber: detected v4l2 device: Integrated Camera: Integrated I
[notice ] ofGstVideoGrabber: driver: uvcvideo, version: 329,746
[notice ] ofGstVideoGrabber: Capabilities: 0x84A00001
[notice ] ofGstVideoGrabber: Found device 13d3:56bc, getting capabilities...
[notice ] ofGstVideoGrabber: detected v4l2 device: Integrated Camera: Integrated I
[notice ] ofGstVideoGrabber: driver: uvcvideo, version: 329,746
[notice ] ofGstVideoGrabber: Capabilities: 0x84A00001
[verbose] Device: Integrated Camera: Integrated C (/dev/video0)

[verbose] ofGstVideoGrabber: add_video_format(): video/x-raw YUY21,280x720 videoformat: 4 framerates: 
[verbose] 10/1 
[verbose] ofGstVideoGrabber: add_video_format(): video/x-raw YUY2960x540 videoformat: 4 framerates: 
[verbose] 15/1 
[verbose] ofGstVideoGrabber: add_video_format(): video/x-raw YUY2848x480 videoformat: 4 framerates: 
[verbose] 20/1 
[verbose] ofGstVideoGrabber: add_video_format(): video/x-raw YUY2640x480 videoformat: 4 framerates: 
[verbose] 30/1 
[verbose] ofGstVideoGrabber: add_video_format(): video/x-raw YUY2640x360 videoformat: 4 framerates: 
[verbose] 30/1 
[verbose] ofGstVideoGrabber: add_video_format(): video/x-raw YUY2424x240 videoformat: 4 framerates: 
[verbose] 30/1 
[verbose] ofGstVideoGrabber: add_video_format(): video/x-raw YUY2352x288 videoformat: 4 framerates: 
[verbose] 30/1 
[verbose] ofGstVideoGrabber: add_video_format(): video/x-raw YUY2320x240 videoformat: 4 framerates: 
[verbose] 30/1 
[verbose] ofGstVideoGrabber: add_video_format(): video/x-raw YUY2320x180 videoformat: 4 framerates: 
[verbose] 30/1 
[verbose] ofGstVideoGrabber: add_video_format(): image/jpeg 1,280x720 videoformat: 0 framerates: 
[verbose] 30/1 
[verbose] ofGstVideoGrabber: add_video_format(): higher framerate replacing existing format
[verbose] ofGstVideoGrabber: add_video_format(): already added, skipping
[verbose] ofGstVideoGrabber: add_video_format(): image/jpeg 960x540 videoformat: 0 framerates: 
[verbose] 30/1 
[verbose] ofGstVideoGrabber: add_video_format(): higher framerate replacing existing format
[verbose] ofGstVideoGrabber: add_video_format(): already added, skipping
[verbose] ofGstVideoGrabber: add_video_format(): image/jpeg 848x480 videoformat: 0 framerates: 
[verbose] 30/1 
[verbose] ofGstVideoGrabber: add_video_format(): higher framerate replacing existing format
[verbose] ofGstVideoGrabber: add_video_format(): already added, skipping
[verbose] ofGstVideoGrabber: add_video_format(): image/jpeg 640x480 videoformat: 0 framerates: 
[verbose] 30/1 
[verbose] ofGstVideoGrabber: add_video_format(): already added, skipping
[verbose] ofGstVideoGrabber: add_video_format(): image/jpeg 640x360 videoformat: 0 framerates: 
[verbose] 30/1 
[verbose] ofGstVideoGrabber: add_video_format(): already added, skipping
[verbose] ofGstVideoGrabber: add_video_format(): image/jpeg 424x240 videoformat: 0 framerates: 
[verbose] 30/1 
[verbose] ofGstVideoGrabber: add_video_format(): already added, skipping
[verbose] ofGstVideoGrabber: add_video_format(): image/jpeg 352x288 videoformat: 0 framerates: 
[verbose] 30/1 
[verbose] ofGstVideoGrabber: add_video_format(): already added, skipping
[verbose] ofGstVideoGrabber: add_video_format(): image/jpeg 320x240 videoformat: 0 framerates: 
[verbose] 30/1 
[verbose] ofGstVideoGrabber: add_video_format(): already added, skipping
[verbose] ofGstVideoGrabber: add_video_format(): image/jpeg 320x180 videoformat: 0 framerates: 
[verbose] 30/1 
[verbose] ofGstVideoGrabber: add_video_format(): already added, skipping
[notice ] ofGstVideoGrabber: initGrabber(): selected device: Integrated Camera: Integrated C
[notice ] ofGstVideoGrabber: initGrabber(): selected format: 1,280x720 image/jpeg  framerate: 30/1
[notice ] ofGstUtils: setPipelineWithSink(): gstreamer pipeline: v4l2src name=video_source device=/dev/video0 ! image/jpeg,width=1280,height=720,framerate=30/1 ! decodebin  ! videoscale method=2   ! appsink name=ofappsink enable-last-sample=0 caps="video/x-raw, format=RGB, width=1,024, height=768"
[verbose] id: 0	w: 1,024	h: 768
[verbose] Initialized: Integrated Camera: Integrated C w:1,024 h:768 index:0
[verbose] Camera Players: 1
[ error ] ofGstUtils: setPipelineWithSink(): couldn't create pipeline: could not set property "caps" in element "ofappsink" to "video/x-raw, format=RGB, width=1,024, height=768"
[notice ] ofGstVideoGrabber: Probing devices with udev...
[notice ] ofGstVideoGrabber: Found device 13d3:56bc, getting capabilities...
[notice ] ofGstVideoGrabber: detected v4l2 device: Integrated Camera: Integrated C
[notice ] ofGstVideoGrabber: driver: uvcvideo, version: 329,746
[notice ] ofGstVideoGrabber: Capabilities: 0x84A00001
[notice ] ofGstVideoGrabber: Found device 13d3:56bc, getting capabilities...
[notice ] ofGstVideoGrabber: detected v4l2 device: Integrated Camera: Integrated C
[notice ] ofGstVideoGrabber: driver: uvcvideo, version: 329,746
[notice ] ofGstVideoGrabber: Capabilities: 0x84A00001
[notice ] ofGstVideoGrabber: Found device 13d3:56bc, getting capabilities...
[notice ] ofGstVideoGrabber: detected v4l2 device: Integrated Camera: Integrated I
[notice ] ofGstVideoGrabber: driver: uvcvideo, version: 329,746
[notice ] ofGstVideoGrabber: Capabilities: 0x84A00001
[notice ] ofGstVideoGrabber: Found device 13d3:56bc, getting capabilities...
[notice ] ofGstVideoGrabber: detected v4l2 device: Integrated Camera: Integrated I
[notice ] ofGstVideoGrabber: driver: uvcvideo, version: 329,746
[ error ] ofGstUtils: error getting device data; module source reported: Device '/dev/video1' is not a capture device.

My initializing code looks like this:

ClipController.cpp


    void initializeCameras()
    {
        ofVideoGrabber vidGrabber;
        vector<ofVideoDevice> devices = vidGrabber.listDevices();

        ofLogVerbose("Initializing Cameras...");
        
        for (int i = 0; i < devices.size(); i++) {
            // create a player for this camera
            string name = devices[i].deviceName;
            float width = ofGetWidth();
            float height = ofGetHeight();
            
            loopier::CameraPlayerPtr cameraplayer(new loopier::CameraPlayer(width, height, i));
            cameraplayer->setName(name);
            // create a camera with the device name
            //            cameraplayers[name] = cameraplayer;
            // create a duplicate with the name 'camN' for faster typing
            cameraplayers["cam"+ofToString(i)] = cameraplayer;
            ofLogVerbose() << "Initialized: " << cameraplayer->getName() << " w:" << width << " h:" << height << " index:" << i;
            ofLogVerbose() << "Camera Players: " << cameraplayers.size();
        }
        
        ofLogVerbose() << "Initialized " << cameraplayers.size() << " camera players";
    }

CameraPlayer.cpp

loopier::CameraPlayer::CameraPlayer(const float camerawidth, const float cameraheight, const int deviceId)
{
    camera.setDeviceID(deviceId);
    camera.setVerbose(true);
    camera.initGrabber(camerawidth, cameraheight);
    image.allocate(camerawidth, cameraheight, OF_IMAGE_COLOR);
    ofLogVerbose() << "id: " << deviceId << "\tw: " << camera.getWidth() << "\th: " << camera.getHeight();
}

EDIT:
I just changed ofVideoGrabberExample’s camera index to 1 and I get the same error. So I guess iterating through devices needs some kind of filtering to check if they are capture devices or not. I don’t quite understand why there are two instances of each device, nor why the second one is not a capture device. Will dig further, but any pointers on how to solve this will be very much appreciated!

EDIT:
I found the reason for the duplicates on this post.

The second device provides metadata about the video data from the first device.