Open SherlockOats opened 8 months ago
Can you provide a sample video? You can probably do that with a simple ffmpeg command...
https://www.twitch.tv/videos/2080537125 This VOD for example has Goose Goose Duck and also Minecraft. I would want one download to be GGD and another to be Minecraft based on when the game is switched. I dont know how to write ffmpeg commands or use them thats why I am using this program.
You can download the VOD by chapters using the -b
and -e
flags to manually set the crop times (the chapters inside are not adjusted but it's a bug). You have to find manually the chapters markers and convert it to seconds like this (02:06:53 is 7613 seconds):
TwitchDownloaderCLI videodownload -u 2080537125 -q best --temp-path './TMP' --oauth your_oauth -o 2080537125_Goose_Goose_Duck.mp4 -e 7613
TwitchDownloaderCLI videodownload -u 2080537125 -q best --temp-path './TMP' --oauth your_oauth -o 2080537125_Minecraft.mp4 -b 7613
Or you can download the full video. It has the chapters already as metadata inside the mp4:
TwitchDownloaderCLI videodownload -u 2080537125 -q best --temp-path './TMP' --oauth your_oauth -o 2080537125.mp4
Some program can help you cut the video in pieces by chapters.
But maybe you want TwitchDownloader
to do it automatically for you?
Some help: https://github.com/lay295/TwitchDownloader/issues/491
If the chapters are (example):
Chapter 1: 00:00 - 19:40
Chapter 2: 19:40 - 24:10
Chapter 3: 24:10 - 1:12:00
You can use ffmpeg to crop without conversion, to match exactly the duration of each chapter. It's the fastest way:
ffmpeg -i output.mp4 -ss 00:00:00 -t 00:19:40 -c copy output_chapter1.mp4
ffmpeg -i output.mp4 -ss 00:19:40 -t 00:24:10 -c copy output_chapter2.mp4
ffmpeg -i output.mp4 -ss 00:24:10 -t 01:12:00 -c copy output_chapter3.mp4
The issue can be that the chapters don't start or end exactly at I-frames, so if you copy without conversion you should match I-frames (example) to avoid codec errors:
ffmpeg -i output.mp4 -ss 00:00:00.2 -t 00:19:40.7 -c copy output_chapter1.mp4
ffmpeg -i output.mp4 -ss 00:19:40.7 -t 00:24:11.1 -c copy output_chapter2.mp4
ffmpeg -i output.mp4 -ss 00:24:11.1 -t 01:11:59.4 -c copy output_chapter3.mp4
This video will not match exactly the chapter, and if the I-frames are separated by a lot of time it can be an issue because some content will be missing or misplaced (you can use next or previous I-frame so no content is discarded in any chapter).
If you want to keep the duration exact, you have to convert, so I-frames are regenerated (change -c copy
for the codec, bit-rate, quality, size, so on). Then if you want include the new chapter from metadata.txt.
But maybe it's more stuff than you need, if you are going to use a video editor anyway and export, you don't need to complicate things.
What you want to do by separating each chapter into a video (no conversion), has the issue that chapters don't start or end with I-frames (usually) so it's not as easy as you want to do.
I don't now if TwitchDownloaderCLI
could separate into chapters matching exactly the chapter duration (and keeping the mp4 format in mint condition). That depends on the Transport Stream format (has I-frames or not). The CLI doesn't convert, just copies making few adjustments, so the same issue could happen anyway. No idea if @ScrubN knows more about this. The whole idea of using codecs with compression does not allow to crop videos at any point without conversion and without errors.
Let us know more about what exactly you want to do, that could help other users too.
This is something I have thought about, however the current enqueuing system would not provide an elegant solution. The current WPF UI is also a little cramped and I'm not sure where I would put video chapter information on either the VOD page or the mass downloader.
I don't now if
TwitchDownloaderCLI
could separate into chapters matching exactly the chapter duration (and keeping the mp4 format in mint condition).
Solving #863 with https://github.com/lay295/TwitchDownloader/issues/863#issuecomment-2031031992 would make it feasible with minimal losses.
Checklist
Write your feature request here
I am an editor for multiple streamers and upkeep a number of YouTube VOD channels. But I dont just upload a full straight VOD, I cut the VOD into different videos by what game was played. 3 games in one stream? thats 3 videos. I see markers for when the game changes categories on the files when I drop them into my editor, but I usually download them as separate files by time stamp so I can keep track of what games I have not edited yet. It would be nice to be able to download a VOD and have it be made into separate videos based on when the game category is changed. If at all possible.