How to make mplayer use subtitles?

I am trying to use subtitles with a mkv file in the following way:

mplayer video.mkv
mplayer -sub video.srt video.mkv
mplayer video.mkv -sub video.srt

but only the video did play, but without any subtitles. I also pressed several buttons while playing the video ('j', 'u', 's') but without any change.

OS: MacOS 10.13.16 mplayer: 1.3.0-4.2.1

Maybe I am missing something? Or the mplayer must be compiled in some special, complicated manner? Or a library is missing? Or its because its a mac?

Is there a way to use the subtitles in the srt file with a mkv video with mplayer?


I have tried as suggested in the comment to set the config as shown here. But I get the following error when playing the mkv file with the srt file in the same folder:

Warning unknown option subfont-text-scale at line 3
Warning unknown option subfont-osd-scale at line 4
The fontconfig option can't be used in a config file.
Error parsing option fontconfig=yes at line 5

The first two entries in the srt file are as follows:

1
00:00:00,000 --> 00:00:05,000
<font face="Hiruko" size="38">Test</font>

2
00:00:05,000 --> 00:00:14,060
<font face="Hiruko" size="38">Subs: English</font>

Current content of .mplayer/config:

# Write your default config options here!
subalign=2
font = "Arial"
subcp = iso8859-1
# Set font.
#font=/home/osmo/.fonts/microsoft-vista/calibri.ttf

# Set font encoding.
subfont-encoding=unicode

# Set subtitle file encoding.
unicode=yes
utf8=yes

When I just play the file as follows

mplayer -v video.mkv

the video plays fine with audio, but without subtitles. The output in the console is the following:

Configuration: --cc=clang --host-cc=clang --disable-cdparanoia --prefix=/usr/local/Cellar/mplayer/1.3.0 --disable-x11
CommandLine: '-v' 'video.mkv'
Using Darwin accurate timing
get_path('input.conf') -> '/Users/adietz/.mplayer/input.conf'
Reading optional input config file /Users/adietz/.mplayer/input.conf: No such file or directory
Reading optional input config file /usr/local/Cellar/mplayer/1.3.0/etc/mplayer/input.conf: No such file or directory
Falling back on default (hardcoded) input config
Can't init Apple Remote.
get_path('video.mkv.conf') -> '/Users/adietz/.mplayer/video.mkv.conf'

Playing video.mkv.
get_path('sub/') -> '/Users/adietz/.mplayer/sub/'
[file] File size is 745530259 bytes
STREAM: [file] video.mkv
STREAM: Description: File
STREAM: Author: Albeu
STREAM: Comment: based on the code from ??? (probably Arpi)
libavformat version 57.25.100 (internal)
Configuration: --enable-gpl --enable-postproc
LAVF_check: Matroska / WebM
libavformat file format detected.
st:0 removing common factor 1000000 from timebase
st:1 removing common factor 1000000 from timebase
[matroska,webm @ 0x103b35490]Before avformat_find_stream_info() pos: 5647 bytes read:32768 seeks:0
[h264 @ 0x103b53440]user data:"x264 - core 125 r2200 999b753 - H.264/MPEG-4 AVC codec - Copyleft 2003-2012 - http://www.videolan.org/x264.html - options: cabac=1 ref=5 deblock=1:1:1 analyse=0x3:0x133 me=umh subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=2 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=12 lookahead_threads=2 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=4 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=0 open_gop=0 weightp=2 keyint=240 keyint_min=23 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=20.0 qcomp=0.60 qpmin=10 qpmax=51 qpstep=4 ip_ratio=1.40 aq=1:1.00"
[h264 @ 0x103b53440]user data:"x264 - core 125 r2200 999b753 - H.264/MPEG-4 AVC codec - Copyleft 2003-2012 - http://www.videolan.org/x264.html - options: cabac=1 ref=5 deblock=1:1:1 analyse=0x3:0x133 me=umh subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=2 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=12 lookahead_threads=2 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=4 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=0 open_gop=0 weightp=2 keyint=240 keyint_min=23 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=20.0 qcomp=0.60 qpmin=10 qpmax=51 qpstep=4 ip_ratio=1.40 aq=1:1.00"
[h264 @ 0x103b53440]no picture 
[matroska,webm @ 0x103b35490]All info found
[matroska,webm @ 0x103b35490]After avformat_find_stream_info() pos: 213450 bytes read:229205 seeks:0 frames:12
==> Found video stream: 0
======= VIDEO Format ======
  biSize 82
  biWidth 1440
  biHeight 1080
  biPlanes 1
  biBitCount 0
  biCompression 875967048='H264'
  biSizeImage 0
Unknown extra header dump: [1] [64] [0] [28] [ff] [e1] [0] [19] [67] [64] [0] [28] [ac] [d9] [80] [5a] [2] [27] [e5] [c0] [44] [0] [0] [f] [a4] [0] [2] [ee] [2] [3c] [60] [c6] [68] [1] [0] [6] [68] [e9] [70] [6c] [b2] [2c] 
===========================
[lavf] stream 0: video (h264), -vid 0
==> Found audio stream: 1
======= WAVE Format =======
Format Tag: 61868 (0xF1AC)
Channels: 2
Samplerate: 48000
avg byte/sec: 0
Block align: 1
bits/sample: 24
cbSize: 34
Unknown extra header dump: [10] [0] [10] [0] [0] [1] [89] [0] [1e] [54] [b] [b8] [3] [70] [4] [6d] [31] [30] [6b] [fc] [52] [fd] [5d] [86] [7e] [6f] [3] [e] [0] [89] [52] [77] [46] [67] 
==========================================================================
[lavf] stream 1: audio (flac), -aid 0
LAVF: 1 audio and 1 video streams found
LAVF: build 3742052
VIDEO:  [H264]  1440x1080  0bpp  23.976 fps    0.0 kbps ( 0.0 kbyte/s)
[V] filefmt:44  fourcc:0x34363248  size:1440x1080  fps:23.976  ftime:=0.0417
2018-10-16 08:08:13.995 mplayer[62669:997915] *** WARNING: Textured window <NSWindow: 0x7fa16f51f4a0> is getting an implicitly transparent titlebar. This will break when linking against newer SDKs. Use NSWindow's -titlebarAppearsTransparent=YES instead.
==========================================================================
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
libavcodec version 57.24.102 (internal)
Configuration: --enable-gpl --enable-postproc
INFO: libavcodec init OK!
Selected video codec: [ffh264] vfm: ffmpeg (FFmpeg H.264)
==========================================================================
Clip info:
 encoder: libebml v1.2.3 + libmatroska v1.3.0
 creation_time: 2012-09-12 10:05:57
Load subtitles in ./
get_path('sub/') -> '/Users/adietz/.mplayer/sub/'
[file] File size is 43583 bytes
STREAM: [file] ./video.srt
STREAM: Description: File
STREAM: Author: Albeu
STREAM: Comment: based on the code from ??? (probably Arpi)
SUB: Detected subtitle file format: subviewer
SUB: opened iconv descriptor.
SUB: closed iconv descriptor.
SUB: Read 318 subtitles, 0 bad line(s).
SUB: Adjusted 102 subtitle(s).
SUB: Added subtitle file (1): ./video.srt

Full mplayer install output:

$ brew install mplayer
Updating Homebrew...
==> Downloading https://homebrew.bintray.com/bottles/mplayer-1.3.0.high_sierra.bottle.tar.gz
Already downloaded: /Users/adietz/Library/Caches/Homebrew/downloads/2c54638881d1afb804282a3afa22709af0d3dec157559541892847a555610955--mplayer-1.3.0.high_sierra.bottle.tar.gz
==> Pouring mplayer-1.3.0.high_sierra.bottle.tar.gz
🍺  /usr/local/Cellar/mplayer/1.3.0: 11 files, 26.9MB

You probably have mplayer without freetype and fontconfig

Configuration: --cc=clang --host-cc=clang --disable-cdparanoia --prefix=/usr/local/Cellar/mplayer/1.3.0 --disable-x11
Configuration: --enable-gpl --enable-postproc

Possible solutions:

  • Install bitmap fonts from mplayer site and uncompress it to ~/.mplayer (for details see mplayer documentation

  • You say You installed mplayer with brew. Install mplayer again with freetype and fontconfig support.

    Uninstall mplayer and:

    brew install freetype
    brew install fontconfig
    brew install --build-from-source mplayer
    

    In theory mplayer can detect fontconfig and freetype and enable it.

EDIT:

To list all possible flags use:

brew info mplayer