RTSP Absolute date time seeking with fragmented files

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

RTSP Absolute date time seeking with fragmented files

Hi I've a RTSP server which works as a VMS recording server. I have a TS files fragments (recorded by splitmuxsink) and database which stores metadata for each fragment like fragment id, start time and end time.

Right now I'm able to load fragments (using splitmuxsrc) and stream them to client as if it was one large video file. Now what I would like to do is to implement seeking by datetime. I would like to ask you what would be the best way to handle seek request from the client (range header) so I can load correct TS fragment and seek in it to a specific position.

Let me explain on an example:

Let's say I have 3 chunks with metadata like so:

FragmentId | StartTime | EndTime
1 | 24.3.2017 11:20:00 | 24.3.2017 11:30:00
2 | 24.3.2017 11:30:00 | 24.3.2017 11:40:00
3 | 24.3.2017 11:40:00 | 24.3.2017 11:50:00

And client sends me Range header with datetime 24.3.2017 11:35:27. I would have to load fragment 2 and 3 (to a splitmuxsrc) and seek to 00:05:27.

Can you please suggest me a way of implementing such feature?

Thank you very much for any response
Kind regards Ivan