Ask Your Question

smokey's profile - activity

2018-05-09 02:32:32 -0600 received badge  Famous Question (source)
2017-08-16 14:53:38 -0600 received badge  Notable Question (source)
2017-07-10 15:10:01 -0600 received badge  Popular Question (source)
2016-12-21 02:40:48 -0600 received badge  Scholar (source)
2016-12-20 11:40:31 -0600 received badge  Self-Learner (source)
2016-12-20 11:25:15 -0600 answered a question How does the cv2.VideoCapture class work with gstreamer pipelines?

A direct excerpt from the comments in the source-code (3.1.0) resolves my question:

(https://github.com/opencv/opencv/blob...)

 * The 'filename' parameter is not limited to filesystem paths, and may be one of the following:
 *
 *  - a normal filesystem path:
 *        e.g. video.avi or /path/to/video.avi or C:\\video.avi
 *  - an uri:
 *        e.g. file:///path/to/video.avi or rtsp:///path/to/stream.asf
 *  - a gstreamer pipeline description:
 *        e.g. videotestsrc ! videoconvert ! appsink
 *        the appsink name should be either 'appsink0' (the default) or 'opencvsink'
 *
 *  When dealing with a file, CvCapture_GStreamer will not drop frames if the grabbing interval
 *  larger than the framerate period. (Unlike the uri or manual pipeline description, which assume
 *  a live source)
 *
 *  The pipeline will only be started whenever the first frame is grabbed. Setting pipeline properties
 *  is really slow if we need to restart the pipeline over and over again.

A little bit further down, the following capabilities are set (For GStreamer 1.x) :

caps = gst_caps_from_string("video/x-raw, format=(string){BGR, GRAY8}; video/x-bayer,format=(string){rggb,bggr,grbg,gbrg}");

Which is what the appsink/opencvsink is capable of.

2016-12-17 15:15:40 -0600 asked a question How does the cv2.VideoCapture class work with gstreamer pipelines?

Today I found out that you can use a gstreamer pipeline-string in the constructor of the VideoCapture class (see http://stackoverflow.com/a/23795492), like this:

cv2.VideoCapture("autovideosrc ! appsink")

(in python 2.7, OpenCV 3.1.0, Gstreamer 1.4.3)

And this works like a charm, apart from a few assertions failing for Gstreamer, with no apparent ramifications. Sadly, I did not find any documentation on this kind of usage. The (! appsink) is mandatory, I assume? Is data format which flows into 'appsink' arbitrary, i.e. as long as it is a valid pipeline, VideoCapture can work with it?

A Disclaimer: Im pretty new with cv2 - in fact today I used it the first time.