Skip to content

BGRx format in the VideoCapture's gstreamer integration #11059

@wjzhou

Description

@wjzhou
System information (version)
  • OpenCV => 3.4.1
  • Operating System / Platform => Linux Arm64
  • Compiler => gcc 5
Detailed description

The gstreamer will return a vague error message OpenCV(3.4.1) Error: Unspecified error (GStreamer: unable to start pipeline when used the BGRx format. From the source code it is clear why this happens:

// we support 11 types of data:
// video/x-raw, format=BGR -> 8bit, 3 channels
// video/x-raw, format=GRAY8 -> 8bit, 1 channel

But these code comments are not accessible anywhere out of source code. And for the fourcc code, BGRx is more nature than BGR(at least for me)

Could we either

  1. add these comments to public document
  2. support BGRx in addition to BGR format?

Also, could we add an early error message if the format is not supported. For now, it didn't do anything if a unsupported format is present and it cause random error in later stage.

Steps to reproduce
import cv2
pipeline='v4l2src device=/dev/video1 ! video/x-raw,width=640,height=480,format=I420,framerate=30/1  !  videoconvert ! video/x-raw,width=640,height=480,format=BGRx ! appsink'
cap=cv2.VideoCapture(pipeline, cv2.CAP_GSTREAMER)

Error:

OpenCV(3.4.1) Error: Unspecified error (GStreamer: unable to start pipeline
) in cvCaptureFromCAM_GStreamer, file /home/nvidia/tmp/opencv/modules/videoio/src/cap_gstreamer.cpp, line 890
VIDEOIO(cvCreateCapture_GStreamer (CV_CAP_GSTREAMER_FILE, filename)): raised OpenCV exception:

OpenCV(3.4.1) /home/nvidia/tmp/opencv/modules/videoio/src/cap_gstreamer.cpp:890: error: (-2) GStreamer: unable to start pipeline
 in function cvCaptureFromCAM_GStreamer

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions