AlexAplin / nndownload

Download and process links from Niconico (nicovideo.jp)
MIT License
213 stars 28 forks source link

Add native HLS downloader #148

Closed AlexAplin closed 2 months ago

AlexAplin commented 3 months ago

As we move to DMS (#146), videos are now downloaded in segments with the grunt work being done by ffmpeg. That doesn't have multithreading support, so as DMC phases out, we probably won't support multithreading for now as DMS delivery is significantly faster even in sequence. One hacky way we might accomplish this for now is by splitting segment groups to multiple ffmpeg processes and combiing the results, but I'm mostly speculating if that's even possible. streamlink --hls-segment-threads may be some prior art for how to approach this.

Picking up on partial downloads also gets tricky because ffmpeg really only ever wants to download everything at once in sequence. yt-dlp even provides their own HLS downloader specifically for this use case with --hls-prefer-native. We should really start saving to PART files and converting the extension after completion to know when overwriting is appropriate.

Given these questions, it's likely we'll probably want to write in our own HLS downloader eventually.