Custom GStreamer Pipeline for USB Video Camera

Hello all!
I’m working with NVidia Jetson Nanos and Xaviers, and I’m finding that the default GStreamer pipeline that ofVideoGrabber assembles for my Logitech C615 USB camera is not able to deliver the 720p or higher resolution that I need or the frame rate I require. Looking at the output of gst-device-monitor-1.0 I surmise that since the grabber is using video/x-raw, my desired settings are not available.

However, if I use image/jpeg than they are, and indeed this gstreamer command works and gets my fast 1080 video:

gst-launch-1.0 v4l2src device=/dev/video2 ! "image/jpeg,framerate=30/1,width=1920,height=1080" ! jpegparse ! jpegdec ! video/x-raw ! videoconvert ! "video/x-raw,width=1920,height=1080,format=BGRx,framerate=30/1" ! ximagesink sync=false

I’m therefore interested in figuring out how to grab video frames from my camera this way, as opposed to with ofVideoGrabber.

Can anyone point me to an example or reference that sheds light on this?



I believe that an appropriate rewording of my question may be:

should I be using @arturo 's ofGstVideoGrabber directly instead of using ofVideoGrabber, and if so are there some example of how to properly set the Gstreamer caps settings for the source?

For anyone else that goes down this page, yes, that was the way to do it.

in ofApp.h:

        // for GStreamer video capture
        ofGstVideoUtils gst;
        ofTexture tex;


// in setup
    gst.setPipeline("v4l2src device=/dev/video0 ! image/jpeg,framerate=30/1,width=1920,height=1080 ! jpegparse ! jpegdec ! video/x-raw ! videoconvert ! video/x-raw,width=1920,height=1080,format=BGRx,framerate=30/1 ! videoconvert  ! videorate" , OF_PIXELS_RGB, true, camWidth, camHeight);

//in update
        if (tex.getWidth() != gst.getWidth())
            tex.allocate(gst.getWidth(), gst.getHeight(), GL_RGB);
        // tex.loadData(gst.getPixels(),(int)gst.getWidth(), (int)gst.getHeight(), GL_RGB);
        tex.loadData(gst.getPixels(), GL_RGB);


// in draw
    tex.draw(0,0, ofGetWidth(), ofGetHeight());