Mac OS X下的MPV配置文件(字幕乱码、从上次播放、Opengl)

前一段时间没事安装了MPV给我的新Macbook Pro 15,启动速度很快,播放视频解码很不错,就是字幕加载这费劲了点,所以简单看了下。没想到要配置一个配置文件,本来很容易的事情没想到还是搞了这么麻烦,无奈只能简单看看了,弄了一个通用的配置文件出来,在这里记录一下,以免以后忘记了,也希望分享给大家,如果没有特殊需要这个文件应该已经能够满足所有需要了。

在粘贴配置之前,我先做一点简单的说明。
该配置是基于

https://github.com/Argon-/mpv-config/blob/master/mpv.conf

该文件修改的,只是这位同学并不是为我们中国大众设置的,所以简单改了改,因为他确实配置的比较全面所以以这个为基础。

  1. 具备记录上次播放位置功能(设置文件第一行,不想要前面加#注释掉就行。我简单看了下原理,就是会往~/.config/mpv/watch_later这个文件夹下面写入一个文件,文件里面有3行,一个记录时间,一个记录当时的播放状态,一个记录了窗体信息。大概就这样你看多了文件就会多,不过一个文件也就40字节左右,没什么关系)
  2. 使用的视频解码是opengl(之前有人说过这个在mac下面比opengl-hq省电,其实太高画质我也看不出来,这个就挺好)
  3. 字幕默认会读取和播放的文件名同名的字幕,当然扩展名肯定是不一样的(字幕的配置请各位看Subtitles那段,我把有一个自定义字幕样式的给注释掉了,如果有人要用请自行设置,他生效的前提是那个字幕文件没有设定样式,不过一般的字幕都不设定样式。这个配置里面还会根据情况将utf8和gb18030编码的字幕正确解码,对于需要中文的一般情况肯定是够了)
  4. 打开视频后自动播放(???是的就是这个设置,本来默认就是有这个设置的,但是这个配置文件默认是关闭的,大家要想打开视频后不默认播放可以把pause那个注释打开,然后就不会默认播放了...)
    BTW:这个默认配置文件缓存原先默认是8G,我给改成80兆了,各位如果有需要可以自己改,但是我确实不知道有什么用。

剩下的就请拷贝下面配置到这个文件里:

vi ~/.config/mpv/mpv.conf

# vim: syntax=config

###########
# General #
###########

save-position-on-quit
no-border                               # no window title bar
msg-module                              # prepend module name to log messages
msg-color                               # color log messages on terminal
term-osd-bar                            # display a progress bar on the terminal
use-filedir-conf                        # look for additional config files in the directory of the opened file
#pause                                  # no autoplay
keep-open                               # keep the player open when a file's end is reached
autofit-larger=100%x95%                 # resize window in case it's larger than W%xH% of the screen
deinterlace=auto                        # 'auto' does not imply interlacing-detection
cursor-autohide-fs-only                 # don't autohide the cursor in window mode, only fullscreen
input-media-keys=no                     # enable/disable OSX media keys
cursor-autohide=1000                    # autohide the curser after 1s

screenshot-format=png
screenshot-png-compression=8
screenshot-template='~/Desktop/%F (%P) %n'

hls-bitrate=max                         # use max quality for HLS streams
ytdl-raw-options=format="[protocol!=http_dash_segments][protocol!=rtmp]"


#########
# Cache #
#########

cache=yes
cache-default=81960                     # size in KB  BTW: before is 8000000 it is too big
cache-backbuffer=25000                  # size in KB
cache-initial=0                         # start playback when your cache is filled up with x kB
cache-secs=10                           # how many seconds of audio/video to prefetch if the cache is active


#############
# OSD / OSC #
#############

osd-level=1                             # enable osd and display --osd-status-msg on interaction
osd-duration=2500                       # hide the osd after x ms
osd-status-msg='${time-pos} / ${duration}${?percent-pos: (${percent-pos}%)}${?vo-drop-frame-count:${!vo-drop-frame-count==0: Dropped: ${vo-drop-frame-count}}}\n${?chapter:Chapter: ${chapter}}'

osd-font='Source Sans Pro'
osd-font-size=32
osd-color='#CCFFFFFF'                   # ARGB format
osd-border-color='#DD322640'            # ARGB format
#osd-shadow-offset=1                    # pixel width for osd text and progress bar
osd-bar-align-y=0                       # progress bar y alignment (-1 top, 0 centered, 1 bottom)
osd-border-size=2                       # size for osd text and progress bar
osd-bar-h=2                             # height of osd bar as a fractional percentage of your screen height
osd-bar-w=60                            # width of " " "


#############
# Subtitles #
#############

sub-use-margins
sub-ass-force-margins

demuxer-mkv-subtitle-preroll            # try to correctly show embedded subs when seeking
sub-auto=fuzzy                          # external subs don't have to match the file name exactly to autoload
sub-paths=ass:srt:sub:subs:subtitles    # search for external subs in the listed subdirectories
embeddedfonts=yes                       # use embedded fonts for SSA/ASS subs
sub-fix-timing=no                       # do not try to fix gaps (which might make it worse in some cases)
sub-ass-force-style=Kerning=yes         # allows you to override style parameters of ASS scripts

sub-font-size=48            # Font Size UPDATE: 2017-02-20
sub-codepage=utf8:gb18030       # for support Chinese

# the following options only apply to subtitles without own styling (i.e. not ASS but e.g. SRT)
#sub-font="Source Sans Pro Semibold"
#sub-font-size=36
#sub-color="#FFFFFFFF"
#sub-border-color="#FF262626"
#sub-border-size=3.2
#sub-shadow-offset=1
#sub-shadow-color="#33000000"
#sub-spacing=0.5


#############
# Languages #
#############

#slang=enm,en,eng,de,deu,ger             # automatically select these subtitles (decreasing priority)
#alang=en,eng,de,deu,ger       # automatically select these audio tracks (decreasing priority)


#########
# Audio #
#########

audio-file-auto=fuzzy                   # external audio doesn't has to match the file name exactly to autoload
audio-pitch-correction=yes              # automatically insert scaletempo when playing with higher speed
volume-max=200                          # maximum volume in %, everything above 100 results in amplification
volume=100                              # default volume, 100 = unchanged


################
# Video Output #
################

# Active VOs (and some other options) are set conditionally
# See here for more information: https://github.com/wm4/mpv-scripts/blob/master/auto-profiles.lua
# The script was slightly modified, functions from scripts/auto-profiles-functions.lua are imported

# Defaults for all profiles
vo=opengl
tscale=linear


[high-quality]
profile-desc=cond:is_desktop() and get('width', math.huge) < 3840
scale=ewa_lanczossharp
cscale=ewa_lanczossoft
dscale=mitchell
scale-antiring=0.7
cscale-antiring=0.7
dither-depth=auto
correct-downscaling=yes
sigmoid-upscaling=yes
deband=yes

[mid-quality]
profile-desc=cond:(is_laptop() and not on_battery() and get('width', math.huge) < 1920) or (is_desktop() and get('width', math.huge) >= 3840)
scale=spline36
cscale=bilinear
dscale=mitchell
scale-antiring=1.0
cscale-antiring=1.0
dither-depth=auto
correct-downscaling=yes
sigmoid-upscaling=yes
deband=yes

[low-quality]
profile-desc=cond:is_laptop() and (on_battery() or get('width', math.huge) >= 1920)
scale=bilinear
cscale=bilinear
dscale=bilinear
scale-antiring=0.0
cscale-antiring=0.0
dither-depth=no
correct-downscaling=no
sigmoid-upscaling=no
deband=no

[60FPS]
profile-desc=cond:is_laptop() and get('container-fps', 0) >= 59
scale=bilinear
cscale=bilinear

[4K]
profile-desc=cond:get('width', -math.huge) >= 3840
vd-lavc-threads=32

[4K-inverted]
profile-desc=cond:get('width', -math.huge) < 3840
vd-lavc-threads=0


[default]


###################################
# Protocol Specific Configuration #
###################################

[protocol.https]
#cache=yes
#cache-default=500000                    # size in KB
#cache-backbuffer=250000                 # size in KB
cache-secs=100                          # how many seconds of audio/video to prefetch
user-agent='Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:47.0) Gecko/20100101 Firefox/47.0'

[protocol.http]
#cache=yes
#cache-default=500000                    # size in KB
#cache-backbuffer=250000                 # size in KB
cache-secs=100                          # how many seconds of audio/video to prefetch
user-agent='Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:47.0) Gecko/20100101 Firefox/47.0'

[extension.gif]
cache=no
no-pause
loop-file=yes

[extension.webm]
#cache=no
#no-pause
#loop-file=yes
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 194,242评论 5 459
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 81,769评论 2 371
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 141,484评论 0 319
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 52,133评论 1 263
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 61,007评论 4 355
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 46,080评论 1 272
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 36,496评论 3 381
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 35,190评论 0 253
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 39,464评论 1 290
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 34,549评论 2 309
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 36,330评论 1 326
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 32,205评论 3 312
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 37,567评论 3 298
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 28,889评论 0 17
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 30,160评论 1 250
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 41,475评论 2 341
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 40,650评论 2 335

推荐阅读更多精彩内容