Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
Unnecessary disk space usage with the native hls downloader #7087
Comments
|
i asked to make this change before(in this pull request #6392) and this is the answer from one of the core Collaborators(@jaimeMF):
|
|
I made pull request #7088 to fix this bug. |
|
Oh just saw your comment. I see. If the default behavior will not be changed I would really like a command line option to make the file not be able to be directly played but not use double the disk space. |
|
With |
|
for m3u8 it is possible to continue download and in the same time be able to play the video without appending the segments to the file. |
|
I might just look into storing a list of downloaded fragments instead of the whole fragments for a pull request myself. It does not look that complicated. |
|
I remember experiencing this a ~year ago, and then it went away?!?!? |
When downloading an HLS stream using the --hls-prefer-native command line option from Twitch.tv for example, while downloading the used disk space is effectively double as much as it needs to be.
This happens because youtube-dl keeps all the fragment files and at the same time writes into the final file containing all the fragments.
I believe this is done at
youtube_dl/downloader/hls.py +97. There in a loop for all fragments, each fragment is downloaded AND appended to the final output file. Only after the loop is finished the fragment files are removed.This can be fixed by either removing a successfully downloaded fragment right after appending it to the final file or by waiting to create the final file in the deletion step after all fragment files are downloaded.
I am guessing fixing this might create some problem for resuming aka continuing an older download however I think this could be fixed by merely storing a list of the fragments that have been successfully downloaded instead of the files and their contents.