# Load Local Subtitles While MPV Plays Remote Videos


## Motivation

Recently I’ve been using PikPak on Linux and ran into a usability issue. There’s no native Linux client, and the web player isn’t always reliable—some videos fail to decode due to codec issues.

My workaround is to use the local player MPV, which can play PikPak files directly via their remote links—very convenient. But another problem appeared: many external subtitle files are not loaded automatically. When MPV handles a remote URL, it won’t probe the same remote path for a matching subtitle file. So I started looking for a better solution.

## Approach

The core idea is to treat video and subtitle files differently and use distinct `rclone` capabilities:

1. **Video**: Use `rclone serve http` to provide remote video files as an HTTP stream to MPV. In my testing, this gives the best experience for smooth playback and fast seeking.
2. **Subtitles**: Use `rclone mount` to mount the remote subtitles folder locally. Subtitle files are small; exposing them as virtual local files lets MPV discover and match them easily with negligible performance cost.

## Step-by-step

### I. Serve videos via `rclone serve http`

I do not recommend using `rclone mount` directly for the video directory. From my tests, streaming large remote files through a FUSE mount performs poorly—especially after seeking, where stutter and buffering are obvious. HTTP streaming avoids these issues.

Assume videos are under the `videos` directory within an rclone remote named `PikPak`. Run:

```bash
rclone serve http PikPak:videos --addr localhost:8080
```

After this, rclone starts an HTTP service on `localhost:8080`. All files under `PikPak:videos/` are now accessible at `http://localhost:8080/<filename>`.

### II. Mount the subtitles directory via `rclone mount`

Subtitle files are tiny; mounting them is the simplest and most efficient approach. Alternatively, you could download them locally.

Suppose subtitles live under the `subtitles` directory of the `PikPak` remote. First create a local mount point (for example `/mnt/subtitles`), then mount:

```bash
# Create mount point
mkdir -p /mnt/subtitles

# Mount in the background
rclone mount PikPak:subtitles /mnt/subtitles --daemon
```

Now the remote subtitle files appear locally at `/mnt/subtitles`, and MPV can access them like regular local files.

### III. Create a playlist

To avoid copying and pasting video URLs every time, create a simple text file as a playlist.

For example, create `playlist.txt` and put one HTTP link per line:

```plaintext
http://localhost:8080/电视剧/S01E01.mp4
http://localhost:8080/电视剧/S01E02.mp4
```

### IV. Launch MPV

With everything ready, start playback with:

```bash
mpv --playlist=/path/to/playlist.txt --sub-file-paths=/mnt/subtitles
```

- `--playlist` points to the playlist file created above.
- `--sub-file-paths` tells MPV to look for subtitles under `/mnt/subtitles`.

With this, each video in the playlist will automatically look for and load a matching subtitle file from the subtitles directory.

### Extra tip: Handle imperfect subtitle filenames

Sometimes downloaded subtitle filenames aren’t standard—extra language codes or suffixes can prevent MPV from matching them by default rules.

In such cases, add `--sub-auto=all` or `--sub-auto=fuzzy` to MPV:

- `--sub-auto=all` loads all subtitle files under the subtitle path.
- `--sub-auto=fuzzy` loads any subtitle files that contain the video filename.

Example:

```bash
mpv --playlist=/path/to/playlist.txt --sub-file-paths=/mnt/subtitles --sub-auto=all
```


---

> Author: Nite  
> URL: https://www.nite07.com/en/posts/mpv-remote-video-local-sub/  

