Mac OS X下的MPV配置文件(字幕亂碼先蒋、從上次播放、Opengl)

前一段時間沒事安裝了MPV給我的新Macbook Pro 15宛渐,啟動速度很快鞭达,播放視頻解碼很不錯,就是字幕加載這費勁了點皇忿,所以簡單看了下。沒想到要配置一個配置文件坦仍,本來很容易的事情沒想到還是搞了這么麻煩鳍烁,無奈只能簡單看看了,弄了一個通用的配置文件出來繁扎,在這里記錄一下幔荒,以免以后忘記了,也希望分享給大家梳玫,如果沒有特殊需要這個文件應(yīng)該已經(jīng)能夠滿足所有需要了爹梁。

在粘貼配置之前,我先做一點簡單的說明提澎。
該配置是基于

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

該文件修改的姚垃,只是這位同學(xué)并不是為我們中國大眾設(shè)置的,所以簡單改了改盼忌,因為他確實配置的比較全面所以以這個為基礎(chǔ)积糯。

  1. 具備記錄上次播放位置功能(設(shè)置文件第一行,不想要前面加#注釋掉就行谦纱。我簡單看了下原理看成,就是會往~/.config/mpv/watch_later這個文件夾下面寫入一個文件,文件里面有3行跨嘉,一個記錄時間川慌,一個記錄當(dāng)時的播放狀態(tài),一個記錄了窗體信息。大概就這樣你看多了文件就會多梦重,不過一個文件也就40字節(jié)左右兑燥,沒什么關(guān)系)
  2. 使用的視頻解碼是opengl(之前有人說過這個在mac下面比opengl-hq省電,其實太高畫質(zhì)我也看不出來忍饰,這個就挺好)
  3. 字幕默認(rèn)會讀取和播放的文件名同名的字幕贪嫂,當(dāng)然擴(kuò)展名肯定是不一樣的(字幕的配置請各位看Subtitles那段,我把有一個自定義字幕樣式的給注釋掉了艾蓝,如果有人要用請自行設(shè)置力崇,他生效的前提是那個字幕文件沒有設(shè)定樣式,不過一般的字幕都不設(shè)定樣式赢织。這個配置里面還會根據(jù)情況將utf8和gb18030編碼的字幕正確解碼亮靴,對于需要中文的一般情況肯定是夠了)
  4. 打開視頻后自動播放(?于置?茧吊?是的就是這個設(shè)置,本來默認(rèn)就是有這個設(shè)置的八毯,但是這個配置文件默認(rèn)是關(guān)閉的搓侄,大家要想打開視頻后不默認(rèn)播放可以把pause那個注釋打開,然后就不會默認(rèn)播放了...)
    BTW:這個默認(rèn)配置文件緩存原先默認(rèn)是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
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
  • 序言:七十年代末乳讥,一起剝皮案震驚了整個濱河市,隨后出現(xiàn)的幾起案子廓俭,更是在濱河造成了極大的恐慌云石,老刑警劉巖,帶你破解...
    沈念sama閱讀 217,826評論 6 506
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件研乒,死亡現(xiàn)場離奇詭異汹忠,居然都是意外死亡,警方通過查閱死者的電腦和手機(jī)雹熬,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 92,968評論 3 395
  • 文/潘曉璐 我一進(jìn)店門错维,熙熙樓的掌柜王于貴愁眉苦臉地迎上來,“玉大人橄唬,你說我怎么就攤上這事赋焕。” “怎么了仰楚?”我有些...
    開封第一講書人閱讀 164,234評論 0 354
  • 文/不壞的土叔 我叫張陵隆判,是天一觀的道長犬庇。 經(jīng)常有香客問我,道長侨嘀,這世上最難降的妖魔是什么臭挽? 我笑而不...
    開封第一講書人閱讀 58,562評論 1 293
  • 正文 為了忘掉前任,我火速辦了婚禮咬腕,結(jié)果婚禮上欢峰,老公的妹妹穿的比我還像新娘。我一直安慰自己涨共,他們只是感情好纽帖,可當(dāng)我...
    茶點故事閱讀 67,611評論 6 392
  • 文/花漫 我一把揭開白布。 她就那樣靜靜地躺著举反,像睡著了一般懊直。 火紅的嫁衣襯著肌膚如雪。 梳的紋絲不亂的頭發(fā)上火鼻,一...
    開封第一講書人閱讀 51,482評論 1 302
  • 那天室囊,我揣著相機(jī)與錄音,去河邊找鬼魁索。 笑死融撞,一個胖子當(dāng)著我的面吹牛,可吹牛的內(nèi)容都是我干的粗蔚。 我是一名探鬼主播尝偎,決...
    沈念sama閱讀 40,271評論 3 418
  • 文/蒼蘭香墨 我猛地睜開眼,長吁一口氣:“原來是場噩夢啊……” “哼支鸡!你這毒婦竟也來了?” 一聲冷哼從身側(cè)響起趁窃,我...
    開封第一講書人閱讀 39,166評論 0 276
  • 序言:老撾萬榮一對情侶失蹤牧挣,失蹤者是張志新(化名)和其女友劉穎,沒想到半個月后醒陆,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體瀑构,經(jīng)...
    沈念sama閱讀 45,608評論 1 314
  • 正文 獨居荒郊野嶺守林人離奇死亡,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點故事閱讀 37,814評論 3 336
  • 正文 我和宋清朗相戀三年刨摩,在試婚紗的時候發(fā)現(xiàn)自己被綠了寺晌。 大學(xué)時的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片。...
    茶點故事閱讀 39,926評論 1 348
  • 序言:一個原本活蹦亂跳的男人離奇死亡澡刹,死狀恐怖呻征,靈堂內(nèi)的尸體忽然破棺而出,到底是詐尸還是另有隱情罢浇,我是刑警寧澤陆赋,帶...
    沈念sama閱讀 35,644評論 5 346
  • 正文 年R本政府宣布沐祷,位于F島的核電站,受9級特大地震影響攒岛,放射性物質(zhì)發(fā)生泄漏赖临。R本人自食惡果不足惜,卻給世界環(huán)境...
    茶點故事閱讀 41,249評論 3 329
  • 文/蒙蒙 一灾锯、第九天 我趴在偏房一處隱蔽的房頂上張望兢榨。 院中可真熱鬧,春花似錦顺饮、人聲如沸吵聪。這莊子的主人今日做“春日...
    開封第一講書人閱讀 31,866評論 0 22
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽暖璧。三九已至,卻和暖如春君旦,著一層夾襖步出監(jiān)牢的瞬間澎办,已是汗流浹背。 一陣腳步聲響...
    開封第一講書人閱讀 32,991評論 1 269
  • 我被黑心中介騙來泰國打工金砍, 沒想到剛下飛機(jī)就差點兒被人妖公主榨干…… 1. 我叫王不留局蚀,地道東北人。 一個月前我還...
    沈念sama閱讀 48,063評論 3 370
  • 正文 我出身青樓恕稠,卻偏偏與公主長得像琅绅,于是被迫代替她去往敵國和親。 傳聞我的和親對象是個殘疾皇子鹅巍,可洞房花燭夜當(dāng)晚...
    茶點故事閱讀 44,871評論 2 354

推薦閱讀更多精彩內(nèi)容