<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    Yes, quite easily, just connect to the "deep-element-added" signal
    and work from there.<br>
    <br>
    <div class="moz-cite-prefix">On 03/27/2018 04:40 PM, David Ing
      wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAKF2gC8RUx7Zk-efabFNFP3XcwxzOpM3UPHN9p+KKgKrj85ioA@mail.gmail.com">
      <div dir="auto">
        <div>Mathieu,</div>
        <div dir="auto"><br>
        </div>
        <div dir="auto">More then just picking the right elements,  I
          also need to set GObject properties on one of the elements
          before it gets used.  Is that also achievable?<br>
          <br>
          <div class="gmail_quote" dir="auto">
            <div dir="ltr">On Tue, Mar 27, 2018, 4:12 AM Mathieu
              Duponchelle <<a href="mailto:mathieu@centricular.com"
                moz-do-not-send="true">mathieu@centricular.com</a>>
              wrote:<br>
            </div>
            <blockquote class="gmail_quote" style="margin:0 0 0
              .8ex;border-left:1px #ccc solid;padding-left:1ex">
              <div text="#000000" bgcolor="#FFFFFF"> The GES timeline
                can indeed be used in a regular gstreamer pipeline, but
                there<br>
                are some undocumented quirks, amongst them the
                "query-position" signal emitted<br>
                by the NLEComposition wrapped by the GESTrack object,
                this is why using GESPipeline<br>
                is the recommended approach.<br>
                <br>
                You can have fine-grained control over the encoders that
                will be picked by encodebin,<br>
                by setting the ranks of the various encoder plugins, for
                example if your system has<br>
                both software and hardware encoders for H264, you would
                list the encoder plugins<br>
                with gst_element_factory_list_filter, then set the ranks
                of those plugins with<br>
                gst_plugin_feature_get_rank, according to your order of
                preference. This will ensure<br>
                that the appropriate elements are picked by encodebin
                when constructing itself, and<br>
                spare you some low-level concerns.<br>
                <br>
                <div class="m_-3826226719482276326moz-cite-prefix">On
                  03/27/2018 04:20 AM, David Ing wrote:<br>
                </div>
                <blockquote type="cite">
                  <div dir="ltr">
                    <div
style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;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">Mathieu,</div>
                    <div
style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;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"><br>
                    </div>
                    <div dir="auto"
style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;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">Yes
                      the reported duration is correct.<br>
                    </div>
                    <div dir="auto"
style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;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"><br>
                    </div>
                    <div dir="auto"
style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;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">I
                      am not using GESPipeline because I need fine
                      control over the encoders, and GESPipeline doesn't
                      seem to allow that.  I think it forces the usage
                      of encodebin which picks encoders in its own way.</div>
                    <div dir="auto"
style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;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"><br>
                    </div>
                    <div
style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;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">I
                      can tell you that the documentation for GES
                      suggests that <span
style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;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">GESPipeline
                        exists for </span> convenience (but not because
                      it is more compatible with GESTimeline).  It also
                      suggests that GESTimeline talks about how it is
                      just another GstElement which can be plugged into
                      a GstPipeline accordingly.  <span
style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;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">Is
                        the documentation wrong?</span> </div>
                    <div
style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;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"><br>
                    </div>
                    <div dir="auto"
style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;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">I
                      tried casting the GESPipeline down to a
                      GstPipeline and building the pipeline manually
                      myself but it didn't work.  <span
                        style="font-size:12.8px">Do you think it should
                        have worked?  (Perhaps I didn't try hard
                        enough.)</span></div>
                    <div dir="auto"
style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;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"><span
                        style="font-size:12.8px"><br>
                      </span></div>
                    <div dir="auto"
style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;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"><span
                        style="font-size:12.8px">Or is there some way of
                        telling the GESPipeline to use specific
                        GstElements with specific settings?  (I don't
                        see anything that might allow that.)</span></div>
                    <div><br>
                    </div>
                    --------------------------------<br>
                    <div>
                      <div>>Date: Tue, 27 Mar 2018 02:35:38 +0200</div>
                      <div>>From: Mathieu Duponchelle <<a
                          href="mailto:mathieu@centricular.com"
                          target="_blank" rel="noreferrer"
                          moz-do-not-send="true">mathieu@centricular.com</a>></div>
                      <div>>To: <a
                          href="mailto:gstreamer-devel@lists.freedesktop.org"
                          target="_blank" rel="noreferrer"
                          moz-do-not-send="true">gstreamer-devel@lists.freedesktop.org</a></div>
                      <div>>Subject: Re: v 1.12, Incorrect current
                        position of GstPipeline is</div>
                      <div>        reported</div>
                      <div>>Message-ID: <<a
                          href="mailto:4f917e98-9649-e779-fe29-40078ae035e7@centricular.com"
                          target="_blank" rel="noreferrer"
                          moz-do-not-send="true">4f917e98-9649-e779-fe29-40078ae035e7@centricular.com</a>></div>
                      <div>>Content-Type: text/plain; charset="utf-8"</div>
                      <div>></div>
                      <div>>Also, more importantly, do you have any
                        reason for not using GESPipeline?</div>
                      <div>></div>
                      <div>>If not, I advise you do so, as it's the
                        recommended way to run a GES timeline.</div>
                      <div>></div>
                      <div>>On 03/27/2018 02:20 AM, David Ing wrote:</div>
                      <div>>> I have a gstreamer pipeline which
                        basically incorporates a GESTimeline, two
                        encoders (audio and video), a muxer, and a
                        filesink.</div>
                      <div>>></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>
                      <div>>></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>
                      <div>>> My goal is to get an accurate
                        indication of the job's progress as it runs</div>
                      <div>>></div>
                      <div>>> Other things I've tried.</div>
                      <div>>></div>
                      <div>>>   * Tried listening for
                        GST_MESSAGE_PROGRESS messages, but I don't get
                        any.</div>
                      <div>>>   * 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.</div>
                      <div>>></div>
                      <div>>> The code for my main loop is shown
                        below.  The progress printing occurs near the
                        very bottom of the loop.</div>
                      <div>>></div>
                      <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>>></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>>></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>>></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>>></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>
                      <div>>> </div>
                    </div>
                  </div>
                  <br>
                  <fieldset
                    class="m_-3826226719482276326mimeAttachmentHeader"></fieldset>
                  <br>
                  <pre>_______________________________________________
gstreamer-devel mailing list
<a class="m_-3826226719482276326moz-txt-link-abbreviated" href="mailto:gstreamer-devel@lists.freedesktop.org" target="_blank" rel="noreferrer" moz-do-not-send="true">gstreamer-devel@lists.freedesktop.org</a>
<a class="m_-3826226719482276326moz-txt-link-freetext" href="https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel" target="_blank" rel="noreferrer" moz-do-not-send="true">https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel</a>
</pre>
                </blockquote>
                <br>
              </div>
              _______________________________________________<br>
              gstreamer-devel mailing list<br>
              <a href="mailto:gstreamer-devel@lists.freedesktop.org"
                target="_blank" rel="noreferrer" moz-do-not-send="true">gstreamer-devel@lists.freedesktop.org</a><br>
              <a
                href="https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel"
                rel="noreferrer noreferrer" target="_blank"
                moz-do-not-send="true">https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel</a><br>
            </blockquote>
          </div>
        </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>