<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Hi Charlie<div class=""><br class=""></div><div class="">We have dealt with similar requirements on the past. After trying several approaches, we developed an open source solution that might fit your needs. Please refer to </div><div class=""><br class=""></div><div class=""><a href="http://developer.ridgerun.com/wiki/index.php?title=GstInterpipe" class="">http://developer.ridgerun.com/wiki/index.php?title=GstInterpipe</a></div><div class=""><br class=""></div><div class="">GstInterpipes was designed in a way that no buffers are lost while you can take your snapshot at any time. I believe in the wiki there is an example of that precise use case.</div><div class=""><br class=""></div><div class="">Hope it helps!</div><div class="">Michael</div><div class=""><br class=""><div class="">
<div class=""><div class=""><font size="1" class="">—</font></div><div class=""><font size="1" class="">Michael Gruner <<a href="mailto:michael.gruner@ridgerun.com" class="">michael.gruner@ridgerun.com</a>></font></div><div class=""><font size="1" class="">Embedded Linux and GStreamer solutions</font></div><div class=""><font size="1" class="">RidgeRun Engineering</font></div><div class=""><font size="1" class="">Contact Us - <a href="http://www.ridgerun.com/#!contact/c3vn" class="">http://www.ridgerun.com/#!contact/c3vn</a></font></div></div>
</div>
<br class=""><div><blockquote type="cite" class=""><div class="">On Jun 8, 2016, at 10:02, Charlie Turner <<a href="mailto:charlie@dune.rocks" class="">charlie@dune.rocks</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div class="">Hi all,</div><div class=""><br class=""></div><div class="">My high-level problem is that I'm generating a stream, and at certain</div><div class="">points in time, I would like to take a screenshot from the camera,</div><div class="">ensuring I don't drop any frames in my stream while this happens. More</div><div class="">details follow.</div><div class=""><br class=""></div><div class="">I currently have a pipeline that generates MPEG-TS streams, for</div><div class="">completeness it looks like this,</div><div class=""><br class=""></div><div class="">mpegtsmux name=mux ! multifilesink next-file=5 max-file-duration=5 location=%05d.ts \</div><div class="">  v4l2src device=/dev/video0 ! video/x-raw,width=1280,height=720 ! videoconvert ! \</div><div class="">      x264enc tune=zerolatency cabac=false speed-preset=ultrafast name=x264enc ! queue ! mux. \</div><div class="">  autoaudiosrc ! audioconvert ! audioresample ! lamemp3enc cbr=true target=bitrate ! \</div><div class="">      mpegaudioparse ! mux.</div><div class=""><br class=""></div><div class="">This pipeline is always running in my app. This point will be</div><div class="">important in a moment.</div><div class=""><br class=""></div><div class="">What I need to do is at an application-determined point in time, save</div><div class="">one frame from v4l2src device as a JPEG.</div><div class=""><br class=""></div><div class="">What I'd love to be able to do is just launch a separate pipeline</div><div class="">thusly,</div><div class=""><br class=""></div><div class="">v4l2src device=/dev/video0 num-buffers=1 ! jpegenc ! filesink location="thumbnail.jpg"</div><div class=""><br class=""></div><div class="">Unfortunately, my hardware drivers only allow me to open the video</div><div class="">device once (don't ask :))</div><div class=""><br class=""></div><div class="">So what options do I have,</div><div class=""><br class=""></div><div class="">   1) I first considered a data probe attached the src of my</div><div class="">     camera. What it does it try to map a buffer from the received</div><div class="">     pad, and if that is successful, saves a JPEG image using the raw</div><div class="">     map.data. This feels really nasty, and I doubt I'm making good</div><div class="">     use of Gstreamer here. The other problem with this approach is</div><div class="">     that I need a user-defined hook to capture a frame. I don't want</div><div class="">     to save every frame, so to support this case, it seems like I</div><div class="">     need to have a global somewhere that my app can set, such that</div><div class="">     when the variable is true it enables capturing a frame, and when</div><div class="">     false, the probe just passes the data along.</div><div class="">   2) Another possibility is using the dynamic pipeline support. But no</div><div class="">     matter how I looked at that, I couldn't convince myself I would</div><div class="">     not drop any frames.</div><div class="">   3) I considered using a combination of the 'tee' and 'valve'</div><div class="">      elements. Similar to option 1), it seems like there would have to</div><div class="">      be some global state somewhere that the user code could set to</div><div class="">      turn the valve on. The problem here is I just want a frame, I</div><div class="">      would have to figure out some way of knowing that just one frame</div><div class="">      got encoded, and then turn the valve off. This seems like a bad</div><div class="">      approach.</div><div class=""><br class=""></div><div class="">Could anyone give me a pointer on what a sensible approach to this</div><div class="">issue might be in the Gstreamer framework? I've had a good rummage</div><div class="">through the excellent docs, but I feel like I'm missing something.</div><div class=""><br class=""></div><div class="">Thanks for your time,</div><div class=""><br class=""></div><div class=""><br class=""></div>-- <br class=""><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr" class=""><div class="">Kind regards,</div>Charlie Turner</div></div>
</div>
_______________________________________________<br class="">gstreamer-devel mailing list<br class=""><a href="mailto:gstreamer-devel@lists.freedesktop.org" class="">gstreamer-devel@lists.freedesktop.org</a><br class="">https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel<br class=""></div></blockquote></div><br class=""></div></body></html>