Skip to content

matvejs16/mpv-player

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Advanced MPV Launcher

A high-performance Rust-based wrapper for mpv.net designed for seamless multi-track audio playback and enhanced video quality. This tool automatically analyzes media files to mix multiple audio streams while preserving the ability to switch back to original tracks.

🚀 Key Features

  • Automatic Audio Mixing: Detects multiple audio tracks and plays them simultaneously by default. Perfect for recordings with separate game and voice tracks.
  • Smart Audio Switching: Toggle between "Mixed" and "Single" audio modes on the fly using a dedicated hotkey.
  • Windows Integration: Built-in commands to register/unregister the launcher in the Windows explorer context menu (Right-click).
  • High-Quality Defaults: Forced gpu-hq profile for superior scaling and hwdec=auto-safe for efficient hardware decoding.
  • Multi-Instance Support: Every video opens in a new window, preventing playback interruption of existing instances.
  • Playlist Awareness: Automatically adds adjacent files in the same folder to the playlist.
  • Portable & Robust: Resolves its own resources (FFmpeg, mpv.net, Lua scripts) relative to the executable path.

🛠 Installation

1. Build the project

Ensure you have the Rust toolchain installed, then run:

cargo build --release

2. Context Menu Integration

To add "Open with Advanced MPV" to your Windows right-click menu, run the compiled executable with the --install flag:

.\target\release\mpv-player.exe --install

Note: This modifies the Current User registry (HKCU), so it doesn't require administrator privileges but only affects your user.

3. Uninstallation

To remove the entry from the context menu:

.\target\release\mpv-player.exe --uninstall

🎮 Controls

While playing a video with multiple audio tracks:

  • n: Toggle between Mixed Mode (all tracks) and Single Mode (original tracks).
  • #: Cycle through individual audio tracks (works in Single Mode).
  • Standard mpv keys: All default mpv.net shortcuts remain active.

📂 Project Structure

For the launcher to work correctly, the following folder structure is required:

.
├── mpv-player.exe (Launcher)
└── bin/
    ├── audio_mixer.lua      (Core logic for mixing)
    ├── mpv.net/             (Contains mpvnet.exe and dependencies)
    └── ffmpeg-essentials/   (Contains ffprobe.exe for analysis)

🧠 How It Works

  1. Pre-flight Check: When a file is opened, the launcher uses ffprobe to scan for the number of audio streams.
  2. Dynamic Injection: If multiple tracks are found, it injects a custom Lua script and passes the stream count via script-opts.
  3. Live Mixing: The Lua script uses lavfi-complex with an amix filter to combine audio on the fly without re-encoding.
  4. Context Switching: The n key dynamically resets the lavfi-complex property to allow standard mpv track selection.

Developed as a specialized engineering tool for advanced media handling.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages