├── fonts
├── oscc.ttf
├── Ubuntu-B.ttf
├── Ubuntu-C.ttf
├── Ubuntu-L.ttf
├── Ubuntu-M.ttf
├── Ubuntu-R.ttf
├── Samsungsans.ttf
├── Ubuntu-BI.ttf
├── Ubuntu-LI.ttf
├── Ubuntu-MI.ttf
├── Ubuntu-RI.ttf
├── SamsungOne-400.ttf
├── SamsungOne-700.ttf
├── modernx-osc-icon.ttf
├── Product Sans Bold.ttf
├── SamsungsansMedium.ttf
├── Product Sans Italic.ttf
├── Product Sans Regular.ttf
├── SamsungSharpSans-Bold.ttf
├── Product Sans Bold Italic.ttf
└── Material-Design-Iconic-Font.ttf
├── removed_conf
├── lua-settings
│ ├── playlistmanager.conf
│ └── stats.conf
├── scripts
│ ├── equalizer.lua
│ ├── ontop-playback.lua
│ ├── pause-when-minimize.lua
│ ├── open-file-dialog.lua
│ ├── autoloop.lua
│ ├── auto-save-state.lua
│ ├── nextfile.lua
│ ├── pause-minimize.lua
│ ├── blur-edges.lua
│ ├── seek-to.lua
│ ├── autoload.lua.bac
│ ├── autoload2.lua.bac
│ ├── audio-balance.lua
│ ├── lin.autoload2.lua
│ ├── lin.autoload1.lua
│ ├── firequalizer15.lua
│ ├── encode.lua
│ └── gestures.lua
├── README.md
├── shaders
│ ├── SSimDownscaler.glsl
│ ├── SSimSuperRes.glsl
│ ├── CAS.glsl
│ ├── NVSharpen.glsl
│ └── AdaptiveSharp.glsl
└── input.options
├── scripts
├── autosave.lua
├── local-state.lua
├── clock.lua
├── easycrop.lua
├── youtube-quality.lua
├── autocrop.lua
└── visualizer.lua
├── lua-settings
└── osc.conf
├── KEY_basic.md
├── README.md
├── mpv.conf
└── KEY.md
/fonts/oscc.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/thisisshihan/mpv-player-config-snad/HEAD/fonts/oscc.ttf
--------------------------------------------------------------------------------
/fonts/Ubuntu-B.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/thisisshihan/mpv-player-config-snad/HEAD/fonts/Ubuntu-B.ttf
--------------------------------------------------------------------------------
/fonts/Ubuntu-C.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/thisisshihan/mpv-player-config-snad/HEAD/fonts/Ubuntu-C.ttf
--------------------------------------------------------------------------------
/fonts/Ubuntu-L.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/thisisshihan/mpv-player-config-snad/HEAD/fonts/Ubuntu-L.ttf
--------------------------------------------------------------------------------
/fonts/Ubuntu-M.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/thisisshihan/mpv-player-config-snad/HEAD/fonts/Ubuntu-M.ttf
--------------------------------------------------------------------------------
/fonts/Ubuntu-R.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/thisisshihan/mpv-player-config-snad/HEAD/fonts/Ubuntu-R.ttf
--------------------------------------------------------------------------------
/fonts/Samsungsans.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/thisisshihan/mpv-player-config-snad/HEAD/fonts/Samsungsans.ttf
--------------------------------------------------------------------------------
/fonts/Ubuntu-BI.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/thisisshihan/mpv-player-config-snad/HEAD/fonts/Ubuntu-BI.ttf
--------------------------------------------------------------------------------
/fonts/Ubuntu-LI.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/thisisshihan/mpv-player-config-snad/HEAD/fonts/Ubuntu-LI.ttf
--------------------------------------------------------------------------------
/fonts/Ubuntu-MI.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/thisisshihan/mpv-player-config-snad/HEAD/fonts/Ubuntu-MI.ttf
--------------------------------------------------------------------------------
/fonts/Ubuntu-RI.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/thisisshihan/mpv-player-config-snad/HEAD/fonts/Ubuntu-RI.ttf
--------------------------------------------------------------------------------
/fonts/SamsungOne-400.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/thisisshihan/mpv-player-config-snad/HEAD/fonts/SamsungOne-400.ttf
--------------------------------------------------------------------------------
/fonts/SamsungOne-700.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/thisisshihan/mpv-player-config-snad/HEAD/fonts/SamsungOne-700.ttf
--------------------------------------------------------------------------------
/fonts/modernx-osc-icon.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/thisisshihan/mpv-player-config-snad/HEAD/fonts/modernx-osc-icon.ttf
--------------------------------------------------------------------------------
/fonts/Product Sans Bold.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/thisisshihan/mpv-player-config-snad/HEAD/fonts/Product Sans Bold.ttf
--------------------------------------------------------------------------------
/fonts/SamsungsansMedium.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/thisisshihan/mpv-player-config-snad/HEAD/fonts/SamsungsansMedium.ttf
--------------------------------------------------------------------------------
/fonts/Product Sans Italic.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/thisisshihan/mpv-player-config-snad/HEAD/fonts/Product Sans Italic.ttf
--------------------------------------------------------------------------------
/fonts/Product Sans Regular.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/thisisshihan/mpv-player-config-snad/HEAD/fonts/Product Sans Regular.ttf
--------------------------------------------------------------------------------
/fonts/SamsungSharpSans-Bold.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/thisisshihan/mpv-player-config-snad/HEAD/fonts/SamsungSharpSans-Bold.ttf
--------------------------------------------------------------------------------
/fonts/Product Sans Bold Italic.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/thisisshihan/mpv-player-config-snad/HEAD/fonts/Product Sans Bold Italic.ttf
--------------------------------------------------------------------------------
/removed_conf/lua-settings/playlistmanager.conf:
--------------------------------------------------------------------------------
1 | [osc-conf]
2 | playlist_savepath=C:\\Users\\PC4466\\Desktop\\
3 | playlist_header_lang=
4 |
--------------------------------------------------------------------------------
/removed_conf/scripts/equalizer.lua:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/thisisshihan/mpv-player-config-snad/HEAD/removed_conf/scripts/equalizer.lua
--------------------------------------------------------------------------------
/fonts/Material-Design-Iconic-Font.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/thisisshihan/mpv-player-config-snad/HEAD/fonts/Material-Design-Iconic-Font.ttf
--------------------------------------------------------------------------------
/removed_conf/lua-settings/stats.conf:
--------------------------------------------------------------------------------
1 | [osc-conf]
2 | duration=4
3 | redraw_delay=1
4 | persistent_overlay=no
5 | plot_perfdata=yes
6 | plot_vsync_ratio=yes
7 | plot_vsync_jitter=yes
8 | flush_graph_data=yes
9 | font=Source Sans Pro
10 | font_mono=Source Sans Pro
11 | font_size=8
12 | font_color=FFFFFF
13 | border_size=0.4
14 | border_color=262626
15 | alpha=78
16 | plot_bg_border_color=0000FF
17 | plot_bg_color=262626
18 | plot_color=FFFFFF
--------------------------------------------------------------------------------
/removed_conf/scripts/ontop-playback.lua:
--------------------------------------------------------------------------------
1 | --makes mpv disable ontop when pausing and re-enable it again when resuming playback
2 | --please note that this won't do anything if ontop was not enabled before pausing
3 |
4 | local was_ontop = false
5 |
6 | mp.observe_property("pause", "bool", function(name, value)
7 | local ontop = mp.get_property_native("ontop")
8 | if value then
9 | if ontop then
10 | mp.set_property_native("ontop", false)
11 | was_ontop = true
12 | end
13 | else
14 | if was_ontop and not ontop then
15 | mp.set_property_native("ontop", true)
16 | end
17 | was_ontop = false
18 | end
19 | end)
20 |
--------------------------------------------------------------------------------
/removed_conf/scripts/pause-when-minimize.lua:
--------------------------------------------------------------------------------
1 | -- This script pauses playback when minimizing the window, and resumes playback
2 | -- if it's brought back again. If the player was already paused when minimizing,
3 | -- then try not to mess with the pause state.
4 |
5 | local did_minimize = false
6 |
7 | mp.observe_property("window-minimized", "bool", function(name, value)
8 | local pause = mp.get_property_native("pause")
9 | if value == true then
10 | if pause == false then
11 | mp.set_property_native("pause", true)
12 | did_minimize = true
13 | end
14 | elseif value == false then
15 | if did_minimize and (pause == true) then
16 | mp.set_property_native("pause", false)
17 | end
18 | did_minimize = false
19 | end
20 | end)
21 |
--------------------------------------------------------------------------------
/scripts/autosave.lua:
--------------------------------------------------------------------------------
1 | -- autosave.lua
2 | --
3 | -- Periodically saves "watch later" data during playback, rather than only saving on quit.
4 | -- This lets you easily recover your position in the case of an ungraceful shutdown of mpv (crash, power failure, etc.).
5 | --
6 | -- You can configure the save period by creating a "lua-settings" directory inside your mpv configuration directory.
7 | -- Inside the "lua-settings" directory, create a file named "autosave.conf".
8 | -- The save period can be set like so:
9 | --
10 | -- save_period=30
11 | --
12 | -- This will set the save period to once every 30 seconds of playback, time while paused is not counted towards the save period timer.
13 | -- The default save period is 30 seconds.
14 | local options = require 'mp.options'
15 |
16 | local o = {
17 | save_period = 30
18 | }
19 |
20 | options.read_options(o)
21 |
22 | local mp = require 'mp'
23 |
24 | local function save()
25 | mp.command("write-watch-later-config")
26 | end
27 |
28 | local save_period_timer = mp.add_periodic_timer(o.save_period, save)
29 |
30 | local function pause(name, paused)
31 | if paused then
32 | save_period_timer:stop()
33 | else
34 | save_period_timer:resume()
35 | end
36 | end
37 |
38 | mp.observe_property("pause", "bool", pause)
39 |
--------------------------------------------------------------------------------
/removed_conf/README.md:
--------------------------------------------------------------------------------
1 | repl.lua.
2 | ========
3 |
4 | Keybindings
5 | -----------
6 |
7 | | Key | Action |
8 | | ---: | :--- |
9 | | ` | Show the REPL |
10 | | Esc | Hide the REPL |
11 | | Enter | Run the typed command |
12 | | Shift + Enter | Type a literal newline character |
13 | | Ctrl + ←, Ctrl + → | Move cursor to previous/next word |
14 | | ↑, ↓ | Navigate command history |
15 | | PgUp | Go to the first command in the history |
16 | | PgDn | Stop navigating command history |
17 | | Insert | Toggle insert mode |
18 | | Shift + Insert | Paste text (uses the primary selection on X11) |
19 | | Tab | Complete the command or property name at the cursor |
20 | | Ctrl + C | Clear current line |
21 | | Ctrl + K | Delete text from the cursor to the end of the line |
22 | | Ctrl + L | Clear all log messages from the console |
23 | | Ctrl + U | Delete text from the cursor to the beginning of the line |
24 | | Ctrl + V | Paste text (uses the clipboard on X11) |
25 | | Ctrl + W | Delete text from the cursor to the beginning of the current word |
26 |
27 | Commands
28 | --------
29 |
30 | | Command | Action |
31 | | :--- | :--- |
32 | | ``script-message-to repl type ""`` | Show the REPL and pre-fill it with the provided text |
33 |
34 | Known issues
35 |
--------------------------------------------------------------------------------
/removed_conf/scripts/open-file-dialog.lua:
--------------------------------------------------------------------------------
1 | -- To the extent possible under law, the author(s) have dedicated all copyright
2 | -- and related and neighboring rights to this software to the public domain
3 | -- worldwide. This software is distributed without any warranty. See
4 | -- for a copy of the CC0
5 | -- Public Domain Dedication, which applies to this software.
6 |
7 | utils = require 'mp.utils'
8 |
9 | function open_file_dialog()
10 | local was_ontop = mp.get_property_native("ontop")
11 | if was_ontop then mp.set_property_native("ontop", false) end
12 | local res = utils.subprocess({
13 | args = {'powershell', '-NoProfile', '-Command', [[& {
14 | Trap {
15 | Write-Error -ErrorRecord $_
16 | Exit 1
17 | }
18 | Add-Type -AssemblyName PresentationFramework
19 |
20 | $u8 = [System.Text.Encoding]::UTF8
21 | $out = [Console]::OpenStandardOutput()
22 |
23 | $ofd = New-Object -TypeName Microsoft.Win32.OpenFileDialog
24 | $ofd.Multiselect = $true
25 |
26 | If ($ofd.ShowDialog() -eq $true) {
27 | ForEach ($filename in $ofd.FileNames) {
28 | $u8filename = $u8.GetBytes("$filename`n")
29 | $out.Write($u8filename, 0, $u8filename.Length)
30 | }
31 | }
32 | }]]},
33 | cancellable = false,
34 | })
35 | if was_ontop then mp.set_property_native("ontop", true) end
36 | if (res.status ~= 0) then return end
37 |
38 | local first_file = true
39 | for filename in string.gmatch(res.stdout, '[^\n]+') do
40 | mp.commandv('loadfile', filename, first_file and 'replace' or 'append')
41 | first_file = false
42 | end
43 | end
44 |
45 | mp.add_key_binding('ctrl+o', 'open-file-dialog', open_file_dialog)
46 |
--------------------------------------------------------------------------------
/lua-settings/osc.conf:
--------------------------------------------------------------------------------
1 | # mpv OSC configuration file by snad
2 | # https://github.com/thisisshihan/mpv-player-config-snad
3 |
4 | showwindowed=yes
5 | showfullscreen=yes
6 | scalewindowed=1
7 | scalefullscreen=1
8 | scaleforcedwindow=1
9 | vidscale=yes
10 | valign=0.8
11 | halign=0.0
12 | hidetimeout=500
13 | fadeduration=200
14 | minmousemove=3
15 | deadzonesize=0.9
16 | seekbarstyle=knob
17 | layout=box
18 | boxalpha=127
19 | title=mpv.snad ~ ${?filename:[${playlist-pos-1}/${playlist-count}] ${filename}}${!filename:No file.}
20 | seekbarhandlesize=1.0
21 |
22 | # Options
23 | # -------
24 | # osc=yes
25 | # layout=box # box, slimbox, bottombar and topbar (defaul: bottombar)
26 | # boxalpha=127 # 0-255 (default: 80)
27 | # deadzonesize=0.9 # mouse movable area without showing osc
28 | # timetotal=no # Show total time instead remaining time (defaul: no)
29 | # timems=no # Show time with millisecond
30 | # boxmaxchars=80 # default: 80
31 | # visibility=auto # Default: auto (auto hide/show on mouse move) Also supports never and always
32 | # seekbarstyle=slider # Sets the style of the seekbar, slider (diamond marker), knob (circle marker with guide), or bar (fill). (Default: slider)
33 | # seekbarhandlesize=0.6 # Default: 0.6, Size ratio of the seek handle if seekbarstyle is set to diamond or knob. This is relative to the full height of the seekbar.
34 | # seekbarkeyframes # Default: yes, Controls the mode used to seek when dragging the seekbar. If set to yes, default seeking mode is used (usually keyframes, but player defaults and heuristics can change it to exact). If set to no, exact seeking on mouse drags will be used instead. Keyframes are preferred, but exact seeks may be useful in cases where keyframes cannot be found. Note that using exact seeks can potentially make mouse dragging much slower.
35 |
--------------------------------------------------------------------------------
/removed_conf/scripts/autoloop.lua:
--------------------------------------------------------------------------------
1 | -- mpv issue 5222
2 | -- Automatically set loop-file=inf for duration <= given length. Default is 5s
3 | -- Use autoloop_duration=n in script-opts/autoloop.conf to set your preferred length
4 | -- Alternatively use script-opts=autoloop-autoloop_duration=n in mpv.conf (takes priority)
5 | -- Also disables the save-position-on-quit for this file, if it qualifies for looping.
6 |
7 |
8 | require 'mp.options'
9 |
10 | function getOption()
11 | -- Use recommended way to get options
12 | local options = {autoloop_duration = 5}
13 | read_options(options)
14 | autoloop_duration = options.autoloop_duration
15 |
16 |
17 | -- Keep old way just for compatibility (remove lines 15-27 soon)
18 | if autoloop_duration ~= 5 then
19 | return
20 | end
21 |
22 | local opt = tonumber(mp.get_opt("autoloop-duration"))
23 | if not opt then
24 | return
25 | end
26 | print("Depracted configuration! Please use script-opts directory to set auto_loop duration")
27 | print("Or use 'script-opts=autoloop-autoloop_duration' in mpv.conf")
28 | autoloop_duration = opt
29 | -- Remove lines 15-27 soon
30 | end
31 |
32 | function set_loop()
33 | local duration = mp.get_property_native("duration")
34 |
35 | -- Checks whether the loop status was changed for the last file
36 | was_loop = mp.get_property_native("loop-file")
37 |
38 | -- Cancel operation if there is no file duration
39 | if not duration then
40 | return
41 | end
42 |
43 | -- Loops file if was_loop is false, and file meets requirements
44 | if not was_loop and duration <= autoloop_duration then
45 | mp.set_property_native("loop-file", true)
46 | mp.set_property_bool("file-local-options/save-position-on-quit", false)
47 | -- Unloops file if was_loop is true, and file does not meet requirements
48 | elseif was_loop and duration > autoloop_duration then
49 | mp.set_property_native("loop-file", false)
50 | end
51 | end
52 |
53 |
54 | getOption()
55 | mp.register_event("file-loaded", set_loop)
56 |
--------------------------------------------------------------------------------
/KEY_basic.md:
--------------------------------------------------------------------------------
1 | -----------------------------------
2 | # Basic Keybindings of [mpv.snad](https://github.com/thisisshihan/mpv-player-config-snad/blob/mpv-config-snad-windows-ubuntu-linux-macos/README.md)
3 |
4 | ##
5 | **Touchpad Gesture** _(swipe with two finger)_
6 | 
7 |
8 | ##
9 | **Keyboard Control**
10 |
11 | | | |
12 | | ---: | --- |
13 | | ESC TAB BACKSPACE
ENTER SPACE | **Keys** |
14 | | ENTER | Exit |
15 | | ESC | Exit |
16 | | Q | Save Video Position and Quit to Watch Later |
17 | | SPACE | Pause |
18 | | F | Change Full Screen / Windowed Mode |
19 | | Mouse Button | Change Full Screen / Windowed Mode |
20 | | → | Foward 3s |
21 | | ← | Backward 3s |
22 | | ↑ | Foward 6s |
23 | | ↓ | Backward 6s |
24 | | CTRL + → | Foward 30s |
25 | | CTRL + ← | Backward 30s |
26 | | CTRL + ↑ | Foward 60s |
27 | | CTRL + ↓ | Backward 60s |
28 | | SHIFT + → | Foward 300s |
29 | | SHIFT + ← | Backward 300s |
30 | | SHIFT + ↑ | Foward 600s |
31 | | SHIFT + ↓ | Backward 600s |
32 | | * | Volume Up (Keypad) |
33 | | / | Volume Down (Keypad) |
34 | | " | Volume Up (Key) |
35 | | / | Volume Down (Key) |
36 | | Mouse Wheel | Volume Up (Key) |
37 | | Mouse Wheel | Volume Down (Key) |
38 | | P | Show Playlist |
39 | | CTRL + P | Save Playlist |
40 | | S | Save Screenshot to Desktop |
41 | | D | Enable / Disable DeInterlace |
42 | | J | Change Subtitle Track |
43 | | K | Change Audio Track |
44 | | L | Enable / Disable Repeat Playlist |
45 | | : | Enable / Disable Repeat Current File |
46 | | M | Enable / Disable Mute |
47 | | < | Jump Previous item in Playlist |
48 | | > | Jump Next item in Playlist |
49 |
50 | #
51 |
--------------------------------------------------------------------------------
/removed_conf/scripts/auto-save-state.lua:
--------------------------------------------------------------------------------
1 | -- Runs write-watch-later-config periodically
2 |
3 | local options = require 'mp.options'
4 | local o = { save_interval = 60 }
5 | options.read_options(o)
6 |
7 | local function save()
8 | if mp.get_property_bool("resume-playback") then
9 | mp.command("write-watch-later-config")
10 | end
11 | end
12 |
13 | local function save_if_pause(_, pause)
14 | if pause then save() end
15 | end
16 |
17 | local function pause_timer_while_paused(_, pause)
18 | if pause then timer:stop() else timer:resume() end
19 | end
20 |
21 | -- This function runs on file-loaded, registers two callback functions, and
22 | -- then they run delete-watch-later-config when appropriate.
23 | local function delete_watch_later(event)
24 | local path = mp.get_property("path")
25 |
26 | -- Temporarily disables save-position-on-quit while eof-reached is true, so
27 | -- state isn't saved at EOF when keep-open=yes
28 | local function eof_reached(_, eof)
29 | if not can_delete then
30 | return
31 | elseif eof then
32 | print("Deleting state (eof-reached)")
33 | mp.commandv("delete-watch-later-config", path)
34 | mp.set_property("save-position-on-quit", "no")
35 | else
36 | mp.set_property("save-position-on-quit", "yes")
37 | end
38 | end
39 |
40 | local function end_file(event)
41 | mp.unregister_event(end_file)
42 | mp.unobserve_property(eof_reached)
43 |
44 | if not can_delete then
45 | can_delete = true
46 | elseif event["reason"] == "eof" or event["reason"] == "stop" then
47 | print("Deleting state (end-file "..event["reason"]..")")
48 | mp.commandv("delete-watch-later-config", path)
49 | end
50 | end
51 |
52 | mp.observe_property("eof-reached", "bool", eof_reached)
53 | mp.register_event("end-file", end_file)
54 | end
55 |
56 | mp.set_property("save-position-on-quit", "yes")
57 |
58 | can_delete = true
59 | mp.register_script_message("skip-delete-state", function() can_delete = false end)
60 |
61 | timer = mp.add_periodic_timer(o.save_interval, save)
62 | mp.observe_property("pause", "bool", pause_timer_while_paused)
63 |
64 | mp.observe_property("pause", "bool", save_if_pause)
65 | mp.register_event("file-loaded", delete_watch_later)
66 |
67 |
--------------------------------------------------------------------------------
/scripts/local-state.lua:
--------------------------------------------------------------------------------
1 | -- this lua script written by snad
2 | -- this lua is a part of
3 | -- https://github.com/thisisshihan/mpv-player-config-snad
4 |
5 |
6 | local opts = require("mp.options")
7 | --local assdraw = require 'mp.assdraw'
8 | --local msg = require 'mp.msg'
9 | --local utils = require 'mp.utils'
10 |
11 | function round_size(num)
12 | mib = (num/(1024*1024))
13 | if mib < 1024 then
14 | rounded = math.floor(mib)
15 | dec = (mib-math.floor(mib))
16 | decpoint = math.floor(dec*1000)
17 | return rounded+decpoint/1000
18 | elseif mib > 1024 then
19 | gib = mib / 1024
20 | rounded = math.floor(gib)
21 | dec = (gib-math.floor(gib))
22 | decpoint = math.floor(dec*1000)
23 | return rounded+decpoint/1000
24 | else
25 | return mib
26 | end
27 | end
28 |
29 | function unit(sizeoffile)
30 | mib = sizeoffile/(1024*1024)
31 | if mib < 1024 then
32 | return " MiB"
33 | else
34 | return " GiB"
35 | end
36 | end
37 |
38 | local settings = {
39 | --set title of window with stripped name
40 | titleStripped = true,
41 | titlePrefix1 = "mpv",
42 | titlePrefix2 = ".sn",
43 | titlePrefix3 = "ad ~ ",
44 | titleSuffix = "",
45 | }
46 |
47 | function on_loaded()
48 | filename = mp.get_property("filename")
49 | plpos = mp.get_property("playlist-pos-1")
50 | plcou = mp.get_property("playlist-count")
51 | --timepos = mp.get_property("time-pos")
52 | --dura = mp.get_property("duration")
53 | filewid = mp.get_property("width")
54 | filehig = mp.get_property("height")
55 | filesize = round_size(mp.get_property("file-size"))
56 | osdStatus = mp.get_property("osd-status-msg")
57 | --filesizeunit = unit(mp.get_property("file-size"))
58 | if settings.titleStripped then
59 | mp.set_property("title", settings.titlePrefix1..settings.titlePrefix2..settings.titlePrefix3.."["..plpos.."/"..plcou.."] "..osdStatus.." ~ "..filename.." ~ ".."["..filewid.."x"..filehig.."] ~ "..filesize..filesizeunit..settings.titleSuffix)
60 | else
61 | mp.set_property("title", settings.titlePrefix1..settings.titlePrefix2..settings.titlePrefix3..filename)
62 | end
63 | end
64 |
65 | mp.register_event("file-loaded", on_loaded)
66 |
--------------------------------------------------------------------------------
/scripts/clock.lua:
--------------------------------------------------------------------------------
1 | -- Mozbugbox's lua utilities for mpv
2 | -- Copyright (c) 2015-2018 mozbugbox@yahoo.com.au
3 | -- Licensed under GPL version 3 or later
4 |
5 | --[[
6 | Show current time on video
7 | Usage: c script_message show-clock [true|yes]
8 | --]]
9 |
10 | local msg = require("mp.msg")
11 | local utils = require("mp.utils") -- utils.to_string()
12 | local assdraw = require('mp.assdraw')
13 |
14 | local update_timeout = 10 -- in seconds
15 |
16 | -- Class creation function
17 | function class_new(klass)
18 | -- Simple Object Oriented Class constructor
19 | local klass = klass or {}
20 | function klass:new(o)
21 | local o = o or {}
22 | setmetatable(o, self)
23 | self.__index = self
24 | return o
25 | end
26 | return klass
27 | end
28 |
29 | -- print content of a lua table
30 | function print_table(tbl)
31 | msg.info(utils.to_string(tbl))
32 | end
33 |
34 | -- Show OSD Clock
35 | local OSDClock = class_new()
36 | function OSDClock:_show_clock()
37 | -- Show wall clock on bottom left corner
38 | local osd_w, osd_h, aspect = mp.get_osd_size()
39 |
40 | local scale = 1
41 | local fontsize = tonumber(mp.get_property("options/osd-font-size")) / scale
42 | fontsize = math.floor(fontsize)
43 | -- msg.info(fontsize)
44 | --
45 | local now = os.date("%H:%M")
46 | local ass = assdraw:ass_new()
47 | ass:new_event()
48 | ass:an(1)
49 | ass:append(string.format("{\\fs%d}", fontsize))
50 | ass:append(now)
51 | ass:an(0)
52 | mp.set_osd_ass(osd_w, osd_h, ass.text)
53 | -- msg.info(ass.text, osd_w, osd_h)
54 | end
55 |
56 | function clear_osd()
57 | local osd_w, osd_h, aspect = mp.get_osd_size()
58 | mp.set_osd_ass(osd_w, osd_h, "")
59 | end
60 |
61 | function OSDClock:toggle_show_clock(val)
62 | local trues = {["true"]=true, ["yes"] = true}
63 | if self.tobj then
64 | if trues[val] ~= true then
65 | self.tobj:kill()
66 | self.tobj = nil
67 | clear_osd()
68 | end
69 | elseif val == nil or trues[val] == true then
70 | self:_show_clock()
71 | local tobj = mp.add_periodic_timer(update_timeout,
72 | function() self:_show_clock() end)
73 | self.tobj = tobj
74 | end
75 | end
76 |
77 | local osd_clock = OSDClock:new()
78 | function toggle_show_clock(v)
79 | osd_clock:toggle_show_clock(v)
80 | end
81 |
82 | mp.add_key_binding("", "show-clock", toggle_show_clock)
83 |
84 |
--------------------------------------------------------------------------------
/removed_conf/scripts/nextfile.lua:
--------------------------------------------------------------------------------
1 | local msg = require('mp.msg')
2 | local assdraw = require('mp.assdraw')
3 |
4 | local script_name = "nextfile"
5 |
6 | local settings = {
7 |
8 | --filetypes,{'mp4','mkv'} for specific or {''} for all filetypes
9 | filetypes = {'mkv', 'avi', 'mp4', 'ogv', 'webm', 'rmvb', 'flv', 'wmv', 'mpeg', 'mpg', 'm4v', '3gp',
10 | 'mp3', 'wav', 'ogv', 'flac', 'm4a', 'wma', 'jpg', 'gif', 'png', 'jpeg', 'webp'},
11 |
12 | --linux(true)/windows(false)/auto(nil)
13 | linux_over_windows = nil,
14 |
15 | --at end of directory jump to start and vice versa
16 | allow_looping = true,
17 |
18 | }
19 | --check os
20 | if settings.linux_over_windows==nil then
21 | local o = {}
22 | if mp.get_property_native('options/vo-mmcss-profile', o) ~= o then
23 | settings.linux_over_windows = false
24 | else
25 | settings.linux_over_windows = true
26 | end
27 | end
28 |
29 | function nexthandler()
30 | movetofile(true)
31 | end
32 |
33 | function prevhandler()
34 | movetofile(false)
35 | end
36 |
37 | function escapepath(dir, escapechar)
38 | return string.gsub(dir, escapechar, '\\'..escapechar)
39 | end
40 |
41 | function movetofile(forward)
42 | if mp.get_property('filename'):match("^%a%a+:%/%/") then return end
43 | local pwd = mp.get_property('working-directory')
44 | local relpath = mp.get_property('path')
45 | if not pwd or not relpath then return end
46 |
47 | local path = utils.join_path(pwd, relpath)
48 | local file = mp.get_property("filename")
49 | local dir = utils.split_path(path)
50 |
51 | local search = ' '
52 | for w in pairs(settings.filetypes) do
53 | if settings.linux_over_windows then
54 | search = search.."*."..settings.filetypes[w]..' '
55 | else
56 | search = search..'"'..escapepath(dir, '"').."*."..settings.filetypes[w]..'" '
57 | end
58 | end
59 |
60 | local popen, err = nil, nil
61 | if settings.linux_over_windows then
62 | popen, err = io.popen('cd "'..escapepath(dir, '"')..'";ls -1p'..search..'2>/dev/null')
63 | else
64 | popen, err = io.popen('dir /b'..(search:gsub("/", "\\")))
65 | end
66 | if popen then
67 | local found = false
68 | local memory = nil
69 | local lastfile = true
70 | local firstfile = nil
71 | for dirx in popen:lines() do
72 | if found == true then
73 | mp.commandv("loadfile", dir..dirx, "replace")
74 | lastfile=false
75 | break
76 | end
77 | if dirx == file then
78 | found = true
79 | if not forward then
80 | lastfile=false
81 | if settings.allow_looping and firstfile==nil then
82 | found=false
83 | else
84 | if firstfile==nil then break end
85 | mp.commandv("loadfile", dir..memory, "replace")
86 | break
87 | end
88 | end
89 | end
90 | memory = dirx
91 | if firstfile==nil then firstfile=dirx end
92 | end
93 | if lastfile and firstfile and settings.allow_looping then
94 | mp.commandv("loadfile", dir..firstfile, "replace")
95 | end
96 | if not found and memory then
97 | mp.commandv("loadfile", dir..memory, "replace")
98 | end
99 | popen:close()
100 | else
101 | mp.msg.error("could not scan for files: "..(err or ""))
102 | end
103 | end
104 |
105 | mp.add_key_binding('shift+RIGHT', 'nextfile', nexthandler)
106 | mp.add_key_binding('shift+LEFT', 'previousfile', prevhandler)
--------------------------------------------------------------------------------
/removed_conf/scripts/pause-minimize.lua:
--------------------------------------------------------------------------------
1 | -- AUTHORS: detuur, zaza42
2 | -- License: MIT
3 | -- link: https://github.com/detuur/mpv-scripts
4 |
5 | -- This script minimises and pauses the window when
6 | -- the boss key (default 'b') is pressed.
7 | -- Can be overwriten in input.conf as follows:
8 | -- KEY script-binding boss-key
9 | -- xdotool is required on Xorg(Linux)
10 |
11 | local platform = nil --set to 'linux', 'windows' or 'macos' to override automatic assign
12 | if not platform then
13 | local o = {}
14 | if mp.get_property_native('options/vo-mmcss-profile', o) ~= o then
15 | platform = 'windows'
16 | elseif mp.get_property_native('options/input-app-events', o) ~= o then
17 | platform = 'macos'
18 | else
19 | platform = 'linux'
20 | end
21 | end
22 |
23 | utils = require 'mp.utils'
24 |
25 | -- TODO: macOS implementation?
26 | function boss_key()
27 | mp.set_property_native("pause", true)
28 | if platform == 'windows' then
29 | mp.command([[run cmd /c echo m > \\.\pipe\mpv-boss-key-]]..utils.getpid())
30 | elseif platform == 'linux' then
31 | utils.subprocess({ args = {'xdotool', 'getactivewindow', 'windowminimize'} })
32 | end
33 | end
34 |
35 | -- Windows is a princess (a very ugly one at that) and needs an external process
36 | -- to minimize mpv, with which we communicate through named pipes. I spent an
37 | -- entire day shouting at my screen to arrive at the code below. This went
38 | -- through several complete rewrites as every iteration broke in subtly
39 | -- different ways. Did you know that Powershell and CMD's echo commands behave
40 | -- slightly differently, one refusing to properly write to some streams where
41 | -- the other doesn't? Did you know Powershell's Events and any kind of async
42 | -- is absolute DOG SHIT which will happily chooch in an interactive session only
43 | -- to shit in your face when put inside a script? Honestly I could write several
44 | -- kb about the bullshit I've encountered but it's past midnight and I just want
45 | -- to watch my weeb shit. Fuck you microsoft.
46 | if platform == 'windows' then
47 | utils.subprocess_detached({
48 | args = {'powershell', '-NoProfile', '-Command', [[&{
49 | $bosspid = ]]..utils.getpid()..[[
50 | # Construct the named pipe's name
51 | $pipename = -join('mpv-boss-key-',$bosspid)
52 | $fullpipename = -join("\\.\pipe\", $pipename)
53 | # This will run in a separate thread
54 | $minimizeloop = {
55 | param($pipename, $bosspid)
56 | # Create the named pipe
57 | $pipe = new-object System.IO.Pipes.NamedPipeServerStream($pipename)
58 | # Compile the Win32 API function call
59 | $signature='[DllImport("user32.dll")] public static extern bool ShowWindowAsync(IntPtr hWnd, int nCmdShow);'
60 | $showWindowAsync = Add-Type -memberDefinition $signature -name "Win32ShowWindowAsync" -namespace Win32Functions -passThru
61 | # The core loop
62 | while($true) {
63 | $pipe.WaitForConnection()
64 | if ($pipe.ReadByte() -ne 109) {
65 | break
66 | }
67 | $pipe.Disconnect()
68 | $showWindowAsync::ShowWindowAsync((Get-Process -id $bosspid).MainWindowHandle, 2)
69 | }
70 | $pipe.Dispose()
71 | }
72 | # Exiting this monstrosity (THANKS POWERSHELL FOR BROKEN ASYNC) is surprisingly
73 | # cumbersome. It took literal hours to find something that didn't spontaneously
74 | # combust. Fuck windows.
75 | $bossproc = Get-Process -pid $bosspid -ErrorAction SilentlyContinue
76 | $exitsequence = {
77 | &{echo q > $fullpipename} 2> $null
78 | [Environment]::Exit(0)
79 | }
80 | if ((-Not $bossproc) -or $bossproc.HasExited) { $exitsequence.Invoke() }
81 | # Begin watching for events until boss closes
82 | Start-Job -ScriptBlock $minimizeloop -Name "mpvminloop" -ArgumentList $pipename,$bosspid
83 | while($true) {
84 | Start-Sleep 1
85 | if ($bossproc.HasExited) { $exitsequence.Invoke() }
86 | }
87 | }]]}})
88 | end
89 |
90 | mp.add_key_binding('', 'pause-minimize', boss_key)
--------------------------------------------------------------------------------
/removed_conf/scripts/blur-edges.lua:
--------------------------------------------------------------------------------
1 | local options = require 'mp.options'
2 |
3 | local opts = {
4 | blur_radius = 10,
5 | blur_power = 10,
6 | minimum_black_bar_size = 3,
7 | mode = "all",
8 | active = true,
9 | reapply_delay = 0.5,
10 | watch_later_fix = false,
11 | }
12 | options.read_options(opts)
13 |
14 | local active = opts.active
15 | local applied = false
16 |
17 | function set_lavfi_complex(filter)
18 | if not filter and mp.get_property("lavfi-complex") == "" then return end
19 | local force_window = mp.get_property("force-window")
20 | local sub = mp.get_property("sub")
21 | mp.set_property("force-window", "yes")
22 | if not filter then
23 | mp.set_property("lavfi-complex", "")
24 | mp.set_property("vid", "1")
25 | else
26 | if not opts.watch_later_fix then
27 | mp.set_property("vid", "no")
28 | end
29 | mp.set_property("lavfi-complex", filter)
30 | end
31 | mp.set_property("sub", "no")
32 | mp.set_property("force-window", force_window)
33 | mp.set_property("sub", sub)
34 | end
35 |
36 | function set_blur()
37 | if applied then return end
38 | if not mp.get_property("video-out-params") then return end
39 | local video_aspect = mp.get_property_number("video-aspect")
40 | local ww, wh = mp.get_osd_size()
41 |
42 | if math.abs(ww/wh - video_aspect) < 0.05 then return end
43 | if opts.mode == "horizontal" and ww/wh < video_aspect then return end
44 | if opts.mode == "vertical" and ww/wh > video_aspect then return end
45 |
46 | local par = mp.get_property_number("video-params/par")
47 | local height = mp.get_property_number("video-params/h")
48 | local width = mp.get_property_number("video-params/w")
49 |
50 | local split = "[vid1] split=3 [a] [v] [b]"
51 | local crop_format = "crop=%s:%s:%s:%s"
52 |
53 | local stack_direction, crop_1, crop_2, blur_size
54 | if ww/wh > video_aspect then
55 | blur_size = math.min(math.floor(((ww/wh)*height/par-width)/2), width/2)
56 | crop_1 = string.format(crop_format, blur_size, height, "0", "0")
57 | crop_2 = string.format(crop_format, blur_size, height, width - blur_size, "0")
58 | stack_direction = "h"
59 | else
60 | blur_size = math.min(math.floor(((wh/ww)*width*par-height)/2), height/2)
61 | crop_1 = string.format(crop_format, width, blur_size, "0", "0")
62 | crop_2 = string.format(crop_format, width, blur_size, "0", height - blur_size)
63 | stack_direction = "v"
64 | end
65 | if blur_size < math.max(1, opts.minimum_black_bar_size) then return end
66 | local lr = math.min(opts.blur_radius, math.floor(blur_size/2)-1)
67 | local cr = math.min(opts.blur_radius, math.floor(blur_size/4)-1)
68 | local blur = string.format("boxblur=lr=%i:lp=%i:cr=%i:cp=%i",
69 | lr, opts.blur_power, cr, opts.blur_power)
70 |
71 | zone_1 = string.format("[a] %s,%s [a_fin]", crop_1, blur)
72 | zone_2 = string.format("[b] %s,%s [b_fin]", crop_2, blur)
73 |
74 | local par_fix = ""
75 | if par ~= 1 then
76 | par_fix = ",setsar=ratio=" .. tostring(par) .. ":max=10000"
77 | end
78 |
79 | stack = string.format("[a_fin] [v] [b_fin] %sstack=3%s [vo]", stack_direction, par_fix)
80 | filter = string.format("%s;%s;%s;%s", split, zone_1, zone_2, stack)
81 | set_lavfi_complex(filter)
82 | applied = true
83 | end
84 |
85 | function unset_blur()
86 | set_lavfi_complex()
87 | applied = false
88 | end
89 |
90 | local reapplication_timer = mp.add_timeout(opts.reapply_delay, set_blur)
91 | reapplication_timer:kill()
92 |
93 | function reset_blur(k,v)
94 | unset_blur()
95 | reapplication_timer:kill()
96 | reapplication_timer:resume()
97 | end
98 |
99 | function toggle()
100 | if active then
101 | active = false
102 | unset_blur()
103 | mp.unobserve_property(reset_blur)
104 | else
105 | active = true
106 | set_blur()
107 | local properties = { "osd-width", "osd-height", "path" }
108 | for _, p in ipairs(properties) do
109 | mp.observe_property(p, "native", reset_blur)
110 | end
111 | end
112 | end
113 |
114 | if active then
115 | active = false
116 | toggle()
117 | end
118 |
119 | mp.add_key_binding(b, "toggle-blur", toggle)
120 | mp.add_key_binding(B, "set-blur", set_blur)
121 | mp.add_key_binding(b, "unset-blur", unset_blur)
--------------------------------------------------------------------------------
/removed_conf/scripts/seek-to.lua:
--------------------------------------------------------------------------------
1 | local assdraw = require 'mp.assdraw'
2 | local active = false
3 | local cursor_position = 1
4 | local time_scale = {60*60*10, 60*60, 60*10, 60, 10, 1, 0.1, 0.01, 0.001}
5 |
6 | local ass_begin = mp.get_property("osd-ass-cc/0")
7 | local ass_end = mp.get_property("osd-ass-cc/1")
8 |
9 | local history = { {} }
10 | for i = 1, 9 do
11 | history[1][i] = 0
12 | end
13 | local history_position = 1
14 |
15 | -- timer to redraw periodically the message
16 | -- to avoid leaving bindings when the seeker disappears for whatever reason
17 | -- pretty hacky tbh
18 | local timer = nil
19 | local timer_duration = 3
20 |
21 | function show_seeker()
22 | local prepend_char = {'','',':','',':','','.','',''}
23 | local str = ''
24 | for i = 1, 9 do
25 | str = str .. prepend_char[i]
26 | if i == cursor_position then
27 | str = str .. '{\\b1}' .. history[history_position][i] .. '{\\r}'
28 | else
29 | str = str .. history[history_position][i]
30 | end
31 | end
32 | mp.osd_message("Seek to: " .. ass_begin .. str .. ass_end, timer_duration)
33 | end
34 |
35 | function copy_history_to_last()
36 | if history_position ~= #history then
37 | for i = 1, 9 do
38 | history[#history][i] = history[history_position][i]
39 | end
40 | history_position = #history
41 | end
42 | end
43 |
44 | function change_number(i)
45 | -- can't set above 60 minutes or seconds
46 | if (cursor_position == 3 or cursor_position == 5) and i >= 6 then
47 | return
48 | end
49 | if history[history_position][cursor_position] ~= i then
50 | copy_history_to_last()
51 | history[#history][cursor_position] = i
52 | end
53 | shift_cursor(false)
54 | end
55 |
56 | function shift_cursor(left)
57 | if left then
58 | cursor_position = math.max(1, cursor_position - 1)
59 | else
60 | cursor_position = math.min(cursor_position + 1, 9)
61 | end
62 | end
63 |
64 | function current_time_as_sec(time)
65 | local sec = 0
66 | for i = 1, 9 do
67 | sec = sec + time_scale[i] * time[i]
68 | end
69 | return sec
70 | end
71 |
72 | function time_equal(lhs, rhs)
73 | for i = 1, 9 do
74 | if lhs[i] ~= rhs[i] then
75 | return false
76 | end
77 | end
78 | return true
79 | end
80 |
81 | function seek_to()
82 | copy_history_to_last()
83 | mp.commandv("osd-bar", "seek", current_time_as_sec(history[history_position]), "absolute")
84 | --deduplicate consecutive timestamps
85 | if #history == 1 or not time_equal(history[history_position], history[#history - 1]) then
86 | history[#history + 1] = {}
87 | history_position = #history
88 | end
89 | for i = 1, 9 do
90 | history[#history][i] = 0
91 | end
92 | end
93 |
94 | function backspace()
95 | if cursor_position ~= 9 or current_time[9] == 0 then
96 | shift_cursor(true)
97 | end
98 | if history[history_position][cursor_position] ~= 0 then
99 | copy_history_to_last()
100 | history[#history][cursor_position] = 0
101 | end
102 | end
103 |
104 | function history_move(up)
105 | if up then
106 | history_position = math.max(1, history_position - 1)
107 | else
108 | history_position = math.min(history_position + 1, #history)
109 | end
110 | end
111 |
112 | local key_mappings = {
113 | LEFT = function() shift_cursor(true) show_seeker() end,
114 | RIGHT = function() shift_cursor(false) show_seeker() end,
115 | UP = function() history_move(true) show_seeker() end,
116 | DOWN = function() history_move(false) show_seeker() end,
117 | BS = function() backspace() show_seeker() end,
118 | ESC = function() set_inactive() end,
119 | ENTER = function() seek_to() set_inactive() end
120 | }
121 | for i = 0, 9 do
122 | local func = function() change_number(i) show_seeker() end
123 | key_mappings[string.format("KP%d", i)] = func
124 | key_mappings[string.format("%d", i)] = func
125 | end
126 |
127 | function set_active()
128 | if not mp.get_property("seekable") then return end
129 | -- find duration of the video and set cursor position accordingly
130 | local duration = mp.get_property_number("duration")
131 | if duration ~= nil then
132 | for i = 1, 9 do
133 | if duration > time_scale[i] then
134 | cursor_position = i
135 | break
136 | end
137 | end
138 | end
139 | for key, func in pairs(key_mappings) do
140 | mp.add_forced_key_binding(key, "seek-to-"..key, func)
141 | end
142 | show_seeker()
143 | timer = mp.add_periodic_timer(timer_duration, show_seeker)
144 | active = true
145 | end
146 |
147 | function set_inactive()
148 | mp.osd_message("")
149 | for key, _ in pairs(key_mappings) do
150 | mp.remove_key_binding("seek-to-"..key)
151 | end
152 | timer:kill()
153 | active = false
154 | end
155 |
156 | mp.add_key_binding(g, "toggle-seeker", function() if active then set_inactive() else set_active() end end)
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | -----------------------------------
2 | # mpv.snad for [Windows](https://github.com/thisisshihan/mpv.snad) / Linux / Mac
3 | _[mpv](https://mpv.io/) a free, open source, and cross-platform media player._
4 | _(This repository contain only stable version of windows)_
5 |
6 | 
7 |
8 | ## About mpv.snad:
9 | _[mpv.snad](https://github.com/thisisshihan/mpv.snad)_ is a player which configured _[mpv](https://mpv.io/) player_
10 | which is based on most known as _[mplayer](http://www.mplayerhq.hu)_ to optimize your video experience with most useful featuers. (see complete _[key gide](https://github.com/thisisshihan/mpv-player-config-snad/blob/mpv-config-snad-windows-ubuntu-linux-macos/KEY.md)_)
11 |
12 | #### Download Latest Windows Version:
13 | * Download the latest version from sourceforge.net [mpv.snad](https://sourceforge.net/projects/mpv-snad/files/) (this file contain all the config files)
14 | * _(AMD FSR and NVIDIA Image Scaling added (CTRL+A/N/Z) added to v35.1 +)_
15 |
16 | #### How to install:
17 | * Extract the files.
18 | * Move the folder to required destination.
19 | * Go to **_`.../installer`_** folder
20 | * Run **_`mpv-install.bat`_** as admin
21 |
22 | #### Other Downloads
23 | * Windows / ubuntu / linux / macos / Android stable cahnnel official: [mpv.io](http://mpv.io/installation)
24 | * Windows beta channel official: [sourceforge.net](https://sourceforge.net/projects/mpv-player-windows/files)
25 | * Android stable official: [play.google.com](https://play.google.com/store/apps/details?id=is.xyz.mpv&hl=en)
26 | * Android test builds official: [github.com](https://github.com/mpv-android/mpv-android/releases)
27 | * Config files by snad for Windows / ubuntu / linux / macos: [mpv.snad](https://goo.gl/7Mphpk)
28 |
29 | #### Config For Windows (not required if you download the player from this repository):
30 | * Download [_All Settings From Here_](https://goo.gl/7Mphpk) and extract them to a folder.
31 | * copy / overwrite extracted files to **_`...AppData\Roaming\mpv`_**
_or_
32 | * create a folder as **_`portable_config`_** in the folder where mpv.exe exist and,
33 | * copy extracted files to **_`...portable_config`_**
34 |
35 | #### Config For Linux:
36 | * Download [_All Settings From Here_](https://goo.gl/7Mphpk) and extract them to a folder.
37 | * copy / overwrite extracted files to **_`...etc/mpv`_** _(you need root access to this folder)_
38 |
39 | #### **Basic key guide -->** [key-guide](https://github.com/thisisshihan/mpv-player-config-snad/blob/mpv-config-snad-windows-ubuntu-linux-macos/KEY_basic.md)
40 | #### **A Complete key guide -->** [key-guide](https://github.com/thisisshihan/mpv-player-config-snad/blob/mpv-config-snad-windows-ubuntu-linux-macos/KEY.md)
41 | -------------------------------------
42 | **Simple Interface**
43 | 
44 | ##
45 | **Touchpad Gesture**
46 | 
47 | ##
48 | **Advanced Playlist Manager**
49 | _Show Playlist_ P / TAB
50 | _Navigate_ UP / DOWN / SPACE / < / >
_A Complete key guide -->_ [key-guide](https://github.com/thisisshihan/mpv-player-config-snad/blob/mpv-config-snad-windows-ubuntu-linux-macos/KEY.md)
51 | 
52 | ##
53 | **Visualizer**
54 | A perfect visualizer for audios with no album-art or for Internet Radios
55 | 
56 | ##
57 | **Improved Video Filter for Best Video Experience**
58 | _Apply Video Filter_ V , CTRL + 1 -> 9
_A Complete key guide -->_ [key-guide](https://github.com/thisisshihan/mpv-player-config-snad/blob/mpv-config-snad-windows-ubuntu-linux-macos/KEY.md)
_(Pic1-without filter, Pic2-with filter)_
59 | 
60 |
61 | -------------------------------------
62 | ## About MPV Player:
63 | **Overview:**
64 | > mpv is a fork of [mplayer2](http://www.mplayerhq.hu/design7/info.html) and [MPlayer](http://www.mplayerhq.hu/design7/info.html). It shares some features with the former projects while introducing many more.
65 |
66 | **Streamlined CLI options:**
67 | > MPlayer's options parser was improved to behave more like other CLI programs, and many option names and semantics were reworked to make them more intuitive and memorable.
68 |
69 | **On Screen Controller:**
70 | > While mpv has no official GUI, it has a small controller that is triggered by mouse movement.
71 |
72 | **High quality video output:**
73 | > mpv has an OpenGL based video output that is capable of many features loved by videophiles, such as video scaling with popular high quality algorithms, color management, frame timing, interpolation, HDR, and more.
74 |
75 | **GPU video decoding:**
76 | > mpv leverages the FFmpeg hwaccel APIs to support VDPAU, VAAPI, DXVA2, VDA and VideoToolbox video decoding acceleration.
77 |
78 | **Embeddable:**
79 | > A straightforward C API was designed from the ground up to make mpv usable as a library and facilitate easy integration into other applications.
80 |
81 | **Active development:**
82 | > mpv is under active development, focusing on code refactoring and cleanups as well as adding features. Want a feature?
83 |
84 | -------------------------------------------
85 |
--------------------------------------------------------------------------------
/removed_conf/scripts/autoload.lua.bac:
--------------------------------------------------------------------------------
1 | -- This script automatically loads playlist entries before and after the
2 | -- the currently played file. It does so by scanning the directory a file is
3 | -- located in when starting playback. It sorts the directory entries
4 | -- alphabetically, and adds entries before and after the current file to
5 | -- the internal playlist. (It stops if the it would add an already existing
6 | -- playlist entry at the same position - this makes it "stable".)
7 | -- Add at most 5000 * 2 files when starting a file (before + after).
8 | MAXENTRIES = 5000
9 |
10 | local msg = require 'mp.msg'
11 | local options = require 'mp.options'
12 | local utils = require 'mp.utils'
13 |
14 | o = {
15 | disabled = false
16 | }
17 | options.read_options(o)
18 |
19 | function Set (t)
20 | local set = {}
21 | for _, v in pairs(t) do set[v] = true end
22 | return set
23 | end
24 |
25 | EXTENSIONS = Set {
26 | 'mkv', 'avi', 'mp4', 'ogv', 'webm', 'rmvb', 'flv', 'wmv', 'mpeg', 'mpg', 'm4v', '3gp', 'mov', 'f4v',
27 | 'mp3', 'wav', 'ogm', 'flac', 'm4a', 'wma', 'ogg', 'opus',
28 | }
29 |
30 | function add_files_at(index, files)
31 | index = index - 1
32 | local oldcount = mp.get_property_number("playlist-count", 1)
33 | for i = 1, #files do
34 | mp.commandv("loadfile", files[i], "append")
35 | mp.commandv("playlist-move", oldcount + i - 1, index + i - 1)
36 | end
37 | end
38 |
39 | function get_extension(path)
40 | match = string.match(path, "%.([^%.]+)$" )
41 | if match == nil then
42 | return "nomatch"
43 | else
44 | return match
45 | end
46 | end
47 |
48 | table.filter = function(t, iter)
49 | for i = #t, 1, -1 do
50 | if not iter(t[i]) then
51 | table.remove(t, i)
52 | end
53 | end
54 | end
55 |
56 | -- splitbynum and alnumcomp from alphanum.lua (C) Andre Bogus
57 | -- Released under the MIT License
58 | -- http://www.davekoelle.com/files/alphanum.lua
59 |
60 | -- split a string into a table of number and string values
61 | function splitbynum(s)
62 | local result = {}
63 | for x, y in (s or ""):gmatch("(%d*)(%D*)") do
64 | if x ~= "" then table.insert(result, tonumber(x)) end
65 | if y ~= "" then table.insert(result, y) end
66 | end
67 | return result
68 | end
69 |
70 | function clean_key(k)
71 | k = (' '..k..' '):gsub("%s+", " "):sub(2, -2):lower()
72 | return splitbynum(k)
73 | end
74 |
75 | -- compare two strings
76 | function alnumcomp(x, y)
77 | local xt, yt = clean_key(x), clean_key(y)
78 | for i = 1, math.min(#xt, #yt) do
79 | local xe, ye = xt[i], yt[i]
80 | if type(xe) == "string" then ye = tostring(ye)
81 | elseif type(ye) == "string" then xe = tostring(xe) end
82 | if xe ~= ye then return xe < ye end
83 | end
84 | return #xt < #yt
85 | end
86 |
87 | local autoloaded = nil
88 |
89 | function find_and_add_entries()
90 | local path = mp.get_property("path", "")
91 | local dir, filename = utils.split_path(path)
92 | msg.trace(("dir: %s, filename: %s"):format(dir, filename))
93 | if o.disabled then
94 | msg.verbose("stopping: autoload disabled")
95 | elseif #dir == 0 then
96 | msg.verbose("stopping: not a local path")
97 | return
98 | end
99 |
100 | local pl_count = mp.get_property_number("playlist-count", 1)
101 | -- check if this is a manually made playlist
102 | if (pl_count > 1 and autoloaded == nil) or
103 | (pl_count == 1 and EXTENSIONS[string.lower(get_extension(filename))] == nil) then
104 | return
105 | else
106 | autoloaded = true
107 | end
108 |
109 | local pl = mp.get_property_native("playlist", {})
110 | local pl_current = mp.get_property_number("playlist-pos-1", 1)
111 | msg.trace(("playlist-pos-1: %s, playlist: %s"):format(pl_current,
112 | utils.to_string(pl)))
113 |
114 | local files = utils.readdir(dir, "files")
115 | if files == nil then
116 | return
117 | end
118 | table.filter(files, function (v, k)
119 | if string.match(v, "^%.") then
120 | return false
121 | end
122 | local ext = get_extension(v)
123 | if ext == nil then
124 | return false
125 | end
126 | return EXTENSIONS[string.lower(ext)]
127 | end)
128 | table.sort(files, alnumcomp)
129 |
130 | if dir == "." then
131 | dir = ""
132 | end
133 |
134 | -- Find the current pl entry (dir+"/"+filename) in the sorted dir list
135 | local current
136 | for i = 1, #files do
137 | if files[i] == filename then
138 | current = i
139 | break
140 | end
141 | end
142 | if current == nil then
143 | return
144 | end
145 | msg.trace("current file position in files: "..current)
146 |
147 | local append = {[-1] = {}, [1] = {}}
148 | for direction = -1, 1, 2 do -- 2 iterations, with direction = -1 and +1
149 | for i = 1, MAXENTRIES do
150 | local file = files[current + i * direction]
151 | local pl_e = pl[pl_current + i * direction]
152 | if file == nil or file[1] == "." then
153 | break
154 | end
155 |
156 | local filepath = dir .. file
157 | if pl_e then
158 | -- If there's a playlist entry, and it's the same file, stop.
159 | msg.trace(pl_e.filename.." == "..filepath.." ?")
160 | if pl_e.filename == filepath then
161 | break
162 | end
163 | end
164 |
165 | if direction == -1 then
166 | if pl_current == 1 then -- never add additional entries in the middle
167 | msg.info("Prepending " .. file)
168 | table.insert(append[-1], 1, filepath)
169 | end
170 | else
171 | msg.info("Adding " .. file)
172 | table.insert(append[1], filepath)
173 | end
174 | end
175 | end
176 |
177 | add_files_at(pl_current + 1, append[1])
178 | add_files_at(pl_current, append[-1])
179 | end
180 |
181 | mp.register_event("start-file", find_and_add_entries)
182 |
--------------------------------------------------------------------------------
/removed_conf/scripts/autoload2.lua.bac:
--------------------------------------------------------------------------------
1 | -- This script automatically loads playlist entries before and after the
2 | -- the currently played file. It does so by scanning the directory a file is
3 | -- located in when starting playback. It sorts the directory entries
4 | -- alphabetically, and adds entries before and after the current file to
5 | -- the internal playlist. (It stops if the it would add an already existing
6 | -- playlist entry at the same position - this makes it "stable".)
7 | -- Add at most 5000 * 2 files when starting a file (before + after).
8 | MAXENTRIES = 5000
9 |
10 | local msg = require 'mp.msg'
11 | local options = require 'mp.options'
12 | local utils = require 'mp.utils'
13 |
14 | o = {
15 | disabled = false
16 | }
17 | options.read_options(o)
18 |
19 | function Set (t)
20 | local set = {}
21 | for _, v in pairs(t) do set[v] = true end
22 | return set
23 | end
24 |
25 | EXTENSIONS = Set {
26 | 'mkv', 'avi', 'mp4', 'ogv', 'webm', 'rmvb', 'flv', 'wmv', 'mpeg', 'mpg', 'm4v', '3gp', 'mov', 'f4v',
27 | 'mp3', 'wav', 'ogm', 'flac', 'm4a', 'wma', 'ogg', 'opus',
28 | }
29 |
30 | function add_files_at(index, files)
31 | index = index - 1
32 | local oldcount = mp.get_property_number("playlist-count", 1)
33 | for i = 1, #files do
34 | mp.commandv("loadfile", files[i], "append")
35 | mp.commandv("playlist-move", oldcount + i - 1, index + i - 1)
36 | end
37 | end
38 |
39 | function get_extension(path)
40 | match = string.match(path, "%.([^%.]+)$" )
41 | if match == nil then
42 | return "nomatch"
43 | else
44 | return match
45 | end
46 | end
47 |
48 | table.filter = function(t, iter)
49 | for i = #t, 1, -1 do
50 | if not iter(t[i]) then
51 | table.remove(t, i)
52 | end
53 | end
54 | end
55 |
56 | -- splitbynum and alnumcomp from alphanum.lua (C) Andre Bogus
57 | -- Released under the MIT License
58 | -- http://www.davekoelle.com/files/alphanum.lua
59 |
60 | -- split a string into a table of number and string values
61 | function splitbynum(s)
62 | local result = {}
63 | for x, y in (s or ""):gmatch("(%d*)(%D*)") do
64 | if x ~= "" then table.insert(result, tonumber(x)) end
65 | if y ~= "" then table.insert(result, y) end
66 | end
67 | return result
68 | end
69 |
70 | function clean_key(k)
71 | k = (' '..k..' '):gsub("%s+", " "):sub(2, -2):lower()
72 | return splitbynum(k)
73 | end
74 |
75 | -- compare two strings
76 | function alnumcomp(x, y)
77 | local xt, yt = clean_key(x), clean_key(y)
78 | for i = 1, math.min(#xt, #yt) do
79 | local xe, ye = xt[i], yt[i]
80 | if type(xe) == "string" then ye = tostring(ye)
81 | elseif type(ye) == "string" then xe = tostring(xe) end
82 | if xe ~= ye then return xe < ye end
83 | end
84 | return #xt < #yt
85 | end
86 |
87 | local autoloaded = nil
88 |
89 | function find_and_add_entries()
90 | local path = mp.get_property("path", "")
91 | local dir, filename = utils.split_path(path)
92 | msg.trace(("dir: %s, filename: %s"):format(dir, filename))
93 | if o.disabled then
94 | msg.verbose("stopping: autoload disabled")
95 | elseif #dir == 0 then
96 | msg.verbose("stopping: not a local path")
97 | return
98 | end
99 |
100 | local pl_count = mp.get_property_number("playlist-count", 1)
101 | -- check if this is a manually made playlist
102 | if (pl_count > 1 and autoloaded == nil) or
103 | (pl_count == 1 and EXTENSIONS[string.lower(get_extension(filename))] == nil) then
104 | return
105 | else
106 | autoloaded = true
107 | end
108 |
109 | local pl = mp.get_property_native("playlist", {})
110 | local pl_current = mp.get_property_number("playlist-pos-1", 1)
111 | msg.trace(("playlist-pos-1: %s, playlist: %s"):format(pl_current,
112 | utils.to_string(pl)))
113 |
114 | local files = utils.readdir(dir, "files")
115 | if files == nil then
116 | return
117 | end
118 | table.filter(files, function (v, k)
119 | if string.match(v, "^%.") then
120 | return false
121 | end
122 | local ext = get_extension(v)
123 | if ext == nil then
124 | return false
125 | end
126 | return EXTENSIONS[string.lower(ext)]
127 | end)
128 | table.sort(files, alnumcomp)
129 |
130 | if dir == "." then
131 | dir = ""
132 | end
133 |
134 | -- Find the current pl entry (dir+"/"+filename) in the sorted dir list
135 | local current
136 | for i = 1, #files do
137 | if files[i] == filename then
138 | current = i
139 | break
140 | end
141 | end
142 | if current == nil then
143 | return
144 | end
145 | msg.trace("current file position in files: "..current)
146 |
147 | local append = {[-1] = {}, [1] = {}}
148 | for direction = -1, 1, 2 do -- 2 iterations, with direction = -1 and +1
149 | for i = 1, MAXENTRIES do
150 | local file = files[current + i * direction]
151 | local pl_e = pl[pl_current + i * direction]
152 | if file == nil or file[1] == "." then
153 | break
154 | end
155 |
156 | local filepath = dir .. file
157 | if pl_e then
158 | -- If there's a playlist entry, and it's the same file, stop.
159 | msg.trace(pl_e.filename.." == "..filepath.." ?")
160 | if pl_e.filename == filepath then
161 | break
162 | end
163 | end
164 |
165 | if direction == -1 then
166 | if pl_current == 1 then -- never add additional entries in the middle
167 | msg.info("Prepending " .. file)
168 | table.insert(append[-1], 1, filepath)
169 | end
170 | else
171 | msg.info("Adding " .. file)
172 | table.insert(append[1], filepath)
173 | end
174 | end
175 | end
176 |
177 | add_files_at(pl_current + 1, append[1])
178 | add_files_at(pl_current, append[-1])
179 | end
180 |
181 | mp.register_event("start-file", find_and_add_entries)
182 |
--------------------------------------------------------------------------------
/removed_conf/scripts/audio-balance.lua:
--------------------------------------------------------------------------------
1 | --[[
2 | hacky port of mpv balance property to lavfi pan
3 | unlike mpv it should also change the volume to
4 | the surround and back lateral channels
5 | might be broken with "6.1" channel layout, since it can use
6 | either back or surround laterals
7 | input.conf default bindings:
8 | ) script-binding balance-to-left
9 | = script-binding balance-to-right
10 | ? script-binding reset-balance
11 | script-message
12 | # 'balance-to-left' is equivalent to "script-message -0.1"
13 | # 'balance-to-right' is equivalent to "script-message 0.1"
14 | --]]
15 |
16 | options = require 'mp.options'
17 |
18 | local opts = {
19 | forcelayout = "",
20 | -- if empty, will use the same layout as the original audio
21 | left = 0.5,
22 | right = 0.5
23 | }
24 |
25 | options.read_options(opts)
26 |
27 | local left = opts.left
28 | local right = opts.right
29 |
30 | local function add_left_channel(left_ch_name, right_ch_name)
31 | return string.format("%s=%.1f*%s+%.1f*%s",
32 | left_ch_name,
33 | math.max(0,math.min(1,left*2)), left_ch_name,
34 | math.max(0,math.min(1,(right-0.5)*2)), right_ch_name)
35 | end
36 |
37 | local function add_right_channel(left_ch_name, right_ch_name)
38 | return string.format("%s=%.1f*%s+%.1f*%s",
39 | right_ch_name,
40 | math.max(0,math.min(1,(left-0.5)*2)), left_ch_name,
41 | math.max(0,math.min(1,right*2)), right_ch_name)
42 | end
43 |
44 | local function update_filter()
45 | local graph = {}
46 | local channels =
47 | opts.forcelayout ~= "" and opts.forcelayout or
48 | mp.get_property('audio-params/hr-channels', 'stereo')
49 | if channels == "mono" then
50 | return
51 | end
52 |
53 | graph[1] = add_left_channel('FL', 'FR')
54 | graph[2] = add_right_channel('FL', 'FR')
55 |
56 | if channels == "3.0" or
57 | channels == "3.0(back)" or
58 | channels == "3.1" or
59 | channels == "5.0" or
60 | channels == "5.0(side)" or
61 | channels == "4.1" or
62 | channels == "5.1" or
63 | channels == "5.1(side)" or
64 | channels == "6.0" or
65 | channels == "6.0(front)" or
66 | channels == "hexagonal" or
67 | channels == "6.1" or
68 | channels == "7.0" or
69 | channels == "7.0(front)" or
70 | channels == "7.1" or
71 | channels == "7.1(wide)" or
72 | channels == "7.1(side-side)" or
73 | channels == "octagonal" then
74 | graph[#graph+1] = 'FC=FC'
75 | end
76 |
77 | if channels == "2.1" or
78 | channels == "3.1" or
79 | channels == "4.1" or
80 | channels == "5.1" or
81 | channels == "5.1(side)" or
82 | channels == "6.1" or
83 | channels == "6.1(front)" or
84 | channels == "7.1" or
85 | channels == "7.1(wide)" or
86 | channels == "7.1(side-side)" then
87 | graph[#graph+1] = 'LFE=LFE'
88 | end
89 |
90 | if channels == "3.0(back)" or
91 | channels == "4.0" or
92 | channels == "4.1" or
93 | channels == "6.0" or
94 | channels == "hexagonal" or
95 | channels == "6.1" or
96 | channels == "6.1(back)" or
97 | channels == "octagonal" then
98 | graph[#graph+1] = 'BC=BC'
99 | end
100 |
101 | if channels == "quad" or
102 | channels == "5.0" or
103 | channels == "5.1" or
104 | channels == "hexagonal" or
105 | channels == "6.1(back)" or
106 | channels == "7.0" or
107 | channels == "7.1" or
108 | channels == "7.1(wide)" or
109 | channels == "octagonal" then
110 | graph[#graph+1] = add_left_channel('BL', 'BR')
111 | graph[#graph+1] = add_right_channel('BL', 'BR')
112 | end
113 |
114 | if channels == "quad(side)" or
115 | channels == "5.0(side)" or
116 | channels == "5.1(side)" or
117 | channels == "hexagonal" or
118 | channels == "6.0" or
119 | channels == "6.0(front)" or
120 | channels == "6.1" or
121 | channels == "6.1(front)" or
122 | channels == "7.0" or
123 | channels == "7.0(front)" or
124 | channels == "7.1" or
125 | channels == "7.1(wide-side)" or
126 | channels == "octagonal" then
127 | graph[#graph+1] = add_left_channel('SL', 'SR')
128 | graph[#graph+1] = add_right_channel('SL', 'SR')
129 | end
130 |
131 | if channels == "6.0(front)" or
132 | channels == "6.1(front)" or
133 | channels == "7.0(front)" or
134 | channels == "7.1(wide)" or
135 | channels == "7.1(wide-side)" then
136 | graph[#graph+1] = add_left_channel('FLC', 'FRC')
137 | graph[#graph+1] = add_right_channel('FLC', 'FRC')
138 | end
139 |
140 | mp.command(string.format('no-osd af add @balance:lavfi=[pan=%s|%s]',
141 | channels, table.concat(graph, "|")))
142 |
143 | mp.commandv('show-text',
144 | string.format('Audio Balance (pan): Left: %.0f%% Right: %.0f%%',
145 | left*100, right*100))
146 | end
147 |
148 | local function change_balance(val)
149 | val = tonumber(val)
150 | if not val or (val > 1 or val < -1) then
151 | mp.msg.warn("Parameter should be a number between -1.0 and 1.0 (was "..val..")")
152 | return
153 | end
154 | left = math.max(0,math.min(1,left + val * -1))
155 | right = math.max(0,math.min(1,right + val))
156 | update_filter()
157 | end
158 |
159 | mp.register_script_message(mp.get_script_name(), change_balance)
160 |
161 | -- shift+9 and shift+0 in Portuguese layout
162 | mp.add_key_binding(")", 'balance-to-left', function() change_balance(-0.05); end, { repeatable = true })
163 | mp.add_key_binding("=", 'balance-to-right', function() change_balance(0.05); end, { repeatable = true })
164 |
165 | mp.add_key_binding("?", 'balance-reset', function()
166 | mp.command('no-osd af del @balance')
167 | left = 0.5
168 | right = 0.5
169 | end)
--------------------------------------------------------------------------------
/removed_conf/scripts/lin.autoload2.lua:
--------------------------------------------------------------------------------
1 | -- This script automatically loads playlist entries before and after the
2 | -- the currently played file. It does so by scanning the directory a file is
3 | -- located in when starting playback. It sorts the directory entries
4 | -- alphabetically, and adds entries before and after the current file to
5 | -- the internal playlist. (It stops if the it would add an already existing
6 | -- playlist entry at the same position - this makes it "stable".)
7 | -- Add at most 5000 * 2 files when starting a file (before + after).
8 | MAXENTRIES = 5000
9 |
10 | local msg = require 'mp.msg'
11 | local options = require 'mp.options'
12 | local utils = require 'mp.utils'
13 |
14 | o = {
15 | disabled = false
16 | }
17 | options.read_options(o)
18 |
19 | function Set (t)
20 | local set = {}
21 | for _, v in pairs(t) do set[v] = true end
22 | return set
23 | end
24 |
25 | EXTENSIONS = Set {
26 | 'mkv', 'avi', 'mp4', 'ogv', 'webm', 'rmvb', 'flv', 'wmv', 'mpeg', 'mpg', 'm4v', '3gp',
27 | 'mp3', 'wav', 'ogm', 'flac', 'm4a', 'wma', 'ogg', 'opus',
28 | }
29 |
30 | function add_files_at(index, files)
31 | index = index - 1
32 | local oldcount = mp.get_property_number("playlist-count", 1)
33 | for i = 1, #files do
34 | mp.commandv("loadfile", files[i], "append")
35 | mp.commandv("playlist-move", oldcount + i - 1, index + i - 1)
36 | end
37 | end
38 |
39 | function get_extension(path)
40 | match = string.match(path, "%.([^%.]+)$" )
41 | if match == nil then
42 | return "nomatch"
43 | else
44 | return match
45 | end
46 | end
47 |
48 | table.filter = function(t, iter)
49 | for i = #t, 1, -1 do
50 | if not iter(t[i]) then
51 | table.remove(t, i)
52 | end
53 | end
54 | end
55 |
56 | -- splitbynum and alnumcomp from alphanum.lua (C) Andre Bogus
57 | -- Released under the MIT License
58 | -- http://www.davekoelle.com/files/alphanum.lua
59 |
60 | -- split a string into a table of number and string values
61 | function splitbynum(s)
62 | local result = {}
63 | for x, y in (s or ""):gmatch("(%d*)(%D*)") do
64 | if x ~= "" then table.insert(result, tonumber(x)) end
65 | if y ~= "" then table.insert(result, y) end
66 | end
67 | return result
68 | end
69 |
70 | function clean_key(k)
71 | k = (' '..k..' '):gsub("%s+", " "):sub(2, -2):lower()
72 | return splitbynum(k)
73 | end
74 |
75 | -- compare two strings
76 | function alnumcomp(x, y)
77 | local xt, yt = clean_key(x), clean_key(y)
78 | for i = 1, math.min(#xt, #yt) do
79 | local xe, ye = xt[i], yt[i]
80 | if type(xe) == "string" then ye = tostring(ye)
81 | elseif type(ye) == "string" then xe = tostring(xe) end
82 | if xe ~= ye then return xe < ye end
83 | end
84 | return #xt < #yt
85 | end
86 |
87 | function find_and_add_entries()
88 | local path = mp.get_property("path", "")
89 | msg.debug("path: "..path)
90 | local dir, filename = utils.split_path(path)
91 | msg.debug(("dir: %s, filename: %s"):format(dir, filename))
92 | if o.disabled then
93 | msg.verbose("stopping: autoload disabled")
94 | elseif #dir == 0 then
95 | msg.verbose("stopping: not a local path")
96 | return
97 | end
98 | local pl_count = mp.get_property_number("playlist-count", 1)
99 | if (pl_count > 1 and autoload_running == nil) or
100 | (pl_count == 1 and EXTENSIONS[string.lower(get_extension(filename))] == nil) then
101 | return
102 | elseif autoload_running then
103 | msg.verbose("stopping: previous autoload script still running")
104 | return
105 | else
106 | autoload_running = true
107 | end
108 |
109 | local pl = mp.get_property_native("playlist", {})
110 | local pl_current = mp.get_property_number("playlist-pos", 0) + 1
111 | msg.debug(("playlist-pos-1: %s, playlist: %s"):format(pl_current,
112 | utils.to_string(pl)))
113 |
114 | local files = utils.readdir(dir, "files")
115 | if files == nil then
116 | autoload_running = false
117 | return
118 | end
119 | table.filter(files, function (v, k)
120 | if string.match(v, "^%.") then
121 | return false
122 | end
123 | local ext = get_extension(v)
124 | if ext == nil then
125 | return false
126 | end
127 | return EXTENSIONS[string.lower(ext)]
128 | end)
129 | table.sort(files, alnumcomp)
130 |
131 | if dir == "." then
132 | dir = ""
133 | end
134 |
135 | -- Find the current pl entry (dir+"/"+filename) in the sorted dir list
136 | local current
137 | for i = 1, #files do
138 | if files[i] == filename then
139 | current = i
140 | break
141 | end
142 | end
143 | if current == nil then
144 | autoload_running = false
145 | return
146 | end
147 | msg.debug("current file position in files: "..current)
148 |
149 | local append = {[-1] = {}, [1] = {}}
150 | for direction = -1, 1, 2 do -- 2 iterations, with direction = -1 and +1
151 | for i = 1, MAXENTRIES do
152 | local file = files[current + i * direction]
153 | local pl_e = pl[pl_current + i * direction]
154 | if file == nil or file[1] == "." then
155 | break
156 | end
157 |
158 | local filepath = dir .. file
159 | if pl_e then
160 | msg.debug(pl_e.filename.."=="..filepath.."?")
161 | -- If there's a playlist entry, and it's the same file, stop.
162 | if pl_e.filename == filepath then
163 | break
164 | end
165 | end
166 |
167 | if direction == -1 then
168 | if pl_current == 1 then -- never add additional entries in the middle
169 | msg.info("Prepending " .. file)
170 | table.insert(append[-1], 1, filepath)
171 | end
172 | else
173 | msg.info("Adding " .. file)
174 | table.insert(append[1], filepath)
175 | end
176 | end
177 | end
178 |
179 | add_files_at(pl_current + 1, append[1])
180 | add_files_at(pl_current, append[-1])
181 | autoload_running = false
182 | end
183 |
184 | mp.register_event("start-file", find_and_add_entries)
185 |
--------------------------------------------------------------------------------
/removed_conf/scripts/lin.autoload1.lua:
--------------------------------------------------------------------------------
1 | -- This script automatically loads playlist entries before and after the
2 | -- the currently played file. It does so by scanning the directory a file is
3 | -- located in when starting playback. It sorts the directory entries
4 | -- alphabetically, and adds entries before and after the current file to
5 | -- the internal playlist. (It stops if the it would add an already existing
6 | -- playlist entry at the same position - this makes it "stable".)
7 | -- Add at most 5000 * 2 files when starting a file (before + after).
8 | MAXENTRIES = 5000
9 |
10 | local msg = require 'mp.msg'
11 | local options = require 'mp.options'
12 | local utils = require 'mp.utils'
13 |
14 | o = {
15 | disabled = false
16 | }
17 | options.read_options(o)
18 |
19 | function Set (t)
20 | local set = {}
21 | for _, v in pairs(t) do set[v] = true end
22 | return set
23 | end
24 |
25 | EXTENSIONS = Set {
26 | 'mkv', 'avi', 'mp4', 'ogv', 'webm', 'rmvb', 'flv', 'wmv', 'mpeg', 'mpg', 'm4v', '3gp',
27 | 'mp3', 'wav', 'ogm', 'flac', 'm4a', 'wma', 'ogg', 'opus',
28 | }
29 |
30 | function add_files_at(index, files)
31 | index = index - 1
32 | local oldcount = mp.get_property_number("playlist-count", 1)
33 | for i = 1, #files do
34 | mp.commandv("loadfile", files[i], "append")
35 | mp.commandv("playlist-move", oldcount + i - 1, index + i - 1)
36 | end
37 | end
38 |
39 | function get_extension(path)
40 | match = string.match(path, "%.([^%.]+)$" )
41 | if match == nil then
42 | return "nomatch"
43 | else
44 | return match
45 | end
46 | end
47 |
48 | table.filter = function(t, iter)
49 | for i = #t, 1, -1 do
50 | if not iter(t[i]) then
51 | table.remove(t, i)
52 | end
53 | end
54 | end
55 |
56 | -- splitbynum and alnumcomp from alphanum.lua (C) Andre Bogus
57 | -- Released under the MIT License
58 | -- http://www.davekoelle.com/files/alphanum.lua
59 |
60 | -- split a string into a table of number and string values
61 | function splitbynum(s)
62 | local result = {}
63 | for x, y in (s or ""):gmatch("(%d*)(%D*)") do
64 | if x ~= "" then table.insert(result, tonumber(x)) end
65 | if y ~= "" then table.insert(result, y) end
66 | end
67 | return result
68 | end
69 |
70 | function clean_key(k)
71 | k = (' '..k..' '):gsub("%s+", " "):sub(2, -2):lower()
72 | return splitbynum(k)
73 | end
74 |
75 | -- compare two strings
76 | function alnumcomp(x, y)
77 | local xt, yt = clean_key(x), clean_key(y)
78 | for i = 1, math.min(#xt, #yt) do
79 | local xe, ye = xt[i], yt[i]
80 | if type(xe) == "string" then ye = tostring(ye)
81 | elseif type(ye) == "string" then xe = tostring(xe) end
82 | if xe ~= ye then return xe < ye end
83 | end
84 | return #xt < #yt
85 | end
86 |
87 | function find_and_add_entries()
88 | local path = mp.get_property("path", "")
89 | msg.debug("path: "..path)
90 | local dir, filename = utils.split_path(path)
91 | msg.debug(("dir: %s, filename: %s"):format(dir, filename))
92 | if o.disabled then
93 | msg.verbose("stopping: autoload disabled")
94 | elseif #dir == 0 then
95 | msg.verbose("stopping: not a local path")
96 | return
97 | end
98 | local pl_count = mp.get_property_number("playlist-count", 1)
99 | if (pl_count > 1 and autoload_running == nil) or
100 | (pl_count == 1 and EXTENSIONS[string.lower(get_extension(filename))] == nil) then
101 | return
102 | -- elseif autoload_running then
103 | -- msg.verbose("stopping: previous autoload script still running")
104 | -- return
105 | else
106 | autoload_running = true
107 | end
108 |
109 | local pl = mp.get_property_native("playlist", {})
110 | local pl_current = mp.get_property_number("playlist-pos", 0) + 1
111 | msg.debug(("playlist-pos-1: %s, playlist: %s"):format(pl_current,
112 | utils.to_string(pl)))
113 |
114 | local files = utils.readdir(dir, "files")
115 | if files == nil then
116 | -- autoload_running = false
117 | return
118 | end
119 | table.filter(files, function (v, k)
120 | if string.match(v, "^%.") then
121 | return false
122 | end
123 | local ext = get_extension(v)
124 | if ext == nil then
125 | return false
126 | end
127 | return EXTENSIONS[string.lower(ext)]
128 | end)
129 | table.sort(files, alnumcomp)
130 |
131 | if dir == "." then
132 | dir = ""
133 | end
134 |
135 | -- Find the current pl entry (dir+"/"+filename) in the sorted dir list
136 | local current
137 | for i = 1, #files do
138 | if files[i] == filename then
139 | current = i
140 | break
141 | end
142 | end
143 | if current == nil then
144 | -- autoload_running = false
145 | return
146 | end
147 | msg.debug("current file position in files: "..current)
148 |
149 | local append = {[-1] = {}, [1] = {}}
150 | for direction = -1, 1, 2 do -- 2 iterations, with direction = -1 and +1
151 | for i = 1, MAXENTRIES do
152 | local file = files[current + i * direction]
153 | local pl_e = pl[pl_current + i * direction]
154 | if file == nil or file[1] == "." then
155 | break
156 | end
157 |
158 | local filepath = dir .. file
159 | if pl_e then
160 | msg.debug(pl_e.filename.."=="..filepath.."?")
161 | -- If there's a playlist entry, and it's the same file, stop.
162 | if pl_e.filename == filepath then
163 | break
164 | end
165 | end
166 |
167 | if direction == -1 then
168 | if pl_current == 1 then -- never add additional entries in the middle
169 | msg.info("Prepending " .. file)
170 | table.insert(append[-1], 1, filepath)
171 | end
172 | else
173 | msg.info("Adding " .. file)
174 | table.insert(append[1], filepath)
175 | end
176 | end
177 | end
178 |
179 | add_files_at(pl_current + 1, append[1])
180 | add_files_at(pl_current, append[-1])
181 | -- autoload_running = false
182 | end
183 |
184 | mp.register_event("start-file", find_and_add_entries)
185 |
--------------------------------------------------------------------------------
/removed_conf/shaders/SSimDownscaler.glsl:
--------------------------------------------------------------------------------
1 | // This library is free software; you can redistribute it and/or
2 | // modify it under the terms of the GNU Lesser General Public
3 | // License as published by the Free Software Foundation; either
4 | // version 3.0 of the License, or (at your option) any later version.
5 | //
6 | // This library is distributed in the hope that it will be useful,
7 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
8 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
9 | // Lesser General Public License for more details.
10 | //
11 | // You should have received a copy of the GNU Lesser General Public
12 | // License along with this library.
13 |
14 | //!HOOK POSTKERNEL
15 | //!BIND HOOKED
16 | //!BIND PREKERNEL
17 | //!SAVE L2
18 | //!WIDTH NATIVE_CROPPED.w
19 | //!WHEN NATIVE_CROPPED.h POSTKERNEL.h >
20 | //!COMPONENTS 3
21 | //!DESC SSimDownscaler L2 pass 1
22 |
23 | #define axis 1
24 |
25 | #define offset vec2(0,0)
26 |
27 | #define MN(B,C,x) (x < 1.0 ? ((2.-1.5*B-(C))*x + (-3.+2.*B+C))*x*x + (1.-(B)/3.) : (((-(B)/6.-(C))*x + (B+5.*C))*x + (-2.*B-8.*C))*x+((4./3.)*B+4.*C))
28 | #define Kernel(x) MN(.0, .5, abs(x))
29 | #define taps 2.0
30 |
31 | vec4 hook() {
32 | vec2 base = PREKERNEL_pt * (PREKERNEL_pos * input_size + tex_offset);
33 |
34 | float low = ceil((PREKERNEL_pos - taps*POSTKERNEL_pt) * input_size - offset + tex_offset - 0.5)[axis];
35 | float high = floor((PREKERNEL_pos + taps*POSTKERNEL_pt) * input_size - offset + tex_offset - 0.5)[axis];
36 |
37 | float W = 0.0;
38 | vec4 avg = vec4(0);
39 | vec2 pos = base;
40 |
41 | for (float k = low; k <= high; k++) {
42 | pos[axis] = PREKERNEL_pt[axis] * (k - offset[axis] + 0.5);
43 | float rel = (pos[axis] - base[axis])*POSTKERNEL_size[axis];
44 | float w = Kernel(rel);
45 |
46 | vec4 tex = textureLod(PREKERNEL_raw, pos, 0.0) * PREKERNEL_mul;
47 | avg += w * tex * tex;
48 | W += w;
49 | }
50 | avg /= W;
51 |
52 | return avg;
53 | }
54 |
55 | //!HOOK POSTKERNEL
56 | //!BIND HOOKED
57 | //!BIND L2
58 | //!SAVE L2
59 | //!WHEN NATIVE_CROPPED.w POSTKERNEL.w >
60 | //!COMPONENTS 3
61 | //!DESC SSimDownscaler L2 pass 2
62 |
63 | #define axis 0
64 |
65 | #define offset vec2(0,0)
66 |
67 | #define MN(B,C,x) (x < 1.0 ? ((2.-1.5*B-(C))*x + (-3.+2.*B+C))*x*x + (1.-(B)/3.) : (((-(B)/6.-(C))*x + (B+5.*C))*x + (-2.*B-8.*C))*x+((4./3.)*B+4.*C))
68 | #define Kernel(x) MN(.0, .5, abs(x))
69 | #define taps 2.0
70 |
71 | vec4 hook() {
72 | float low = ceil((L2_pos - taps*POSTKERNEL_pt) * L2_size - offset - 0.5)[axis];
73 | float high = floor((L2_pos + taps*POSTKERNEL_pt) * L2_size - offset - 0.5)[axis];
74 |
75 | float W = 0.0;
76 | vec4 avg = vec4(0);
77 | vec2 pos = L2_pos;
78 |
79 | for (float k = low; k <= high; k++) {
80 | pos[axis] = L2_pt[axis] * (k - offset[axis] + 0.5);
81 | float rel = (pos[axis] - L2_pos[axis])*POSTKERNEL_size[axis];
82 | float w = Kernel(rel);
83 |
84 | avg += w * textureLod(L2_raw, pos, 0.0) * L2_mul;
85 | W += w;
86 | }
87 | avg /= W;
88 |
89 | return avg;
90 | }
91 |
92 | //!HOOK POSTKERNEL
93 | //!BIND HOOKED
94 | //!BIND L2
95 | //!SAVE MR
96 | //!WHEN NATIVE_CROPPED.h POSTKERNEL.h >
97 | //!COMPONENTS 4
98 | //!DESC SSimDownscaler mean & R
99 |
100 | #define oversharp 0.0
101 |
102 | #define sigma_nsq 10. / (255.*255.)
103 | #define locality 2.0
104 |
105 | #define offset vec2(0,0)
106 |
107 | #define Kernel(x) pow(1.0 / locality, abs(x))
108 | #define taps 3.0
109 |
110 | #define Luma(rgb) ( dot(rgb, vec3(0.2126, 0.7152, 0.0722)) )
111 |
112 | mat3x3 ScaleH(vec2 pos) {
113 | float low = ceil(-0.5*taps - offset)[0];
114 | float high = floor(0.5*taps - offset)[0];
115 |
116 | float W = 0.0;
117 | mat3x3 avg = mat3x3(0);
118 |
119 | for (float k = low; k <= high; k++) {
120 | pos[0] = HOOKED_pos[0] + HOOKED_pt[0] * k;
121 | float rel = k + offset[0];
122 | float w = Kernel(rel);
123 |
124 | vec3 L = POSTKERNEL_tex(pos).rgb;
125 | avg += w * mat3x3(L, L*L, L2_tex(pos).rgb);
126 | W += w;
127 | }
128 | avg /= W;
129 |
130 | return avg;
131 | }
132 |
133 | vec4 hook() {
134 | vec2 pos = HOOKED_pos;
135 |
136 | float low = ceil(-0.5*taps - offset)[1];
137 | float high = floor(0.5*taps - offset)[1];
138 |
139 | float W = 0.0;
140 | mat3x3 avg = mat3x3(0);
141 |
142 | for (float k = low; k <= high; k++) {
143 | pos[1] = HOOKED_pos[1] + HOOKED_pt[1] * k;
144 | float rel = k + offset[1];
145 | float w = Kernel(rel);
146 |
147 | avg += w * ScaleH(pos);
148 | W += w;
149 | }
150 | avg /= W;
151 |
152 | float Sl = Luma(max(avg[1] - avg[0] * avg[0], 0.));
153 | float Sh = Luma(max(avg[2] - avg[0] * avg[0], 0.));
154 | return vec4(avg[0], mix(sqrt((Sh + sigma_nsq) / (Sl + sigma_nsq)) * (1. + oversharp), clamp(Sh / Sl, 0., 1.), int(Sl > Sh)));
155 | }
156 |
157 | //!HOOK POSTKERNEL
158 | //!BIND HOOKED
159 | //!BIND MR
160 | //!WHEN NATIVE_CROPPED.h POSTKERNEL.h >
161 | //!DESC SSimDownscaler final pass
162 |
163 | #define locality 2.0
164 |
165 | #define offset vec2(0,0)
166 |
167 | #define Kernel(x) pow(1.0 / locality, abs(x))
168 | #define taps 3.0
169 |
170 | #define Gamma(x) ( pow(x, vec3(1.0/2.0)) )
171 | #define GammaInv(x) ( pow(clamp(x, 0.0, 1.0), vec3(2.0)) )
172 |
173 | mat3x3 ScaleH(vec2 pos) {
174 | float low = ceil(-0.5*taps - offset)[0];
175 | float high = floor(0.5*taps - offset)[0];
176 |
177 | float W = 0.0;
178 | mat3x3 avg = mat3x3(0);
179 |
180 | for (float k = low; k <= high; k++) {
181 | pos[0] = HOOKED_pos[0] + HOOKED_pt[0] * k;
182 | float rel = k + offset[0];
183 | float w = Kernel(rel);
184 |
185 | vec4 MR = MR_tex(pos);
186 | avg += w * mat3x3(MR.a*MR.rgb, MR.rgb, MR.aaa);
187 | W += w;
188 | }
189 | avg /= W;
190 |
191 | return avg;
192 | }
193 |
194 | vec4 hook() {
195 | vec2 pos = HOOKED_pos;
196 |
197 | float low = ceil(-0.5*taps - offset)[1];
198 | float high = floor(0.5*taps - offset)[1];
199 |
200 | float W = 0.0;
201 | mat3x3 avg = mat3x3(0);
202 |
203 | for (float k = low; k <= high; k++) {
204 | pos[1] = HOOKED_pos[1] + HOOKED_pt[1] * k;
205 | float rel = k + offset[1];
206 | float w = Kernel(rel);
207 |
208 | avg += w * ScaleH(pos);
209 | W += w;
210 | }
211 | avg /= W;
212 | vec4 L = POSTKERNEL_texOff(0);
213 | return vec4(avg[1] + avg[2] * L.rgb - avg[0], L.a);
214 | }
215 |
--------------------------------------------------------------------------------
/removed_conf/shaders/SSimSuperRes.glsl:
--------------------------------------------------------------------------------
1 | // SSimSuperRes by Shiandow
2 | //
3 | // This library is free software; you can redistribute it and/or
4 | // modify it under the terms of the GNU Lesser General Public
5 | // License as published by the Free Software Foundation; either
6 | // version 3.0 of the License, or (at your option) any later version.
7 | //
8 | // This library is distributed in the hope that it will be useful,
9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 | // Lesser General Public License for more details.
12 | //
13 | // You should have received a copy of the GNU Lesser General Public
14 | // License along with this library.
15 |
16 | //!HOOK POSTKERNEL
17 | //!BIND HOOKED
18 | //!SAVE LOWRES
19 | //!HEIGHT NATIVE_CROPPED.h
20 | //!WHEN NATIVE_CROPPED.h OUTPUT.h <
21 | //!COMPONENTS 4
22 | //!DESC SSSR Downscaling I
23 |
24 | #define axis 1
25 |
26 | #define offset vec2(0,0)
27 |
28 | #define MN(B,C,x) (x < 1.0 ? ((2.-1.5*B-(C))*x + (-3.+2.*B+C))*x*x + (1.-(B)/3.) : (((-(B)/6.-(C))*x + (B+5.*C))*x + (-2.*B-8.*C))*x+((4./3.)*B+4.*C))
29 | #define Kernel(x) MN(0.334, 0.333, abs(x))
30 | #define taps 2.0
31 |
32 | #define Luma(rgb) dot(rgb*rgb, vec3(0.2126, 0.7152, 0.0722))
33 |
34 | vec4 hook() {
35 | float low = ceil((HOOKED_pos - taps/input_size) * HOOKED_size - offset - 0.5)[axis];
36 | float high = floor((HOOKED_pos + taps/input_size) * HOOKED_size - offset - 0.5)[axis];
37 |
38 | float W = 0.0;
39 | vec4 avg = vec4(0);
40 | vec2 pos = HOOKED_pos;
41 | vec4 tex;
42 |
43 | for (float k = low; k <= high; k++) {
44 | pos[axis] = HOOKED_pt[axis] * (k - offset[axis] + 0.5);
45 | float rel = (pos[axis] - HOOKED_pos[axis])*input_size[axis];
46 | float w = Kernel(rel);
47 |
48 | tex.rgb = textureLod(HOOKED_raw, pos, 0.0).rgb * HOOKED_mul;
49 | tex.a = Luma(tex.rgb);
50 | avg += w * tex;
51 | W += w;
52 | }
53 | avg /= W;
54 |
55 | return vec4(avg.rgb, max(abs(avg.a - Luma(avg.rgb)), 5e-7));
56 | }
57 |
58 | //!HOOK POSTKERNEL
59 | //!BIND LOWRES
60 | //!SAVE LOWRES
61 | //!WIDTH NATIVE_CROPPED.w
62 | //!HEIGHT NATIVE_CROPPED.h
63 | //!WHEN NATIVE_CROPPED.w OUTPUT.w <
64 | //!COMPONENTS 4
65 | //!DESC SSSR Downscaling II
66 |
67 | #define axis 0
68 |
69 | #define offset vec2(0,0)
70 |
71 | #define MN(B,C,x) (x < 1.0 ? ((2.-1.5*B-(C))*x + (-3.+2.*B+C))*x*x + (1.-(B)/3.) : (((-(B)/6.-(C))*x + (B+5.*C))*x + (-2.*B-8.*C))*x+((4./3.)*B+4.*C))
72 | #define Kernel(x) MN(0.334, 0.333, abs(x))
73 | #define taps 2.0
74 |
75 | #define Luma(rgb) dot(rgb*rgb, vec3(0.2126, 0.7152, 0.0722))
76 |
77 | vec4 hook() {
78 | float low = ceil((LOWRES_pos - taps/input_size) * LOWRES_size - offset - 0.5)[axis];
79 | float high = floor((LOWRES_pos + taps/input_size) * LOWRES_size - offset - 0.5)[axis];
80 |
81 | float W = 0.0;
82 | vec4 avg = vec4(0);
83 | vec2 pos = LOWRES_pos;
84 | vec4 tex;
85 |
86 | for (float k = low; k <= high; k++) {
87 | pos[axis] = LOWRES_pt[axis] * (k - offset[axis] + 0.5);
88 | float rel = (pos[axis] - LOWRES_pos[axis])*input_size[axis];
89 | float w = Kernel(rel);
90 |
91 | tex.rgb = textureLod(LOWRES_raw, pos, 0.0).rgb * LOWRES_mul;
92 | tex.a = Luma(tex.rgb);
93 | avg += w * tex;
94 | W += w;
95 | }
96 | avg /= W;
97 |
98 | return vec4(avg.rgb, max(abs(avg.a - Luma(avg.rgb)), 5e-7) + LOWRES_texOff(0).a);
99 | }
100 |
101 | //!HOOK POSTKERNEL
102 | //!BIND PREKERNEL
103 | //!BIND LOWRES
104 | //!SAVE var
105 | //!WIDTH NATIVE_CROPPED.w
106 | //!HEIGHT NATIVE_CROPPED.h
107 | //!WHEN NATIVE_CROPPED.h OUTPUT.h <
108 | //!COMPONENTS 2
109 | //!DESC SSSR var
110 |
111 | #define spread 1.0 / 4.0
112 |
113 | #define GetL(x,y) PREKERNEL_tex(PREKERNEL_pt * (PREKERNEL_pos * input_size + tex_offset + vec2(x,y))).rgb
114 | #define GetH(x,y) LOWRES_texOff(vec2(x,y)).rgb
115 |
116 | #define Luma(rgb) dot(rgb*rgb, vec3(0.2126, 0.7152, 0.0722))
117 | #define diff(x,y) vec2(Luma((GetL(x,y) - meanL)), Luma((GetH(x,y) - meanH)))
118 |
119 | vec4 hook() {
120 | vec3 meanL = GetL(0,0);
121 | vec3 meanH = GetH(0,0);
122 | for (int X=-1; X<=1; X+=2) {
123 | meanL += GetL(X,0) * spread;
124 | meanH += GetH(X,0) * spread;
125 | }
126 | for (int Y=-1; Y<=1; Y+=2) {
127 | meanL += GetL(0,Y) * spread;
128 | meanH += GetH(0,Y) * spread;
129 | }
130 | meanL /= (1.0 + 4.0*spread);
131 | meanH /= (1.0 + 4.0*spread);
132 |
133 | vec2 var = diff(0,0);
134 | for (int X=-1; X<=1; X+=2)
135 | var += diff(X,0) * spread;
136 |
137 | for (int Y=-1; Y<=1; Y+=2)
138 | var += diff(0,Y) * spread;
139 |
140 | return vec4(max(var / (1.0 + 4.0*spread), vec2(1e-6)), 0, 0);
141 | }
142 |
143 | //!HOOK POSTKERNEL
144 | //!BIND HOOKED
145 | //!BIND PREKERNEL
146 | //!BIND LOWRES
147 | //!BIND var
148 | //!WHEN NATIVE_CROPPED.h OUTPUT.h <
149 | //!DESC SSSR final pass
150 |
151 | #define oversharp 0.5
152 |
153 | // -- Window Size --
154 | #define taps 3.0
155 | #define even (taps - 2.0 * floor(taps / 2.0) == 0.0)
156 | #define minX int(1.0-ceil(taps/2.0))
157 | #define maxX int(floor(taps/2.0))
158 |
159 | #define Kernel(x) cos(acos(-1.0)*(x)/taps) // Hann kernel
160 |
161 | // -- Input processing --
162 | #define var(x,y) var_tex(var_pt * (pos + vec2(x,y) + 0.5)).rg
163 | #define GetL(x,y) PREKERNEL_tex(PREKERNEL_pt * (pos + tex_offset + vec2(x,y) + 0.5)).rgb
164 | #define GetH(x,y) LOWRES_tex(LOWRES_pt * (pos + vec2(x,y) + 0.5))
165 |
166 | #define Luma(rgb) dot(rgb*rgb, vec3(0.2126, 0.7152, 0.0722))
167 |
168 | vec4 hook() {
169 | vec4 c0 = HOOKED_texOff(0);
170 |
171 | vec2 pos = HOOKED_pos * LOWRES_size - vec2(0.5);
172 | vec2 offset = pos - (even ? floor(pos) : round(pos));
173 | pos -= offset;
174 |
175 | vec2 mVar = vec2(0.0);
176 | for (int X=-1; X<=1; X++)
177 | for (int Y=-1; Y<=1; Y++) {
178 | vec2 w = clamp(1.5 - abs(vec2(X,Y)), 0.0, 1.0);
179 | mVar += w.r * w.g * vec2(GetH(X,Y).a, 1.0);
180 | }
181 | mVar.r /= mVar.g;
182 |
183 | // Calculate faithfulness force
184 | float weightSum = 0.0;
185 | vec3 diff = vec3(0);
186 |
187 | for (int X = minX; X <= maxX; X++)
188 | for (int Y = minX; Y <= maxX; Y++)
189 | {
190 | float R = (-1.0 - oversharp) * sqrt(var(X,Y).r / (var(X,Y).g + mVar.r));
191 |
192 | vec2 krnl = Kernel(vec2(X,Y) - offset);
193 | float weight = krnl.r * krnl.g / (Luma((c0.rgb - GetH(X,Y).rgb)) + GetH(X,Y).a);
194 |
195 | diff += weight * (GetL(X,Y) + GetH(X,Y).rgb * R + (-1.0 - R) * (c0.rgb));
196 | weightSum += weight;
197 | }
198 | diff /= weightSum;
199 |
200 | c0.rgb = ((c0.rgb) + diff);
201 |
202 | return c0;
203 | }
204 |
--------------------------------------------------------------------------------
/removed_conf/scripts/firequalizer15.lua:
--------------------------------------------------------------------------------
1 | --[[
2 | Linear Phase 15-Bands Equalizer
3 | Key:
4 | - toggle equalizer control: ctrl+e
5 | - prev/next gain control: UP / DOWN
6 | - decrease/increase gain: LEFT / RIGHT
7 | - copy gain value from prev gain control: [
8 | - copy gain value from next gain control: ]
9 | Note that ~~/lua-settings directory should exist to save gain values.
10 | --]]
11 |
12 | local options = require "mp.options"
13 | local msg = require "mp.msg"
14 |
15 | local key_toggle_control = "ctrl+e"
16 | local key_prev_entry = "UP"
17 | local key_next_entry = "DOWN"
18 | local key_decrease = "LEFT"
19 | local key_increase = "RIGHT"
20 | local key_copy_prev = "["
21 | local key_copy_next = "]"
22 |
23 | local control_enabled = false
24 | local num_entry = 15
25 | local selected_entry = 0
26 | local min_val = -360
27 | local max_val = 120
28 | local stale_gain_entry = ""
29 |
30 | local function eq(x)
31 | return "eq" .. x
32 | end
33 |
34 | local gain_table = {
35 | eq0 = 0,
36 | eq1 = 0,
37 | eq2 = 0,
38 | eq3 = 0,
39 | eq4 = 0,
40 | eq5 = 0,
41 | eq6 = 0,
42 | eq7 = 0,
43 | eq8 = 0,
44 | eq9 = 0,
45 | eq10 = 0,
46 | eq11 = 0,
47 | eq12 = 0,
48 | eq13 = 0,
49 | eq14 = 0
50 | }
51 |
52 | local freq_label = {
53 | eq0 = "# 0 Hz:",
54 | eq1 = "# 65 Hz:",
55 | eq2 = "# 157 Hz:",
56 | eq3 = "# 288 Hz:",
57 | eq4 = "# 472 Hz:",
58 | eq5 = "# 733 Hz:",
59 | eq6 = "# 1k1 Hz:",
60 | eq7 = "# 1k6 Hz:",
61 | eq8 = "# 2k4 Hz:",
62 | eq9 = "# 3k4 Hz:",
63 | eq10 = "# 4k9 Hz:",
64 | eq11 = "# 7k0 Hz:",
65 | eq12 = "# 10k Hz:",
66 | eq13 = "# 14k Hz:",
67 | eq14 = "# 20k Hz:"
68 | }
69 |
70 | options.read_options(gain_table)
71 |
72 | for x = 0, num_entry-1 do
73 | gain_table[eq(x)] = math.min(math.max(gain_table[eq(x)], min_val), max_val)
74 | end
75 |
76 | local function save_gain_table()
77 | local settingdir = mp.find_config_file("lua-settings")
78 | local fp = settingdir and io.open(settingdir .. "/" .. mp.get_script_name() .. ".conf", "w")
79 | if fp == nil then
80 | msg.warn("Cannot save gain table.")
81 | else
82 | for x = 0, num_entry-1 do
83 | fp:write(eq(x) .. "=" .. gain_table[eq(x)] .. "\n")
84 | end
85 | fp:close()
86 | end
87 | end
88 |
89 | local normalcolor = "ffffff"
90 | local selectedcolor = "00ffff"
91 | local fontsize = 70
92 | local fontfamily = "mono"
93 | local pdefault = "{\\fn" .. fontfamily .. "\\fscx" .. fontsize .. "\\fscy" .. fontsize .. "\\1c&" .. normalcolor .. "&}"
94 | local pselected = "{\\fn" .. fontfamily .. "\\fscx" .. fontsize .. "\\fscy" .. fontsize .. "\\1c&" .. selectedcolor .. "&}"
95 |
96 | local function gain_line(x)
97 | local val = gain_table[eq(x)] - min_val;
98 | local str = ""
99 | local x = 10
100 | while x <= val do
101 | str = str .. "="
102 | x = x + 20
103 | end
104 | return str
105 | end
106 |
107 | local function show_osd_ass()
108 | local str = pdefault .. "Linear Phase 15-Bands Equalizer\n"
109 | for x = 0, num_entry-1 do
110 | local pval = pdefault
111 | if x == selected_entry then
112 | pval = pselected
113 | end
114 | str = str .. pval .. freq_label[eq(x)] .. string.format("%7.1f", gain_table[eq(x)]*0.1) .. " dB |" .. gain_line(x) .. "\n"
115 | end
116 | mp.set_osd_ass(0, 0, str)
117 | end
118 |
119 | local function hide_osd_ass()
120 | mp.set_osd_ass(0, 0, "{}")
121 | end
122 |
123 | local function gen_gain_entry()
124 | local str = string.format("entry(0,%.1f)", gain_table[eq(0)]*0.1)
125 | for x = 1, num_entry-1 do
126 | str = str .. string.format(";entry(%d,%.1f)", x, gain_table[eq(x)]*0.1)
127 | end
128 | return str
129 | end
130 |
131 | local function insert_filter(gain_entry)
132 | local graph = "firequalizer = " ..
133 | "wfunc = tukey:" ..
134 | "delay = 0.028:" ..
135 | "scale = linlog:" ..
136 | "zero_phase = on:" ..
137 | "gain_entry = '" .. gain_entry .. "':" ..
138 | "gain = 'cubic_interpolate(2.8853900817779269*log(f/157.48+1))'"
139 | mp.commandv("af", "add", "@" .. mp.get_script_name() .. ":lavfi=graph=[" .. graph .. "]")
140 | end
141 |
142 | local function audio_reconfig()
143 | local gain_entry = gen_gain_entry()
144 | if not (stale_gain_entry == gain_entry) then
145 | insert_filter(gain_entry)
146 | stale_gain_entry = gain_entry
147 | end
148 | end
149 |
150 | audio_reconfig()
151 | mp.register_event("playback-restart", audio_reconfig)
152 |
153 | local function send_command()
154 | mp.commandv("af-command", mp.get_script_name(), "gain_entry", gen_gain_entry())
155 | end
156 |
157 | local function prev_entry()
158 | selected_entry = math.max(selected_entry-1, 0)
159 | show_osd_ass()
160 | end
161 |
162 | local function next_entry()
163 | selected_entry = math.min(selected_entry+1, num_entry-1)
164 | show_osd_ass()
165 | end
166 |
167 | local function decrease_gain()
168 | gain_table[eq(selected_entry)] = math.max(gain_table[eq(selected_entry)]-1, min_val)
169 | send_command()
170 | show_osd_ass()
171 | save_gain_table()
172 | end
173 |
174 | local function increase_gain()
175 | gain_table[eq(selected_entry)] = math.min(gain_table[eq(selected_entry)]+1, max_val)
176 | send_command()
177 | show_osd_ass()
178 | save_gain_table()
179 | end
180 |
181 | local function copy_prev()
182 | gain_table[eq(selected_entry)] = gain_table[eq(math.max(selected_entry-1, 0))]
183 | send_command()
184 | show_osd_ass()
185 | save_gain_table()
186 | end
187 |
188 | local function copy_next()
189 | gain_table[eq(selected_entry)] = gain_table[eq(math.min(selected_entry+1, num_entry-1))]
190 | send_command()
191 | show_osd_ass()
192 | save_gain_table()
193 | end
194 |
195 | local function binding_name(name)
196 | return mp.get_script_name() .. "-" .. name
197 | end
198 |
199 | local function toggle_control()
200 | control_enabled = not control_enabled
201 | if control_enabled then
202 | show_osd_ass()
203 | mp.add_forced_key_binding(key_prev_entry, binding_name("prev"), prev_entry, {repeatable=true})
204 | mp.add_forced_key_binding(key_next_entry, binding_name("next"), next_entry, {repeatable=true})
205 | mp.add_forced_key_binding(key_decrease, binding_name("decrease"), decrease_gain, {repeatable=true})
206 | mp.add_forced_key_binding(key_increase, binding_name("increase"), increase_gain, {repeatable=true})
207 | mp.add_forced_key_binding(key_copy_prev, binding_name("copy_prev"), copy_prev)
208 | mp.add_forced_key_binding(key_copy_next, binding_name("copy_next"), copy_next)
209 | else
210 | hide_osd_ass()
211 | mp.remove_key_binding(binding_name("prev"))
212 | mp.remove_key_binding(binding_name("next"))
213 | mp.remove_key_binding(binding_name("decrease"))
214 | mp.remove_key_binding(binding_name("increase"))
215 | mp.remove_key_binding(binding_name("copy_prev"))
216 | mp.remove_key_binding(binding_name("copy_next"))
217 | end
218 | end
219 |
220 | mp.add_forced_key_binding(key_toggle_control, binding_name("toggle_control"), toggle_control)
--------------------------------------------------------------------------------
/scripts/easycrop.lua:
--------------------------------------------------------------------------------
1 | local msg = require('mp.msg')
2 | local assdraw = require('mp.assdraw')
3 |
4 | local script_name = "easycrop"
5 |
6 | -- Number of crop points currently chosen (0 to 2)
7 | local points = {}
8 | -- True if in cropping selection mode
9 | local cropping = false
10 | -- Original value of osc property
11 | local osc_prop = false
12 |
13 | -- Helper that converts two points to top-left and bottom-right
14 | local swizzle_points = function (p1, p2)
15 | if p1.x > p2.x then p1.x, p2.x = p2.x, p1.x end
16 | if p1.y > p2.y then p1.y, p2.y = p2.y, p1.y end
17 | end
18 |
19 | local clamp = function (val, min, max)
20 | assert(min <= max)
21 | if val < min then return min end
22 | if val > max then return max end
23 | return val
24 | end
25 |
26 | local video_space_from_screen_space = function (ssp)
27 | -- Video native dimensions and screen size
28 | local vid_w = mp.get_property("width")
29 | local vid_h = mp.get_property("height")
30 | local osd_w = mp.get_property("osd-width")
31 | local osd_h = mp.get_property("osd-height")
32 |
33 | -- Factor by which the video is scaled to fit the screen
34 | local scale = math.min(osd_w/vid_w, osd_h/vid_h)
35 |
36 | -- Size video takes up in screen
37 | local vid_sw, vid_sh = scale*vid_w, scale*vid_h
38 |
39 | -- Video offset within screen
40 | local off_x = math.floor((osd_w - vid_sw)/2)
41 | local off_y = math.floor((osd_h - vid_sh)/2)
42 |
43 | local vsp = {}
44 |
45 | -- Move the point to within the video
46 | vsp.x = clamp(ssp.x, off_x, off_x + vid_sw)
47 | vsp.y = clamp(ssp.y, off_y, off_y + vid_sh)
48 |
49 | -- Convert screen-space to video-space
50 | vsp.x = math.floor((vsp.x - off_x) / scale)
51 | vsp.y = math.floor((vsp.y - off_y) / scale)
52 |
53 | return vsp
54 | end
55 |
56 | local screen_space_from_video_space = function (vsp)
57 | -- Video native dimensions and screen size
58 | local vid_w = mp.get_property("width")
59 | local vid_h = mp.get_property("height")
60 | local osd_w = mp.get_property("osd-width")
61 | local osd_h = mp.get_property("osd-height")
62 |
63 | -- Factor by which the video is scaled to fit the screen
64 | local scale = math.min(osd_w/vid_w, osd_h/vid_h)
65 |
66 | -- Size video takes up in screen
67 | local vid_sw, vid_sh = scale*vid_w, scale*vid_h
68 |
69 | -- Video offset within screen
70 | local off_x = math.floor((osd_w - vid_sw)/2)
71 | local off_y = math.floor((osd_h - vid_sh)/2)
72 |
73 | local ssp = {}
74 | ssp.x = vsp.x * scale + off_x
75 | ssp.y = vsp.y * scale + off_y
76 | return ssp
77 | end
78 |
79 | -- Wrapper that converts RRGGBB / RRGGBBAA to ASS format
80 | local ass_set_color = function (idx, color)
81 | assert(color:len() == 8 or color:len() == 6)
82 | local ass = ""
83 |
84 | -- Set alpha value (if present)
85 | if color:len() == 8 then
86 | local alpha = 0xff - tonumber(color:sub(7, 8), 16)
87 | ass = ass .. string.format("\\%da&H%X&", idx, alpha)
88 | end
89 |
90 | -- Swizzle RGB to BGR and build ASS string
91 | color = color:sub(5, 6) .. color:sub(3, 4) .. color:sub(1, 2)
92 | return "{" .. ass .. string.format("\\%dc&H%s&", idx, color) .. "}"
93 | end
94 |
95 | local draw_rect = function (p1, p2)
96 | local osd_w, osd_h = mp.get_property("osd-width"), mp.get_property("osd-height")
97 |
98 | ass = assdraw.ass_new()
99 |
100 | -- Draw overlay over surrounding unselected region
101 |
102 | ass:draw_start()
103 | ass:pos(0, 0)
104 |
105 | ass:append(ass_set_color(1, "000000aa"))
106 | ass:append(ass_set_color(3, "00000000"))
107 |
108 | local l = math.min(p1.x, p2.x)
109 | local r = math.max(p1.x, p2.x)
110 | local u = math.min(p1.y, p2.y)
111 | local d = math.max(p1.y, p2.y)
112 |
113 | ass:rect_cw(0, 0, l, osd_h)
114 | ass:rect_cw(r, 0, osd_w, osd_h)
115 | ass:rect_cw(l, 0, r, u)
116 | ass:rect_cw(l, d, r, osd_h)
117 |
118 | ass:draw_stop()
119 |
120 | -- Draw border around selected region
121 |
122 | ass:new_event()
123 | ass:draw_start()
124 | ass:pos(0, 0)
125 |
126 | ass:append(ass_set_color(1, "00000000"))
127 | ass:append(ass_set_color(3, "000000ff"))
128 | ass:append("{\\bord2}")
129 |
130 | ass:rect_cw(p1.x, p1.y, p2.x, p2.y)
131 |
132 | ass:draw_stop()
133 |
134 | mp.set_osd_ass(osd_w, osd_h, ass.text)
135 | end
136 |
137 | local draw_fill = function ()
138 | local osd_w, osd_h = mp.get_property("osd-width"), mp.get_property("osd-height")
139 |
140 | ass = assdraw.ass_new()
141 | ass:draw_start()
142 | ass:pos(0, 0)
143 |
144 | ass:append(ass_set_color(1, "000000aa"))
145 | ass:append(ass_set_color(3, "00000000"))
146 | ass:rect_cw(0, 0, osd_w, osd_h)
147 |
148 | ass:draw_stop()
149 | mp.set_osd_ass(osd_w, osd_h, ass.text)
150 | end
151 |
152 | local draw_clear = function ()
153 | local osd_w, osd_h = mp.get_property("osd-width"), mp.get_property("osd-height")
154 | mp.set_osd_ass(osd_w, osd_h, "")
155 | end
156 |
157 | local draw_cropper = function ()
158 | if #points == 1 then
159 | local p1 = screen_space_from_video_space(points[1])
160 | local p2 = {}
161 | p2.x, p2.y = mp.get_mouse_pos()
162 | draw_rect(p1, p2)
163 | end
164 | end
165 |
166 | local uncrop = function ()
167 | mp.command("no-osd vf del @" .. script_name .. ":crop")
168 | end
169 |
170 | local crop = function(p1, p2)
171 | swizzle_points(p1, p2)
172 |
173 | local w = p2.x - p1.x
174 | local h = p2.y - p1.y
175 | local ok, err = mp.command(string.format(
176 | "no-osd vf add @%s:crop=%s:%s:%s:%s", script_name, w, h, p1.x, p1.y))
177 |
178 | if not ok then
179 | mp.osd_message("Cropping failed")
180 | points = {}
181 | end
182 | end
183 |
184 | local easycrop_stop = function ()
185 | mp.set_property("osc", osc_prop)
186 | cropping = false
187 | mp.remove_key_binding("easycrop_mouse_btn0")
188 | draw_clear()
189 | end
190 |
191 | local mouse_btn0_cb = function ()
192 | if not cropping then
193 | return
194 | end
195 |
196 | local mx, my = mp.get_mouse_pos()
197 | table.insert(points, video_space_from_screen_space({ x = mx, y = my }))
198 |
199 | if #points == 2 then
200 | crop(points[1], points[2])
201 | easycrop_stop()
202 | end
203 | end
204 |
205 | local easycrop_start = function ()
206 | -- Cropping requires swdec or hwdec with copy-back
207 | local hwdec = mp.get_property("hwdec-current")
208 | if hwdec == nil then
209 | return mp.msg.error("Cannot determine current hardware decoder mode")
210 | end
211 | -- Check whitelist of ok values
212 | local valid_hwdec = {
213 | ["no"] = true, -- software decoding
214 | -- Taken from mpv manual
215 | ["videotoolbox-co"] = true,
216 | ["vaapi-copy"] = true,
217 | ["dxva2-copy"] = true,
218 | ["d3d11va-copy"] = true,
219 | ["mediacodec"] = true
220 | }
221 | if not valid_hwdec[hwdec] then
222 | return mp.osd_message("Cropping requires swdec or hwdec with copy-back (see mpv manual)")
223 | end
224 |
225 | -- Just clear the current crop and return, if there is one
226 | if #points ~= 0 then
227 | uncrop()
228 | points = {}
229 | return
230 | end
231 |
232 | -- Hide OSC
233 | osc_prop = mp.get_property("osc")
234 | mp.set_property("osc", "no")
235 |
236 | cropping = true
237 | mp.add_forced_key_binding("mouse_btn0", "easycrop_mouse_btn0", mouse_btn0_cb)
238 | draw_fill()
239 | end
240 |
241 | local easycrop_activate = function ()
242 | if cropping then
243 | easycrop_stop()
244 | else
245 | easycrop_start()
246 | end
247 | end
248 |
249 | mp.add_key_binding("mouse_move", draw_cropper)
250 | mp.observe_property("osd-width", "native", draw_cropper)
251 | mp.observe_property("osd-height", "native", draw_cropper)
252 |
253 | mp.add_key_binding("k", "easycrop", easycrop_activate)
254 | mp.add_key_binding("K", "easycrop", easycrop_activate)
--------------------------------------------------------------------------------
/removed_conf/input.options:
--------------------------------------------------------------------------------
1 | # mpv keybindings
2 | #
3 | # Location of user-defined bindings: ~/.config/mpv/input.conf
4 | #
5 | # Lines starting with # are comments. Use SHARP to assign the # key.
6 | # Copy this file and uncomment and edit the bindings you want to change.
7 | #
8 | # List of commands and further details: DOCS/man/input.rst
9 | # List of special keys: --input-keylist
10 | # Keybindings testing mode: mpv --input-test --force-window --idle
11 | #
12 | # Use 'ignore to unbind a key fully
13 | #
14 | # Strings need to be quoted and escaped:
15 | # KEY show-text "This is a single backslash: \\ and a quote: \" !"
16 | #
17 | # You can use modifier-key combinations like Shift+Left or Ctrl+Alt+x with
18 | # the modifiers Shift, Ctrl, Alt and Meta (may not work on the terminal).
19 | #
20 | # The default keybindings are hardcoded into the mpv binary.
21 | # You can disable them completely with: --no-input-default-bindings
22 |
23 | # Developer note:
24 | # On compilation, this file is baked into the mpv binary, and all lines are
25 | # uncommented (unless '#' is followed by a space) - thus this file defines the
26 | # default key bindings.
27 |
28 | # If this is enabled, treat all the following bindings as default.
29 | # default-bindings start
30 |
31 | # MOUSE_BTN0 ignore # don't do anything
32 | # MOUSE_BTN0_DBL cycle fullscreen # toggle fullscreen on/off
33 | # MOUSE_BTN2 cycle pause # toggle pause on/off
34 | # MOUSE_BTN3 seek 10
35 | # MOUSE_BTN4 seek -10
36 | # MOUSE_BTN5 add volume -2
37 | # MOUSE_BTN6 add volume 2
38 |
39 | # Mouse wheels, touchpad or other input devices that have axes
40 | # if the input devices supports precise scrolling it will also scale the
41 | # numeric value accordingly
42 | # AXIS_UP seek 10
43 | # AXIS_DOWN seek -10
44 | # AXIS_LEFT seek 5
45 | # AXIS_RIGHT seek -5
46 |
47 | # Seek units are in seconds, but note that these are limited by keyframes
48 | # RIGHT seek 5
49 | # LEFT seek -5
50 | # UP seek 60
51 | # DOWN seek -60
52 | # Do smaller, always exact (non-keyframe-limited), seeks with shift.
53 | # Don't show them on the OSD (no-osd).
54 | # Shift+RIGHT no-osd seek 1 exact
55 | # Shift+LEFT no-osd seek -1 exact
56 | # Shift+UP no-osd seek 5 exact
57 | # Shift+DOWN no-osd seek -5 exact
58 | # Skip to previous/next subtitle (subject to some restrictions; see manpage)
59 | # Ctrl+LEFT no-osd sub-seek -1
60 | # Ctrl+RIGHT no-osd sub-seek 1
61 | # PGUP add chapter 1 # skip to next chapter
62 | # PGDWN add chapter -1 # skip to previous chapter
63 | # Shift+PGUP seek 600
64 | # Shift+PGDWN seek -600
65 | #[ multiply speed 0.9091 # scale playback speed
66 | #] multiply speed 1.1
67 | #{ multiply speed 0.5
68 | #} multiply speed 2.0
69 | #BS set speed 1.0 # reset speed to normal
70 | #q quit
71 | #Q quit-watch-later
72 | #q {encode} quit 4
73 | #ESC set fullscreen no
74 | #ESC {encode} quit 4
75 | #p cycle pause # toggle pause/playback mode
76 | #. frame-step # advance one frame and pause
77 | #, frame-back-step # go back by one frame and pause
78 | #SPACE cycle pause
79 | #> playlist-next # skip to next file
80 | #ENTER playlist-next # skip to next file
81 | #< playlist-prev # skip to previous file
82 | #O no-osd cycle_values osd-level 3 1 # cycle through OSD mode
83 | #o show-progress
84 | #P show-progress
85 | #I show-text "${filename}" # display filename in osd
86 | #z add sub-delay -0.1 # subtract 100 ms delay from subs
87 | #x add sub-delay +0.1 # add
88 | #ctrl++ add audio-delay 0.100 # this changes audio/video sync
89 | #ctrl+- add audio-delay -0.100
90 | #9 add volume -2
91 | #/ add volume -2
92 | #0 add volume 2
93 | #* add volume 2
94 | #m cycle mute
95 | #1 add contrast -1
96 | #2 add contrast 1
97 | #3 add brightness -1
98 | #4 add brightness 1
99 | #5 add gamma -1
100 | #6 add gamma 1
101 | #7 add saturation -1
102 | #8 add saturation 1
103 | #d cycle framedrop # cycle through framedrop modes
104 | # toggle deinterlacer (automatically inserts or removes required filter)
105 | #D cycle deinterlace
106 | #r add sub-pos -1 # move subtitles up
107 | #t add sub-pos +1 # down
108 | #v cycle sub-visibility
109 | # stretch SSA/ASS subtitles with anamorphic videos to match historical
110 | #V cycle ass-vsfilter-aspect-compat
111 | # switch between applying no style overrides to SSA/ASS subtitles, and
112 | # overriding them almost completely with the normal subtitle style
113 | #u cycle-values ass-style-override "force" "no"
114 | #j cycle sub # cycle through subtitles
115 | #J cycle sub down # ...backwards
116 | #SHARP cycle audio # switch audio streams
117 | #_ cycle video
118 | #T cycle ontop # toggle video window ontop of other windows
119 | #f cycle fullscreen # toggle fullscreen
120 | #s screenshot # take a screenshot
121 | #S screenshot video # ...without subtitles
122 | #Ctrl+s screenshot window # ...with subtitles and OSD, and scaled
123 | #Alt+s screenshot each-frame # automatically screenshot every frame
124 | #w add panscan -0.1 # zoom out with -panscan 0 -fs
125 | #e add panscan +0.1 # in
126 | # cycle video Video aspects; "-1" is the container aspect
127 | #A cycle-values video-aspect "16:9" "4:3" "2.35:1" "-1"
128 | #POWER quit
129 | #PLAY cycle pause
130 | #PAUSE cycle pause
131 | #PLAYPAUSE cycle pause
132 | #STOP quit
133 | #FORWARD seek 60
134 | #REWIND seek -60
135 | #NEXT playlist-next
136 | #PREV playlist-prev
137 | #VOLUME_UP add volume 2
138 | #VOLUME_DOWN add volume -2
139 | #MUTE cycle mute
140 | #CLOSE_WIN quit
141 | #CLOSE_WIN {encode} quit 4
142 | #E cycle edition # next edition
143 | #l ab_loop # Set/clear A-B loop points
144 | #L cycle-values loop "inf" "no" # toggle infinite looping
145 | #ctrl+c quit 4
146 |
147 | # Apple Remote section
148 | #AR_PLAY cycle pause
149 | #AR_PLAY_HOLD quit
150 | #AR_CENTER cycle pause
151 | #AR_CENTER_HOLD quit
152 | #AR_NEXT seek 10
153 | #AR_NEXT_HOLD seek 120
154 | #AR_PREV seek -10
155 | #AR_PREV_HOLD seek -120
156 | #AR_MENU show-progress
157 | #AR_MENU_HOLD cycle mute
158 | #AR_VUP add volume 2
159 | #AR_VUP_HOLD add chapter 1
160 | #AR_VDOWN add volume -2
161 | #AR_VDOWN_HOLD add chapter -1
162 |
163 | # For dvdnav:// and bdnav://
164 |
165 | # navigation controls during playback
166 | #ENTER {discnav} discnav menu # DISCNAV MENU
167 | # BS {discnav} discnav prev # DISCNAV PREVIOUS menu (in the order chapter->title->root)
168 | # navigation controls when showing menu (additionally to the controls above)
169 | #UP {discnav-menu} discnav up # DISCNAV UP
170 | #DOWN {discnav-menu} discnav down # DISCNAV DOWN
171 | #LEFT {discnav-menu} discnav left # DISCNAV LEFT
172 | #RIGHT {discnav-menu} discnav right # DISCNAV RIGHT
173 | #ENTER {discnav-menu} discnav select # DISCNAV SELECT (ok)
174 | #MOUSE_BTN0 {discnav-menu} discnav mouse
175 | #MOUSE_MOVE {discnav-menu} discnav mouse_move
176 |
177 | # For tv://
178 | #h cycle tv-channel -1 # previous channel
179 | #k cycle tv-channel +1 # next channel
180 |
181 | #
182 | # Legacy bindings (may or may not be removed in the future)
183 |
184 | #
185 | # Not assigned by default
186 | # (not an exhaustive list of unbound commands)
187 | #
188 |
189 | # ? add sub-scale +0.1 # increase subtitle font size
190 | # ? add sub-scale -0.1 # decrease subtitle font size
191 | # ? sub-step -1 # immediately display next subtitle
192 | # ? sub-step +1 # previous
193 | # ? cycle-values window-scale 0.5 2 1 # switch between 1/2, 2x, unresized window size
194 | # ? cycle colormatrix
195 | # ? add audio-delay 0.100 # this changes audio/video sync
196 | # ? add audio-delay -0.100
197 | # ? cycle angle # switch DVD/Bluray angle
198 | # ? cycle sub-forced-only # toggle DVD forced subs
199 | # ? cycle program # cycle transport stream programs
200 | # ? stop # stop playback (quit or enter idle mode)
--------------------------------------------------------------------------------
/mpv.conf:
--------------------------------------------------------------------------------
1 | # mpv configuration file by snad
2 | # https://github.com/thisisshihan/mpv-player-config-snad
3 |
4 |
5 | # player / window configuration
6 | # -----------------------------
7 | border=yes # Border at startup (default:yes)
8 | autofit-larger=90%x82% # resize window in case it's larger than W%xH% of the screen 100%x95%
9 | autofit-smaller=65%x65% # resize window in case it's smaller
10 | geometry=50%:50% # Window geometry (default:50%:50%)
11 | cursor-autohide-fs-only # don't autohide the cursor in window mode, only fullscreen
12 | input-media-keys=no # enable/disable OSX media keys
13 | cursor-autohide=5000 # autohide the curser after 1s
14 | ontop=no # always on top enable when open
15 | snap-window=yes
16 | prefetch-playlist=yes
17 | force-seekable=yes # Flag (default: no)
18 | framedrop=no
19 | # no-window-dragging # use for gestures.lua
20 | # fit-border=yes
21 |
22 |
23 | # autoload configuration
24 | # ----------------------
25 | autoload-files=yes # Flag (default: no)
26 | directory-mode=ignore # Flag , igonre will prevent from loading directories
27 | autocreate-playlist=filter # Flag
28 | directory-filter-types=video,audio # Flag