Quantcast

get timestamp from playbin

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

get timestamp from playbin

pinkesh vaghela
Hi,

I am new to gstreamer. I am able to play the audio on rtsp client with playbin element.
How can I get the timestamp of every frame from playbin element while playing the audio frames?
I found that gstbuffer pts contains the timestamp but I don't know how to extract the gstbuffer from playbin element and get the server injected timestamp of every frame.

Thanks,
P.Vaghela
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: get timestamp from playbin

Nicolas Dufresne-5
Le jeudi 16 mars 2017 à 09:53 -0700, pinkesh vaghela a écrit :

> I am new to gstreamer. I am able to play the audio on rtsp client
> with
> playbin element.
> How can I get the timestamp of every frame from playbin element while
> playing the audio frames?
> I found that gstbuffer pts contains the timestamp but I don't know
> how to
> extract the gstbuffer from playbin element and get the server
> injected
> timestamp of every frame.
Doing that from playbin might be a bit involving programatically.
What's the purpose here ? For debugging purpose, I usually trace that
information using:

  GST_DEBUG="GST_SCHEDULING:5" gst-launch-1.0 ...

This will trace GstBuffer and it's attached data (everything that can
be serialized, except the data of course) every time a buffer reaches a
sink pad.

regards,
Nicolas
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

signature.asc (188 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: get timestamp from playbin

pinkesh vaghela
Hi Nicolas,

Thanks for your reply.

The purpose here is to sync the multiple audio clients. I want to decode the timestamp for every frame set by the server(which will be system time of server) and by taking that as a reference for multi client sync.

Regards,
pinkesh
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: get timestamp from playbin

Nicolas Dufresne-5
Le jeudi 16 mars 2017 à 13:02 -0700, pinkesh vaghela a écrit :
> The purpose here is to sync the multiple audio clients. I want to decode the
> timestamp for every frame set by the server(which will be system time of
> server) and by taking that as a reference for multi client sync.

In general this is easier to control the clock, base-time and latency
for that. If all pipelines have the same clock and same base-time, then
same running time in all clients will be the same moment. This way, you
can let GStreamer do it's sync, and use similar sync method in your
other clients (which I suppose are not GStreamer ?). Specifically for
RTP, there is extra configuration, but someone else would need to jump
in and explain.

regards,
Nicolas
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

signature.asc (188 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: get timestamp from playbin

pinkesh vaghela
Hi Nicolas,

Thanks for your answer.
As you said Gstreamer do it's sync, for multiple client to sync which clock setting I should use. My all clients are gstreamer only but they have different network delay from server to client.. So to sync all clients which clock setting or pipeline I should use?

can I get sync by playbin or I should use other pipeline? I managed to get timestamp of buffer from appsink but it is starting from zero and increasing frame by frame but it is not the server injected timestamp(system time of server). I used rtspsrc location="<url>" ! rtpbin ! rtppcmadepay ! appsink pipeline.

Regards,
Pinkesh
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: get timestamp from playbin

Nicolas Dufresne-5
Le vendredi 17 mars 2017 à 12:37 -0700, pinkesh vaghela a écrit :
> Hi Nicolas,
>
> Thanks for your answer. 
> As you said Gstreamer do it's sync, for multiple client to sync which clock
> setting I should use. My all clients are gstreamer only but they have
> different network delay from server to client.. So to sync all clients which
> clock setting or pipeline I should use?

So if clients are spread accross multiple computers over the network,
you'll have to pick from GstNetClientClock (with a master running
GstNetTimeProvider), or GstPtpClock (with a maser running a PTP
server), or GstNtpClock specifying an NTP server. The NetClientClock
and PTP clock are known to be more precise.

Now, if the delays varies between machines, you will have to pick a
configured latency that is at least as large to the worst case.
Otherwise, synchronization is impossible. Usually we pick the larger
acceptable delay. That only apply to live playback of course. For non-
live playback, you would just signal the media, and wait for all remote
devices to have reached paused state (preroll).

>
> can I get sync by playbin or I should use other pipeline? I managed to get
> timestamp of buffer from appsink but it is starting from zero and increasing
> frame by frame but it is not the server injected timestamp(system time of
> server). I used rtspsrc location="<url>" ! rtpbin ! rtppcmadepay ! appsink
> pipeline.

Playbin should work. Just remember that rtpsrc, even though seekable,
is a live source.

>
> Regards,
> Pinkesh
>
>
>
> --
> View this message in context: http://gstreamer-devel.966125.n4.nabble
> .com/get-timestamp-from-playbin-tp4682261p4682290.html
> Sent from the GStreamer-devel mailing list archive at Nabble.com.
> _______________________________________________
> gstreamer-devel mailing list
> [hidden email]
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

signature.asc (188 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: get timestamp from playbin

pinkesh vaghela
In reply to this post by pinkesh vaghela
Hi Nicolas,

Thanks for your answer.

I am setting system time of server with gst_net_time_provider at server and getting clock at client side with gst_net_client_clock. I am setting this clock as a pipeline clock and setting the latency as 500ms(max network delay). I have used below configuration. Can you please suggest is there anything I am missing?

 Server side:
--------------
 GstClock* global_clock = gst_system_clock_obtain ();
 GstNetTimeProvider * timeProvider = gst_net_time_provider_new (global_clock, nullptr, args.port + 1);


Client side:
-------------
 GstClock *clientClock = gst_net_client_clock_new("Klok","192.168.113.7", 8554 + 1, 0);

 gst_clock_wait_for_sync (clientClock, GST_CLOCK_TIME_NONE);

 GstClock *systemClock = gst_system_clock_obtain();

 GstClockTime baseTime = gst_clock_get_time(systemClock);

 gst_pipeline_set_latency (GST_PIPELINE (playbin), 500 * GST_MSECOND);

 gst_pipeline_use_clock(GST_PIPELINE(playbin), clientClock);

 gst_element_set_start_time(playbin, GST_CLOCK_TIME_NONE);
 gst_element_set_base_time(playbin, baseTime);


Thanks,
Pinkesh
Loading...