Difference between revisions of "Mpv"

From ArchWiki
Jump to: navigation, search
(Configuration: volume tip.)
(12 intermediate revisions by one other user not shown)
Line 12: Line 12:
 
{{Tip|If you prefer a custom location for configurations, set the {{ic|MPV_HOME}} variable as you like in your shell configuration file. A predictable choice is {{ic|<nowiki>MPV_HOME=$XDG_CONFIG_HOME/mpv</nowiki>}}.}}
 
{{Tip|If you prefer a custom location for configurations, set the {{ic|MPV_HOME}} variable as you like in your shell configuration file. A predictable choice is {{ic|<nowiki>MPV_HOME=$XDG_CONFIG_HOME/mpv</nowiki>}}.}}
  
An example configuration:
+
See the [https://github.com/mpv-player/mpv/blob/master/etc/example.conf official example], or alternatively, the one [[#Example configuration|below]].
 +
 
 +
{{Tip|If you have a laptop computer and cannot get a good loud sound, set {{ic|1=softvol-max}} in your configuration file to a reasonable amount. {{ic|1=softvol-max=600}} can be a good value. Remember: in default configuration, 0 key turns the volume up.}}
 +
 
 +
== Hardware Decoding ==
 +
 
 +
You can reduce the CPU usage (and extend mobile battery life) by enabling GPU hardware decoding for common video codecs. Unlike mplayer, and mplayer2, mpv has both [[Wikipedia:VDPAU|VDPAU]] and [[Wikipedia:VAAPI|VAAPI]] built-in! To enable hardware decoding, add --hwdec=<method> to the mpv command line, where <method> is one of "auto", "vdpau", "vaapi". To make this persistent, add the line hwdec=<method> to the config file. With hardwarde decoding --hwdec=[vdpau|vaapi], the video output must be specified as --vo=opengl (preferred) or --vo=[vdpau|vaapi]. While --vo=opengl should generally be of better quality,--vo=vdpau may give better frame timings, and --vo=vaapi may use less power. If hardware decoding can't be used, mpv will automatically fallback to software decoding.
 +
 
 +
== Key bindings ==
 +
 
 +
System key bindings are configured via {{ic|/etc/mpv/input.conf}}. Personal key bindings are stored in {{ic|~/.mpv/input.conf}}.
 +
Available keybinds and configuration are explained in the [https://github.com/mpv-player/mpv/blob/master/DOCS/man/en/mpv.rst manual pages].
 +
 
 +
=== Automatic resuming from where you left off ===
 +
 
 +
The default key to quit saving the video advance state is {{ic|Q}}. This behaviour is controlled by the {{ic|quit_watch_later}} string in the key bindings configuration file.
 +
 
 +
=== Quick aspect ratio change ===
 +
 
 +
Append to your {{ic|input.conf}}:
 +
{{bc|
 +
F1 set aspect 1.3333
 +
F2 set aspect 1.6
 +
F3 set aspect 1.7777
 +
F4 set aspect 1.85
 +
F5 set aspect 0
 +
}}
 +
Now you are able to change the aspect ratio with {{ic|F1}} to {{ic|F5}}.
 +
 
 +
 
 +
== Example configuration ==
 
{{bc|1=
 
{{bc|1=
 
# default configuration that applies to every file
 
# default configuration that applies to every file
Line 18: Line 48:
  
 
# try to use high quality opengl output, with standard opengl, classic xv, and wayland as fallbacks
 
# try to use high quality opengl output, with standard opengl, classic xv, and wayland as fallbacks
vo=opengl-hq,opengl,xv,wayalnd
+
# note: opengl has numerous quality/performance trade-off options.
 +
# as per the mpv(1), "opengl-hq" is just an alias for "opengl:lscale=lanczos2:dither-depth=auto:fbo-format=rgb16"
 +
vo=opengl-hq,opengl,xv,wayland
  
 
# use alsa for audio output, choose pulse, or oss4 as fallback
 
# use alsa for audio output, choose pulse, or oss4 as fallback
Line 74: Line 106:
 
af-add=pan=2:0.7:0:0:0.7:0.5:0:0:0.5:0.6:0.6:0:0
 
af-add=pan=2:0.7:0:0:0.7:0.5:0:0:0.5:0.6:0.6:0:0
 
}}
 
}}
 
See another example at https://github.com/mpv-player/mpv/blob/master/etc/example.conf.
 
 
== Hardware Decoding ==
 
 
You can reduce the CPU usage (and extend mobile battery life) by enabling GPU hardware decoding for common video codecs. Unlike mplayer, and mplayer2, mpv has both [[Wikipedia:VDPAU|VDPAU]] and [[Wikipedia:VAAPI|VAAPI]] built-in! To enable hardware decoding, add "--hwdec=<method>" to the mpv command line, where <method> is one of "auto", "vdpau", "vaapi" or "vaapi-copy". To make this persistent, add the line "hwdec=<method>" to the config file. Any video output (--vo) can be used with "vaapi-copy", which, however is expected to have the worst performance because it requires the decoded video to be copied back from the GPU to the main system memory before being sent again to the video driver for display. Better performance is had using "--hwdec=vdpau"/"--hwdec=vaapi" with either "--vo=opengl" (preferred) or "--vo=vdpau"/"--vo=vaapi" respectively. While the opengl output should generally be of better quality, the "-vo=vdpau" may gives better frame timings when using "--hwdec=vdpau". If hardware decoding can't be used, mpv will automatically fallback to software decoding.
 
 
== Key bindings ==
 
 
System key bindings are configured via {{ic|/etc/mpv/input.conf}}. Personal key bindings are stored in {{ic|~/.mpv/input.conf}}.
 
Available keybinds and configuration are explained in the [https://github.com/mpv-player/mpv/blob/master/DOCS/man/en/mpv.rst manual pages].
 
 
=== Automatic resuming from where you left off ===
 
 
The default key to quit saving the video advance state is {{ic|Q}}. This behaviour is controlled by the {{ic|quit_watch_later}} string in the key bindings configuration file.
 
 
=== Quick aspect ratio change ===
 
 
Append to your {{ic|input.conf}}:
 
{{bc|
 
F1 set aspect 1.3333
 
F2 set aspect 1.6
 
F3 set aspect 1.7777
 
F4 set aspect 1.85
 
F5 set aspect 0
 
}}
 
Now you are able to change the aspect ratio with {{ic|F1}} to {{ic|F5}}.
 

Revision as of 17:24, 16 February 2014

From the development page:

Movie player based on MPlayer and mplayer2. It supports a wide variety of video file formats, audio and video codecs, and subtitle types. If you are wondering what's different from mplayer2 and MPlayer you can read more about the changes.

Installation

Install mpv from the official repositories or mpv-gitAUR from the AUR. Alternatively install cmplayerAUR or cmplayer-gitAUR Qt5 frontend which provides its own mpv.

Configuration

System-wide configuration is located in /etc/mpv/mpv.conf, whereas the user-local settings are stored in ~/.mpv/config. The complete list of options is located here.

Tip: If you prefer a custom location for configurations, set the MPV_HOME variable as you like in your shell configuration file. A predictable choice is MPV_HOME=$XDG_CONFIG_HOME/mpv.

See the official example, or alternatively, the one below.

Tip: If you have a laptop computer and cannot get a good loud sound, set softvol-max in your configuration file to a reasonable amount. softvol-max=600 can be a good value. Remember: in default configuration, 0 key turns the volume up.

Hardware Decoding

You can reduce the CPU usage (and extend mobile battery life) by enabling GPU hardware decoding for common video codecs. Unlike mplayer, and mplayer2, mpv has both VDPAU and VAAPI built-in! To enable hardware decoding, add --hwdec=<method> to the mpv command line, where <method> is one of "auto", "vdpau", "vaapi". To make this persistent, add the line hwdec=<method> to the config file. With hardwarde decoding --hwdec=[vdpau|vaapi], the video output must be specified as --vo=opengl (preferred) or --vo=[vdpau|vaapi]. While --vo=opengl should generally be of better quality,--vo=vdpau may give better frame timings, and --vo=vaapi may use less power. If hardware decoding can't be used, mpv will automatically fallback to software decoding.

Key bindings

System key bindings are configured via /etc/mpv/input.conf. Personal key bindings are stored in ~/.mpv/input.conf. Available keybinds and configuration are explained in the manual pages.

Automatic resuming from where you left off

The default key to quit saving the video advance state is Q. This behaviour is controlled by the quit_watch_later string in the key bindings configuration file.

Quick aspect ratio change

Append to your input.conf:

F1 set aspect 1.3333
F2 set aspect 1.6
F3 set aspect 1.7777
F4 set aspect 1.85
F5 set aspect 0

Now you are able to change the aspect ratio with F1 to F5.


Example configuration

# default configuration that applies to every file
[default]

# try to use high quality opengl output, with standard opengl, classic xv, and wayland as fallbacks
# note: opengl has numerous quality/performance trade-off options.
# as per the mpv(1), "opengl-hq" is just an alias for "opengl:lscale=lanczos2:dither-depth=auto:fbo-format=rgb16"
vo=opengl-hq,opengl,xv,wayland

# use alsa for audio output, choose pulse, or oss4 as fallback
ao=alsa,pulse,oss

# prefer using 5.1 channels audio (defaults to 2 - see mpv --channels=help) 
# mixing is handled by libavcodec unless using "--af-add=pan" (see below)
channels=5.1

# scale the subtitles to the 3% of the screen size
sub-scale=3

# set the window title using the media filename (see Property Expansion section of mpv(1))
title="${filename}"

# add black borders so the movies have the same aspect ratio of the monitor
# for wide screen monitors
vf=expand=::::1:16/9:16

# for non wide screen traditional monitors, alternative to the above item
#vf=expand=::::1:4/3:16

# disable screensaver
stop-screensaver="yes"

# execute a command every 30 seconds
# useful to disable a non-standard-compliant screensavers and to work around buggy behaviours
# BE WARNED: to avoid dangerous commands is your responsibility
#heartbeat-cmd="xscreensaver-command -deactivate &" # stop xscreensaver

# custom heartbeat frequency in seconds
#heartbeat-interval=600

# correct pitch when speed is faster or slower than 1.0
af=scaletempo

# allow to seek in a file which is still downloading whilst watching it
# from manpage:"this switch has no effect in the typical case" (usually done automatically by demuxers)
# idx=yes

# allow to increase the maximal volume to 600%
#softvol-max=600

# skip displaying some frames to maintain A/V sync on slow systems
framedrop=yes

# profile for up-mixing two channels audio to six channels
# 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