Source Code Compilation Series - MPV Player Compilation Tutorial
There are two ways to compile mpv player:
- Manually download the mpv source code and compile it, then compile and install it.
- Compile and install through
mpv-build
tools, the compilation is simple, and the library version script is automatically downloaded, but the problem with the X-related library still needs to be solved by yourself.
Prepare before compiling mpv
The dependent packages required during compilation are as follows:
sudo zypper in -y xscreensaver libXss-devel libXpresent-devel libXv-devel
If some libraries are missing, there are still some error messages when compiling, such as the following key problem:
INFO:cfg:err: Package xscrnsaver was not found in the pkg-config search path.
Perhaps you should add the directory containing `xscrnsaver.pc' to the PKG_CONFIG_PATH environment variable
No package 'xscrnsaver' found
Package xscrnsaver was not found in the pkg-config search path.
Perhaps you should add the directory containing `xscrnsaverpc' to the PKG_CONFIG_PATH environment variable
No package 'xscrnsaver' found
INFO:cfg:from /apps/code/github/mpv-0.34.1: The configuration failed
INFO:cfg:no ('x11 >= 1.0.0 xscrnsaver >= 1.0.0 xext >= 1.0.0 xinerama >= 1.0.0 xrandr >= 1.2.0' not found)
no ('x11 >= 1.0.0 xscrnsaver >= 1.0.0 xext >= 1.0.0 xinerama >= 1.0.0 xrandr >= 1.2.0' not found)
INFO:waflib:no ('x11 >= 1.0.0 xscrnsaver >= 1.0.0 xext >= 1.0.0 xinerama >= 1.0.0 xrandr >= 1.2.0' not found)
Checking for X11 : no ('x11 >= 1.0.0 xscrnsaver >= 1.0.0 xext >= 1.0.0 xinerama >= 1.0.0 xrandr >= 1.2.0' not found)
After that, it compiled very smoothly.
Method 1: Compile mpv directly
The specific operation is as follows:
git clone https://github.com/mpv-player/mpv.git
cd mpv
git checkout v0.34.1
./bootstrap.py
./waf configure --prefix=/usr
./waf build
sudo ./waf install
If the compilation goes well, you can use the mpv player.
Method 2: Use the mpv-build tool to compile mpv
If there are too many problems encountered in the compilation process of method 1, then use the mpv-build tool to compile mpv. The specific operation is as follows:
git clone https://github.com/mpv-player/mpv-build.git
cd mpv-build
# 编译
./rebuild -j$(nproc)
# 编译完毕,安装mpv 到 /usr/local/bin 目录下
sudo ./install
At this point, after compiling, you can use the mpv player.
at last
The mpv player is very powerful, the interface is simple and easy to use, and it is also very easy to use on platforms such as Raspberry Pi. If you plan to use it, then compile it yourself.