morrah / mpv-twitch-chat-irc

Show Twitch chat messages as subtitles when watching Twitch Live with mpv.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Show Twitch chat messages as subtitles when watching Twitch Live with mpv.

Based on mpv Twitch Chat for VODs, but since mpv-twitch-chat uses Twitch API to retrieve comments history, it doesn't support live chat comments. This script uses a python subprocess to keep a background irc connection to a channel and dump last 10 messages to file in SubRip format.

Issues

  • Subtitle track is deleted and re-added on every refresh, so it blinks.

Requirement

python3

Install

git clone or download and unpack to mpv's scripts directory.

pip install certifi – added certifi dependency to fix "certificate verify failed: unable to get local issuer certificate" error popped out on some win10 system;

TODO

Remove python dependency: re-write in Lua using lua-irc-engine and luasocket.

Usage

To activate the script, play a Twitch Live and switch on the "Twitch Chat" subtitle track. The script will replace it with its own subtitle track.

You can use mpv's auto profiles to conditionally apply special subtitle options when Twitch Live is on. For example,

[twitch]
profile-cond=get("path", ""):find("^https://w?w?w?%.?twitch%.tv/") ~= nil
profile-restore=copy-equal
sub-font-size=25
sub-align-x=right
sub-align-y=top

makes the Twitch chat subtitles smaller than default, and moved to the top right corner.

About

Show Twitch chat messages as subtitles when watching Twitch Live with mpv.


Languages

Language:Python 55.9%Language:Lua 44.1%