Ten Logo
Resources Board

Script

MPV Sync Script: Co-Watching with Custom Subtitle Preferences

Sync two MPV instances for co-watching, ideal for Discord screensharing. One instance can have subtitles/audio while the other doesn't, allowing personalized viewing experiences.

  • Script
  • #Co-watching
  • #MPV
  • #Subtitles

Shared by 天 Staff

Published ·Updated

Details

"Want to watch anime with your 恋人 over Discord, but they want subtitles and you don't? This quick & dirty script helps you do just that!

Here's how it works:

First, open 2 mpv instances with different IPC sockets:

```bash

mpv video.mp4 --pause --mute=yes --no-sub --input-ipc-server=/tmp/mpv1.sock &

mpv video.mp4 --pause --mute=no --sub-auto=fuzzy --input-ipc-server=/tmp/mpv2.sock &

`

Then, run the script: python3 mpvsync.py

The mpv1.sock instance is your main one, the other is the "slave" - pause/unpause and playback position will be synced from the main one.

In the example above, the main instance is set to be muted and have no-subs, while the slave has audio + subs. That way you can screenshare the slave instance to the person you're watching with, and fullscreen the main one for yourself. We both get audio but you won't see subs while they do.

From experience using the script, video stays pretty much perfectly in sync even with pausing/seeking. If it's a bit off, you can decrease the stray threshold and poll interval at the top of the script.

Note: This only works for 1x speed for now."

Visit Link