Skip to content

Python script that replays a livestream chat alongside a local video playing in mpv

Notifications You must be signed in to change notification settings

shadax1/mpv_chat_replay

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 

Repository files navigation

mpv_chat_replay

Python script that replays a livestream chat alongside a local video playing in mpv.

Note: At the moment, this script only works with chat logs from HexChat where lines are formatted as follows:

MMM DD hh:mm:ss <username> message

  • MMM being a short month name (Jan, Feb, Mar, etc...)
  • DD being a day of month (01-31)
  • hh being hours (00-24)
  • mm being minutes (00-59)
  • ss being seconds (00-59)

This script has been tested on both Windows 10 and Linux

Requirements

This script relies on a couple things:

  • mpv player
  • Python 3 (this was developed with version 3.9.7 but anything above should work fine)
  • The mpv python package which can be installed with pip install mpv
  • ffprobe which can be installed by downloading the release binaries/executables here or with a package manager like chocolatey or your Linux distribution's package manager. Type ffprobe in a command line to see if the command is present or not
  • mpv-1.dll (for Windows users) which is included in this repository but can also be found here
  • The video file to play needs be named exactly the same way OBS does by default (example: 2017-03-10_22-57-54.mp4)
  • A log file generated by HexChat
  • The year when logging started for the given log file

How to use

Download this repository and unzip it anywhere on your disk. Open the config.json file and add the path to the chat log as well as the year when logging started for that log file in the appropriate fields like this:

{
    "log_path":"/home/user/chatlog.txt",
    "log_year_start":2016
}

Note: for Windows paths, use escape characters for backslashes like this for instance C:\\Users\\user\\chatlog.txt

After that, open a command line to run the script with the path to the video file as an argument:

python mpv_chat_replay.py '/home/user/2017-03-10_22-57-54.mp4'

In this case, the argument is the following video file path /home/user/2017-03-10_22-57-54.mp4.

mpv will then start and the command line will display chat lines as the video plays or as you scrub through it.

About

Python script that replays a livestream chat alongside a local video playing in mpv

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages