summaryrefslogtreecommitdiffstats
path: root/mpv.md
blob: 87171f4b2decdd686b343a11892f03c5d4f0ce97 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
[[!meta title="MPV tips"]]
[[!meta copyright="Copyright © 2022 Sacha Chua"]]

# Displaying subtitles below the video

The default position of subtitles tends to hide important details like the mode line or minibuffer. If you use `mpv` to view videos, you can adjust the position of subtitles with the "r" and "R" keyboard shortcuts, which run `add sub-pos -1` and `add sub-pos +1` respectively. 

Alternatively, you can configure your MPV to resize videos and show
subtitles underneath. On Linux, you can create or edit
`~/.config/mpv/mpv.conf`. On Windows, if compiled with MinGW, MPV will
look for your configuration in `%APPDATA%\mpv\mpv.conf`. You can
override the directory that contains mpv.conf by setting the
`MPV_HOME` environment variable on either system.
<https://mpv.io/manual/stable/#configuration-files> has more details
on the format and location of the config file.

For regular use, you might prefer to watch horizontally-centered
videos with centered subtitles underneath. Here's the `mpv.conf` for
that.

```
# Positioning
video-zoom=-0.15
video-align-x=1
video-align-y=-1
sub-use-margins=yes
sub-scale-by-window=yes
sub-pos=103
sub-margin-x=110
sub-margin-y=60
sub-align-x=center
# Style
sub-back-color=0.0
sub-color="1/0.82/0"
sub-blur=0.2
sub-scale=0.9
sub-font-size=30
sub-border-size=0
sub-border-color=0/1
sub-shadow-color=0/1
sub-shadow-offset=1.2
sub-ass-force-style=Kerning=yes
sub-ass-line-spacing=0
```

When we broadcast videos for EmacsConf 2022, we place them on the top
right so that there's room underneath to display a conference logo and
a talk URL, and we align the text left so that it doesn't feel like
it's shifting around a lot. If you want to do the same, here's the
configuration:

```
# Positioning
video-zoom=-0.15
video-align-x=1
video-align-y=-1
sub-use-margins=yes
sub-scale-by-window=yes
sub-pos=103
sub-margin-x=110
sub-margin-y=60
sub-align-x=left
# Style
sub-back-color=0.0
sub-color="1/0.82/0"
sub-blur=0.2
sub-scale=0.9
sub-font-size=30
sub-border-size=0
sub-border-color=0/1
sub-shadow-color=0/1
sub-shadow-offset=1.2
sub-ass-force-style=Kerning=yes
sub-ass-line-spacing=0
```

If you would like to specify the font to use, you can include a line like:

```
sub-font="Clear Sans Bold"
```

# Loading a subtitle file manually

To load a specific subtitle file in MPV, use the `--sub-file=` or `--sub-files=` command-line argument.