Hello, I would like to know if there's a way to extract the buffer timestamp of the video stream that a video player is playing at a certain moment. So far I've been using the timestamps extracted by an identity element placed just before the video player but the handoff signals are not generated synchronously, so between 2 buffers of length = 0.04 s there's a system time delta extracted at the handoff signal generation slightly different than 0.04 s...for this reason I suppose that either the video player receives these buffers asynchronously, so it has a buffer itself and synchronizes with the general clock, or the identity signal is emitted asynchronously (or maybe both)...
For audio/video synchronization purposes I need to know something like: in a certain precise instant the video player is displaying a frame with timestamp=x..is it possible? Thank you very much. Enrico |
Hi,
Are you looking for something like this?
Best, Angel 2012/5/14 enricom <[hidden email]> Hello, I would like to know if there's a way to extract the buffer timestamp _______________________________________________ gstreamer-devel mailing list [hidden email] http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
On 15 May 2012 12:07, Angel Martin <[hidden email]> wrote:
> Hi, > > Are you looking for something like this? > http://gstreamer.freedesktop.org/data/doc/gstreamer/head/manual/html/chapter-queryevents.html > > Best, > > Angel > Also worth reading: http://cgit.freedesktop.org/gstreamer/gstreamer/tree/docs/design/part-synchronisation.txt Luis > 2012/5/14 enricom <[hidden email]> >> >> Hello, I would like to know if there's a way to extract the buffer >> timestamp >> of the video stream that a video player is playing at a certain moment. So >> far I've been using the timestamps extracted by an identity element placed >> just before the video player but the handoff signals are not generated >> synchronously, so between 2 buffers of length = 0.04 s there's a system >> time >> delta extracted at the handoff signal generation slightly different than >> 0.04 s...for this reason I suppose that either the video player receives >> these buffers asynchronously, so it has a buffer itself and synchronizes >> with the general clock, or the identity signal is emitted asynchronously >> (or >> maybe both)... >> For audio/video synchronization purposes I need to know something like: in >> a >> certain precise instant the video player is displaying a frame with >> timestamp=x..is it possible? >> Thank you very much. >> >> Enrico >> gstreamer-devel mailing list [hidden email] http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
Thank you very much four your replies. Unfortunately this problem seems to be quite complicated...my final solution is to double check the video position controlling buffer timestamps (through an identity element just before the video player) and also querying the video player with GST_FORMAT_DEFAULT.
The problem is that the first method tells me which buffer is arriving but not when it is going to be played (even if we can suppose that the identity is passing it immediately to the player) whereas the second one in some cases returns a frame number not correspondent to the one returned by the identity element. For instance sometimes the video player tells me that it is playing frame number 650 whereas the handoff signal says that the last received buffer corresponds to frame number 630...and by analizing the synchronization I found that it's the video player that is wrong... Anyway thank you for your support! Enrico On 15 May 2012 12:07, Angel Martin <[hidden email]> wrote: > Hi, > > Are you looking for something like this? > http://gstreamer.freedesktop.org/data/doc/gstreamer/head/manual/html/chapter-queryevents.html > > Best, > > Angel > Also worth reading: http://cgit.freedesktop.org/gstreamer/gstreamer/tree/docs/design/part-synchronisation.txt Luis > 2012/5/14 enricom <[hidden email]> >> >> Hello, I would like to know if there's a way to extract the buffer >> timestamp >> of the video stream that a video player is playing at a certain moment. So >> far I've been using the timestamps extracted by an identity element placed >> just before the video player but the handoff signals are not generated >> synchronously, so between 2 buffers of length = 0.04 s there's a system >> time >> delta extracted at the handoff signal generation slightly different than >> 0.04 s...for this reason I suppose that either the video player receives >> these buffers asynchronously, so it has a buffer itself and synchronizes >> with the general clock, or the identity signal is emitted asynchronously >> (or >> maybe both)... >> For audio/video synchronization purposes I need to know something like: in >> a >> certain precise instant the video player is displaying a frame with >> timestamp=x..is it possible? >> Thank you very much. >> >> Enrico >> _______________________________________________ gstreamer-devel mailing list [hidden email] http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
In reply to this post by enricom
On Mon, 2012-05-14 at 01:35 -0700, enricom wrote:
Hi Enrico, > I would like to know if there's a way to extract the buffer timestamp > of the video stream that a video player is playing at a certain moment. So > far I've been using the timestamps extracted by an identity element placed > just before the video player but the handoff signals are not generated > synchronously, so between 2 buffers of length = 0.04 s there's a system time > delta extracted at the handoff signal generation slightly different than > 0.04 s...for this reason I suppose that either the video player receives > these buffers asynchronously, so it has a buffer itself and synchronizes > with the general clock, or the identity signal is emitted asynchronously (or > maybe both)... > For audio/video synchronization purposes I need to know something like: in a > certain precise instant the video player is displaying a frame with > timestamp=x..is it possible? > Thank you very much. What exactly is it that you would like to do / achieve? I presume just querying the current playback position using: GstFormatTime format = GST_FORMAT_TIME; gin64 duration; if (gst_element_query_position (pipeline, &format, &dur)) { g_print ("Position: %" GST_TIME_FORMAT "\n", GST_TIME_ARGS (dur)); } else { g_print ("Could not query position.\n"); } (once the pipeline is prerolled, i.e. in paused/playing state, or you have received an ASYNC_DONE message on the bus) is not what you're after? You can also get the current buffer from the video-sink using the "last-buffer" property and check GST_BUFFER_TIMESTAMP() on it, but the timestamp alone is not particularly useful without other information like the newsegment event. The handoff callback from the identity element is called synchronously from the streaming thread btw, but once it goes to the videosink it is usually not played right away, but the sink will wait for the right time to render it, so the handoff signal will usually get the buffer too early (unless the decoders or other upstream parts are too slow). Cheers -Tim _______________________________________________ gstreamer-devel mailing list [hidden email] http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
On Sat, 2012-05-19 at 12:25 +0100, Tim-Philipp Müller wrote:
> I presume just querying the current playback position using: > > GstFormatTime format = GST_FORMAT_TIME; > gin64 duration; > if (gst_element_query_position (pipeline, &format, &dur)) { > g_print ("Position: %" GST_TIME_FORMAT "\n", GST_TIME_ARGS (dur)); > } else { > g_print ("Could not query position.\n"); > } Err, make that gint64 pos; and &pos and GST_TIME_ARGS(pos) _______________________________________________ gstreamer-devel mailing list [hidden email] http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
Well... I already tried many times but I failed to receive a precise video position. In my opinion that code returns the position of the video player, so if it's receiving frames at constant rate it's good (it works if the file I'm playing is on my hard disk).
But in my case I have a rtp source, and it happens that the video player shows the first frame, then there's a delay (so the first frame freezes) and after that it goes on displaying the successive frames correctly. But I found that during that delay the timer of the video player goes on...so for example if we have timestamp = 0 shown at video player position = 0 , then there's that delay and timestamp 0.04 is shown at video player position = 0.8 (it's only an example)...and so I'm losing reference between my timestamp and the video player position... Anyway by querying the video player position (with a DEFAULT format) and checking buffers passing the identity just before the player I'm able to correctly identify the timestamp that is shown (of course not with an infinite precision, but enough for audio/video synchronization that is what I want to achieve). Thank you for your help!
|
Free forum by Nabble | Edit this page |