Python script to convert the Json containing all the chat of Twitch, to the Youtube Timed Text subtitle format (YTT).
- Use the users' colors
- Create a unique color for users who don't have one
- Display the subtitles in chat order (new at bottom). Do this by compiling collisions
- Display the chat at the bottom left of the screen
- Display unicode emojis
- Doesn't show Twitch only emojis (show only their names)
- Doesn't show users' badges
Either make it executable (chmod +x
), or just run python3 convert-combined-ytt.py twitchChat.json
. It will write the output to the console. You can save the file by redirecting the output with >
:
python3 convert-combined-ytt.py twitchChat.json > twitchChat.ytt
You can also use a second command line argument to set an output file. It's probably needed if your console/cmd is not in UTF-8. Beware, it'll write to the file without any confirmation asked if the file exists, overwritting it by default.
python3 convert-combined-ytt.py twitchChat.json twitchChat.ytt
You can use Twitch Downloader to download the JSON of the Twitch Chat :
TwitchDownloaderCLI -m ChatDownload -u videoID -o videoID.json
I also used YTSubConverter extensively to understand the YTT format. Note that they implemented at my request a feature to handle the reverse order of Collision in .ass format, allowing for chat order of subtitles (new at bottom).
This tool is great, so don't hesitate to use it if it fits your needs more.
Note that in order to do this script, I also made JSON to .ssa and JSON to .ass converters. If you want them, ask and I'll add them.
The script may have bugs. I didn't test it extensively. But looks good as far as I know. Don't hesitate to comment if you find bugs.
I tried your script but the first thing I noticed was that when trying to upload the subtitle file my old notebook was extremely slow, apparently YouTube uses the browser's local processing to load each subtitle line. When testing with a smaller processed .json I was able to upload it to YouTube, but the result in the player was the same in the standard YouTube subtitles (a single centered line) and with overlap as Twitch timestamps are disorganized. Is it not possible to do as in the example video that was sent? Using yt-dlp in the link it is possible to download the custom subtitle of the video in the formats "vtt, ttml, srv3, srv2, srv1, json3", I just don't know which format was originally uploaded for the video. Also, can you send the other formats converters? Thank you