MPlayer (简体中文)

From ArchWiki
Jump to navigation Jump to search
翻译状态: 本文是英文页面 MPlayer翻译,最后翻译时间:2018-11-24,点击这里可以查看翻译后英文页面的改动。

MPlayer 是 GNU/Linux 下非常流行的影音播放器,支持绝大多数视频/音频文件格式,非常通用。


安装 软件包 mplayer 或它的开发版本 mplayer-svnAUR


  • MPlayer-VAAPI — 支持 VAAPI 的版本 || mplayer-vaapiAUR
  • MPlayer2 — MPlayer 的分支 || mplayer2AUR
注意: mplayer2 的开发已经停止,推荐使用 mpv,mpv 更注重速度和开发质量,尽管它对老旧设备兼容性差。使用前请注意一下它们的 差异


参考 List of applications/Multimedia#MPlayer-based.



/etc/mplayer/ 下默认包含:

  • codecs.conf - 解码器配置文件。
  • example.conf - mplayer.conf 不会在安装时自动创建,这是其示例文件。
  • input.conf - 快捷键配置文件。

~/.mplayer/ 下默认包含一个 config 文件。

参考 MPlayer 配置示例mplayer(1)


系统按键绑定通过 /etc/mplayer/input.conf 配置,个人按键绑定通过 ~/.mplayer/input.conf 配。完整的键盘快捷键列表请阅读 mplayer(1)

参阅:XF86 键盘符号



为了获得这个功能, 你可以到 AUR 下载mplayer-resumerAUR 软件包。这个软件包包含一个Perl脚本,使你可以从上一次的播放记录继续播放。

To use it, simply call the wrapper script in place of MPlayer:

$ mplayer-resumer options path/to/file

If this script is restarted within a short amount of time after closing MPayer (default 5 seconds) then it will delete the file used to keep track of the videos resume position, effectively starting the video from the beginning.

If the video file to be played is on a read-only filesystem, or otherwise lives in a location that cannot be written to, resume will fail. This is because the current implementation uses a file parallel to the video file to store the timecode.


参考 Hardware video acceleration.



  • The trailing commas are important! They tell MPlayer to fall back on other drivers and codecs should the specified ones not be found.
  • -vo option selects VDPAU video output driver, -vc option selects VDPAU video codecs.
警告: 只有最新型号的显卡支持ffodivxvdpau。如果你的不支持,可以删除。详情请查阅 NVIDIA#VDPAU[broken link: invalid section]


This requires mplayer-vaapiAUR from the AUR.

$ mplayer -vo vaapi -va vaapi foobar.mpeg
  • -vo - Select vaapi video output driver
  • -va - Select vaapi video decoder driver

MPlayer based players:

  • gnome-mplayer: To enable hardware acceleration: Edit > Preferences > Player, then set Video Output to vaapi.
  • smplayer: To enable hardware acceleration: Options > Preferences > General > Video, then set Output driver to vaapi.

Radeon 显卡启用半透明视频混合显示

为了在 X 中获得半透明视频效果,你需要在MPlayer中启用视频纹理:

$ mplayer -vo xv:adaptor=1 file

或者在 ~/.mplayer/config 中添加一行:


你可以使用 xvinfo 命令检查你的显卡支持那种视频模式。



$ mplayer -playlist link-to-stream.asx 



To play a DVD with MPlayer:

$ mplayer dvd://N

where N is the desired title number. Start at 1 and work up if unsure. To start at a specific chapter use the '-chapter' flag. For example, adding '-chapter 5' to the command starts the dvd playing at chapter five of the title.

Mplayer checks /dev/dvd by default. Tell it to use /dev/sr0 with the dvd-device option at the command line, or the dvd-device variable in ~/.mplayer/config.

To play a DVD image file:

$ mplayer -dvd-device movie.iso dvd://N

To enable the DVD menu use:

$ mplayer dvdnav://
Note: You use arrow keys to navigate and the Enter key to choose.

To enable mouse support in DVD menus use:

$ mplayer -mouse-movements dvdnav://

To find the audio language, start MPlayer with the -v switch to output audio IDs. An audio track is selected with -aid audio_id. Set a default audio language by editing ~/.mplayer/config and adding the line alang=en for English.

With MPlayer, the DVD could be set to a low volume. To increase the maximum volume to 400%, use softvol=yes and softvol-max=400. The startup volume defaults to 100% of software volume and the global mixer levels will remain untouched. Using the 9 and 0 keys, volume can be adjusted between 0 and 400 percent.


DVB-T Streaming

See DVB-T for more info.

JACK support

To have MPlayer audio output directed to JACK as its default behavior, edit ~/.mplayer/config and add:


If you do not have JACK running all the time, you can have MPlayer output to JACK on an as-needed basis by invoking MPlayer from the command line as such:

$ mplayer -ao jack path/to/file

Advanced Subtitles

In order to get Advanced SubStation Alpha (ass) or SubStation Alpha (ssa) formatted subtitles to display properly you need to either edit ~/.mplayer/config and add:


or add -ass to the command line:

$ mplayer -ass path/to/subtitledVideo.mkv

One possible indication of needing to enable this flag is if you get numbers appearing with your subtitles. This is caused by the positioning information being interpreted as something to be displayed. Mplayer will also complain about subtitles being either too long or having too many lines.

Enabling ass also enables any embedded fonts. As per the note in the mplayer's man adding embeddedfonts=true is unneeded if fontconfig is version 2.4.2 or newer. Fontconfig will also be used to select which font to use when there are no embedded fonts. This may result in a different font being used than the OSD subtitle renderer.

Internet radio

Here is an example of a script for an easy start/stop of playing a predefined radio station. [1]

PLAYIT='mplayer  -loop 0 -playlist http://*.*.*.*:8000/listen.pls';

if [ "$XX" == "Xstop" ]; then
  killall mplayer;
  if [ 'EX' == 'EX'"$(pidof mplayer)" ]; then
    if [ "$UID" -ne 0 ]; then 
      nohup $PLAYIT &> /dev/null & disown;
      echo The "root" user is not allowed to run this script.
    echo mplayer is already running by user: $(ps -eo user,comm | grep -i "mplayer"$ | sed 's/ mplayer/,/m') | sed "s/ ,$/./m";

For more details on a running mplayer instance:

$ ps -eo pcpu,pid,user,comm | grep -i "mplayer"$ | sed  "s/ mplayer$//m"





Exec=mplayer %U


Exec=mplayer "%F"

如果要使用图形前端,修改为Exec=gui_name "%F"即可。

MPlayer has black or strange colored font for OSD and Subtitles

There appears to be an issue with OSD and Subtitle colors when using vdpau output, which mplayer may be using by default. You can get around this issue by using xv instead of vdpau:

As a command line option:

mplayer -vo xv

Adding the following line to your ~/.mplayer/config file:


See the original forums thread for details.


打开mp4和flv文件时,Smplayer可能出现无图像问题。解决方法如下: 打开~/.mplayer/config添加:



 $ rm -rf ~/.config/smplayer/file_settings

Transparent SMPlayer in Gnome with Composite enabled

Have you noticed the transparent screen of smplayer when you are using compiz and maybe cairo-dock? Well it’s ridiculous that when you open your videos using SMplayer you can just hear audio and no video! Here’s how you fix this: [copy paste into terminal]

   sudo bash -c "cat > /usr/bin/smplayer.helper" <<EOF
   exec smplayer.real "$@"
   sudo chmod 755 /usr/bin/smplayer.helper
   sudo mv /usr/bin/smplayer{,.real}
   sudo ln -sf smplayer.helper /usr/bin/smplayer

If you don’t use sudo then just use “su” to login as root and do the above!

SMPlayer: OSD font too big / subtitle text too small

Since SMPlayer (with MPlayer2 20121128-1), the ratio of the subtitle font to the OSD font is very strange. This can result in the OSD text filling the whole screen while the subtitles are very small and unreadable. This problem can be solved by adding:

-subfont-osd-scale 2

or to the extra options passed to MPlayer from SMPlayer. These options are found in Options > Preferences > Advanced > Options for MPlayer. This can also be achieved by adding the following line to ~/.mplayer/config:


Mplayer shows question marks for some characters on subtitle

If the codepage of the subtitles is utf8, try using:

-subcp utf8

You can find the codepage of the subtitles with:


See mplayer-shows-question-marks-for-some-characters-on-subtitle.

Choppy audio CD playback

CDDA playback may be interrupted every few seconds as the CDROM spins down the CD. To get around this you need to cache or buffer in advance using the -cache option:

mplayer cdda://:1 -cache 1024

The :1 is to lower the CDROM speed for a constant spin and less noise.