Turning hard-coded subtitles on and off using mpv

Posted 2021-11-02.

I often find myself watching Chinese language videos that have hard-coded subtitles. For language learning, I prefer to watch videos without subtitles and only want to see the subtitles when I cannot understand the spoken dialogue. So basically what I want is to conditionally apply a delogo filter over the hardcoded subtitle area, and be able to press a key to toggle it on or off.

mpv, the media player, has a capability called 'conditional auto profiles' to apply different filters based on a conditional statement. mpv has a huge number of properties that a conditional statement can be formed over. A suitable property is 'fullscreen' that is controlled by default by the 'f' key. So when in mpv is in full-screen mode, I want to apply the delogo filter, and when not in full-screen mode, I want to remove the delogo filter. Below is the mpv configuration file to implement this.


profile-cond=not fullscreen

Because the delogo parameters are unique for each movie or TV show, I place the mpv.conf file in the directory of each movie or TV show, and invoke mpv using the --config-dir=. option. I use a 'play' shell alias to avoid typing the full command each time. I have found this setup to be really useful for language learning.