mplayer

mplayer does not return error exit status

Ether when playing a non playable file:
mplayer file.txt
or when playing a non-existing file:
mplayer i-dont-exist.mp4
mplayer does not return 1 or other error status.

e.g.:

$ mplayer movie.mp4
MPlayer 1.2.1-4.9.4 (C) 2000-2016 MPlayer Team
3DNow supported but disabled
3DNowExt supported but disabled

Playing movie.mp4.
File not found: 'movie.mp4'
Failed to open movie.mp4.

Exiting... (End of file)
$ echo $?
0
$ mplayer movie.mp4 || echo "Error"
MPlayer 1.2.1-4.9.4 (C) 2000-2016 MPlayer Team
3DNow supported but disabled
3DNowExt supported but disabled

SUB: Could not determine file format

Symptoms

Sometimes, mplayer won't recognize the format of a subtitle file.
In the console, it may be displayed:

SUB: Could not determine file format
Cannot load subtitles subtitle_file.srt.

Causes and solutions

Wrong encoding

For example the .srt file is encoded in UTF-16 when the system expects UTF-8.

A simple way to test the validity of the file encoding, is to do:

$ cat -t subtitle_file.srt

If you get some garbage output like:

^@8^@9^@3^@

Syndicate content