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

Download VOD Separated into different files by Game #980

Open
2 tasks done
SherlockOats opened this issue Feb 26, 2024 · 5 comments
Open
2 tasks done

Download VOD Separated into different files by Game #980

SherlockOats opened this issue Feb 26, 2024 · 5 comments
Labels
enhancement New feature or request

Comments

@SherlockOats
Copy link

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.

@SherlockOats SherlockOats added the enhancement New feature or request label Feb 26, 2024
@superbonaci
Copy link
Contributor

Can you provide a sample video?
You can probably do that with a simple ffmpeg command...

@SherlockOats
Copy link
Author

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.

@superbonaci
Copy link
Contributor

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: #491

@superbonaci
Copy link
Contributor

superbonaci commented Mar 12, 2024

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.

@ScrubN
Copy link
Collaborator

ScrubN commented Apr 2, 2024

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 #863 (comment) would make it feasible with minimal losses.

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

No branches or pull requests

3 participants