[MPV Awesome] Script hay ho cho MPV
Các thành phần phụ
cURL
Windows:
- Tải
cURLở đây: https://curl.se/windows/ - Giải nén, mở thư mục
/bin/
1
2
3
4
5
6
7
.
├── BUILD-HASHES.txt
...
├── bin
│ ├── curl-ca-bundle.crt
│ ├── curl.exe
...
- Copy file
curl.exevàcurl-ca-bundle.crtvào cùng thư mục vớimpv.exe - Cấu trúc thư mục
mpv
1
2
3
4
5
6
7
.
│
├── mpv.exe
├── curl.exe
├── curl-ca-bundle.crt
|
...
MacOS
MacOS đã có sẵn cURL, nhưng nếu muốn cập nhật thì chạy lệnh
1
brew install curl
yt-dlp
yt-dlpcó 2 phiên bản làstablemột (vài?) tháng release 1 lần; vànightlyrelease liên tục tự động khi có code mớiRelease
stable: https://github.com/yt-dlp/yt-dlp/releases/latestRelease
nightly: https://github.com/yt-dlp/yt-dlp-nightly-builds/releases/latestDùng cái nào cũng được
Windows
- Vào link phiên bản muốn cài tương ứng ở trên tải file
yt-dlp.exe. yt-dlp.exe Windows (Win7 SP1+) standalone x64 binary (recommended for Windows) yt-dlp_x86.exe Windows (Vista SP2+) standalone x86 (32-bit) binary yt-dlp_min.exe Windows (Win7 SP1+) standalone x64 binary built with py2exe (NOT recommended) - Copy file
yt-dlp.exevào cùng thư mục vớimpv.exe - Cấu trúc thư mục
mpv
1
2
3
4
5
6
.
│
├── mpv.exe
├── yt-dlp.exe
|
...
MacOS
Để cài
brew.sh, chạy lệnh/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
- Cài đặt
brew install yt-dlp
1
brew install yt-dlp
- Cập nhật
brew upgrade yt-dlp
1
brew upgrade yt-dlp
PhantomJS 1
Hiện tại phía yt-dlp họ có cách dùng PhantomJS để phá nsig của Youtube, khiến Youtube nó nghĩ rằng người dùng xem từ trình duyệt web, tác dụng thì không rõ cơ mà cứ nên thử:
- Windows
- Vào: https://phantomjs.org/download.html
- Tải file
phantomjs-x.x.x-windows.ziprồi giải nén filephantomjs.exevào folder chứampv.exevàyt-dlp.exe - Tải file
1
2
3
4
5
6
.
│
├── mpv.exe
├── yt-dlp.exe
|
...
- MacOS
- Chạy lệnh Terminal
brew install phantomjs
ffmpeg
Link:
- Mở link https://github.com/yt-dlp/FFmpeg-Builds/releases/latest/
- Tải file
ffmpeg-master-latest-win64-gpl.zip, giải nén
1
2
3
4
5
6
7
8
.
├── LICENSE.txt
├── bin
│ ├── ffmpeg.exe
│ ├── ffplay.exe
│ └── ffprobe.exe
└── doc
└── ...
- Tìm trong thư mục
bin2 fileffmpeg.exeandffprobe.exe - Copy vào cùng thư mục
mpv.exe
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
.
├── mpv.exe
├── yt-dlp.exe
├── yt-dlp.conf
├── ffmpeg.exe
├── ffprobe.exe
├── phantomjs.exe
└── portable_config
├── input.conf
├── mpv.conf
├── fonts
├── scripts
├── script-opts
├── script-modules
└── shaders
UOSC - Feature-rich minimalist proximity-based UI for MPV player 2
- Download các thành phần
- Tải file
uosc.zip, giải nén được 2 thư mụcfontsvàscripts- Tải file
uosc.conf - Tải file
- Copy các thành phần vào
/mpv/portable_config/ - Copy 2 thư mục
fontsvàscriptsvào/mpv/portable_config/- Copy
uosc.confvào/mpv/portable_config/scrips-opts - Copy
1
2
3
4
5
6
7
8
9
10
11
12
.
├── fonts
│ ├── uosc_icons.otf
│ └── uosc_textures.ttf
├── script-opts
│ └── uosc.conf
└── scripts
├── uosc.lua
└── uosc_shared
├── elements
├── lib
└── main.lua
- Mở file
/mpv/portable_config/mpv.conf(tạo mới nếu chưa có) - Copy toàn bộ đoạn dưới này vào rồi Save:
1
2
3
4
5
6
7
#uosc
## required so that the 2 UIs don't fight each other
osc=no
## uosc provides its own seeking/volume indicators, so you also don't need this
osd-bar=no
## uosc will draw its own window controls if you disable window border
border=no
thumbfast - High-performance on-the-fly thumbnailer for mpv 34
- Vào https://github.com/po5/thumbfast
- Download
thumbfast.luavào/mpv/portable_config/scripts- Download
thumbfast.conf/mpv/portable_config/scrips-opts/ - Download
1
2
3
4
5
.
├── script-opts
│ └── thumbfast.conf
└── scripts
└── thumbfast.lua
- Nếu dùng giao diện gốc
mpv(hoặcmpv.net): Downloadosc.luavà copy vào thư mụcportable_config/scripts- Link: https://raw.githubusercontent.com/po5/thumbfast/vanilla-osc/player/lua/osc.lua
- Sau đó thêm
osc=novàompv.conf
quality-menu - Change the streamed video and audio quality (ytdl-format) on the fly 5
Link: https://github.com/christoph-heinrich/mpv-quality-menu
- Vào https://github.com/christoph-heinrich/mpv-quality-menu
- Download
quality-menu.luavào/mpv/portable_config/scripts- Download
quality-menu.confvào/mpv/portable_config/scrips-opts/ - Download
1
2
3
4
5
.
├── script-opts
│ └── quality-menu.conf
└── scripts
└── quality-menu.lua
- Nếu dùng giao diện gốc
mpv(hoặcmpv.net): Download thêm filequality-menu-osc.luavà copy vào thư mụcportable_config/scripts- Sau đó thêm
osc=novàompv.conf
youtube-search - Tìm kiếm video trên Youtube
Cần
API keycủa Youtube, có thể tạo miễn phí ở https://console.developers.google.com/apis/api/youtube.googleapis.com/
Cài đặt
- Vào https://github.com/CogentRedTester/mpv-scripts/
- Download
youtube-search.luavào./portable_config/scripts- Download
script-opts/youtube-search.luavào./portable_config/script-opts - Download
- Vào https://github.com/CogentRedTester/mpv-user-input
- Download
user-input.luavào./portable_config/scripts- Download
user-input-module.luavào./portable_config/script-modules - Download
- Vào https://github.com/CogentRedTester/mpv-scroll-list
- Download
scroll-list.luavào./portable_config/scripts
Sử dụng
Y: Kết quả tìm kiếm,ấn lần nữamở Thanh tìm kiếm.Ctrl+y: Mở Thanh tìm kiếm.Esc: Tắt giao diện.Up/Down: Chọn kết quảEnter: Mở lựa chọnShift+Enter: Thêm vào playlist.
Tích hợp vào uosc
Thêm vào ./portable_config/input.conf
1
2
## script-binding yt #! Open > Youtube > Search
## script-binding youtube-search #! Open > Youtube > Result
youtube-upnext - Tự động chuyển tiếp video theo Youtube Recommendation
Cần
API keycủa Youtube, có thể tạo miễn phí ở https://console.developers.google.com/apis/api/youtube.googleapis.com/
Cài đặt
- Vào https://github.com/cvzi/mpv-youtube-upnext
- Download
youtube-upnext.luavào./portable_config/scripts- Download
youtube-upnext.confvào./portable_config/script-opts - Download
Sử dụng
Ctrl+u: Mở danh sách.Up/Down: Chọn kết quảEnter: Mở lựa chọnSpace: Thêm vào playlist.EschoặcCtrl+u: Tắt giao diện (hoặc sẽ tự động tắt sau 10s).
Tích hợp vào uosc
Thêm vào ./portable_config/input.conf
1
# script-message-to youtube_upnext menu #! Open > Youtube > Next
SponsorBlock - Bỏ qua quảng cáo tài trợ trong video 6
Cài đặt
- Vào https://codeberg.org/jouni/mpv_sponsorblock_minimal/
- Download
sponsorblock_minimal.luavào./portable_config/scripts
1
2
3
4
5
6
7
.
│
...
└── scripts
| ├── sponsorblock_minimal.lua
| ...
...
Sử dụng
b: Bật / Tắt
Tự động kích hoạt: Mở file
sponsorblock_minimal.luachỉnhlocal ON = falsethànhlocal ON = true
zones.lua - Điều khiển dựa trên thao tác và vị trí chuột
Cài đặt
- Vào https://github.com/wiiaboo/mpv-scripts/
- Download
zones.luavào./portable_config/scripts
Sử dụng
Y: Kết quả tìm kiếm,ấn lần nữamở Thanh tìm kiếm.Ctrl+y: Mở Thanh tìm kiếm.Esc: Tắt giao diện.Up/Down: Chọn kết quảEnter: Mở lựa chọnShift+Enter: Thêm vào playlist.
Tùy chỉnh
Ví dụ đối với thao tác lăn chuột, sửa file ./portable_config/input.conf
1
2
WHEEL_UP script_message_to zones commands "top-*: playlist-prev" "*-left: add brightness 1" "*-right: add volume 5" "bottom-*: seek 10"
WHEEL_DOWN script_message_to zones commands "top-*: playlist-next" "*-left: add brightness -1" "*-right: add volume -5" "bottom-*: seek -10"
Xem thêm
1
2
3
4
5
6
7
8
9
10
11
-- Vertical positions can be top, middle, bottom or "*" to represent the whole column.
-- Horizontal positions can be left, middle, bottom or "*" to represent the whole row.
-- If you only use one position, it'll only represent the middle slot of that position.
-- ex: "top" == "top-middle", "right" == "middle-right", "middle" == "middle-middle"
-- "default" will be the fallback command to be used if no command is assigned to that area.
-- "" (empty), "*-*" and "*" are synonyms for "default"
--
-- ## input.conf example of use:
-- ## wheel up/down with mouse
-- MOUSE_BTN3 script_message_to zones commands "top-right: add brightness 1" "top: add contrast 1" "*-left: add volume 5" "default: seek 10"
-- MOUSE_BTN4 script_message_to zones commands "top-right: add brightness -1" "top: add contrast -1" "*-left: add volume -5" "default: seek -10"
Dynamic crop - Tự động crop các dải đen xung quanh video
Cài đặt
- Vào https://github.com/Ashyni/mpv-scripts/
- Tải
dynamic-crop.luavào./portable_config/scripts
Sử dụng
Y: Kết quả tìm kiếm,ấn lần nữamở Thanh tìm kiếm.Ctrl+y: Mở Thanh tìm kiếm.Esc: Tắt giao diện.Up/Down: Chọn kết quảEnter: Mở lựa chọnShift+Enter: Thêm vào playlist.
Tùy chỉnh (chỉnh sửa dynamic-crop.lua)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
local options = {
-- behavior
mode = 4, -- [0-4] more details above
start_delay = 0, -- delay in seconds used to skip intro (usefull with mode 2)
prevent_change_timer = 0, -- seconds
prevent_change_mode = 2, -- [0-2], disable with 'prevent_change_timer = 0'
resize_windowed = true,
fast_change_timer = 0.1, -- seconds, minimum 0 = 1 frame
new_known_ratio_timer = 5, -- seconds
new_fallback_timer = 30, -- seconds, >= 'new_known_ratio_timer', disable with 0
ratios = "2.4 2.39 2.35 2.2 2 1.85 16/9 5/3 1.5 4/3 1.25 9/16", -- list separated by space
segmentation = 0.5, -- %, 0 will approved only a continuous metadata (strict)
-- filter, see https://ffmpeg.org/ffmpeg-filters.html#cropdetect for details
detect_limit = 26, -- is the maximum use, increase it slowly if lighter black are present
detect_round = 2, -- even number
detect_reset = 1, -- minimum 1
detect_skip = 2, -- mininum 1 (ffmpeg build since 12/2020), more details above
-- verbose
debug = false
}
- Trong đó
mode = 4 - có 04 chế độ, trong đó:
0- Tắt, còn lại:Một lần Liên tục Thủ công 1 3 Tự động 2 4
Đối với các chế độ Thủ công
1và3cần kích hoạt bằng phím tắt mặc địnhShift + c. Sau khi kích hoạt, script sẽ ở trạng thái sẵn sàng, chờ đến khung hình thích hợp để tự động crop
start_delay = 0- Delay từ thời điển bắt đầu video đến khi bắt đầu tính toán crop Thường kết hợp với
mode = 2để bỏ qua không crop quảng cáo
Cần đảm bảo tham số
hwdec=làno(mặc định) hoặc một trong các giá trị*-copy, nẾu không, script sẽ không thể hoạt động. Xem thêm về tham sốhwdectại đây
Chạy lệnh
mpv --hwdec=helpđể xem danh sách hardware decoding api của máy
Ví dụ:
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
$ mpv --hwdec=help
Valid values (with alternative full names):
videotoolbox (h263-videotoolbox)
videotoolbox (h263p-videotoolbox)
videotoolbox (h264-videotoolbox)
videotoolbox (hevc-videotoolbox)
videotoolbox (mpeg1video-videotoolbox)
videotoolbox (mpeg2video-videotoolbox)
videotoolbox (mpeg4-videotoolbox)
videotoolbox (prores-videotoolbox)
videotoolbox (vp9-videotoolbox)
videotoolbox-copy (h263-videotoolbox-copy)
videotoolbox-copy (h263p-videotoolbox-copy)
videotoolbox-copy (h264-videotoolbox-copy)
videotoolbox-copy (hevc-videotoolbox-copy)
videotoolbox-copy (mpeg1video-videotoolbox-copy)
videotoolbox-copy (mpeg2video-videotoolbox-copy)
videotoolbox-copy (mpeg4-videotoolbox-copy)
videotoolbox-copy (prores-videotoolbox-copy)
videotoolbox-copy (vp9-videotoolbox-copy)
auto (yes '')
no
auto-safe
auto-copy
auto-copy-safe
Nếu script không hoạt động, kiểm tra lại phiêm bản
mpvcó build cùng libavfiltercropvàcropdetect. Chạy lệnhmpv --vf=help | grep crop
Ví dụ:
1
2
3
$ mpv --vf=help | grep crop
crop Crop the input video.
cropdetect Auto-detect crop size.
SmartCopyPaste - SmartCopyPaste_II - Paste mọi thứ trực tiếp vào mpv
Link: https://github.com/Eisa01/mpv-scripts
SmartCopyPaste- Copy mọi thứ (file ảnh, file phim, link youtube, link magnet, phụ đề…) và paste trực tiếp vào mpv, cũng như là copy từ cửa sổmpvnày sang cửa sổmpvkhác
SmartCopyPaste_II- Y hệt SmartCopyPaste nhưng có thêm clipboard log
Cài đặt
- Vào https://github.com/Eisa01/mpv-scripts
- Tải
scripts/SmartCopyPaste.lua(hoặcscripts/SmartCopyPaste_II.lua) vào./portable_config/scripts- Tải
script-opts/SmartCopyPaste.conf(hoặcscript-opts/SmartCopyPaste_II.conf) vào./portable_config/script-opts - Tải
Sử dụng
| Keybind | Name | Description |
|---|---|---|
ctrl+c / ctrl+C /meta+c / meta+C | copy | Copy đường dẫn/link có mốc thời gian |
ctrl+v / ctrl+V /meta+v / meta+V | paste | Paste vào mpv và chạy |
ctrl+alt+c / ctrl+alt+C /meta+alt+c / meta+alt+C | copy-specific | Copy đường dẫn/link không có mốc thời gian |
ctrl+alt+v / ctrl+alt+V /meta+alt+v / meta+alt+V | paste-specific | Thêm vào playlist |
c / C(đối với SmartCopyPaste-II) | open-list | Mở Clipboard list (LogManager) |
Nguồn:
https://voz.vn/t/tong-hop-nhung-addon-chat-cho-firefox-pc-mobile.682181/page-156#post-25522101 ↩︎
https://voz.vn/t/tong-hop-nhung-addon-chat-cho-firefox-pc-mobile.682181/page-31#post-23246313 ↩︎
https://voz.vn/t/tong-hop-nhung-addon-chat-cho-firefox-pc-mobile.682181/page-51#post-23869287 ↩︎
https://voz.vn/t/tong-hop-nhung-addon-chat-cho-firefox-pc-mobile.682181/page-162#post-25597851 ↩︎
https://voz.vn/t/tong-hop-nhung-addon-chat-cho-firefox-pc-mobile.682181/page-112#post-25012334 ↩︎

