Getting played time in RTSP video

Stefan Sauer ensonic at hora-obscura.de
Sun Jan 29 05:47:31 PST 2012


On 01/26/2012 10:50 AM, Bruno Gonzalez wrote:
> I expect I cannot get duration, since the RTSP source can sometimes be
> live video (unknown duration).
Yes, that can be the case.
> However, when I try to get the position, using a Query on my rtspsrc
> element of the pipeline, I always get "-1" as result. I've tried using
> a position query with bytes, buffers, time, percentage and everything,
> but none returns a usable value.
Well invetigate the code and figure out why you get a -1. In most cases
reporting a position should be possible. Trying the different formats is
less useful as e.g. percent is calculated from pos and duration.
>
> Furthermore, the rtspsrc clock is not usable either, since it's just a
> counter of time passed on the client side. So when playing at 2x, it
> doesn't match the server time, nor does it account for jitter.
>
> What can be influencing the queries to return -1? Am I doing something
> wrong?
Dump a pipeline graph of you pipeline to see which element are used and
check their query implementations to see why they don't answer the
position query.

Stefan
>
> The code I'm using looks like this (using gstreamer-sharp):
>
> Element rtspsrc = m_pipeline.GetByName("rtspsrc");
> Query query = Query.NewPosition(Gst.Format.Time);
> rtspsrc.Query(query);
> long value;
> Gst.Format format;
> query.ParsePosition(out format, out value);
> writeTrace("Query results: " + format + ", " + value);
>
> Is that correct?
>
> On Wed, Jan 25, 2012 at 10:07, Stefan Sauer <ensonic at hora-obscura.de
> <mailto:ensonic at hora-obscura.de>> wrote:
>
>     On 01/24/2012 05:24 PM, Bruno Gonzalez wrote:
>>     Thanks for the input.
>>
>>     Unfortunately, I still don't have any hints as to how to get the
>>     play time in the original source file.
>
>     Use queries to get the duration and current playback position
>
>     Stefan.
>
>>
>>     Doing back-of-the-envelope calculations on the client is not
>>     an option, I need the actual playing time, with a precision of
>>     cents of second.
>>
>>     Any idea?
>>
>>     On Tue, Jan 24, 2012 at 16:08, Stefan Sauer
>>     <ensonic at hora-obscura.de <mailto:ensonic at hora-obscura.de>> wrote:
>>
>>         On 01/24/2012 03:49 PM, Bruno Gonzalez wrote:
>>>         Hi,
>>>
>>>         I have a server-client video streaming using gstreamer and
>>>         RTP. So basically:
>>>         [source storage] --> [server] ---------> [client] -->
>>>         [frames rendered
>>>         on screen]
>>>
>>>         Is there any way to know, for each rendered frame, what was the
>>>         original playing time in the video source of the server?
>>>
>>>         For example.
>>>          - At 10 fps, after 30 seconds of playing, the "playing
>>>         time" would be
>>>         300.0 seconds.
>>>          - But if the network is slow, the playing time could very
>>>         well be
>>>         only 276.4 seconds.
>>>          - Or maybe some frames could be lost if using UDP.
>>>          - Also, if the source storage has variable framerate, I
>>>         cannot use
>>>         "10fps" or any other average fps for any calculations.
>>
>>         video is synchronized to the clock. That is after 30 sec of
>>         playing time the video is more or less at 30s. If the network
>>         is slow, it is likely that some frames have been skipped.
>>
>>         Stefan
>>
>>>
>>>         How could this be achieved?
>>>
>>>         Thanks!
>>>
>>>         -- 
>>>         Saludos,
>>>              Bruno González
>>>
>>>         _______________________________________________
>>>         Jabber: stenyak AT gmail.com <http://gmail.com>
>>>         http://www.stenyak.com
>>>
>>>
>>>         _______________________________________________
>>>         gstreamer-devel mailing list
>>>         gstreamer-devel at lists.freedesktop.org <mailto:gstreamer-devel at lists.freedesktop.org>
>>>         http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>>
>>
>>         _______________________________________________
>>         gstreamer-devel mailing list
>>         gstreamer-devel at lists.freedesktop.org
>>         <mailto:gstreamer-devel at lists.freedesktop.org>
>>         http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>>
>>
>>
>>
>>     -- 
>>     Saludos,
>>          Bruno González
>>
>>     _______________________________________________
>>     Jabber: stenyak AT gmail.com <http://gmail.com>
>>     http://www.stenyak.com
>>
>>
>>     _______________________________________________
>>     gstreamer-devel mailing list
>>     gstreamer-devel at lists.freedesktop.org <mailto:gstreamer-devel at lists.freedesktop.org>
>>     http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>
>
>     _______________________________________________
>     gstreamer-devel mailing list
>     gstreamer-devel at lists.freedesktop.org
>     <mailto:gstreamer-devel at lists.freedesktop.org>
>     http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>
>
>
>
> -- 
> Saludos,
>      Bruno González
>
> _______________________________________________
> Jabber: stenyak AT gmail.com <http://gmail.com>
> http://www.stenyak.com
>
>
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20120129/b4a0433d/attachment.htm>


More information about the gstreamer-devel mailing list