<div dir="ltr">
<p>I have a Python GStreamer application that uses appsrc to record mp4 files. </p>

<p>The issue is that despite specifying <code>tune=zerolatency</code> 
for x264enc, there is latency, and the output video is truncated when an
 eos is sent to the pipeline. Depending on the machine, the latency is 
substantial, resulting in a much shorter than expected output file.</p>

<p>If I change the pipeline to save the video as an AVI file, it is not 
truncated. Unfortunately, the resulting file is approximately 2 GB per 
minute versus 12 MB per minute with H.264.</p>

<p>Here is the x264enc pipeline:</p><p>
</p><pre><code>appsrc name=appsrc format=time is-live=true caps=video/x-raw,format=(string)BGR appsrc. ! videoconvert ! x264enc tune=zerolatency ! qtmux ! filesink location=out.mp4</code></pre>

<div>
When the application is finished, it sends end-of-stream messages to the appsrc and pipeline: <br></div><div></div><div>
<pre><code>if self._appsrc.emit("end-of-stream") == Gst.FlowReturn.OK:
    self._sink_pipeline.send_event(Gst.Event.new_eos())</code></pre>

</div><div>
Is there a way for my application to wait while x264enc processes its 
buffer? A message, perhaps? I don't care how long it takes to finish. 
What's important is that all frames pushed to the <code>appsrc</code> are written to the output video file. <br></div><div><br></div><div>Thanks,</div><div>Alex.<br></div><div><br></div>

</div>