forked from ainopara/ainopara.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathterminal-mpv.html
255 lines (238 loc) · 9.13 KB
/
terminal-mpv.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<link rel="stylesheet" type="text/css" href="css/style.css" />
<title>Terminal启动sublime及mpv改键</title>
</head>
<body>
<h1>Terminal启动sublime及mpv改键</h1>
<p>这几天主要做的有两件事。第一件事是为terminal增加了启动subl编辑文本的能力,第二件事是修改了几个mpv的快捷键。</p>
<h2>Terminal启动Sublime Text 3编辑文本</h2>
<p>将sublime text中的相应可执行程序软链接到<code>~/bin</code>中,进而以后在terminal中编辑文件就可以使用Sublime text 3打开了。</p>
<pre><code>ln -s "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" ~/bin/subl
</code></pre>
<p>同时也将mpv的执行程序软链接进去了。</p>
<pre><code>ln -s "/Applications/mpv.app/Contents/MacOS/mpv" ~/bin/mpv
</code></pre>
<h2>修改mpv的快捷键</h2>
<p>方法很简单,在<code>~/.config/mpv/input.conf</code>中粘入下面的文字(<a href="https://github.com/mpv-player/mpv/blob/master/etc/input.conf">出处</a>):</p>
<pre><code># mpv keybindings
#
# Location of user-defined bindings: ~/.config/mpv/input.conf
#
# Lines starting with # are comments. Use SHARP to assign the # key.
# Copy this file and uncomment and edit the bindings you want to change.
#
# List of commands and further details: DOCS/man/input.rst
# List of special keys: --input-keylist
# Keybindings testing mode: mpv --input-test --force-window --idle
#
# Use 'ignore' to unbind a key fully (e.g. 'ctrl+a ignore').
#
# Strings need to be quoted and escaped:
# KEY show_text "This is a single backslash: \\ and a quote: \" !"
#
# You can use modifier-key combinations like Shift+Left or Ctrl+Alt+x with
# the modifiers Shift, Ctrl, Alt and Meta (may not work on the terminal).
#
# The default keybindings are hardcoded into the mpv binary.
# You can disable them completely with: --no-input-default-bindings
# Developer note:
# On compilation, this file is baked into the mpv binary, and all lines are
# uncommented (unless '#' is followed by a space) - thus this file defines the
# default key bindings.
# If this is enabled, treat all the following bindings as default.
#default-bindings start
#MOUSE_BTN0 ignore # don't do anything
#MOUSE_BTN0_DBL cycle fullscreen # toggle fullscreen on/off
#MOUSE_BTN2 cycle pause # toggle pause on/off
#MOUSE_BTN3 seek 10
#MOUSE_BTN4 seek -10
#MOUSE_BTN5 add volume 2
#MOUSE_BTN6 add volume -2
# Mouse wheels, touchpad or other input devices that have axes
# if the input devices supports precise scrolling it will also scale the
# numeric value accordingly
#AXIS_UP seek 10
#AXIS_DOWN seek -10
#AXIS_LEFT seek 5
#AXIS_RIGHT seek -5
## Seek units are in seconds, but note that these are limited by keyframes
#RIGHT seek 5
#LEFT seek -5
#UP seek 60
#DOWN seek -60
# Do smaller, always exact (non-keyframe-limited), seeks with shift.
# Don't show them on the OSD (no-osd).
#Shift+RIGHT no-osd seek 1 - exact
#Shift+LEFT no-osd seek -1 - exact
#Shift+UP no-osd seek 5 - exact
#Shift+DOWN no-osd seek -5 - exact
# Skip to previous/next subtitle (subject to some restrictions; see manpage)
#Ctrl+LEFT no-osd sub_seek -1
#Ctrl+RIGHT no-osd sub_seek 1
#PGUP add chapter 1 # skip to next chapter
#PGDWN add chapter -1 # skip to previous chapter
#Shift+PGUP seek 600
#Shift+PGDWN seek -600
#[ multiply speed 0.9091 # scale playback speed
#] multiply speed 1.1
#{ multiply speed 0.5
#} multiply speed 2.0
#BS set speed 1.0 # reset speed to normal
#q quit
#Q quit_watch_later
#q {encode} quit
#ESC set fullscreen no
#ESC {encode} quit
#p cycle pause # toggle pause/playback mode
#. frame_step # advance one frame and pause
#, frame_back_step # go back by one frame and pause
#SPACE cycle pause
#> playlist_next # skip to next file
#ENTER playlist_next # skip to next file
#< playlist_prev # skip to previous file
#O osd # cycle through OSD mode
#o show_progress
#P show_progress
#I show_text "${filename}" # display filename in osd
#z add sub-delay -0.1 # subtract 100 ms delay from subs
#x add sub-delay +0.1 # add
#ctrl++ add audio-delay 0.100 # this changes audio/video sync
#ctrl+- add audio-delay -0.100
#9 add volume -2
#/ add volume -2
#0 add volume 2
#* add volume 2
#m cycle mute
#1 add contrast -1
#2 add contrast 1
#3 add brightness -1
#4 add brightness 1
#5 add gamma -1
#6 add gamma 1
#7 add saturation -1
#8 add saturation 1
#d cycle framedrop # cycle through framedrop modes
# toggle deinterlacer (automatically inserts or removes required filter)
#D cycle deinterlace
#r add sub-pos -1 # move subtitles up
#t add sub-pos +1 # down
#v cycle sub-visibility
# stretch SSA/ASS subtitles with anamorphic videos to match historical
#V cycle ass-vsfilter-aspect-compat
#j cycle sub # cycle through subtitles
#J cycle sub down # ...backwards
#SHARP cycle audio # switch audio streams
#_ cycle video
#T cycle ontop # toggle video window ontop of other windows
#f cycle fullscreen # toggle fullscreen
#s screenshot # take a screenshot
#S screenshot video # ...without subtitles
#Alt+s screenshot - each-frame # automatically screenshot every frame
#w add panscan -0.1 # zoom out with -panscan 0 -fs
#e add panscan +0.1 # in
# cycle video aspect ratios; "-1" is the container aspect
#A cycle_values video-aspect "16:9" "4:3" "2.35:1" "-1"
#POWER quit
#MENU cycle osd
#PLAY cycle pause
#PAUSE cycle pause
#PLAYPAUSE cycle pause
#STOP quit
#FORWARD seek 60
#REWIND seek -60
#NEXT playlist_next
#PREV playlist_prev
#VOLUME_UP add volume 2
#VOLUME_DOWN add volume -2
#MUTE cycle mute
#CLOSE_WIN quit
#CLOSE_WIN {encode} quit
#E cycle edition # next edition
#l ab_loop # Set/clear A-B loop points
#ctrl+c quit
# Apple Remote section
#AR_PLAY cycle pause
#AR_PLAY_HOLD quit
#AR_CENTER cycle pause
#AR_CENTER_HOLD quit
#AR_NEXT seek 10
#AR_NEXT_HOLD seek 120
#AR_PREV seek -10
#AR_PREV_HOLD seek -120
#AR_MENU show_progress
#AR_MENU_HOLD cycle mute
#AR_VUP add volume 2
#AR_VUP_HOLD add chapter 1
#AR_VDOWN add volume -2
#AR_VDOWN_HOLD add chapter -1
# Joystick section
# WARNING: joystick support has to be explicitly enabled at
# compiletime with --enable-joystick
#
#JOY_AXIS0_PLUS seek 10
#JOY_AXIS0_MINUS seek -10
#JOY_AXIS1_MINUS seek 60
#JOY_AXIS1_PLUS seek -60
#JOY_BTN0 cycle pause
#JOY_BTN1 cycle osd
#JOY_BTN2 add volume 2
#JOY_BTN3 add volume -2
# For dvdnav:// and bdnav://
# navigation controls during playback
#ENTER {discnav} discnav menu # DISCNAV MENU
# BS {discnav} discnav prev # DISCNAV PREVIOUS menu (in the order chapter->title->root)
# navigation controls when showing menu (additionally to the controls above)
#UP {discnav-menu} discnav up # DISCNAV UP
#DOWN {discnav-menu} discnav down # DISCNAV DOWN
#LEFT {discnav-menu} discnav left # DISCNAV LEFT
#RIGHT {discnav-menu} discnav right # DISCNAV RIGHT
#ENTER {discnav-menu} discnav select # DISCNAV SELECT (ok)
#MOUSE_BTN0 {discnav-menu} discnav mouse
#MOUSE_MOVE {discnav-menu} discnav mouse_move
# For tv://
#h cycle tv-channel -1 # previous channel
#k cycle tv-channel +1 # next channel
#
# Legacy bindings (may or may not be removed in the future)
#
#! add chapter -1 # skip to previous chapter
#@ add chapter 1 # next
#
# Not assigned by default
# (not an exhaustive list of unbound commands)
#
# ? add sub-scale +0.1 # increase subtitle font size
# ? add sub-scale -0.1 # decrease subtitle font size
# ? sub_step -1 # immediately display next subtitle
# ? sub_step +1 # previous
# ? cycle_values window-scale 0.5 2 1 # switch between 1/2, 2x, unresized window size
# ? cycle colormatrix
# ? add audio-delay 0.100 # this changes audio/video sync
# ? add audio-delay -0.100
# ? cycle angle # switch DVD/Bluray angle
# ? add balance -0.1 # adjust audio balance in favor of left
# ? add balance 0.1 # right
# ? cycle sub-forced-only # toggle DVD forced subs
# ? cycle program # cycle transport stream programs
# ? stop # stop playback (quit or enter idle mode)
</code></pre>
<p>这是一份当前默认按键绑定清单,里面所有的条目都被注释掉了,实际上这些按键绑定都是在mpv的源代码中实现的。可以在这里编辑相应的绑定代码来覆盖默认的绑定结果。</p>
<p>我这里就用将fbnp四个按键替代了方向键的功能,并设置w键用来使mpv在全屏与窗口之间切换。这样改的主要原因是在我的键盘上按方向键并不方便。</p>
<pre><code>f seek 5
b seek -5
n seek 60
p seek -60
w cycle fullscreen
</code></pre>
<p>除了这几个我修改的按键外,我能用上的也只有用来截图的s键、用来暂停的空格键和用来退出的q键。再加上这几个按键,我基本上可以实现完全不碰鼠标来操作mpv了。</p>
<p>参考资料:</p>
<ol>
<li>Sublime Text 2 <a href="https://www.sublimetext.com/docs/2/osx_command_line.html">OS X Command Line</a></li>
<li>官网有一份<a href="http://mpv.io/manual/stable/">Mpv 用户手册</a>可以方便地查找mpv的各种功能,设置上的问题也可以在这里面找到答案。 </li>
<li>Stage1st上有一个<a href="http://bbs.saraba1st.com/2b/forum.php?mod=viewthread&tid=1036499">指导贴</a>,可以从中学到如何配置mpv以获得更好的画面质量。</li>
</ol>
</body>
</html>