Skip to content

Instantly share code, notes, and snippets.

@B1-Bloom
Created June 27, 2024 17:38
Show Gist options
  • Save B1-Bloom/5b0d78eedb1df9434afb461b1883da1e to your computer and use it in GitHub Desktop.
Save B1-Bloom/5b0d78eedb1df9434afb461b1883da1e to your computer and use it in GitHub Desktop.
Mpv config
# vim: syntax=config
# +--+ | +------+
###########
# General # +--+ | +------+
###########
# +--+ | +------+
[default]
# input-ipc-server=/tmp/mpvsocket # listen for IPC on this socket
save-position-on-quit # handled by a script
loop-playlist=inf
video-output-levels=full
# load-stats-overlay=yes # use local stats.lua
force-seekable=yes
# +--+ | +------+
# no-border # no window title bar
# osd-bar=yes # Do not remove/comment if mpv_thumbnail_script_client_osc.lua is being used.
# msg-module # prepend module name to log messages
# msg-color # color log messages on terminal
# term-osd-bar # display a progress bar on the terminal
# term-osd-bar-chars='[━━ ]'
use-filedir-conf # look for additional config files in the directory of the opened file
# pause # no autoplay
keep-open # keep the player open when a file's end is reached
cursor-autohide-fs-only # don't autohide the cursor in window mode, only fullscreen
input-media-keys=yes # enable/disable OSX media keys
cursor-autohide=1000 # autohide the curser after 1s
prefetch-playlist=yes
# osd-on-seek=msg-bar
# seekbarstyle=bar
autofit-larger=70%x65% # resize window in case it's larger than W%xH% of the screen
autofit-larger=100%x95% # resize window in case it's larger than W%xH% of the screen
af=rubberband # Set audio filter(af) to be rubberband, makes 2x speed audio better (requires --with-rubberband with hommebrew)
# +--+ | +------+
screenshot-format=png
screenshot-png-compression=8
screenshot-template='/Users/d3-doom/Documents/Screen/Film-Screen/%F (%P) %n'
screenshot-directory='/Users/d3-doom/Documents/Screen/Film-Screen'
screenshot-tag-colorspace=yes
screenshot-high-bit-depth=yes # Same output bitdepth as the video
# +--+ | +------+
hls-bitrate=max # use max quality for HLS streams
ytdl-format=bestvideo[height<=?1080][fps<=?30][vcodec!=?vp9][protocol!=http_dash_segments]+bestaudio/best #[protocol!=http_dash_segments][protocol!=rtmp]
# +--+ | +------+
#
# [ytdl-desktop]
# profile-desc=cond:dedicated_gpu()
# ytdl-format=bestvideo[height<=?2160]+bestaudio/best
# +--+ | +------+
# [ytdl-laptop]
# profile-desc=cond:not dedicated_gpu()
# ytdl-format=bestvideo[height<=?1080][fps<=?30][vcodec!=?vp9][protocol!=http_dash_segments]+bestaudio/best
#########
# Cache # +--+ | +------+
#########
cache=yes
demuxer-readahead-secs=300
# demuxer-max-bytes=400MiB
# demuxer-max-back-bytes=150MiB
demuxer-max-back-bytes=20M # sets fast seeking
demuxer-max-bytes=20M # sets fast seeking
#
prefetch-playlist=yes # prefetches the playlist
snap-window=yes # Enables windows snapping for Windows 10, 11
priority=high # Makes PC prioritize MPV for allocating resources
# +--+ | +------+
#############
# OSD / OSC # +--+ | +------+
#############
# +--+ | +------+
osc=yes # display a progress bar on the terminal
osd-level=1 # enable osd and display --osd-status-msg on interaction
osd-on-seek=msg-bar
osd-bar=yes # Do not remove/comment if mpv_thumbnail_script_client_osc.lua is being used.
term-osd-bar # display a progress bar on the terminal
# term-osd-bar-chars='[━━ ]'
# +--+ | +------+
osd-duration=1500 # hide the osd after x ms
osd-status-msg='${time-pos} / ${duration}${?percent-pos: (${percent-pos}%)}${?frame-drop-count:${!frame-drop-count==0: Dropped: ${frame-drop-count}}}\n${?chapter:Chapter: ${chapter}}'
# +--+ | +------+
osd-scale-by-window=yes # Whether to scale the OSD with the window size
osd-font='Source Sans 3'
osd-font-size=32
osd-color='#CCFFFFFF' # ARGB format
osd-border-color='#DD322640' # ARGB format
osd-bar-align-y=0 # progress bar y alignment (-1 top, 0 centered, 1 bottom)
osd-border-size=1 # size for osd text and progress bar
osd-bar-h=2 # height of osd bar as a fractional percentage of your screen height
osd-bar-w=70 # width of " " "
osd-shadow-offset=1 # pixel width for osd text and progress bar
# +--+ | +------+
msg-module # prepend module name to log messages
msg-color
#############
# Subtitles # +--+ | +------+
#############
demuxer-mkv-subtitle-preroll=yes # try to show embedded subs when seeking even when no index information is present
demuxer-mkv-subtitle-preroll-secs=2
# +--+ | +------+
sub-ass-vsfilter-blur-compat=yes # Backward compatibility for vsfilter fansubs
sub-ass-scale-with-window=no # May have undesired effects with signs being misplaced.
# +--+ | +------+
sub-auto=fuzzy # external subs don't have to match the file name exactly to autoload
sub-file-paths-append=ass # search for external subs in these relative subdirectories
sub-file-paths-append=srt
sub-file-paths-append=sub
sub-file-paths-append=subs
sub-file-paths-append=subtitles
# +--+ | +------+
embeddedfonts=yes # use embedded fonts for SSA/ASS subs
sub-fix-timing=no # do not try to fix gaps (which might make it worse in some cases)
sub-ass-force-style=Kerning=yes # allows you to override style parameters of ASS scripts
sub-use-margins
sub-ass-force-margins
# +--+ | +------+
sub-file-paths-append='Subs/${filename/no-ext}' # search for external subs in these relative subdirectories
sub-file-paths-append='Subs/${filename}'
sub-file-paths-append='subs/${filename/no-ext}'
sub-file-paths-append='subs/${filename}'
sub-file-paths-append=ASS
sub-file-paths-append=Ass
sub-file-paths-append=SRT
sub-file-paths-append=Srt
sub-file-paths-append=Sub
sub-file-paths-append=Subs
sub-file-paths-append=Subtitles
sub-file-paths-append=ass
sub-file-paths-append=srt
sub-file-paths-append=sub
sub-file-paths-append=subs
sub-file-paths-append=subtitles
# the following options only apply to subtitles without own styling (i.e. not ASS but e.g. SRT)
sub-font="Source Sans 3 Semibold"
sub-font-size=36
sub-color="#FFFFFFFF"
sub-border-color="#FF262626"
sub-border-size=3.2
sub-shadow-offset=1
sub-shadow-color="#33000000"
sub-spacing=0.5
# +--+ | +------+
#############
# Languages # +--+ | +------+
#############
slang=en,enm,eng,de,deu,ger # automatically select these subtitles (decreasing priority)
alang=ja,jp,jpn,en,eng,de,deu,ger # automatically select these audio tracks (decreasing priority)
# +--+ | +------+
#########
# Audio # +--+ | +------+
#########
ao=coreaudio
# audio-stream-silence # fix audio popping on random seek
audio-file-auto=fuzzy # external audio doesn't has to match the file name exactly to autoload
audio-pitch-correction=yes # automatically insert scaletempo when playing with higher speed
volume-max=200 # maximum volume in %, everything above 100 results in amplification
volume=100 # default volume, 100 = unchanged
# +--+ | +------+
################
# Video Output # +--+ | +------+
################
# +--+ | +------+
#
# Active VO options are set conditionally and require my slightly modified `scripts/auto-profiles.lua` as well as `scripts/auto-profiles-functions.lua`.
#
# More information about auto-profiles in general: https://github.com/wiiaboo/mpv-scripts/blob/master/auto-profiles.lua
# on_battery() and dedicated_gpu() are my own functions in `scripts/auto-profiles-functions.lua` and might need to be adjusted for your system/setup.
#
# +--+ | +------+ | Defaults for all profiles
# NOTE: [sharp] oversample <-> linear (triangle) <-> catmull_rom <-> mitchell <-> gaussian <-> bicubic [smooth]
tscale=oversample
opengl-early-flush=auto
# NOTE: "yes" is currently bugged: https://github.com/mpv-player/mpv/issues/4988
# opengl-pbo=no
# icc-profile-auto
# NOTE: silence some warning because the profile is bad
# icc-contrast=1000
hwdec=yes-safe
hwdec-codecs=all
# +--+ | +------+
target-trc=bt.1886
# saturation=26
# +--+ | +------+
# [high-quality]
# +--+ | +------+
profile-desc=cond:is_high(get('width', 0), get('height', 0), get('estimated-vf-fps', 0))
# NOTE: hanning with this radius is broken on OSX due to OpenGL driver bug
#scale=ewa_hanning
#scale-radius=3.2383154841662362
# +--+ | +------+
scale=ewa_lanczossharp
cscale=ewa_lanczossoft
dscale=mitchell
scale-antiring=0
cscale-antiring=0
dither-depth=auto
correct-downscaling=yes
sigmoid-upscaling=yes
deband=yes
# +--+ | +------+
# glsl-shaders-append="~/.mpv/shaders/KrigBilateral.glsl"
glsl-shaders-append="~/.mpv/shaders/ravu-lite-r4.hook"
glsl-shaders-append="~/.mpv/shaders/ravu-lite-r4.hook"
glsl-shaders-append="~/.mpv/shaders/ravu-lite-r4.hook"
# +--+ | +------+
#
[mid-quality]
profile-desc=cond:is_mid(get('width', 0), get('height', 0), get('estimated-vf-fps', 0))
scale=spline36
cscale=bicubic
dscale=mitchell
scale-antiring=1.0
cscale-antiring=1.0
dither-depth=auto
correct-downscaling=yes
sigmoid-upscaling=yes
deband=yes
glsl-shaders-set=""
# +--+ | +------+
[low-quality]
profile-desc=cond:is_low(get('width', 0), get('height', 0), get('estimated-vf-fps', 0))
scale=bilinear
cscale=bilinear
dscale=bilinear
scale-antiring=0
cscale-antiring=0
dither-depth=no
correct-downscaling=no
sigmoid-upscaling=no
deband=no
glsl-shaders-set=""
# # +--+ | +------+
[4K-lavc-threads]
profile-desc=cond:get('width', -math.huge) >= 3840
vd-lavc-threads=32
# +--+ | +------+
[4K-lavc-threads-inverted]
profile-desc=cond:get('width', math.huge) < 3840
vd-lavc-threads=0
# +--+ | +------+
#################
# Interpolation # +--+ | +------+ | [<sharp>, ..., <smooth>]
#################
# +--+ | [oversample, linear (triangle), catmull_rom, mitchell, gaussian, bicubic], [spline36, robidoux, robidouxsharp]
# +--+ | +------+ | interpolation
interpolation=yes
# +--+ | +------+ |
tscale=mitchell
# tscale=oversample
opengl-early-flush=no
opengl-pbo=no
icc-profile-auto
icc-contrast=1000
# hwdec=yes
tscale-antiring=0.608
tscale-clamp=1
video-sync=display-resample
# +--+ | +------+ NNEDI SETTINGS
# backend=dxinterop
# prescale=nnedi3
# prescale-passes=1
# nnedi3-neurons=128
# nnedi3-window=8x6
# blend-subtitles=yes
# target-prim=bt.709
# +--+ | +------+
#############
# Upscaling # +--+ | +------+ | see: https://github.com/mpv-player/mpv/wiki/Upscaling
#############
# [bilinear, lanczos, mitchell, spline16, spline36, spline64, ewa_lanczos (:scale-radius=float),
# ewa_lanczossharp, ewa_lanczossoft, robidoux, robidouxsharp, ewa_ginseng, ewa_hanning, bicubic,
# gaussian, catmull_rom, nearest, oversample, sharpen3, sharpen5, sinc:scale-radius=R]
# +--+ | +------+
scale=spline36
cscale=ewa_lanczossoft
# cscale=bicubic
# cscale-radius=10
# +--+ | +------+ |
dscale=catmull_rom
scale-antiring=0.0
cscale-antiring=0.0
dither-depth=auto
dither-depth=no
correct-downscaling=yes
sigmoid-upscaling=yes
deband=no
deband-grain=36
deband-range=12
deband-threshold=32
# +--+ | +------+
# hwdec=auto
# hwdec=no
# hwdec=auto-copy
# +--+ | +------+ tweak interpolation
# no-correct-pts
# display-fps=59.934
# display-fps=59.94
# fps=23.976
# +--+ | +------+ vapoursynth options
# hwdec-codecs=all
input-ipc-server=/tmp/mpvsocket
hr-seek-framedrop=no
# no-resume-playback
# +--+ | +------+
[extension.gif]
profile-desc=GIF
cache=no
no-pause
# loop-file=yes
[extension.png]
profile-desc=PNG
video-aspect-override=no
# loop-file=yes
[extension.jpg]
profile-desc=JPG
video-aspect-override=no
# loop-file=yes
[extension.jpeg]
profile-desc=JPEG
profile=extension.jpg
# loop-file=yes
###################################
# Protocol Specific Configuration # +--+ | +------+
###################################
[protocol.https]
cache=yes
user-agent='Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:57.0) Gecko/20100101 Firefox/58.0'
# +--+ | +------+
[protocol.http]
cache=yes
user-agent='Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:57.0) Gecko/20100101 Firefox/58.0'
# +--+ | +------+
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment