[pi4 bulleye ] libcamerasrc and ofGstVideoUtils

Hi!

I want to use the raspberry pi camera in openframeworks (0.11.2) on a raspberry pi 4 (4gb) running debian bulleye (32 bit).

I tried every detected camera in the videoGrabberExample but it does not seem to work (compile ok but no video texture).

I’m able to preview the camera using this command

gst-launch-1.0 -v libcamerasrc ! video/x-raw,width=640,height=480,framerate=60/1 ! videoconvert ! autovideosink

Is there a way to use libcamerasrc with ofGstVideoUtils ?

I tried this
setup()

camWidth = 640; 
camHeight = 480;
gst.setPipeline("-v libcamerasrc ! video/x-raw,width=640,height=480,framerate=60/1 ! videoconvert " , OF_PIXELS_RGB, true, camWidth, camHeight);
gst.startPipeline();
gst.play();
 tex.allocate(camWidth,camHeight,GL_RGB);

update

gst.update();
    if(gst.isFrameNew()){
        if (tex.getWidth() != gst.getWidth())
        {
            tex.allocate(gst.getWidth(), gst.getHeight(), GL_RGB);
        }
        tex.loadData(gst.getPixels(), GL_RGB);

draw()

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

It compiles fine, still no texture and an error

using newer build and GLFW window
[notice ] ofGstUtils: setPipelineWithSink(): gstreamer pipeline: -v libcamerasrc ! video/x-raw,width=640,height=480,framerate=60/1 ! videoconvert  ! appsink name=ofappsink enable-last-sample=0 caps="video/x-raw, format=RGB, width=640, height=480"
[ error ] ofGstUtils: setPipelineWithSink(): couldn't create pipeline: syntax error
[2:17:24.374080858] [26592]  INFO Camera camera_manager.cpp:293 libcamera v0.0.0+3866-0c55e522
[2:17:24.405790102] [26594]  INFO RPI raspberrypi.cpp:1374 Registered camera /base/soc/i2c0mux/i2c@1/ov5647@36 to Unicam device /dev/media3 and ISP device /dev/media0
[2:17:24.412440443] [26597]  INFO Camera camera.cpp:1035 configuring streams: (0) 640x480-NV21
[2:17:24.413619213] [26594]  INFO RPI raspberrypi.cpp:761 Sensor: /base/soc/i2c0mux/i2c@1/ov5647@36 - Selected sensor format: 640x480-SGBRG10_1X10 - Selected unicam format: 640x480-pGAA

Is there a GST guru that can help me?

just a side question: are you able to run OF in bullseye?

Thank for the interest,

Two workarounds were needed to compile OF 0.11.2 armhf on raspberry pi 4 running raspberry pi OS 32 bit

GTK2 instead of GTK3

in scripts/linux/debian/install_dependencies.sh
comment out line 29 to 35

Remove openmaxil in the default.mk

in libs/openFrameworksCompiled/project/linuxarmv6l/config.linuxarmv6l.default.mk
comment out line 176

Also, I’m using Clang to compile

export CXX=clang++
2 Likes

Also I think I solved my problem
instead of :

gst.setPipeline("-v libcamerasrc ! video/x-raw,width=640,height=480,framerate=60/1 ! videoconvert " , OF_PIXELS_RGB, true, camWidth, camHeight);

I used this command

gst.setPipeline("libcamerasrc ! video/x-raw,width=640,height=480,framerate=60/1 ! videoconvert " , OF_PIXELS_RGB, true, camWidth, camHeight);

And it worked :smiley:

1 Like