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

Video Chapters #491

Closed
2 tasks done
TheMadog24 opened this issue Jan 3, 2023 · 19 comments · Fixed by #497
Closed
2 tasks done

Video Chapters #491

TheMadog24 opened this issue Jan 3, 2023 · 19 comments · Fixed by #497
Labels
enhancement New feature or request

Comments

@TheMadog24
Copy link

Checklist

Write your feature request here

I would love to be able to have chapters in one way or another, whether it be generating a chapter file, or embedding chapters into the mp4 metadata with ffmpeg.

@TheMadog24 TheMadog24 added the enhancement New feature or request label Jan 3, 2023
@ScrubN
Copy link
Collaborator

ScrubN commented Jan 3, 2023

As far as I can tell none of the current requests that we make return stream chapters and I have no clue where to begin looking. If @lay295 can figure out the request then I would easily be able to implement the metadata to downloaded videos.

@TheMadog24
Copy link
Author

I'm not sure if it helps at all, but the reason I suggest it is because Tartube has it, but it's meant for youtube and uses yt-dlp. The download speed is pretty terrible (1-3Mbps), but it does work with twitch, and can embed chapters.

@ScrubN
Copy link
Collaborator

ScrubN commented Jan 3, 2023

Oh interesting. On the one hand, yes that is helpful, but on the other hand, the mainapp.py script (where I assume the queries are made) is fucking 27,000 lines. I'll try looking through it.

@lay295
Copy link
Owner

lay295 commented Jan 3, 2023

I dunno if they've changed their GQL call but this is what I've used before

image

@ScrubN
Copy link
Collaborator

ScrubN commented Jan 3, 2023

Tartube does not handle chapters, it is merely a glorified yt-dlp GUI frontend. Here is the script responsible for all of the metadata scraping in yt-dlp. It looks like there's a lot of other metadata we could grab as well so I may look into that too.

@TheMadog24
Copy link
Author

right now, the only player i know that reads embedded chapter metadata is VLC. But I'm using mediainfo.js in my project to extract the metadata, and form a chapters menu with it.
If there is other metadata you can grab, that would be interesting.

@lay295
Copy link
Owner

lay295 commented Jan 3, 2023

Personally, I'd be in favor of storing whatever metadata we gather inside the chat json instead of somehow in the mp4 file.

I am a little afraid Twitch is gonna crack down more on these GQL calls with the integrity endpoint check... But we'll cross that road when we get there.

@TheMadog24
Copy link
Author

Storing the chapters and other metadata in the chat file would actually make it much easier to work with for me, since Mediainfo.js can't be a local file, and doesn't work offline.

I am also surprised that you guys haven't asked what I'm working on that uses TwitchDownloader.
You have all been very nice and willing to help, despite all of my odd requests, lol.

@ScrubN
Copy link
Collaborator

ScrubN commented Jan 3, 2023

I assumed you just wanted the chapters for playback purposes. If you're going to be actually using the information then we should add it to both video and chat files. It could be practical in the future for chats anyways.

Also VLC, MPV, Handbrake, XMedia, and Gnome Videos are all able to read chapter data.
image
image
image

@TheMadog24
Copy link
Author

TheMadog24 commented Jan 4, 2023

If you're going to be actually using the information then we should add it to both video and chat files. It could be practical in the future for chats anyways.

For my application of it, either is fine, and both is also fine. Having the chapter data stored in the video file is how it works now, but that system doesn't work if you have no internet (since it relies on web resources). Having it stored in the chat file would allow me to always make it work, but that also relies on the people pairing the correct video and chat together.

Also VLC, MPV, Handbrake, XMedia, and Gnome Videos are all able to read chapter data.

AH, I forgot about Handbrake, but I'm not familiar with the others.

@TheMadog24
Copy link
Author

To further this, even if you wanted to export those chapters to a separate file, that would also work for me. I believe Chapter files are stored as .WebVTT?

@ScrubN
Copy link
Collaborator

ScrubN commented Jan 4, 2023

As far as I can tell chapters are not standardized as a whole, they're standardized per encoding format/tool

@ScrubN
Copy link
Collaborator

ScrubN commented Jan 6, 2023

https://twitch.tv/videos/1694846567

image
image

Note: The "date" metadata key is known as "year" in most formats.

@ScrubN
Copy link
Collaborator

ScrubN commented Jan 6, 2023

I'm torn between directly embedding the GQL chapter response or beautifying it in ChatRoot.

Edit: I think I'll beautify it so it's easier to understand in layman's

@ScrubN
Copy link
Collaborator

ScrubN commented Jan 6, 2023

Here's the current chatdownload version. Any objections/suggestions? I assume there's more chapter types than just GAME_CHANGE, probably stream markers, that would fill in the empty strings but I'm having trouble with EditThisCookie so I can't verify this.

image

@TheMadog24
Copy link
Author

I'm not sure if I'm the one you're asking, but it looks great to me!

@ScrubN
Copy link
Collaborator

ScrubN commented Jan 11, 2023

I assume there's more chapter types than just GAME_CHANGE, probably stream markers, that would fill in the empty strings but I'm having trouble with EditThisCookie so I can't verify this.

By using cookie quick manager with firefox, I was able to get my token and confirm that stream markers are not returned in the chapter response. Not sure if there really is any chapter type other than GAME_CHANGE, though I will still keep the check in videodownload just in case.

@TheMadog24
Copy link
Author

Feel free to correct me if I am wrong, but I thought the stream markers were only visible by the streamer.

@ScrubN
Copy link
Collaborator

ScrubN commented Jan 11, 2023

If a user has editor permissions then they can also see stream markers.

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

Successfully merging a pull request may close this issue.

3 participants