hlsdl icon indicating copy to clipboard operation
hlsdl copied to clipboard

Support for EXT-X-MAP (basic)

Open Scorg opened this issue 1 year ago • 2 comments

This adds basic support for the EXT-X-MAP tag that has the Media Initialization Section necessary for a valid video. Things that don't work yet, probably:

  • Discontinuities. When a new map comes, it would be written like any other segment, but probably should start a new file. Considering that hlsdl is only give one target file per launch, this would need some thinking.
  • Encryption. I haven't quite understood form the spec how does an init section behave in the presence of encryption, and what must be used as the key.

Scorg avatar Nov 24 '24 10:11 Scorg

Just to confirm, did you test this? I'm not really familiar with EXT-X-MAP but if you tested that this works correctly I'm fine with merging it.

selsta avatar Dec 02 '24 02:12 selsta

Yes, but likely not exhaustively. The stream I tested on had just one map segment for the full length, no discontinuities, no encryption. VLC didn't like the video file as is - loading took time proportional to the file's size, seeking also wasn't fast, but it played at least. ffprobe didn't complain. I'm neither an expert on the HLS spec, nor MPEG, at first I tried to prepend the map to every segment (this is how ffmpeg does download a live hls, but from the logs it looks like it redownloads the map with each playlist update), but ffmpeg complained about duplicate moov atoms. Then I made it so that the map segment is written just once, and complaints went away.

Scorg avatar Dec 02 '24 16:12 Scorg