|
| 1 | +# 🎬 mpv-multi-screen |
| 2 | + |
| 3 | +**mpv-multi-screen** is a lightweight macOS command-line tool that launches one [`mpv`](https://mpv.io/) instance per display, each running fullscreen in loop mode. |
| 4 | +It supports **per-screen audio routing** and optional **volume control**, so each screen can output sound to its own device at the desired level. |
| 5 | + |
| 6 | +--- |
| 7 | + |
| 8 | +## 🚀 Features |
| 9 | +- Launch one fullscreen `mpv` instance per screen |
| 10 | +- Play either: |
| 11 | + - a single video file per screen, or |
| 12 | + - an entire folder of videos (looped as a playlist) |
| 13 | +- Independent audio device selection per screen |
| 14 | +- Persistent configuration of audio routing & volume |
| 15 | +- Clean playback: no UI, no OSC, just video |
| 16 | + |
| 17 | +--- |
| 18 | + |
| 19 | +## 📦 Installation |
| 20 | + |
| 21 | +You need [`mpv`](https://mpv.io/) installed on your Mac. The easiest way is via [Homebrew](https://brew.sh): |
| 22 | + |
| 23 | +```bash |
| 24 | +# Install Homebrew if not already installed |
| 25 | +/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" |
| 26 | + |
| 27 | +# Install mpv |
| 28 | +brew install mpv |
| 29 | +``` |
| 30 | + |
| 31 | +Then build this project in Xcode (or `swift build`) to get the `mpv-multi-screen` executable. |
| 32 | + |
| 33 | +--- |
| 34 | + |
| 35 | +## 🔧 Usage |
| 36 | + |
| 37 | +### 1. List available audio devices |
| 38 | +```bash |
| 39 | +mpv-multi-screen list |
| 40 | +``` |
| 41 | + |
| 42 | +Example output: |
| 43 | +``` |
| 44 | +[0] 'coreaudio/auto' (default) |
| 45 | +[1] 'coreaudio/USB HIFI Audio' |
| 46 | +[2] 'coreaudio/HDMI LG TV' |
| 47 | +
|
| 48 | +Config will be saved to: ~/Library/Application Support/mpv-multi-screen/audio.conf |
| 49 | +Use: mpv-multi-screen setaudio <idx[,vol]> <idx[,vol]> ... (one per screen, in order; vol = 0–100) |
| 50 | +``` |
| 51 | + |
| 52 | +--- |
| 53 | + |
| 54 | +### 2. Save audio routing per screen |
| 55 | +Choose a device (and optionally a volume 0–100) for each screen: |
| 56 | + |
| 57 | +```bash |
| 58 | +# screen1 → device index 1 @ 100% |
| 59 | +# screen2 → device index 2 @ 45% |
| 60 | +mpv-multi-screen setaudio 1,100 2,45 |
| 61 | +``` |
| 62 | + |
| 63 | +The configuration is saved persistently at: |
| 64 | + |
| 65 | +``` |
| 66 | +~/Library/Application Support/mpv-multi-screen/audio.conf |
| 67 | +``` |
| 68 | + |
| 69 | +--- |
| 70 | + |
| 71 | +### 3. Launch videos |
| 72 | +Pass **one path per screen** (each path can be a single file or a folder): |
| 73 | + |
| 74 | +```bash |
| 75 | +# Example: 2 screens, each looping its own folder |
| 76 | +mpv-multi-screen /path/to/folder1 /path/to/folder2 |
| 77 | +``` |
| 78 | + |
| 79 | +- If you pass a folder, all supported videos inside (`.mp4`, `.mov`, `.mkv`, `.webm`, etc.) are sorted and looped as a playlist. |
| 80 | +- Each instance runs fullscreen on its assigned display. |
| 81 | +- The saved audio device and volume settings are automatically applied. |
| 82 | + |
| 83 | +--- |
| 84 | + |
| 85 | +## 🛠 Development |
| 86 | + |
| 87 | +This project is written in Swift and can be built via Xcode or the Swift Package Manager: |
| 88 | + |
| 89 | +```bash |
| 90 | +swift build -c release |
| 91 | +``` |
| 92 | + |
| 93 | +The resulting binary can be copied into `/usr/local/bin` or another location on your `$PATH`. |
| 94 | + |
| 95 | +--- |
| 96 | + |
| 97 | +## 📄 License |
| 98 | +MIT License © 2025 Alaric Hamacher |
0 commit comments