Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] Allow for Multiple VOD Downloads & Merge Capability? #74

Open
chemputer opened this issue Sep 9, 2021 · 2 comments
Open

Comments

@chemputer
Copy link

Feature Request

Idea:

Ability to download multiple VODs with one command, and merge two or more VODs together into one file.

This is a feature that, admittedly, would take some effort, but I think that a lot of Streamers would find useful. Occasionally Twitch acts up, cuts a stream in two, or three, or four, depending on the length, and most Streamers simply deal with that as a fact of life. It would be wonderful to have functionality built into this so that if that happens, you provide the URL's or IDs (this can also be used to download more than one, not just for merging VODs). While I do think a separate feature request would be appropriate for allowing for multiple downloads at the same time (or queued), it's inherent in this one, so it may as well be addressed here.

Example Syntax

So, example syntax would be, twitch-dl download ID1 ID2 ID3 ID4 ... IDX [--merge] (where the --merge switch is optional, and without it, it simply downloads all the videos, but with it, it merges), and/or twitch-dl merge ID1 ID2 ID3 ID4 ... IDX (In the future, I'll refer to a 2 VOD situation for ease of writing and my own sanity, but it can be extended out to n number of VODs)

Relatively Easy Way

After playing around with twitch-dl and the source, and a bit of time figuring out how it works to a limited extent, I've discovered that you download a m3u8 playlist file, which you then use to download a number of individual chunks of the video. They're in the .ts format, which luckily, is one that can be concatenated extremely easily. (see this page on merging/concatenating files with ffmpeg) cat in Linux distros can handle it, it's that straightforward, as can ffmpeg, so to do this, you would simply need to download VOD A's .ts files as normal, but instead of using the output of ffmpeg to make it an MKV file, you could quite easily just leave it as a .ts file, like so: ffmpeg -i .\highlight-ID.m3u8 -c copy -stats -loglevel warning out.ts then download VOD B's .ts files, concatenate them with ffmpeg with a .ts file extension, and then use cat to concatenate the two files together, or use ffmpeg in a manner like so: ffmpeg -i "concat:VODA.ts|VODB.ts" -c copy mergedVideo.mkv which would produce a perfectly watchable video. I've tried this myself, and it works fine. For extending it beyond 2, you could have a function that takes two .ts files, and outputs a .ts file, and so concat VODA.ts + VODB.ts into VODAB.ts, then concat VODAB + VODC, and simply repeatedly concatenate the extra files onto the end until it's done, then convert it to mkv, with ffmpeg -i VOD.ts -c copy out.mkv, quite simple, really. This could eventually even be merged into an application that allows Streamers to upload the videos directly to YouTube once they've merged them, but that's outside the scope of this feature request.

I apologize if that was confusing, it's a bit hard to convey the concepts clearly in my opinion, but I did my best. If I can clarify anything, let me know.

Conclusions and Final Thoughts

At the very least, it would be nice to be able to download more than one video at the same time (or queued) with twitch-dl, much like youtube-dl supports, so you could do twitch-dl download ID1 ID2 and it would download both videos with ID1 and ID2. As for that, it's likely as simple as storing each arg that meets the expectations of either an ID or URL, and then using that to run the download function(s) multiple times until you're at the end of the list. I'm not even remotely familiar enough with that part of the source to make any definitive suggestions.

I have some experience doing something vaguely similar (concatenating every 6 videos together so that what was a bunch of 10-minute episodes is now several hour-long episodes) with YouTube-dl programmatically, so if you're interested in this and I can be of any assistance, please don't hesitate to ask. I'm not sure I understand the code well enough at this point to fork it and try to do the modifications myself, wholesale, but the idea works, anyway. I'm just not quite familiar enough with the code to figure out how to implement it. I'm perfectly willing to work with you if you like.

@ihabunek
Copy link
Owner

Thanks for the detailed request. I agree that this would be a good feature. At the moment I cannot promise a timeline for when I will have the time to work on it.

@ihabunek
Copy link
Owner

It's now possible to download multiple videos by specifying multiple ids twitch-dl download ID1 ID2 ID3. The merge is not yet implemented.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants