UYVY pixel formatting in ofGstVideoGrabber w. CSI / V4L2 device

#1

Hello, I’m working with a prototype video input device for Raspberry Pi using a ADV7280A-M chip and the CSI port to capture PAL / NTSE analogue video. It’s registered as a V4L2 device so works out-the-box with ofVideoGrabber, but I’m struggling to set UYVY pixel formatting.

By default ofVideoGrabber tries to use RGB, which conks the framerate and has irregular color, and leads to out-of-memory errors (I guess from a mismatched pipeline).

Setting pixel format via setPixelFormat() to OF_PIXELS_YUY2 / OF_PIXELS_YV12 / OF_PIXELS_I420 and I get a smooth 30fps monochrome image.

Setting it to OF_PIXELS_UYVY however and ofGstUtils reports back UNKNOWN format in its pipeline string, and the errors:

[notice ] ofGstVideoGrabber: initGrabber(): selected format:  720 x 576   video/x-raw   UYVY  framerate:  25 / 1
[notice ] ofGstUtils: setPipelineWithSink(): gstreamer pipeline:  v4l2src name=video_source device=/dev/video0 ! video/x-raw,format=UYVY,width=720,height=576,framerate=25/1  ! videoconvert   ! appsink name=ofappsink enable-last-sample=0 caps="video/x-raw, format=UNKNOWN, width=720, height=576"
[ error ] ofGstUtils: setPipelineWithSink(): couldn't create pipeline:  could not link videoconvert0 to ofappsink
[warning] ofGstVideoUtils: update(): ofGstVideoUtils not loaded

It’s also worth noting that the ofGstDevice and ofGstFormat reported back when setting the grabber to OF_PIXELS UYVY is format_name I420.

So attempting then to hard-code UYVY or I420 to replace UNKNOWN in the string and I get errors from GL:

[ error ] ofGLUtils: ofGetGLFormatFromPixelFormat(): unknown OF pixel format  OF_PIXELS_UYVY , returning GL_LUMINANCE

Is this a limitation of GStreamer and GL or is there a way to get the color UYVY image? And could it be related to the benefits of using MMAL or ofxOMXCamera?

The device is not actually recognised as a conventional Raspberry Pi Camera (for example, through raspistill command), so for testing it outside of OF I’m successfully using this V4L2 to MMAL tool:

https://github.com/6by9/yavta

Thanks!