- Mpv linux ��� ���
- Mpv linux ��� ���
- Contents
- Installation
- Front ends
- Configuration
- General settings
- Subtitle configurations
- High quality configurations
- Custom profiles
- Key bindings
- Additional configuration files
- Scripts
- JavaScript
- mpv-ytdlAutoFormat
- mpv-stats
- mpv-webm
- mpv-mpris
- Vapoursynth
- SVP 4 Linux (SmoothVideoProject)
- Tips and Tricks
- Hardware video acceleration
- Save position on quit
- Volume is too low
- Specify an audio output
- HD Audio passthrough
- Better audio with sped up content
- Volume normalization
- Play a DVD
- Quickly cycle between aspect ratios
- Ignoring aspect ratio
- Draw to the root window
- Always show application window
- Disable video output
- Restoring old OSC
- Use as a browser plugin
- Improving mpv as a music player with Lua scripts
- Twitch.tv streaming over mpv
- youtube-dl and choosing formats
- youtube-dl audio with search
- Reproducible screenshots
- Creating a single screenshot
- Terminal output (libcaca)
- Troubleshooting
- General debugging
- Fix jerky playback and tearing
- Problems with window compositors
- No volume bar, cannot change volume
- GNOME Blank screen (Wayland)
- Use mpv with a compositor
- Cursor theme not respected under GNOME Wayland
Mpv linux ��� ���
Using git master is recommended.
All binary packages are unofficial third-party builds.
Unofficial third-party builds.
djinn/mpv_osx/
If you want bleeding edge functionality, link against git versions of FFmpeg or if a package for your platform is not available or updated, you can build mpv from source code. The helper build scripts are recommended for most users since they perform a static build of FFmpeg and libass as well as mpv.
Distributions usually package outdated, unmaintained, and unsupported versions of mpv. This is especially true for popular distros like Debian and Ubuntu. You are recommended to use mpv-build or third-party packages instead. All of these packages are unofficial.
Источник
Mpv linux ��� ���
mpv is a media player based on MPlayer and the now unmaintained mplayer2. It supports a wide variety of video file formats, audio and video codecs, and subtitle types. A detailed (although admittedly incomplete) list of differences between mpv and the aforementioned players can be found here.
Contents
Installation
Install the mpv package or mpv-git AUR for the development version.
Front ends
Configuration
mpv comes with good all-around defaults that should work well on computers with weaker/older video cards. However, if you have a computer with a more modern video card then mpv allows you to do a great deal of configuration to achieve better video quality (limited only by the power of your video card). To do this one only needs to create a few configuration files (they do not exist by default).
/.config/mpv (unless the environment variable XDG_CONFIG_HOME is set), where per-user settings override system-wide settings, all of which are overridden by the command line. User specific configuration is suggested since it may require some trial and error.
To help you get started mpv provides sample configuration files with default settings. Copy them to use as a starting point:
mpv.conf contains the majority of mpv’s settings, input.conf contains key bindings. Read through both of them to get an idea of how they work and what options are available.
General settings
Add the following settings to
Subtitle configurations
Enable fuzzy searching:
Bold the subtitles to increase readability:
High quality configurations
This loads high quality OpenGL options when using vo=gpu as video output (default). Most users can run these without any problems, but they are not enabled by default to avoid causing problems for the few users who cannot run them:
The gpu-hq profile defaults to the spline36 scaling filter for mid quality and speed. For the best quality video output, the manual states that if your hardware can run it, ewa_lanczossharp is probably what you should use.
These last three options are a little more complicated. The first option makes it so that if audio and video go out of sync then instead of dropping video frames it will resample the audio (a slight change in audio pitch is often less noticeable than dropped frames). The mpv wiki has an in depth article on it titled Display Synchronization. The remaining two essentially make motion appear smoother on your display by changing the way that frames are shown so that the source framerate jives better with your display’s refresh rate (not to be confused with SVP’s technique which actually converts video to 60fps). The mpv wiki has an in depth article on it titled Interpolation though it is also commonly known as smoothmotion.
Beyond this there is still a lot you can do but things become more complicated, require more powerful video cards, and are in constant development. As a brief overview, it is possible to load special shaders that perform exotic scaling and sharpening techniques including some that actually use deep neural networks trained on images (for both real world and animated content). To learn more about this take a look around the mpv wiki, particularly the user shader’s section.
There are also plenty of other options you may find desirable as well. It is worthwhile taking a look at mpv(1) . It is also helpful to run mpv from the command line to check for error messages about the config.
Custom profiles
In mpv.conf it is possible to create profiles which are essentially just «groups of options» with which you can:
- Quickly switch between different configurations without having to rewrite the file.
- Create special profiles for special content.
- nest profiles so that you can make more complicated profiles out of simpler ones.
Creating a profile is easy. The area at the top of mpv.conf is called the top level, any options you write there will kick into effect once mpv is started. However, once you define a profile by writing its name in brackets then every option you write below it (until you define a new profile) is considered part of that profile. Here is an example mpv.conf :
There are only two lines within the top level area and there are two separate profiles defined below it. When mpv starts it sees the first line, loads the options in myprofile2 (which means it loads the options in gpu-hq and log-file=
/log ) finally it loads ontop=yes and finishes starting up. Note, myprofile1 is never loaded because it is never called in the top level area.
Alternatively one could call mpv from the command line with:
and it would ignore all options except the ones for myprofile1 .
Key bindings
Key bindings are fairly straightforward given the examples in /usr/share/doc/mpv/input.conf and the relevant section in the manual.
Add the following examples to
For an attempt to reproduce MPC-HC key bindings in mpv, see [1].
Additional configuration files
In addition there are a few more configuration files and directories that can be created, among which:
/.config/mpv/script-opts/osc.conf manages the On Screen Controller.
/.config/mpv/scripts/script-name.lua for Lua scripts. See [2] for an example.
Scripts
mpv has a large variety of scripts that extend the functionality of the player. To this end, it has internal bindings for both Lua and JavaScript (added recently).
Scripts are typically installed by putting them in the
/.config/mpv/scripts/ directory (you may have to create it first). After that they will be automatically loaded when mpv starts (this behavior can be altered with other mpv options). Some scripts come with their own installation and configuration instructions, so make sure to have a look. In addition some scripts are old, broken, and unmaintained.
JavaScript
JavaScript (ES5 via MuJS) has been supported as an mpv scripting language since 2014. Currently only a few scripts are available, but documentation exists for anyone interested in making their own.
To get started, drop a script with a .js extension in the mpv scripts directory, e.g.:
For more details, e.g. on using require to load CommonJS modules, see the documentation.
JavaScript support is available in the mpv package, as well as some AUR packages, e.g. mpv-full AUR and mpv-full-git AUR .
The development of mpv’s Lua scripts is documented in DOCS/man/lua.rst with examples in TOOLS/lua
mpv-ytdlAutoFormat
mpv-ytdlautoformat is a Lua script to auto change ytdl-format for Youtube and Twitch or the domains you desire, to 480p or the quality you desire.
mpv-stats
mpv-stats (or simply stats) is a Lua script that outputs a lot of live statistics showing how well mpv is currently doing. It is very useful for making sure that your hardware can keep up with your configuration and for comparing different configurations. Since version v0.28.0, the script is built into mpv and can be toggled on or off with the i or I keys (by default).
mpv-webm
mpv-webm (or simply webm) is a very easy to use Lua script that allows one to create WebM files while watching videos. It includes several features and does not have any extra dependencies (relies entirely on mpv).
mpv-mpris
The C plugin mpv-mpris allows other applications to integrate with mpv via the MPRIS protocol. For example, with mpv-mpris installed, kdeconnect can automatically pause video playback in mpv when a phone call arrives. Another example is buttons (play\pause etc) on bluetooth audio-devices.
Install mpv-mpris AUR and follow the post-installation instructions displayed by Pacman.
Vapoursynth
Vapoursynth is an alternative to AviSynth that can be used on Linux and allows for Video manipulation via python scripts. Vapoursynths python scripts can be used as video filters for mpv.
To use vapoursynth filters you have to install the vapoursynth package (or vapoursynth-git AUR ) and compile mpv with the —enable-vapoursynth build flag.
This is easier to do by first installing Vapoursynth and then installing (or re-installing if it is already installed) mpv-git AUR . The configure script for mpv-git AUR will auto-detect Vapoursynth (as long as it has already been installed) and it will automatically compile mpv with support for Vapoursynth without having to manually change any configure options or anything (this makes it very easy to update mpv as well).
SVP 4 Linux (SmoothVideoProject)
SmoothVideoProject SVP is a program that is primarily known for converting video to 60fps. It is free [as in beer] and full featured for 64bit Linux (costs money for Windows and OS X and is incompatible with 32bit Linux).
It has three main features and each one can be disabled/enabled as one chooses (you are not forced to use motion interpolation).
- Motion interpolation (youtube video) — An algorithm that converts video to 60fps. This creates the somewhat controversial «soap opera effect» that some people love and others hate. Unfortunately the algorithm is not perfect and it also introduces more than its share of weird artifacts. The algorithm can be tuned (via a slider) for either performance or quality. It also has some artifact reduction settings that interpolate actual frames with the generated frames reducing the noticeability of the artifacts. The framerate detection can be set to automatic or manual (manual seems to resolve performance issues for some users).
- Black bar lighting (youtube video) — If the image has an aspect ratio that produces black bars on your display then SVP will illuminate the black bars with «lights» generated by the content on the screen. It has some amount of customization but the defaults are pretty close to optimal.
- LED ambient lighting control (youtube video) — Has the ability to control LED ambient lighting attached to your television.
Once you have mpv compiled with Vapoursynth support it is fairly easy to get SVP working with mpv. Simply install svp AUR , open the SVP program to let it assess your system performance (you may want to close other programs first so that it gets an accurate reading), and finally add the following mpv profile to your mpv.conf[3]:
Then, in order to use SVP you must have the SVP program running in the background before opening the file using mpv with that profile. Either do:
or set profile=svp in the top-level portion of the mpv configuration.
If you want to use hardware decoding then you must use a copy-back decoder since normal decoders are not compatible with Vapoursynth (choose a hwdec option that ends in -copy ). For instance:
Either way, hardware decoding is discouraged by mpv developers and is not likely to make a significant difference in performance.
Tips and Tricks
Hardware video acceleration
Hardware accelerated video decoding is available via —hwdec=API option. For list of all supported APIs and other required options see relevant manual section.
For Wayland use —gpu-context=wayland option. For list of other available GPU APIs see manual.
Save position on quit
By default you can save the position and quit by pressing Shift+q . The shortcut can be changed by setting quit_watch_later in the key bindings configuration file.
To automatically save the current playback position on quit, start mpv with —save-position-on-quit , or add save-position-on-quit to the configuration file.
Volume is too low
Set volume-max=value in your configuration file to a reasonable amount, such as volume-max=150 , which then allows you to increase your volume up to 150%, which is more than twice as loud. Increasing your volume too high will result in clipping artefacts. Additionally (or alternatively), you can utilize dynamic range compression with af=acompressor .
Specify an audio output
Run the following command to get a list of available audio output devices
Then add one to
/.config/mpv/mpv.conf . For example:
HD Audio passthrough
To enable HD audio codecs like TrueHD and DTS-MA to passthrough to an AV receiver add the following to
Better audio with sped up content
If regularly viewing sped up content, use the following filter for a better audio quality:
Volume normalization
This article or section needs expansion.
Different sources may have different or inconsistent loudness, so mpv users may need to configure automatic volume normalization. For example:
This binds the key n to cycle the audio filter settings ( af ) through the specified values:
- loudnorm=I=-30 : loudnorm setting with I=-30 , soft volume, might be suitable for background music
- loudnorm=I=-15 : louder volume, might be good for the video currently in view
- anull : reset audio filter to null, i.e., disable the audio filter
Audio filtering in mpv is provided by the FFmpeg backend. See Wikipedia:EBU R 128 and ffmpeg loudnorm filter for details.
See also upstream issues [5] and [6] which mention different options.
Play a DVD
mpv does not support DVD menus. To start the main stream with the longest title of a video DVD, use the command:
An optional title specifier is a number (starting at 0) which selects between separate video streams on the DVD:
DVDs which have been copied on to a local file system (by e.g. the dvdbackup tool) are accommodated by specifying the path to the local copy: —dvd-device=PATH .
See the following desktop file example for playing DVDs from a local file system:
By replacing the Exec line with
the mpv player will queue DVD title 0 to 9 in the playlist, which allows the user to play the titles consecutively or jump forward and backward in the DVD titles with the mpv GUI.
Install libdvdcss , to fix the error:
Quickly cycle between aspect ratios
You can cycle between aspect ratios using Shift+a .
Ignoring aspect ratio
You can ignore aspect ratio using —keepaspect=no . To make option permanent, add line keepaspect=no to configuration file.
Draw to the root window
Run mpv with —wid=0 . mpv will draw to the window with a window ID of 0.
Always show application window
To show application window even for audio files when launching mpv from command line use —force-window option. To make option permament, add line force-window=yes to the configuration file.
Disable video output
To disable video output when launching from command line use —vid=no option, or its alias, —no-video .
Restoring old OSC
Since version 0.21.0, mpv has replaced the on-screen controls by a bottombar. In case you want on-screen controls back, you can edit the mpv configuration as described here.
Use as a browser plugin
With the help of mozplugger AUR , mpv can be used in a supported browser to play video. See Browser plugins#MozPlugger for configuration details. This coupled with a user script such as ViewTube, allows you to use mpv in place of a site’s integrated video player.
It may be needed to specify a valid user agent for HTTP streaming, e.g. user-agent=»Mozilla/5.0 (X11; Linux x86_64; rv:49.0) Gecko/20100101 Firefox/49.0″ .
Browser plugins#Multimedia playback page shows other easy ways to watch videos.
Improving mpv as a music player with Lua scripts
This blog post introduces the music.lua script, which shows how Lua scripts can be used to improve mpv as a music player.
Twitch.tv streaming over mpv
If youtube-dl is installed, mpv can directly open a Twitch livestream.
Another alternative based on Livestreamer is this Lua script: https://gist.github.com/ChrisK2/8701184fe3ea7701c9cc
youtube-dl and choosing formats
The default —ytdl-format is bestvideo+bestaudio/best . For youtube videos that have 4K resolutions available, this may mean that your device will struggle to decode 4K VP9 encoded video in software even if the attached monitor is much lower resolution.
Setting the right youtube-dl format selectors can fix this easily though. In the following configuration example, only videos with a vertical resolution of 1080 pixels or less will be considered.
If you wish to avoid a certain codec altogether because you cannot hardware-decode it, you can add this to the format selector. For example, we can additionally choose to ignore VP9 as follows:
If you prefer best quality open codecs (VP9 and Opus), use:
youtube-dl audio with search
To find and stream audio from your terminal emulator with yta search terms put the following function in your .bashrc :
Reproducible screenshots
The filename template option can include the precise timecode (HH:MM:SS.mmm) of the screenshoted frame. The meaningful filename makes it easy to know the origin of the screenshot. It is set like this:
This expands to filename — [HH:MM:SS.mmm]vnumber.jpg . Example result:
A bonus is it sorts nicely because alphabetically, the timecode is sorted within the episode number.
Creating a single screenshot
An example of creating a single screenshot, by using a start time ( HH:MM:SS ):
Screenshots will be saved in /path/to/screenshot.png.
Terminal output (libcaca)
libcaca support is disabled due to vulnerabilities (see FS#70962), so if you want or need terminal output, install mpv-caca AUR .
Troubleshooting
General debugging
If you are having trouble with mpv’s playback (or if it is flat out failing to run) then the first three things you should do are:
- Run mpv from the command line (the -v flag increases verbosity). If you are lucky there will be an error message there telling you what is wrong.
$ mpv -v video.mkv - Have mpv output a log file. The log file might be difficult to sift through but if something is broken you might see it there.
$ mpv -v —log-file=./log video.mkv - Run mpv without a configuration. If this runs well then the problem is somewhere in your configuration (perhaps your hardware cannot keep up with your settings).
$ mpv —no-config video.mkv
If mpv runs but it just does not run well then a fourth thing that might be worth taking a look at is installing the mpv-stats script and using it to see exactly how it is performing.
Fix jerky playback and tearing
mpv defaults to using the OpenGL video output device setting on hardware that supports it. In cases such as trying to play video back on a 4K display using a Intel HD4XXX series card or similar, you will find video playback unreliable, jerky to the point of stopping entirely at times and with major tearing when using any OpenGL output setting. If you experience any of these issues, using the XV (Xorg only) video output device may help:
It is possible to increase playback performance even more (especially on lower hardware), but this decreases the video quality dramatically in most cases.
The following options may be considered to increase the video playback performance:
Problems with window compositors
Window compositors such as KWin or Mutter can cause trouble for playback smoothness. In such cases, it may help to set x11-bypass-compositor=yes to make mpv also disable window compositing when playing in windowed mode (if supported by the compositor).
With KWin compositing and hardware decoding, you may also want to set x11-bypass-compositor=no to keep compositing enabled in fullscreen, since reanabling compositing after leaving fullscreen may introduce stutter for a period of time.
No volume bar, cannot change volume
Spin the mouse wheel over the volume icon.
GNOME Blank screen (Wayland)
mpv may not suspend GNOME’s Power Saving Settings if using Wayland resulting in screen saver turning off the monitor during video playback. A workaround is to add gnome-session-inhibit to the beginning of the Exec= line in mpv.desktop .
Use mpv with a compositor
If you are using a compositor (e.g. in KDE Plasma 5) and find that composition is disabled (e.g. in Plasma this would make you unable to present windows or see window thumbnails in the default app switcher) when mpv is playing a video, try x11-bypass-compositor=no
Cursor theme not respected under GNOME Wayland
On Wayland, clients can display different cursor themes because there is not a unique configuration file for it. For the cursor theme, Qt apps usually accept the value that is set for the environment variable XCURSOR_THEME . However, in the specific case of mpv, the cursor theme that is displayed needs to be the one set in
Источник