Difference between revisions of "Template:RK3399 Linux mpv"

From FriendlyELEC WiKi
Jump to: navigation, search
(updated by API)
(updated by API)
 
Line 1: Line 1:
===mpv硬解播放器===
+
===Mpv hardware decoding video player===
FriendlyCore预装了基于 ffmpeg 实现的命令行视频播放器,除了 mpv 播放器本身,也包含了 libmpv 库文件,方便在程序里调用。<br />
+
FriendlyCore comes pre-installed with the ffmpeg-based command line video player mpv, which also includes libmpv.<br />
mpv播放器支持 Rockchip MPP,所以支持4K硬解播放,mpv的参数较多,为了简化使用,我们提供了一个脚本 '''start-mpv''',简化后,只要传文件名给它,就可以播放视频了:
+
The mpv player supports Rockchip MPP video decoder, so it supports 4K hardware decoding. There are many parameters of mpv. In order to simplify the use, we provide a script '''start-mpv'''. After simplification, there is only one parameter: video file name, as follows:
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
 
start-mpv /home/pi/demo.mp4
 
start-mpv /home/pi/demo.mp4
 
</syntaxhighlight>
 
</syntaxhighlight>
需要注意的是,播放时需要使用pi用户登录,因为其它用户的目录里没有mpv相关的设置,当然你可以从pi用户目录复制一份过来也是可以的,mpv的设置文件存放在以下路径:
+
It should be noted that the pi user needs to log in during playback, because there are no mpv related settings in other users' directories. Of course, you can copy one from the pi user directory. The mpv settings file is stored in the following path:
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
 
/home/pi/.config/mpv/mpv.conf
 
/home/pi/.config/mpv/mpv.conf
 
</syntaxhighlight>
 
</syntaxhighlight>
mpv.conf的文件内容如下所示:
+
The contents of the mpv.conf file are as follows:
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
 
vo=gpu
 
vo=gpu
Line 20: Line 20:
 
audio-device=alsa/default:CARD=rockchiphdmi
 
audio-device=alsa/default:CARD=rockchiphdmi
 
</syntaxhighlight>
 
</syntaxhighlight>
这些都是比较重要的,会传递给 mpv 的参数,其中hwdec需要指定为rkmpp才能开启硬件解码,audio-device用于指定音频输出设备,默认输出到HDMI,你可以用以下命令来查询系统中有哪些音频设备:
+
These will be passed as parameters to mpv. When the value of hwdec is rkmpp, it means using hardware decoding, audio-device is used to specify the audio output device, and the default output is to HDMI. You can use the following command to query which audio devices are in the system:
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
 
mpv --audio-device=help
 
mpv --audio-device=help
 
</syntaxhighlight>
 
</syntaxhighlight>
另一个比较重要的参数是 drm-osd-size,当全屏播放视频时,drm-osd-size指定为屏幕的分辨率即可,这个参数由start-mpv自动获取屏幕参数并传给mpv,start-mpv脚本除此之外,还会做一件更重要的事情,它需要保证系统中的 libmali 库用了正确的版本,因为 mpv 是通过 gbm 来渲染画面的,所以 libmali.so 需要使用这个版本: libmali-midgard-t86x-r14p0-gbm.so,这也意味着,这个版本的mpv只能在FriendlyCore下使用,不能在X11 Desktop下使用,具体细节可以自已查看 start-mpv 的脚本内容。<br />
+
Another important parameter is drm-osd-size. When playing video in full screen, drm-osd-size is specified as the resolution of the screen. This parameter is automatically obtained by start-mpv and passed to mpv, start-mpv script will do one more important thing. It needs to ensure that the libmali library in the system uses the correct version, because mpv renders the image through gbm, so libmali.so needs to use this version: libmali-midgard-t86x -r14p0-gbm.so, which means that this version of mpv can only be used under FriendlyCore, can not be used under X11 Desktop.<br />
mpv官方使用指南:https://github.com/mpv-player/mpv/wiki <br />
+
Mpv official use guide:https://github.com/mpv-player/mpv/wiki <br />

Latest revision as of 02:34, 21 December 2018

Mpv hardware decoding video player

FriendlyCore comes pre-installed with the ffmpeg-based command line video player mpv, which also includes libmpv.
The mpv player supports Rockchip MPP video decoder, so it supports 4K hardware decoding. There are many parameters of mpv. In order to simplify the use, we provide a script start-mpv. After simplification, there is only one parameter: video file name, as follows:

start-mpv /home/pi/demo.mp4

It should be noted that the pi user needs to log in during playback, because there are no mpv related settings in other users' directories. Of course, you can copy one from the pi user directory. The mpv settings file is stored in the following path:

/home/pi/.config/mpv/mpv.conf

The contents of the mpv.conf file are as follows:

vo=gpu
gpu-context=drm
hwdec=rkmpp
demuxer-max-bytes=41943040
demuxer-max-back-bytes=41943040
drm-osd-plane-id=1
drm-video-plane-id=0
audio-device=alsa/default:CARD=rockchiphdmi

These will be passed as parameters to mpv. When the value of hwdec is rkmpp, it means using hardware decoding, audio-device is used to specify the audio output device, and the default output is to HDMI. You can use the following command to query which audio devices are in the system:

mpv --audio-device=help

Another important parameter is drm-osd-size. When playing video in full screen, drm-osd-size is specified as the resolution of the screen. This parameter is automatically obtained by start-mpv and passed to mpv, start-mpv script will do one more important thing. It needs to ensure that the libmali library in the system uses the correct version, because mpv renders the image through gbm, so libmali.so needs to use this version: libmali-midgard-t86x -r14p0-gbm.so, which means that this version of mpv can only be used under FriendlyCore, can not be used under X11 Desktop.
Mpv official use guide:https://github.com/mpv-player/mpv/wiki