<div dir="ltr"><div>I'm using gstreamer 1.0 from python.<br></div>The gst script is something like:<br><br><pre style="background-color:rgb(255,255,255);color:rgb(0,0,0);font-family:"courier new"">default_script = <span style="color:rgb(0,128,128);font-weight:bold"><br>"videotestsrc pattern=smpte is-live=1"</span><br><span style="color:rgb(0,128,128);font-weight:bold">" ! timeoverlay"</span><br><span style="color:rgb(0,128,128);font-weight:bold">" ! video/x-raw,width=640,height=480,framerate=30/1"</span><br><span style="color:rgb(0,128,128);font-weight:bold">" ! x264enc key-int-max=3"</span><br><span style="color:rgb(0,128,128);font-weight:bold">" ! tee name = branch"</span><span style="color:rgb(0,128,128);font-weight:bold"><br></span><span style="color:rgb(0,128,128);font-weight:bold"><span style="color:rgb(128,128,128);font-style:italic"># udp sink</span><span style="color:rgb(0,128,128);font-weight:bold"><br></span>"branch."</span><span style="color:rgb(0,128,128);font-weight:bold"><br>" ! queue silent = true name = queue_stream "<br></span><span style="color:rgb(0,128,128);font-weight:bold">" ! rtph264pay config-interval = 1 pt = 96"</span><span style="color:rgb(0,128,128);font-weight:bold"><br>" ! udpsink host = 192.168.0.12 port = 9000 name = sink_stream"</span><br><span style="color:rgb(128,128,128);font-style:italic"></span><span style="color:rgb(128,128,128);font-style:italic"># app sink for capture</span><span style="color:rgb(0,128,128);font-weight:bold"><br>" branch.</span><span style="color:rgb(0,128,128);font-weight:bold">"<br>" ! queue silent = true max-size-buffers = 1 name = queue_capture "</span><br><span style="color:rgb(0,128,128);font-weight:bold">" ! openh264dec"<br></span><span style="color:rgb(0,128,128);font-weight:bold">" ! jpegenc"<br></span><span style="color:rgb(0,128,128);font-weight:bold">" ! multifilesink location=alma%d.jpg name = capture_sink </span><br><br></pre><pre style="background-color:rgb(255,255,255);color:rgb(0,0,0);font-family:"courier new"">Pad-probes are to drop data on the multifilesink branch like this.<br>First a wait for wait-preroll probe, than an dropp buffer probe is added:<br></pre><pre style="background-color:rgb(255,255,255);color:rgb(0,0,0);font-family:"courier new""><br><span style="color:rgb(0,0,128);font-weight:bold">def </span>pad_data_probe_preroll_capture(<span style="color:rgb(128,128,128)">pad</span>, <span style="color:rgb(128,128,128)">info</span>, cam):<br>    <a href="http://log.info">log.info</a>(<span style="color:rgb(0,128,128);font-weight:bold">"preroll capture"</span>)<br>    queue = cam._pipeline.get_by_name(<span style="color:rgb(0,128,128);font-weight:bold">"queue_capture"</span>)<br>    pad = queue.get_static_pad(<span style="color:rgb(0,128,128);font-weight:bold">"sink"</span>)<br>    pad.add_probe(Gst.PadProbeType.BUFFER, pad_data_probe_capture, cam)<br>    <span style="color:rgb(0,0,128);font-weight:bold">return </span>Gst.PadProbeReturn.REMOVE<br><br><br><span style="color:rgb(0,0,128);font-weight:bold">def </span>pad_data_probe_capture(<span style="color:rgb(128,128,128)">pad</span>, <span style="color:rgb(128,128,128)">info</span>, cam):<br>    <span style="color:rgb(0,0,128);font-weight:bold">if </span>cam._capture_counter.acquire(<span style="color:rgb(0,0,128);font-weight:bold">False</span>):<br>        <a href="http://log.info">log.info</a>(<span style="color:rgb(0,128,128);font-weight:bold">"enable data, capture"</span>)<br>        <span style="color:rgb(0,0,128);font-weight:bold">return </span>Gst.PadProbeReturn.OK<br>    <span style="color:rgb(0,0,128);font-weight:bold">else</span>:<br>        <span style="color:rgb(128,128,128);font-style:italic">#<a href="http://log.info">log.info</a>("info drop: {} {}".format(pad, info.get_buffer().dts))<br></span><span style="color:rgb(128,128,128);font-style:italic">        </span><span style="color:rgb(0,0,128);font-weight:bold">return </span>Gst.PadProbeReturn.DROP<br><br><br>queue = <span style="color:rgb(148,85,141)">self</span>._pipeline.get_by_name(<span style="color:rgb(0,128,128);font-weight:bold">"capture_sink"</span>)<br>pad = queue.get_static_pad(<span style="color:rgb(0,128,128);font-weight:bold">"sink"</span>);<br>pad.add_probe(Gst.PadProbeType.BUFFER | Gst.PadProbeType.BLOCK, pad_data_probe_preroll_capture, <span style="color:rgb(148,85,141)">self</span>)<br><span style="color:rgb(148,85,141)">self</span>._pipeline.set_state(Gst.State.PLAYING)<br><span style="color:rgb(0,0,128);font-weight:bold">if </span><span style="color:rgb(148,85,141)">self</span>._pipeline.get_state(Gst.CLOCK_TIME_NONE) == Gst.StateChangeReturn.FAILURE:<br>    <span style="color:rgb(0,0,128);font-weight:bold">raise </span>CameraError(<span style="color:rgb(0,128,128);font-weight:bold">"pipeline cannot be prerolled"</span>)<br><br>It seems to work, but multifilesink captures some old frames instead of new one (player is at 10s but captures saves frames from the 1st seconds)<br></pre><pre style="background-color:rgb(255,255,255);color:rgb(0,0,0);font-family:"courier new"">Any suggestions, I've tried to play with the queue parameters but without any success.<br></pre><pre style="background-color:rgb(255,255,255);color:rgb(0,0,0);font-family:"courier new"">Is it the preferred way to capture screen on events ? As events are quite frequent (but not time based) disconnect the capture branch seemed  overkill.<br></pre><pre style="background-color:rgb(255,255,255);color:rgb(0,0,0);font-family:"courier new"">Also note that, multifilesink will be replaced by appsink once it is working.<br><br></pre><pre style="background-color:rgb(255,255,255);color:rgb(0,0,0);font-family:"courier new"">Thanks, gzp<br></pre></div>