Add initial configs

This commit is contained in:
2026-05-25 00:32:00 +03:00
parent 18fe98a122
commit bc1c135526
34 changed files with 1330 additions and 0 deletions
Binary file not shown.
+10
View File
@@ -0,0 +1,10 @@
ESC ignore
ALT+k add sub-scale +0.02
ALT+j add sub-scale -0.02
KP3 add chapter -1
KP9 add chapter 1
WHEEL_UP add volume 5
WHEEL_DOWN add volume -5
+229
View File
@@ -0,0 +1,229 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Quality
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
profile=gpu-hq
# Hardware decoding
vo=gpu
hwdec=auto-safe
# Scaling
scale=ewa_lanczossharp
cscale=ewa_lanczossharp
dscale=mitchell
# Deband
deband=yes
# Range 1-16. Higher = better quality but more GPU usage. >5 is redundant.
deband-iterations=1
# Range 0-4096. Deband strength.
deband-threshold=35
# Range 1-64. Range of deband. Too high may destroy details.
deband-range=20
# Range 0-4096. Inject grain to cover up bad banding, higher value needed for poor sources.
deband-grain=5
# Interpolation
interpolation=no
video-sync=display-resample
blend-subtitles=yes
# Dithering
dither-depth=auto
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Interface
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Force starting with centered window
geometry=50%:50%
# Restrict window's size
autofit-larger=75%
# Make window at least this size
autofit-smaller=50%
# Always open window (maximum GUI)
force-window=immediate
# Disable window border
border=no
# Disable progress indicator in the taskbar
taskbar-progress=no
# Window title
title='${filename} - mpv'
# Don't close the player + don't advance to the next file on finish
keep-open=always
# Don't pause on finish
keep-open-pause=no
# Reset some settings on next file
reset-on-next-file=pause
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# OSD
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Custom status message
osd-status-msg='${time-pos} / ${duration}${?percent-pos: (${percent-pos}%)}\n${?chapter:Chapter: ${chapter}} (${chapter-list/count})'
# Show ms in the console
osd-fractions
# Status message font
osd-font="Gordita Medium"
osd-font-size=30
osd-color="#ffffff"
osd-border-size=2.0
osd-border-color="#262626"
# Interval of the osd disappearing (ms)
osd-duration=500
# Don't scale OSD according to the window size
osd-scale-by-window=no
# Don't show the bar
no-osd-bar
# Less annoying OSD bar on seeking
osd-on-seek=msg-bar
# Hide the cursor in 500 ms
cursor-autohide=500
# Prepend module name to log messages
msg-module
# Color log messages on terminal
msg-color
# Display a progress bar on the terminal
term-osd-bar
# Disable not important log messages
msg-level=input=error,demux=error
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Language
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Audio priority
alang=Japanese,jap,jpn,jp,ja,English,en,eng,Russian,rus,ru
# Subtitles priority
slang=English,eng,en,Russian,rus,ru
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Audio
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Volume
volume=100
volume-max=100
# Correct pitch when changing the playback speed
audio-pitch-correction=yes
# Load external audio tracks automatically
audio-file-auto=fuzzy
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Subtitles
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Load external subtitle tracks automatically
sub-auto=fuzzy
sub-file-paths=Sub;Subs;Subtitles
# Subtitles encoding
# sub-codepage=cp1251
# Forces showing subtitles while seeking through the video
demuxer-mkv-subtitle-preroll=yes
# Backward compatibility for vsfilter fansubs
sub-ass-vsfilter-blur-compat=yes
# Fixes subtitle timing for gaps smaller than 210ms (works with PGS subtitles)
sub-fix-timing=yes
# ASS subtitles override
sub-ass-force-margins=yes
sub-ass-force-style=kerning=yes
sub-ass-override=force
# Disable ligatures
sub-ass-shaper=simple
# Subtitles style
sub-font="Verdana"
sub-font-size=36
sub-color="#E6FFFFFF"
sub-border-size = 2.5
sub-border-color="#D21C1C1C"
sub-margin-x=100
sub-margin-y=50
sub-shadow-color=0.0/0.0/0.0/0.25
sub-shadow-offset=0
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Screenshots
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Output format
screenshot-format=png
# Better quality
screenshot-high-bit-depth=yes
screenshot-tag-colorspace=yes
# Compression of PNG pictures (1-9)
screenshot-png-compression=5
# Output directory
screenshot-directory="~/Pictures/Screenshots"
# Name format to save the screenshots
screenshot-template="%f-%wH.%wM.%wS.%wT-#%#00n"
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Streaming
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[protocol.http]
# Display media title instead of the URL
title='${media-title}'
osd-playing-msg='${media-title}'
# Cache
demuxer-max-bytes=150000000 # 150 MB
demuxer-max-back-bytes=75000000 # 75 MB
demuxer-seekable-cache=yes
force-seekable=yes
# youtube-dl default format
ytdl-format=((bestvideo[vcodec=vp9][height<=?1080]/bestvideo)+(bestaudio[acodec=opus]/bestaudio))/best
# UA (the most common chrome)
user-agent='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.121 Safari/537.36'
# Automatically advance in the playlist
keep-open=yes
# Turn off dither and deband
dither=no
deband=no
[protocol.https]
profile=protocol.http
[protocol.ytdl]
profile=protocol.http
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# File-specific
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# WebMs
[extension.webm]
loop-file=yes
# Animated gif
[extension.gif]
loop-file=yes
# Audio files
[extension.mp3]
autofit-larger=30%
script-opts=osc-layout=box,osc-visibility=always,osc-scalewindowed=2
keep-open=yes
[extension.flac]
profile=extension.mp3
[extension.opus]
profile=extension.mp3
[extension.m4a]
profile=extension.mp3
+4
View File
@@ -0,0 +1,4 @@
disabled=no
images=no
videos=yes
audio=yes
+9
View File
@@ -0,0 +1,9 @@
layout=bottombar
title=${media-title}
hidetimeout=500
fadeduration=0
vidscale=no
# Show OSC only when hovered directly
deadzonesize=1
minmousemove=1
+2
View File
@@ -0,0 +1,2 @@
duration=2
font_size=7
+155
View File
@@ -0,0 +1,155 @@
-- This script adds control to the dynamic range compression ffmpeg
-- filter including key bindings for adjusting parameters.
--
-- See https://ffmpeg.org/ffmpeg-filters.html#acompressor for explanation
-- of the parameteres.
local mp = require 'mp'
local options = require 'mp.options'
local o = {
default_enable = false,
show_osd = true,
osd_timeout = 4000,
filter_label = mp.get_script_name(),
key_toggle = 'n',
key_increase_threshold = 'F1',
key_decrease_threshold = 'Shift+F1',
key_increase_ratio = 'F2',
key_decrease_ratio = 'Shift+F2',
key_increase_knee = 'F3',
key_decrease_knee = 'Shift+F3',
key_increase_makeup = 'F4',
key_decrease_makeup = 'Shift+F4',
key_increase_attack = 'F5',
key_decrease_attack = 'Shift+F5',
key_increase_release = 'F6',
key_decrease_release = 'Shift+F6',
default_threshold = -25.0,
default_ratio = 3.0,
default_knee = 2.0,
default_makeup = 8.0,
default_attack = 20.0,
default_release = 250.0,
step_threshold = -2.5,
step_ratio = 1.0,
step_knee = 1.0,
step_makeup = 1.0,
step_attack = 10.0,
step_release = 10.0,
}
options.read_options(o)
local params = {
{ name = 'attack', min=0.01, max=2000, hide_default=true, dB='' },
{ name = 'release', min=0.01, max=9000, hide_default=true, dB='' },
{ name = 'threshold', min= -30, max= 0, hide_default=false, dB='dB' },
{ name = 'ratio', min= 1, max= 20, hide_default=false, dB='' },
{ name = 'knee', min= 1, max= 10, hide_default=true, dB='dB' },
{ name = 'makeup', min= 0, max= 24, hide_default=false, dB='dB' },
}
local function parse_value(value)
-- Using nil here because tonumber differs between lua 5.1 and 5.2 when parsing fractions in combination with explicit base argument set to 10.
-- And we can't omit it because gsub returns 2 values which would get unpacked and cause more problems. Gotta love scripting languages.
return tonumber(value:gsub('dB$', ''), nil)
end
local function format_value(value, dB)
return string.format('%g%s', value, dB)
end
local function show_osd(filter)
if not o.show_osd then
return
end
if not filter.enabled then
mp.commandv('show-text', 'Dynamic range compressor: disabled', o.osd_timeout)
return
end
local pretty = {}
for _,param in ipairs(params) do
local value = parse_value(filter.params[param.name])
if not (param.hide_default and value == o['default_' .. param.name]) then
pretty[#pretty+1] = string.format('%s: %g%s', param.name:gsub("^%l", string.upper), value, param.dB)
end
end
if #pretty == 0 then
pretty = ''
else
pretty = '\n(' .. table.concat(pretty, ', ') .. ')'
end
mp.commandv('show-text', 'Dynamic range compressor: enabled' .. pretty, o.osd_timeout)
end
local function get_filter()
local af = mp.get_property_native('af', {})
for i = 1, #af do
if af[i].label == o.filter_label then
return af, i
end
end
af[#af+1] = {
name = 'acompressor',
label = o.filter_label,
enabled = false,
params = {},
}
for _,param in pairs(params) do
af[#af].params[param.name] = format_value(o['default_' .. param.name], param.dB)
end
return af, #af
end
local function toggle_acompressor()
local af, i = get_filter()
af[i].enabled = not af[i].enabled
mp.set_property_native('af', af)
show_osd(af[i])
end
local function update_param(name, increment)
for _,param in pairs(params) do
if param.name == string.lower(name) then
local af, i = get_filter()
local value = parse_value(af[i].params[param.name])
value = math.max(param.min, math.min(value + increment, param.max))
af[i].params[param.name] = format_value(value, param.dB)
af[i].enabled = true
mp.set_property_native('af', af)
show_osd(af[i])
return
end
end
mp.msg.error('Unknown parameter "' .. name .. '"')
end
mp.add_key_binding(o.key_toggle, "toggle-acompressor", toggle_acompressor)
mp.register_script_message('update-param', update_param)
for _,param in pairs(params) do
for direction,step in pairs({increase=1, decrease=-1}) do
mp.add_key_binding(o['key_' .. direction .. '_' .. param.name],
'acompressor-' .. direction .. '-' .. param.name,
function() update_param(param.name, step*o['step_' .. param.name]); end,
{ repeatable = true })
end
end
if o.default_enable then
local af, i = get_filter()
af[i].enabled = true
mp.set_property_native('af', af)
end
+220
View File
@@ -0,0 +1,220 @@
-- This script automatically loads playlist entries before and after the
-- the currently played file. It does so by scanning the directory a file is
-- located in when starting playback. It sorts the directory entries
-- alphabetically, and adds entries before and after the current file to
-- the internal playlist. (It stops if it would add an already existing
-- playlist entry at the same position - this makes it "stable".)
-- Add at most 5000 * 2 files when starting a file (before + after).
--[[
To configure this script use file autoload.conf in directory script-opts (the "script-opts"
directory must be in the mpv configuration directory, typically ~/.config/mpv/).
Example configuration would be:
disabled=no
images=no
videos=yes
audio=yes
--]]
MAXENTRIES = 5000
local msg = require 'mp.msg'
local options = require 'mp.options'
local utils = require 'mp.utils'
o = {
disabled = false,
images = true,
videos = true,
audio = true
}
options.read_options(o)
function Set (t)
local set = {}
for _, v in pairs(t) do set[v] = true end
return set
end
function SetUnion (a,b)
local res = {}
for k in pairs(a) do res[k] = true end
for k in pairs(b) do res[k] = true end
return res
end
EXTENSIONS_VIDEO = Set {
'mkv', 'avi', 'mp4', 'ogv', 'webm', 'rmvb', 'flv', 'wmv', 'mpeg', 'mpg', 'm4v', '3gp'
}
EXTENSIONS_AUDIO = Set {
'mp3', 'wav', 'ogm', 'flac', 'm4a', 'wma', 'ogg', 'opus'
}
EXTENSIONS_IMAGES = Set {
'jpg', 'jpeg', 'png', 'tif', 'tiff', 'gif', 'webp', 'svg', 'bmp'
}
EXTENSIONS = Set {}
if o.videos then EXTENSIONS = SetUnion(EXTENSIONS, EXTENSIONS_VIDEO) end
if o.audio then EXTENSIONS = SetUnion(EXTENSIONS, EXTENSIONS_AUDIO) end
if o.images then EXTENSIONS = SetUnion(EXTENSIONS, EXTENSIONS_IMAGES) end
function add_files_at(index, files)
index = index - 1
local oldcount = mp.get_property_number("playlist-count", 1)
for i = 1, #files do
mp.commandv("loadfile", files[i], "append")
mp.commandv("playlist-move", oldcount + i - 1, index + i - 1)
end
end
function get_extension(path)
match = string.match(path, "%.([^%.]+)$" )
if match == nil then
return "nomatch"
else
return match
end
end
table.filter = function(t, iter)
for i = #t, 1, -1 do
if not iter(t[i]) then
table.remove(t, i)
end
end
end
-- splitbynum and alnumcomp from alphanum.lua (C) Andre Bogus
-- Released under the MIT License
-- http://www.davekoelle.com/files/alphanum.lua
-- split a string into a table of number and string values
function splitbynum(s)
local result = {}
for x, y in (s or ""):gmatch("(%d*)(%D*)") do
if x ~= "" then table.insert(result, tonumber(x)) end
if y ~= "" then table.insert(result, y) end
end
return result
end
function clean_key(k)
k = (' '..k..' '):gsub("%s+", " "):sub(2, -2):lower()
return splitbynum(k)
end
-- compare two strings
function alnumcomp(x, y)
local xt, yt = clean_key(x), clean_key(y)
for i = 1, math.min(#xt, #yt) do
local xe, ye = xt[i], yt[i]
if type(xe) == "string" then ye = tostring(ye)
elseif type(ye) == "string" then xe = tostring(xe) end
if xe ~= ye then return xe < ye end
end
return #xt < #yt
end
local autoloaded = nil
function find_and_add_entries()
local path = mp.get_property("path", "")
local dir, filename = utils.split_path(path)
msg.trace(("dir: %s, filename: %s"):format(dir, filename))
if o.disabled then
msg.verbose("stopping: autoload disabled")
return
elseif #dir == 0 then
msg.verbose("stopping: not a local path")
return
end
local pl_count = mp.get_property_number("playlist-count", 1)
-- check if this is a manually made playlist
if (pl_count > 1 and autoloaded == nil) or
(pl_count == 1 and EXTENSIONS[string.lower(get_extension(filename))] == nil) then
msg.verbose("stopping: manually made playlist")
return
else
autoloaded = true
end
local pl = mp.get_property_native("playlist", {})
local pl_current = mp.get_property_number("playlist-pos-1", 1)
msg.trace(("playlist-pos-1: %s, playlist: %s"):format(pl_current,
utils.to_string(pl)))
local files = utils.readdir(dir, "files")
if files == nil then
msg.verbose("no other files in directory")
return
end
table.filter(files, function (v, k)
if string.match(v, "^%.") then
return false
end
local ext = get_extension(v)
if ext == nil then
return false
end
return EXTENSIONS[string.lower(ext)]
end)
table.sort(files, alnumcomp)
if dir == "." then
dir = ""
end
-- Find the current pl entry (dir+"/"+filename) in the sorted dir list
local current
for i = 1, #files do
if files[i] == filename then
current = i
break
end
end
if current == nil then
return
end
msg.trace("current file position in files: "..current)
local append = {[-1] = {}, [1] = {}}
for direction = -1, 1, 2 do -- 2 iterations, with direction = -1 and +1
for i = 1, MAXENTRIES do
local file = files[current + i * direction]
local pl_e = pl[pl_current + i * direction]
if file == nil or file[1] == "." then
break
end
local filepath = dir .. file
if pl_e then
-- If there's a playlist entry, and it's the same file, stop.
msg.trace(pl_e.filename.." == "..filepath.." ?")
if pl_e.filename == filepath then
break
end
end
if direction == -1 then
if pl_current == 1 then -- never add additional entries in the middle
msg.info("Prepending " .. file)
table.insert(append[-1], 1, filepath)
end
else
msg.info("Adding " .. file)
table.insert(append[1], filepath)
end
end
end
add_files_at(pl_current + 1, append[1])
add_files_at(pl_current, append[-1])
end
mp.register_event("start-file", find_and_add_entries)
@@ -0,0 +1,3 @@
mp.add_hook('on_load', 10, function ()
mp.set_property('sub-file-paths', 'Subs/' .. mp.get_property('filename/no-ext'))
end)