MPlayer (简体中文)

From ArchWiki
Jump to: navigation, search


翻译状态: 本文是英文页面 MPlayer翻译,最后翻译时间:2016-12-23,点击这里可以查看翻译后英文页面的改动。

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

安装 || mplayer


  • MPlayer-VAAPI — 启用 VAAPI 的版本 || mplayer-vaapiAUR
  • MPlayer-svn — 开发版本
|| mplayer-svnAUR
  • MPlayer2 — MPlayer 的一个分支 || mplayer2AUR
注意: mplayer2 的开发已经停止,推荐使用 mpv,mpv 更注重速度和开发质量,这会破坏兼容性,使用前请注意一下它们的 差异


  • SMPlayer — MPlayer 的Qt前端,外加一些补丁。 || smplayer
  • UMPlayer — SMPlayer的个分支,额外功能包括:CSS 主题、YouTube 整合、ShoutCast 支持等。 || umplayerAUR
  • GNOME-MPlayer — MPlayer的 GTK 前端。 || gnome-mplayer
  • KMPlayer — Konqueror 视频播放插件,KDE 的MPlayer/Xine/ffmpeg/ffserver/VDR 前端。 || kmplayer



Firefox 和 Chromium

官方软件仓库提供了gecko-mediaplayer 软件包,依赖于 gnome-mplayer,这个软件还提供了完整的图形前端。


AUR 中的 kmplayer 软件包提供了Konqueror 插件,这个软件包也提供了完整的 mplayer 图形前端。



/etc/mplayer/ 下默认包含:

  • codecs.conf - 解码器配置文件.
  • example.conf - mplayer.conf 示例,要进行配置,需要安装之后将此示例文件复制为 mplayer.conf.
  • input.conf - 快捷键配置.

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

参考 MPlayer 配置示例man mplayer.


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

参阅:XF86 键盘符号



To get this behavior, you can install the mplayer-resumerAUR package from the AUR. The package contains a Perl wrapper script for MPlayer which will allow you to autoresume playback from the point it was last stopped.

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.


See 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 页面

Enabling VA-API

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.

Translucent video with Radeon cards and Composite enabled

To get translucent video output in X you have to enable textured video in MPlayer:

$ mplayer -vo xv:adaptor=1 file

Or add the following line to ~/.mplayer/config:


You can use xvinfo to check which video modes your graphic card supports.



$ 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.