summaryrefslogblamecommitdiffstats
path: root/mpv.md
blob: 04921f217c0935811d6b96becb29b8ead1a1e19e (plain) (tree)
1
2
3
4
5


                                                      

                                      

















                                                                                                                                                                                                                                                                                     



                       
               
               
       
                  




















                                                                      







                       
                               
                    








                               
      

   




                                                                          
 








                                                                      

                                  

                                                                                                                                                                                                                                                                                                          
[[!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-y=-1
sub-use-margins=yes
sub-scale-by-window=yes
sub-pos=103
sub-margin-x=10
sub-margin-y=60
# 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-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-font="{{ emacsconf_font }}"
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
osc=no
```

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

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

# Streaming files from the backstage area

The backstage area uses basic HTTP authentication. To play files
directly from the backstage area, specify the username and password in
the URL as follows:

`mpv https://username:password@media.emacsconf.org/path/to/video.webm`


# Loading a subtitle file manually

To load a specific subtitle file in MPV, use the `--sub-file=` or `--sub-files=` command-line argument. Note that this argument does not expand `~` to the user's home directory. If you want to refer to something in your home, use a command like: `mpv --sub-file=$HOME/directory/sub.vtt video.webm`.