Difference between revisions of "MPlayer"

From ArchWiki
Jump to: navigation, search
m (replaced wrong key for subtitle visibility)
(Frontends/GUIs: remove broken pkg link (Rosa seems to have been discontinued))
 
(160 intermediate revisions by 48 users not shown)
Line 1: Line 1:
[[Category:Audio/Video]]
+
[[Category:Multimedia players]]
 
[[cs:MPlayer]]
 
[[cs:MPlayer]]
 +
[[de:MPlayer]]
 
[[el:MPlayer]]
 
[[el:MPlayer]]
 +
[[es:MPlayer]]
 
[[fr:MPlayer]]
 
[[fr:MPlayer]]
 
[[it:MPlayer]]
 
[[it:MPlayer]]
 +
[[ja:MPlayer]]
 
[[ru:MPlayer]]
 
[[ru:MPlayer]]
 
[[uk:MPlayer]]
 
[[uk:MPlayer]]
 
[[zh-CN:MPlayer]]
 
[[zh-CN:MPlayer]]
'''MPlayer''' is a popular movie player for GNU/Linux. It has support for pretty much every video and audio format out there and is hence very versatile, even though most people use it for viewing videos.
+
{{Related articles start}}
 +
{{Related|mpv}}
 +
{{Related articles end}}
  
==Installation==
+
'''MPlayer''' is a popular movie player for GNU/Linux. It has support for most video and audio formats and is thus highly versatile, even if it is mostly used for viewing videos.
The {{Pkg|mplayer}} package is available in [extra]:
+
# pacman -S mplayer
+
  
Alternatively, the latest development version can be installed from the [[AUR]] ({{AUR|mplayer-svn}}).
+
== Installation ==
  
You may also want to try [http://www.mplayer2.org/ mplayer2], a fork of mplayer, also available there ({{AUR|mplayer2-git}}). It has several improvements over the original mplayer, see: [http://www.mplayer2.org/differences/ mplayer2 vs mplayer]
+
Various flavours of MPlayer can be [[pacman|installed]] from the [[official repositories]] or from the [[AUR]]:
 +
*{{App|[[MPlayer]]|Official package|https://mplayerhq.hu/|{{pkg|mplayer}}}}
  
==Additional installation tips==
+
Notable variants are:
  
===Frontends/GUIs===
+
*{{App|MPlayer-VAAPI|VAAPI-enabled version|http://gitorious.org/vaapi/mplayer|{{AUR|mplayer-vaapi}}}}
There are several GUIs for MPlayer.
+
*{{App|MPlayer-svn|Development version||{{AUR|mplayer-svn}}}}
* Qt: {{Pkg|smplayer}} is in the extra repository. The smplayer-themes package provides themes for it.
+
*{{App|MPlayer2|Fork of MPlayer|http://www.mplayer2.org/|{{AUR|mplayer2}}}}
* Qt: {{AUR|umplayer}} is in the AUR - like smplayer with some neat features like downloading youtube videos from within it.
+
* GTK+: {{AUR|pymp}} and {{Pkg|gnome-mplayer}} are in the AUR and community repos, respectively.
+
* gmplayer: this GUI is no longer included in the mplayer package. There is an alternative mplayer package (mplayer-x) in AUR in which the gmplayer GUI is enabled.
+
  
===Browser integration===
+
{{Note|''mplayer2'' development seems to be ceased in favour of [[mpv]], which is focused on speed and quality of development, though this breaks compatibility with old hardware and software. Be aware of its [https://github.com/mpv-player/mpv/blob/master/DOCS/mplayer-changes.rst differences] if you want to use it.}}
  
If you want to let MPlayer control video viewing in your favorite web browser, install the following:
+
== Frontends/GUIs ==
  
====Firefox====
+
* {{App|GNOME MPlayer|Simple GTK+-based GUI for MPlayer.|http://kdekorte.googlepages.com/gnomemplayer|{{Pkg|gnome-mplayer}}}}
 +
* {{App|KPlayer|Multimedia player for KDE4 using mplayer as a backend.|http://kplayer.sourceforge.net/|{{AUR|kplayer}}}}
 +
* {{App|KMPlayer|Video player plugin for Konqueror and basic MPlayer/Xine/ffmpeg/ffserver/VDR frontend for KDE.|http://kmplayer.kde.org/|{{Pkg|kmplayer}}}}
 +
* {{App|[[Wikipedia:SMPlayer|SMPlayer]]|Qt multimedia player with extra features (CSS themes, YouTube integration, etc.).|http://smplayer.sourceforge.net/|{{Pkg|smplayer}}}}
  
# pacman -S gecko-mediaplayer
+
== Browser integration ==
  
{{Note| Depends on gnome-mplayer, which provides a complete frontend to MPlayer.}}
+
If you want to let MPlayer control video viewing in your favorite web browser, install one of the following plugins for your browser.
  
====Konqueror====
+
=== Firefox ===
{{AUR|kmplayer}} is in the [[AUR]].
+
  
{{Note| Also provides a complete frontend to MPlayer.}}
+
A browser plugin is available in the official repositories with the {{Pkg|gecko-mediaplayer}} package.
  
==Usage==
+
{{Note|It depends on {{Pkg|gnome-mplayer}}, which provides a complete frontend to MPlayer.}}
  
===Configuration===
+
=== Konqueror ===
System-wide configuration is located in {{ic|/etc/mplayer/mplayer.conf}}, whereas the user-local settings are stored in {{ic|~/.mplayer/config}}. The file {{ic|/etc/mplayer/example.conf}} is a good starting point.
+
  
An example configuration:
+
A plugin for Konqueror can be found in the [[AUR]] with the {{Pkg|kmplayer}} package.
  
{{hc|/etc/mplayer/example.conf|2=
+
{{Note|{{Pkg|kmplayer}} also provides a complete frontend to MPlayer.}}
  
# default configuration that applies to every file
+
=== Chromium ===
[default]
+
# use X11 for video output
+
vo=xv
+
# use also for audio output
+
ao=alsa
+
# ao=oss # Use OSS4
+
# multithreaded decoding of H264/MPEG-1/2 (valid: 1-8)
+
lavdopts=threads=2
+
# prefer using six channels audio
+
channels = 6
+
# scale the subtitles to the 3% of the screen size
+
subfont-text-scale = 3
+
# never use font config
+
nofontconfig = 1
+
# add black borders so the movies have the same aspect ratio of the monitor
+
# for wide screen monitors
+
vf-add=expand=::::1:16/9:16
+
# for non wide screen traditional monitors
+
#vf-add=expand=::::1:4/3:16
+
  
#profile for up-mixing two channels audio to six channels
+
The {{Pkg|gecko-mediaplayer}} plugin for Firefox also works in [[Chromium]].
# use -profile 2chto6ch to activate
+
[2chto6ch]
+
af-add=pan=6:1:0:.4:0:.6:2:0:1:0:.4:.6:2
+
+
#profile to down-mixing six channels audio to two channels
+
# use -profile 6chto2ch to activate
+
[6chto2ch]
+
af-add=pan=2:0.7:0:0:0.7:0.5:0:0:0.5:0.6:0.6:0:0
+
  
# Disable screensaver.
+
== Configuration ==
heartbeat-cmd="xscreensaver-command -deactivate &" # stop xscreensaver
+
stop-xscreensaver="yes" # stop gnome-screensaver
+
}}
+
  
===Keybindings===
+
System-wide configuration files are located in the {{ic|/etc/mplayer/}}, whereas the user-local settings are stored in {{ic|~/.mplayer/}} directory.
 +
The default files in the {{ic|/etc/mplayer/}} are:
 +
* {{ic|codecs.conf}} - Contains configuration of codecs. 
 +
* {{ic|example.conf}} - Is an example of mplayer.conf, which is not automatically created after installation.
 +
* {{ic|input.conf}} - Contains configuration of a hotkeys.
 +
In the {{ic|~/.mplayer/}} by default created a file with a name ''config''.
  
:''This is a list of the most basic MPlayer keys.''
+
See also: [http://mplayerhq.hu/DOCS/man/en/mplayer.1.html#CONFIGURATION%20FILES Example MPlayer configuration file], {{ic|man mplayer}}.
  
{|
+
=== Key bindings ===
! width=50 align=left | Key
+
! align=left | Description
+
|-
+
| p
+
| Toggle pause/play.
+
|-
+
| Space
+
| Toggle pause/play.
+
|-
+
|-
+
| Backspace
+
| Return to menu when using dvdnav.
+
|-
+
| Left
+
| Seek backward ten seconds.
+
|-
+
| Right
+
| Seek forward ten seconds.
+
|-
+
| Down
+
| Seek backward one minute.
+
|-
+
| Up
+
| Seek forward one minute.
+
|-
+
| <
+
| Go back in the playlist.
+
|-
+
| >
+
| Go forward in the playlist.
+
|-
+
| m
+
| Mute the sound.
+
|-
+
| 0
+
| Volume up.
+
|-
+
| 9
+
| Volume down.
+
|-
+
| f
+
| Toggle fullscreen mode.
+
|-
+
| o
+
| Toggle OSD state.
+
|-
+
| v
+
| Toggle subtitle visibility.
+
|-
+
| {{ic|I}}
+
| Show filename.
+
|-
+
| 1, 2
+
| Adjust contrast.
+
|-
+
| 3, 4
+
| Adjust brightness.
+
|-
+
| j
+
| Cycle through the available subtitles.
+
|-
+
| #
+
| Cycle through the available audio tracks.
+
|}
+
  
== Tips and Tricks ==
+
System key bindings are configured via {{ic|/etc/mplayer/input.conf}}. Personal key bindings are stored in {{ic|~/.mplayer/input.conf}}. For a complete list of keyboard shortcuts look at {{ic|man mplayer}}.
===Automatic Resuming Where You Left Off===
+
  
The [[AUR]] contains an elegant perl wrapper-script which will allow autoresuming from the point at which playback was stopped {{AUR|mplayer-resumer}}.
+
See also: [http://wiki.linuxquestions.org/wiki/XF86_keyboard_symbols XF86 keyboard symbols]
  
Usage is trivial: simply call the wrapper-script in place of mplayer.
+
== Tips and tricks ==
Example:
+
$ mplayer-resumer [options] [path/]filename
+
  
If this script is restarted within $tdiff (default 5 seconds) then it will delete the file used to keep track of the videos resume position.
+
=== Automatic resuming from where you left off ===
  
'''RATIONALE'''
+
To get this behavior, you can install the {{AUR|mplayer-resumer}} 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.
  
Watching 90% of a video and stopping causes you to return to the beginning again the next time you watch it.  Remembering where you were in the video and resuming at that position is a much nicer behavior for the user.  By default, mplayer spits out timecode information that tells you where you are in the video, to the tenth of a second.  MPlayer also supports a seek feature on the command-line.  We can make use of these features to write an mplayer wrapper that will remember the last position in a video file and resume to it on playback.
+
To use it, simply call the wrapper script in place of MPlayer:
  
'''DESIGN LIMITATION'''
+
$ mplayer-resumer ''options'' ''path/to/file''
  
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.
+
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.
  
===Enabling VDPAU (modern nVidia cards only)===
+
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.
  
For a complete list of VDPAU capable hardware, see [[http://en.wikipedia.org/wiki/PureVideo#Table_of_PureVideo_.28HD.29_GPUs this table]].  Ensure the ''nvidia'' driver is installed and consider one of the following two methods to automatically enable vdpau for playback.
+
=== Hardware acceleration ===
  
==== 1. Using a conf file ====
+
See [[Hardware video acceleration]].
Append the following to either the system-wide or user-specific config files
+
 
 +
==== Enabling VDPAU ====
 +
 
 +
===== Using a configuration file =====
 +
 
 +
Append the following to either the system-wide ({{ic|/etc/mplayer/mplayer.conf}}) or user-specific ({{ic|~/.mplayer/config}}) configuration files:
  
 
  vo=vdpau,
 
  vo=vdpau,
  vc=ffh264vdpau,ffmpeg12vdpau,ffodivxvdpau,ffwmv3vdpau,ffvc1vdpau,
+
  vc=ffh264vdpau,ffmpeg12vdpau,ffodivxvdpau,ffwmv3vdpau,ffvc1vdpau,ffhevcvdpau
  
{{Note|The trailing commas are important! They tell MPlayer to fall back on other drivers and codecs should the specified ones not be found.}}
+
{{Note|
{{Warning|The ffodivxvdpau is only supported by the most recent series of nVidia hardware.  Consider omitting it based on your specific hardware. See [[NVIDIA#Enabling_Pure_Video_HD_.28VDPAU.2FVAAPI.29|the NVIDIA page]] for more information.}}
+
* The trailing commas are important! They tell MPlayer to fall back on other drivers and codecs should the specified ones not be found.
 +
* {{ic|-vo}} option selects VDPAU video output driver, {{ic|-vc}} option selects VDPAU video codecs.
 +
}}
  
==== 2. Using a wrapper script ====
+
{{Warning|The {{ic|ffodivxvdpau}} codec is only supported by the most recent series of NVIDIA hardware. Consider omitting it based on your specific hardware. See [[NVIDIA#Pure Video HD (VDPAU/VAAPI)|the NVIDIA page]]{{Broken section link}} for more information.}}
  
The [[AUR]] contains a trivial bash script called {{AUR|mplayer-vdpau-auto}} that detects which vc to use and when to use vo=vdpau.
+
===== Using a wrapper script =====
  
===Translucent Video with radeon and Composite enabled===
+
{{deletion|None of the following (or similar) packages are available anymore, and haven't been for quite a long time now.}}
  
To get translucent video output in X you have to enable textured video in mplayer:
+
The [[AUR]] contains a trivial Bash script called {{AUR|mplayer-vdpau-auto}}{{Broken package link|{{aur-mirror|mplayer-vdpau-auto}}}} that detects which video codec to use and when to use VDPAU as the video output.
  
  $ mplayer -vo xv:adaptor=1 <File>
+
Another simple wrapper is {{AUR|mplayer-vdpau-shell-git}}{{Broken package link|{{aur-mirror|mplayer-vdpau-shell-git}}}}, which can recover from a VDPAU FATAL error.
 +
This wrapper uses the "-include" option to include a VDPAU configuration, so it will ignore any VDPAU specific settings in your {{ic|~/.mplayer/config}} file.
 +
 
 +
==== Enabling VA-API ====
 +
 
 +
This requires {{AUR|mplayer-vaapi}} from the AUR.
 +
 
 +
{{bc|$ mplayer -vo vaapi -va vaapi ''foobar.mpeg''}}
 +
*'''-vo''' - Select vaapi video output driver
 +
*'''-va''' - Select vaapi video decoder driver
 +
 
 +
MPlayer based players:
 +
 
 +
* {{Pkg|gnome-mplayer}}: To enable hardware acceleration: ''Edit > Preferences > Player'', then set Video Output to {{ic|vaapi}}.
 +
* {{Pkg|smplayer}}: To enable hardware acceleration: ''Options > Preferences > General > Video'', then set Output driver to {{ic|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 {{ic|~/.mplayer/config}}:
 
Or add the following line to {{ic|~/.mplayer/config}}:
Line 202: Line 139:
 
  vo=xv:adaptor=1
 
  vo=xv:adaptor=1
  
You can use xvinfo to check which video modes your graphic card supports.
+
You can use {{ic|xvinfo}} to check which video modes your graphic card supports.
  
=== SMPlayer No Video Issue ===
+
=== Watching streamed video ===
  
SMPlayer may have trouble opening mp4 (and probably flv) videos. If it plays only audio without video here is the fix:
+
If you want to play a video stream (e.g an {{ic|ASX}} link) use:
Open your {{Ic|~/.mplayer/config}} file and add
+
  
  [extension.mp4]
+
$ mplayer -playlist link-to-stream.asx
  demuxer=mov
+
  
If problem persists after doing so, it is because of smplayer is keeping settings for that specific file. Deleting file settings of smplayer will fix this.
+
The {{ic|-playlist}} option is necessary because these streams are actually playlists and cannot be played without it.
  
  $ rm -rf ~/.config/smplayer/file_settings
+
==== DVD playing ====
  
=== SMPlayer fails to resume playback after pause ===
+
To play a DVD with MPlayer:
  
SMPlayer might stop playing a video after pausing it if your audio output driver is set wrong. If PulseAudio is used start mplayer with the "-ao pulse" argument or edit your {{Ic|~/.mplayer/config}} file and add
+
$ mplayer dvd://''N''
  
  ao=pulse
+
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.
  
In SMPlayer you have to change your "Output-driver" under "General" - "Audio" in the options.
+
Mplayer checks {{ic|/dev/dvd}} by default. Tell it to use {{ic|/dev/sr0}} with the {{ic|dvd-device}} option at the command line, or the {{ic|dvd-device}} variable in {{ic|~/.mplayer/config}}.
  
===Transparent SMPlayer in Gnome with Composite enabled===
+
To play a DVD image file:
  
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]
+
$ mplayer -dvd-device movie.iso dvd://''N''
  
    sudo bash -c "cat > /usr/bin/smplayer.helper" <<EOF
+
To enable the DVD menu use:
    export XLIB_SKIP_ARGB_VISUALS=1
+
    exec smplayer.real "$@"
+
    EOF
+
    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!
+
$ mplayer dvdnav://
  
===Watching streamed video===
+
{{Note|You use arrow keys to navigate and the {{ic|Enter}} key to choose.}}
If you want to play a video stream (e.g *.asx link) use:
+
To enable mouse support in DVD menus use:
  
  $ mplayer -playlist link-to-stream.asx
+
  $ mplayer -mouse-movements dvdnav://
  
To play the stream, as these are playlists of streams and won't be playable by omitting the -playlist option.
+
To find the audio language, start MPlayer with the {{ic|-v}} switch to output audio IDs. An audio track is selected with {{ic|-aid ''audio_id''}}. Set a default audio language by editing {{ic|~/.mplayer/config}} and adding the line {{ic|1=alang=en}} for English.  
  
===Play mplayer with dvdnav support===
+
With MPlayer, the DVD could be set to a low volume. To increase the maximum volume to 400%, use {{ic|1=softvol=yes}} and {{ic|1=softvol-max=400}}. The startup volume defaults to 100% of software volume and the global mixer levels will remain untouched. Using the {{ic|9}} and {{ic|0}} keys, volume can be adjusted between 0 and 400 percent.
If you want to use mplayer with dvdnav support to enable the menus of a dvd then use the following syntax:
+
  
  $ mplayer -nocache dvdnav://
+
  alang=en
 +
softvol=yes
 +
softvol-max=400
  
===Seek forward/backward in a downloading file===
+
==== DVB-T Streaming ====
If you want to be able to seek forward and backward in a video file which is still downloading whilst watching it, add the following to your config file.
+
  
idx=yes
+
See [[DVB-T]] for more info.
  
===Increase the total volume===
+
=== JACK support ===
If the maximal volume provided by the sound settings is not loud enough, you can increase the volume by mplayer itself. Activate softvol and set a maximal level which has to range between 10 and 10000.
+
  
softvol=1
+
To have MPlayer audio output directed to [[JACK]] as its default behavior, edit {{ic|~/.mplayer/config}} and add:
softvol-max=600
+
  
===Stream mplayer audio to jackd===
+
ao=jack
  
Edit {{ic|~/.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:
  
ao=jack
+
$ 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 {{ic|~/.mplayer/config}} and add:
 +
 
 +
ass=true
 +
 
 +
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 {{ic|ass}} also enables any embedded fonts. As per the note in the mplayer's man adding {{ic|1=embeddedfonts=true}} is unneeded if {{Pkg|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. [http://www.linuxforums.org/forum/miscellaneous/199396-mplayer-flash.html#post941062]
 +
 
 +
{{bc|<nowiki>
 +
#!/bin/bash
 +
XX="X"$1;
 +
PLAYIT='mplayer  -loop 0 -playlist http://*.*.*.*:8000/listen.pls';
 +
 
 +
if [ "$XX" == "Xstop" ]; then
 +
  killall mplayer;
 +
else
 +
  if [ 'EX' == 'EX'"$(pidof mplayer)" ]; then
 +
    if [ "$UID" -ne 0 ]; then
 +
      nohup $PLAYIT &> /dev/null & disown;
 +
    else
 +
      echo The "root" user is not allowed to run this script.
 +
    fi
 +
  else
 +
    echo mplayer is already running by user: $(ps -eo user,comm | grep -i "mplayer"$ | sed 's/ mplayer/,/m') | sed "s/ ,$/./m";
 +
  fi
 +
fi
 +
</nowiki>}}
 +
 
 +
For more details on a running mplayer instance:
 +
 
 +
$ ps -eo pcpu,pid,user,comm | grep -i "mplayer"$ | sed  "s/ mplayer$//m"
 +
 
 +
== Troubleshooting ==
  
 
=== MPlayer fails to open files with spaces ===
 
=== MPlayer fails to open files with spaces ===
  
If you try to open a file with spaces (The Movie) and mplayer fails. Saying that it could not open the file (file:///The%20Movie), where all spaces are converted to %20.  
+
MPlayer can fail to open a file with spaces (e.g. 'The Movie') by saying that it could not open the file {{ic|file:///''The%20Movie''}} (where all spaces are converted to {{ic|%20}}). This can be fixed by editing {{ic|/usr/share/applications/mplayer.desktop}} to changing the following line from:
  
Then edit {{ic|/usr/share/applications/mplayer.desktop}} to change the following line from:
 
 
 
  Exec=mplayer %U
 
  Exec=mplayer %U
  
To:
+
to:
  
 
  Exec=mplayer "%F"
 
  Exec=mplayer "%F"
  
If you have a frontend/GUI enter GUI name in Exec=gui_name "%F".
+
If you use a frontend/GUI for MPlayer, enter its name in {{ic|<nowiki>Exec=gui_name "%F"</nowiki>}}.
 +
 
 +
=== 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 {{ic|~/.mplayer/config}} file:
 +
 
 +
vo=xv
 +
 
 +
See the original [https://bbs.archlinux.org/viewtopic.php?pid=1379141 forums thread] for details.
 +
 
 +
=== SMPlayer: No video issue ===
 +
 
 +
SMPlayer may have trouble opening some {{ic|MP4}} (and probably {{ic|FLV}}) videos. If it plays only audio without any video, a possible fix is to add the following lines to your {{ic|~/.mplayer/config}} file:
 +
 
 +
[extension.mp4]
 +
demuxer=mov
 +
 
 +
If problem persists after doing so, it is because SMPlayer is keeping settings for that specific file. Deleting the settings for all the files that SMPlayer is keeping will solve this problem:
 +
 
 +
$ rm -rf ~/.config/smplayer/file_settings
 +
 
 +
=== SMPlayer: fail to resume playback after pause ===
 +
 
 +
SMPlayer might stop playing a video after pausing it if your audio output driver is incorrectly set. You can fix this by specifically setting your audio driver. For example, if you use PulseAudio, this can be done by starting MPlayer with the {{ic|-ao pulse}} argument or by adding
 +
the following to your {{ic|~/.mplayer/config}} file:
 +
 
 +
ao=pulse
 +
 
 +
You can also change this from SMPlayer by going to ''Options > Preferences > General > Audio'' and setting the ''Output Driver'' option to ''pulse''.
 +
 
 +
=== SMPlayer: no video when using transparency in GNOME ===
 +
 
 +
This problem may arise under GNOME when using Compiz to provide transparency: SMPlayer starts with a transparent screen with audio playing, but no video. To fix this, create (as root) a file with the contents:
 +
 
 +
{{hc|/usr/local/bin/smplayer.helper|<nowiki>
 +
export XLIB_SKIP_ARGB_VISUALS=1
 +
exec smplayer.real "$@"
 +
</nowiki>}}
 +
 
 +
Then do the following:
 +
 
 +
# chmod 755 /usr/local/bin/smplayer.helper
 +
# ln -sf /usr/local/bin/smplayer.helper /usr/local/bin/smplayer
 +
 
 +
=== SMPlayer: OSD font too big / subtitle text too small ===
 +
 
 +
Since SMPlayer 0.8.2.1 (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 {{ic|~/.mplayer/config}}:
 +
subfont-osd-scale=2
 +
 
 +
=== 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:
 +
 
 +
file subtitles.srt
 +
 
 +
See [http://www.linuxquestions.org/questions/slackware-14/mplayer-shows-question-marks-for-some-characters-on-subtitle-works-fine-on-xine-906077/ 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 {{ic|-cache}} option:
 +
 
 +
mplayer cdda://:1 -cache 1024
 +
 
 +
The {{ic|:1}} is to lower the CDROM speed for a constant spin and less noise.
 +
 
 +
== See also ==
  
==External links==
 
 
* [http://www.mplayerhq.hu/ Official MPlayer website]
 
* [http://www.mplayerhq.hu/ Official MPlayer website]
* [http://www.keyxl.com/aaa2fa5/302/MPlayer-keyboard-shortcuts.htm List of shortcut keys]
+
* [http://www.mplayer2.org/ Official MPlayer2 website]
 +
* [http://wiki.multimedia.cx/index.php?title=MPlayer_FAQ MPlayer FAQ]
 +
* [https://www.youtube.com/watch?v=n4Ul_A0VBVI MPlayer notes]
 +
* [https://help.ubuntu.com/community/MPlayerTips MPlayer tips]
 +
* [http://how-to.wikia.com/wiki/How_to_configure_MPlayer How to configure MPlayer]
 +
* [https://github.com/acrisci/playerctl playerctl]: A command-line utility and library for controlling media players

Latest revision as of 09:52, 20 October 2016

Related articles

MPlayer is a popular movie player for GNU/Linux. It has support for most video and audio formats and is thus highly versatile, even if it is mostly used for viewing videos.

Installation

Various flavours of MPlayer can be installed from the official repositories or from the AUR:

  • MPlayer — Official package
https://mplayerhq.hu/ || mplayer

Notable variants are:

  • MPlayer-VAAPI — VAAPI-enabled version
http://gitorious.org/vaapi/mplayer || mplayer-vaapiAUR
  • MPlayer-svn — Development version
|| mplayer-svnAUR
  • MPlayer2 — Fork of MPlayer
http://www.mplayer2.org/ || mplayer2AUR
Note: mplayer2 development seems to be ceased in favour of mpv, which is focused on speed and quality of development, though this breaks compatibility with old hardware and software. Be aware of its differences if you want to use it.

Frontends/GUIs

  • GNOME MPlayer — Simple GTK+-based GUI for MPlayer.
http://kdekorte.googlepages.com/gnomemplayer || gnome-mplayer
  • KPlayer — Multimedia player for KDE4 using mplayer as a backend.
http://kplayer.sourceforge.net/ || kplayerAUR
  • KMPlayer — Video player plugin for Konqueror and basic MPlayer/Xine/ffmpeg/ffserver/VDR frontend for KDE.
http://kmplayer.kde.org/ || kmplayer
  • SMPlayer — Qt multimedia player with extra features (CSS themes, YouTube integration, etc.).
http://smplayer.sourceforge.net/ || smplayer

Browser integration

If you want to let MPlayer control video viewing in your favorite web browser, install one of the following plugins for your browser.

Firefox

A browser plugin is available in the official repositories with the gecko-mediaplayer package.

Note: It depends on gnome-mplayer, which provides a complete frontend to MPlayer.

Konqueror

A plugin for Konqueror can be found in the AUR with the kmplayer package.

Note: kmplayer also provides a complete frontend to MPlayer.

Chromium

The gecko-mediaplayer plugin for Firefox also works in Chromium.

Configuration

System-wide configuration files are located in the /etc/mplayer/, whereas the user-local settings are stored in ~/.mplayer/ directory. The default files in the /etc/mplayer/ are:

  • codecs.conf - Contains configuration of codecs.
  • example.conf - Is an example of mplayer.conf, which is not automatically created after installation.
  • input.conf - Contains configuration of a hotkeys.

In the ~/.mplayer/ by default created a file with a name config.

See also: Example MPlayer configuration file, man mplayer.

Key bindings

System key bindings are configured via /etc/mplayer/input.conf. Personal key bindings are stored in ~/.mplayer/input.conf. For a complete list of keyboard shortcuts look at man mplayer.

See also: XF86 keyboard symbols

Tips and tricks

Automatic resuming from where you left off

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.

Hardware acceleration

See Hardware video acceleration.

Enabling VDPAU

Using a configuration file

Append the following to either the system-wide (/etc/mplayer/mplayer.conf) or user-specific (~/.mplayer/config) configuration files:

vo=vdpau,
vc=ffh264vdpau,ffmpeg12vdpau,ffodivxvdpau,ffwmv3vdpau,ffvc1vdpau,ffhevcvdpau
Note:
  • 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.
Warning: The ffodivxvdpau codec is only supported by the most recent series of NVIDIA hardware. Consider omitting it based on your specific hardware. See the NVIDIA page[broken link: invalid section] for more information.
Using a wrapper script

Tango-edit-cut.pngThis section is being considered for removal.Tango-edit-cut.png

Reason: None of the following (or similar) packages are available anymore, and haven't been for quite a long time now. (Discuss in Talk:MPlayer#)

The AUR contains a trivial Bash script called mplayer-vdpau-autoAUR[broken link: archived in aur-mirror] that detects which video codec to use and when to use VDPAU as the video output.

Another simple wrapper is mplayer-vdpau-shell-gitAUR[broken link: archived in aur-mirror], which can recover from a VDPAU FATAL error. This wrapper uses the "-include" option to include a VDPAU configuration, so it will ignore any VDPAU specific settings in your ~/.mplayer/config file.

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:

vo=xv:adaptor=1

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

Watching streamed video

If you want to play a video stream (e.g an ASX link) use:

$ mplayer -playlist link-to-stream.asx

The -playlist option is necessary because these streams are actually playlists and cannot be played without it.

DVD playing

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.

alang=en
softvol=yes
softvol-max=400

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:

ao=jack

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:

ass=true

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]

#!/bin/bash
XX="X"$1;
PLAYIT='mplayer  -loop 0 -playlist http://*.*.*.*:8000/listen.pls';

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

For more details on a running mplayer instance:

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

Troubleshooting

MPlayer fails to open files with spaces

MPlayer can fail to open a file with spaces (e.g. 'The Movie') by saying that it could not open the file file:///The%20Movie (where all spaces are converted to %20). This can be fixed by editing /usr/share/applications/mplayer.desktop to changing the following line from:

Exec=mplayer %U

to:

Exec=mplayer "%F"

If you use a frontend/GUI for MPlayer, enter its name in 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:

vo=xv

See the original forums thread for details.

SMPlayer: No video issue

SMPlayer may have trouble opening some MP4 (and probably FLV) videos. If it plays only audio without any video, a possible fix is to add the following lines to your ~/.mplayer/config file:

[extension.mp4]
demuxer=mov

If problem persists after doing so, it is because SMPlayer is keeping settings for that specific file. Deleting the settings for all the files that SMPlayer is keeping will solve this problem:

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

SMPlayer: fail to resume playback after pause

SMPlayer might stop playing a video after pausing it if your audio output driver is incorrectly set. You can fix this by specifically setting your audio driver. For example, if you use PulseAudio, this can be done by starting MPlayer with the -ao pulse argument or by adding the following to your ~/.mplayer/config file:

ao=pulse

You can also change this from SMPlayer by going to Options > Preferences > General > Audio and setting the Output Driver option to pulse.

SMPlayer: no video when using transparency in GNOME

This problem may arise under GNOME when using Compiz to provide transparency: SMPlayer starts with a transparent screen with audio playing, but no video. To fix this, create (as root) a file with the contents:

/usr/local/bin/smplayer.helper
export XLIB_SKIP_ARGB_VISUALS=1
exec smplayer.real "$@"

Then do the following:

# chmod 755 /usr/local/bin/smplayer.helper
# ln -sf /usr/local/bin/smplayer.helper /usr/local/bin/smplayer

SMPlayer: OSD font too big / subtitle text too small

Since SMPlayer 0.8.2.1 (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:

subfont-osd-scale=2

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:

file subtitles.srt

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.

See also