<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
Also, more importantly, do you have any reason for not using
GESPipeline?<br>
<br>
If not, I advise you do so, as it's the recommended way to run a GES
timeline.<br>
<br>
<div class="moz-cite-prefix">On 03/27/2018 02:20 AM, David Ing
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CAKF2gC_xa8oKcEDyfCskUzNvKyLJtBqL6bwO0S5G8axzJWyxmQ@mail.gmail.com">
<div dir="ltr">I have a gstreamer pipeline which basically
incorporates a GESTimeline, two encoders (audio and video), a
muxer, and a filesink.
<div><br>
</div>
<div>When I run the pipeline, I periodically query the stream
position (as shown in code below) and print into the terminal
(stdout).
<div><br>
</div>
<div>The problem is: When I run the pipeline, the terminal
says that I have reached 100% relatively early (within 2
seconds), but the pipeline itself continues to run for 10
more seconds. When the terminal reports being 100% done, I
can see that the target mp4 file (the final output of the
pipeline) is less than 5% of it's final size.</div>
</div>
<div><br>
</div>
<div>
<span
style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">My
goal is to get an accurate indication of the job's progress
as it runs</span>
</div>
<div><br>
</div>
<div>Other things I've tried.<br>
</div>
<div>
<ul>
<li>Tried listening for GST_MESSAGE_PROGRESS messages, but I
don't get any.</li>
<li>Tried executing `gst_element_query_position` on the
filesink (the last element of the pipeline), instead of
the entire pipeline itself, but my results did not change.</li>
</ul>
</div>
<div><span
style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">The
code for my main loop is shown below. The progress printing
occurs near the very bottom of the loop.</span><br>
</div>
<div><span
style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><br>
</span></div>
<div><span
style="text-align:start;text-indent:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><font
face="monospace, monospace">
<div> /// Run the job. Will throw exception if
unsuccessful.</div>
<div> void CompositionJob::run()</div>
<div> {</div>
<div> GstStateChangeReturn stateChangeReturn;</div>
<div> </div>
<div> // Start playing the pipeline.</div>
<div> stateChangeReturn =
gst_element_set_state(reinterpret_cast<GstElement*>(this->gstPipeline),
GST_STATE_PLAYING);</div>
<div> if (stateChangeReturn ==
GST_STATE_CHANGE_FAILURE)</div>
<div> throw std::runtime_error("Unable to set
the pipeline to the playing state.");</div>
<div><br>
</div>
<div> // Talk to the message bus</div>
<div> this->gstBus =
gst_element_get_bus(reinterpret_cast<GstElement*>(this->gstPipeline));</div>
<div> unique_gmob<GstMessage> gstMessage =
nullptr;</div>
<div> </div>
<div> this->shouldTerminate = false;</div>
<div> while (!this->shouldTerminate)</div>
<div> {</div>
<div> gstMessage =
gst_bus_timed_pop_filtered(this->gstBus, 100 *
GST_MSECOND,</div>
<div>
(GstMessageType)(GST_MESSAGE_STATE_CHANGED |
GST_MESSAGE_ERROR | GST_MESSAGE_EOS |
GST_MESSAGE_DURATION));</div>
<div><br>
</div>
<div> if (gstMessage)</div>
<div> {</div>
<div>
this->handleMessage(gstMessage.get());</div>
<div> gstMessage.reset();</div>
<div> }</div>
<div> else</div>
<div> {</div>
<div> // If we got no message, a timeout
period has expired.</div>
<div> if (this->isPlaying)</div>
<div> {</div>
<div> // Query the stream position (in
nanoseconds).</div>
<div> if (!gst_element_query_position(</div>
<div>
reinterpret_cast<GstElement*>(this->gstPipeline),</div>
<div> GST_FORMAT_TIME,</div>
<div>
&this->streamPosition))</div>
<div> GST_DEBUG("Could not query
current position.");</div>
<div><br>
</div>
<div> // Query the duration if we don't
have it already.</div>
<div> if
(!GST_CLOCK_TIME_IS_VALID(this->streamDuration))</div>
<div> {</div>
<div> if
(!gst_element_query_duration(</div>
<div>
reinterpret_cast<GstElement*>(this->gstPipeline),</div>
<div> GST_FORMAT_TIME,</div>
<div>
&this->streamDuration))</div>
<div> GST_DEBUG("Could not get
pipeline duration.");</div>
<div> }</div>
<div><br>
</div>
<div> // Print position and duration.</div>
<div> if (this->printProgress)</div>
<div> {</div>
<div> g_print("Position %"
GST_TIME_FORMAT " / %" GST_TIME_FORMAT "\r",</div>
<div>
GST_TIME_ARGS(this->streamPosition),
GST_TIME_ARGS(this->streamDuration));</div>
<div> }</div>
<div> }</div>
<div> }</div>
<div> }</div>
<div> }</div>
</font></span></div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
gstreamer-devel mailing list
<a class="moz-txt-link-abbreviated" href="mailto:gstreamer-devel@lists.freedesktop.org">gstreamer-devel@lists.freedesktop.org</a>
<a class="moz-txt-link-freetext" href="https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel">https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel</a>
</pre>
</blockquote>
<br>
</body>
</html>