Getting Timestamps From a Resulting Video File With splitmuxsink

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Getting Timestamps From a Resulting Video File With splitmuxsink

Michael MacIntosh
Hey,

Basically what I am trying to do, is I am trying to record to a video
file, and while that is recording, a user can point out a point of
interest in that video, so they can review it later.

I can get the sample and convert it to a jpeg, and that works. Right now
what I am having a hard time doing is getting the point in the output
file that this frame represents.

Both the presentation time stamps and the decoding time stamps seem to
correlate with the running duration of the total stream, but I am
interested in finding it relative to the output file.  So when the
splitmuxsink goes from file00000.mp4 to file00001.mp4, I want timestamps
that would be starting at 0 after we start recording to file00001.mp4.

Currently I am trying to use the signals emitted by splitmuxsink,
"format-location" and "format-location-full" to save the current
pipeline clock time to use as a base.  However for whatever reason,
these signals crash when the callback exits (I might need to file a
ticket on that if I can dig up more on it, I'm running on windows, so I
blame that).

tl;dr: Is there an "easy" way to get what the current duration of the
file it is recording from splitmuxsink?

Cheers,
Michael.



--
This message has been scanned by E.F.A. Project and is believed to be clean.


_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Getting Timestamps From a Resulting Video File With splitmuxsink

Baby Octopus
Administrator
The approach is right. You will have to use the signal to have whichever name that you like for the output file

Another option is to tamper splitmuxsink code to that internally. Instead of running index 0,1,.. and so on, get the segment_to_running_time and decide the file name yourself..

~BO
Reply | Threaded
Open this post in threaded view
|

Re: Getting Timestamps From a Resulting Video File With splitmuxsink

Tim Müller
In reply to this post by Michael MacIntosh
On Tue, 2017-06-13 at 18:31 -0700, Michael MacIntosh wrote:

Hi Michael,

Doesn't splitmuxsink post ELEMENT messages on the bus that give you a
mapping of running time to filename ?

If you keep track of those it should allow you to figure out which file
it is and what the time into the file part is.

Alternatively you could just use splitmuxsrc of course and seek to the
right location that way based on the original timestamp.

Cheers
 -Tim

--
Tim Müller, Centricular Ltd - http://www.centricular.com
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

AW: Getting Timestamps From a Resulting Video File With splitmuxsink

Thornton, Keith
Splitmuxsink sends splitmuxsink-fragment-opened / splitmuxsink-fragment-closed messages for each fragment.

-----Ursprüngliche Nachricht-----
Von: gstreamer-devel [mailto:[hidden email]] Im Auftrag von Tim Müller
Gesendet: Mittwoch, 14. Juni 2017 10:40
An: [hidden email]
Betreff: Re: Getting Timestamps From a Resulting Video File With splitmuxsink

On Tue, 2017-06-13 at 18:31 -0700, Michael MacIntosh wrote:

Hi Michael,

Doesn't splitmuxsink post ELEMENT messages on the bus that give you a mapping of running time to filename ?

If you keep track of those it should allow you to figure out which file it is and what the time into the file part is.

Alternatively you could just use splitmuxsrc of course and seek to the right location that way based on the original timestamp.

Cheers
 -Tim

--
Tim Müller, Centricular Ltd - http://www.centricular.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
Reply | Threaded
Open this post in threaded view
|

Re: AW: Getting Timestamps From a Resulting Video File With splitmuxsink

Michael MacIntosh
Hey,

Thank you guys for all of your responses!  The message should do the trick!

For some reason I didn't even think that the splitmuxsink would be
posting messages on the bus.  Is there documentation on this? The
gstreamer documentation on element messages says check the documentation
for that element, but from what I can tell, no elements have
documentation stating what element messages they use.  I just had to
look over the source code to find out what the parameters were for
"splitmuxsink-fragment-opened".

Anyways, after some digging I realized that the splitmuxsink holds onto
the last I frame it has received and only writes to the file when it
gets the next I frame (it has a full GOP length).

This makes things interesting when you grab a specific frame from the
stream, and want to know where in the output video file it would land,
because you technically wouldn't know until the splitmuxsink makes the
decision that it will either record that GOP to the current file, or
that the GOP is too big (I am rotating on max bytes) and it needs to
save it to a new file.

For now I can grab the starting times and filenames from the bus with
the "splitmuxsink-fragment-opened" message, and use them to build a
mapping, and calculate the differences when recording has finished.

Still, it feels like I am missing the mark, I feel like the muxer or the
filesink should be aware of what the timestamp is going to be in the
file it is writing to, but whatever.

Cheers,

Michael.


On 6/14/2017 1:55 AM, Thornton, Keith wrote:

> Splitmuxsink sends splitmuxsink-fragment-opened / splitmuxsink-fragment-closed messages for each fragment.
>
> -----Ursprüngliche Nachricht-----
> Von: gstreamer-devel [mailto:[hidden email]] Im Auftrag von Tim Müller
> Gesendet: Mittwoch, 14. Juni 2017 10:40
> An: [hidden email]
> Betreff: Re: Getting Timestamps From a Resulting Video File With splitmuxsink
>
> On Tue, 2017-06-13 at 18:31 -0700, Michael MacIntosh wrote:
>
> Hi Michael,
>
> Doesn't splitmuxsink post ELEMENT messages on the bus that give you a mapping of running time to filename ?
>
> If you keep track of those it should allow you to figure out which file it is and what the time into the file part is.
>
> Alternatively you could just use splitmuxsrc of course and seek to the right location that way based on the original timestamp.
>
> Cheers
>   -Tim
>
> --
> Tim Müller, Centricular Ltd - http://www.centricular.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

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