Opening a webcam which is already in use by a gst-launch

simo zz simon.zz at
Tue Aug 29 11:13:27 UTC 2017

I am using the following gst-launch command to grab an h264 mp4 video from my usb camer hardware video encoder using the following pipeline :
gst-launch-1.0 -e v4l2src device=/dev/webcam ! videoconvert ! video/x-raw,width=544,height=288,framerate=10/1 ! v4l2h264enc ! h264parse ! mp4mux ! filesink location=video.mp4
The problem is that I need to process the read frames with OpenCV while the video is being recorded.Possible solution options I thought are:
1 - Open the webcam in parallel with gstreamer pipelie: doesn't work since webcam is busy.2 - Open the video output from OpenCV API, retrieve the last frame and process it each time I need: doesn't work because while gstreamer is recording the video, this is not closed. I only can open the video if the pipeline (and consequently the video) has been closed.3 - Every N frames read, grab 1 frame (to be read and processed from OpenCV) in a JPG/PNG image apart of the video: I don't know if it's possible, neither how to do it in the same pipeline. This option would be the best choise..

Learning the gstreamer API modifying the OpenCV program I already have seems the most laborious option, and perhaps is not necessary.There is way to make options 1 or 2 or 3 to work ?

Thank you in advance.Regards,Simon

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the gstreamer-devel mailing list