Spark-NF/hls-downloader

Problems when segment file name repeats

Opened this issue · 1 comments

Seems that there is a requirement that the file names in the hls playlist are unique. So for example a manifest like this just keeps overwriting the same files:

#EXTINF:8,
03efa717-1a8e-4742-af46-6b93a5f93318/9f6a-MAIN/03/audio_aac_128K/00/00/00_000.mp4a
#EXTINF:8,
03efa717-1a8e-4742-af46-6b93a5f93318/9f6a-MAIN/03/audio_aac_128K/00/00/08_000.mp4a
#EXTINF:8,
03efa717-1a8e-4742-af46-6b93a5f93318/9f6a-MAIN/03/audio_aac_128K/00/00/16_000.mp4a
#EXTINF:8,
...
03efa717-1a8e-4742-af46-6b93a5f93318/9f6a-MAIN/03/audio_aac_128K/00/02/00_000.mp4a
#EXTINF:8,
03efa717-1a8e-4742-af46-6b93a5f93318/9f6a-MAIN/03/audio_aac_128K/00/02/08_000.mp4a

Not sure of the best solution, but perhaps an event to allow specification of each segment file path or something.

Or just allow for you to replace the slash with another character and keep that as the filename. So:
03efa717-1a8e-4742-af46-6b93a5f93318/9f6a-MAIN/03/audio_aac_128K/00/00/00_000.mp4a
would become
03efa717-1a8e-4742-af46-6b93a5f93318_9f6a-MAIN_03_audio_aac_128K_00_00_00_000.mp4a

Interestingly, I notice that ffmpeg supports downloading segments. That seems to fit my needs over downloading them myself.

ffmpeg -i https://mnmedias.api.telequebec.tv/m3u8/29880.m3u8 -map p:6 -c copy -t 60 -f segment -segment_list out.list out%03d.ts