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.
Function to limit duration and/or size (for livestreams) #11206
Comments
PlaceholderOkay after an hour of research I find it pretty easy to look through the m3u8 downloading a single .ts (Transport Stream) file. Those have a length of 2sec each. After the download I can use ffmpeg on that using spefici parameters to drop the video and only convert the ts file with audio to something like mp4 (ofc mp3 makes more sense with only audio was just a quick test). This is at least a first step. I will probably pull the whole repo and make a module. Just a matter of time when I will make a pull request and contribute to this project :) |
|
Hi, |
Make sure you are using the latest version: run
youtube-dl --versionand ensure your version is 2016.11.14.1. If it's not read this FAQ entry and update. Issues with outdated version will be rejected.Before submitting an issue make sure you have:
What is the purpose of your issue?
The following sections concretize particular purposed issues, you can erase any section (the contents between triple ---) not applicable to your issue
As said in the title youtube-dl is missing any function/parameter to limit the duration and/or the size.
I tried livestreamer before but it did not work at all with the livestream I was recording so I switched to youtube-dl (sorry for that much offtopic). That stream is running 24/7 without any break or so. But they change the title if another content/show starts (e.g. 10min 'news' then 30min 'talk' just a general example). Unfortunately there is also no way to only get audio for a livestream tho I think it should be at least possible to save only audio directly (but still receiving video+audio just drop the video and save only audio). I know there is '-x' but only for postprocessing that means I need to finish a download which will never happen with a 24/7 livestream. It would be nice to have an option to set a limit on the duration but more preferable at least the size.
Let's say we have an option like '--maxdl-filesize SIZE' -> '--maxdl-filesize 10.0m'
this will save the output so far into a file (it's best to use template then to get timecode/length).
I cannot say how difficulty it would be to make a prototype for that (I would do that on my own but I am also in lack of time). The best thing I thought about would be using a script that collects the information about the length of the shows then let it send ctrl-c to stop the download but before that already start a new youtube-dl process since it takes a little time for a new process to start the download. This would not be a perfect solution but a quick'n'dirty one. I haven't tested yet to continuously download the stream and directly use it while downloading in e.g. ffmpeg to split it into parts and as audio only (I am relating to this option --hls-use-mpegts).
Edit: Youtube is using Fragments. Maybe it's possible to start off with those at least.