hlsdl icon indicating copy to clipboard operation
hlsdl copied to clipboard

How can I download from the beginning of a live stream, and not at the current time?

Open shillshocked opened this issue 4 years ago • 1 comments

I want to capture the whole stream from beginning to end. Let's say I miss 1/2 an hour. How can I capture the whole live stream from the start to the end?

shillshocked avatar Nov 27 '19 23:11 shillshocked

When you start a stream and download the media playlist, you get the media segments as far back as that playlist goes. For a livestream, you will generally be downloading a playlist and starting it somewhere in the middle; the software continually re-downloads the playlist found at the same URL, and the server continually updates the playlist with the current list of segments comprising the livestream.

So, you can go back as far as the first segment in the playlist, however far back in time that goes, but in most cases it isn't possible to go back in time any farther than the first media segment.

I don't see any logic in hlsdl that takes the wall-clock time into account, it appears to chop off the first 120 seconds from the livestream, by default.

It appears you can use the -s 0 command-line argument to start from the first media segment in the playlist, however far back that goes.

This code appears to skip forward by the number of seconds you specify with the -s option, and if you don't specify it, the value is initialized to the constant HLSDL_LIVE_START_OFFSET_SEC, which is 120.

I'm not quite sure why 120s are skipped by default, or if there's some other logic in play that would make -s 0 start somewhere other than the beginning.

@selsta - Will -s 0 start downloading from the first segment in the playlist? Why does it skip 120s by default? Or am I reading something wrong? Thanks for any light you can shed on the matter!

nekno avatar May 26 '20 04:05 nekno