<html><head></head><body><div style="color:#000; background-color:#fff; font-family:標楷體, dfkai-sb;font-size:16px"><div id="yiv3687161885"><div id="yui_3_16_0_ym19_1_1504004831780_3082"><div id="yui_3_16_0_ym19_1_1504004831780_3081" style="color:#000;background-color:#fff;font-family:標楷體, dfkai-sb;font-size:16px;"><div id="yiv3687161885yui_3_16_0_ym19_1_1503929284411_4610"><font id="yiv3687161885yui_3_16_0_ym19_1_1503929284411_16238" size="2">Hello,</font></div><div id="yiv3687161885yui_3_16_0_ym19_1_1503929284411_4611"><font size="2"><br></font></div><div id="yiv3687161885yui_3_16_0_ym19_1_1503929284411_4612"><div id="yui_3_16_0_ym19_1_1504004831780_3468" dir="ltr"><font id="yui_3_16_0_ym19_1_1504004831780_3466" size="2">I am using the following gst-launch command to grab an h264 mp4 video from my usb camer </font><font id="yiv3687161885yui_3_16_0_ym19_1_1503929284411_4720" size="2"><font id="yui_3_16_0_ym19_1_1504004831780_3467" size="2">hardware video encoder using the following pipeline </font>:</font></div></div><div id="yiv3687161885yui_3_16_0_ym19_1_1503929284411_4723"><br></div><div dir="ltr" id="yiv3687161885yui_3_16_0_ym19_1_1503929284411_4724"><font id="yiv3687161885yui_3_16_0_ym19_1_1503929284411_4720" size="2"><b id="yiv3687161885yui_3_16_0_ym19_1_1503929284411_4774">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</b></font></div><div id="yiv3687161885yui_3_16_0_ym19_1_1503929284411_4798" dir="ltr"><div id="yui_3_16_0_ym19_1_1504004831780_3484"><font id="yiv3687161885yui_3_16_0_ym19_1_1503929284411_4720" size="2"><br></font></div><div id="yui_3_16_0_ym19_1_1504004831780_3483"><font id="yiv3687161885yui_3_16_0_ym19_1_1503929284411_4720" size="2">The problem is that I need to process the read frames with OpenCV while the video is being recorded.</font></div><div id="yui_3_16_0_ym19_1_1504004831780_3208"><font id="yiv3687161885yui_3_16_0_ym19_1_1503929284411_4720" size="2">Possible solution options I thought are:</font></div><div id="yui_3_16_0_ym19_1_1504004831780_3209"><br></div><div id="yui_3_16_0_ym19_1_1504004831780_3210"><font id="yiv3687161885yui_3_16_0_ym19_1_1503929284411_4720" size="2"><b id="yui_3_16_0_ym19_1_1504004831780_3501">1 - Open the webcam in parallel with gstreamer pipelie: </b>doesn't work since webcam is busy.</font></div><div dir="ltr" id="yui_3_16_0_ym19_1_1504004831780_3211"><font id="yiv3687161885yui_3_16_0_ym19_1_1503929284411_4720" size="2"><b id="yui_3_16_0_ym19_1_1504004831780_3503">2 - Open the video output from OpenCV API, retrieve the last frame and process it each time I need:</b> 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.</font></div><div id="yui_3_16_0_ym19_1_1504004831780_3358" dir="ltr"><font id="yiv3687161885yui_3_16_0_ym19_1_1503929284411_4720" size="2"><b id="yui_3_16_0_ym19_1_1504004831780_3517">3 - Every <i id="yui_3_16_0_ym19_1_1504004831780_3566">N</i> frames read, grab 1 frame (to be read and processed from OpenCV) in a JPG/PNG image apart of the video: </b>I don't know if it's possible, neither how to do it in the same pipeline. This option would be the best choise..<br></font></div><div id="yui_3_16_0_ym19_1_1504004831780_3286" dir="ltr"><br></div><div id="yui_3_16_0_ym19_1_1504004831780_3404" dir="ltr"><font id="yui_3_16_0_ym19_1_1504004831780_3405" size="2">Learning the gstreamer API modifying the OpenCV program I already have seems the most laborious option, and perhaps is not necessary.</font></div><div id="yui_3_16_0_ym19_1_1504004831780_3300" dir="ltr"><font id="yiv3687161885yui_3_16_0_ym19_1_1503929284411_4720" size="2">There is way to make options 1 or 2 or 3 to work ?<br></font></div><div id="yui_3_16_0_ym19_1_1504004831780_3370" dir="ltr"><br><font id="yiv3687161885yui_3_16_0_ym19_1_1503929284411_4720" size="2"></font></div><div id="yui_3_16_0_ym19_1_1504004831780_3447" dir="ltr"><font id="yiv3687161885yui_3_16_0_ym19_1_1503929284411_4720" size="2">Thank you in advance.</font></div><div id="yui_3_16_0_ym19_1_1504004831780_3446" dir="ltr"><font id="yiv3687161885yui_3_16_0_ym19_1_1503929284411_4720" size="2">Regards,</font></div><div id="yui_3_16_0_ym19_1_1504004831780_3445" dir="ltr"><font id="yiv3687161885yui_3_16_0_ym19_1_1503929284411_4720" size="2">Simon<br></font></div><div id="yui_3_16_0_ym19_1_1504004831780_3393" dir="ltr"><br></div><div id="yui_3_16_0_ym19_1_1504004831780_3394" dir="ltr"><font id="yiv3687161885yui_3_16_0_ym19_1_1503929284411_4720" size="2"><br></font></div></div><div id="yiv3687161885yui_3_16_0_ym19_1_1503929284411_15355"><font size="2"><br></font></div><div id="yiv3687161885yui_3_16_0_ym19_1_1503929284411_13393" dir="ltr"><font id="yiv3687161885yui_3_16_0_ym19_1_1503929284411_4720" size="2"><br></font></div></div></div></div></div></body></html>