<div dir="ltr"><div>Hi all,</div><div><br></div><div>My high-level problem is that I'm generating a stream, and at certain</div><div>points in time, I would like to take a screenshot from the camera,</div><div>ensuring I don't drop any frames in my stream while this happens. More</div><div>details follow.</div><div><br></div><div>I currently have a pipeline that generates MPEG-TS streams, for</div><div>completeness it looks like this,</div><div><br></div><div>mpegtsmux name=mux ! multifilesink next-file=5 max-file-duration=5 location=%05d.ts \</div><div>  v4l2src device=/dev/video0 ! video/x-raw,width=1280,height=720 ! videoconvert ! \</div><div>      x264enc tune=zerolatency cabac=false speed-preset=ultrafast name=x264enc ! queue ! mux. \</div><div>  autoaudiosrc ! audioconvert ! audioresample ! lamemp3enc cbr=true target=bitrate ! \</div><div>      mpegaudioparse ! mux.</div><div><br></div><div>This pipeline is always running in my app. This point will be</div><div>important in a moment.</div><div><br></div><div>What I need to do is at an application-determined point in time, save</div><div>one frame from v4l2src device as a JPEG.</div><div><br></div><div>What I'd love to be able to do is just launch a separate pipeline</div><div>thusly,</div><div><br></div><div>v4l2src device=/dev/video0 num-buffers=1 ! jpegenc ! filesink location="thumbnail.jpg"</div><div><br></div><div>Unfortunately, my hardware drivers only allow me to open the video</div><div>device once (don't ask :))</div><div><br></div><div>So what options do I have,</div><div><br></div><div>   1) I first considered a data probe attached the src of my</div><div>     camera. What it does it try to map a buffer from the received</div><div>     pad, and if that is successful, saves a JPEG image using the raw</div><div>     map.data. This feels really nasty, and I doubt I'm making good</div><div>     use of Gstreamer here. The other problem with this approach is</div><div>     that I need a user-defined hook to capture a frame. I don't want</div><div>     to save every frame, so to support this case, it seems like I</div><div>     need to have a global somewhere that my app can set, such that</div><div>     when the variable is true it enables capturing a frame, and when</div><div>     false, the probe just passes the data along.</div><div>   2) Another possibility is using the dynamic pipeline support. But no</div><div>     matter how I looked at that, I couldn't convince myself I would</div><div>     not drop any frames.</div><div>   3) I considered using a combination of the 'tee' and 'valve'</div><div>      elements. Similar to option 1), it seems like there would have to</div><div>      be some global state somewhere that the user code could set to</div><div>      turn the valve on. The problem here is I just want a frame, I</div><div>      would have to figure out some way of knowing that just one frame</div><div>      got encoded, and then turn the valve off. This seems like a bad</div><div>      approach.</div><div><br></div><div>Could anyone give me a pointer on what a sensible approach to this</div><div>issue might be in the Gstreamer framework? I've had a good rummage</div><div>through the excellent docs, but I feel like I'm missing something.</div><div><br></div><div>Thanks for your time,</div><div><br></div><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div>Kind regards,</div>Charlie Turner</div></div>
</div>