Skip to content

Instantly share code, notes, and snippets.

@mdizo
Last active February 29, 2024 08:31
Show Gist options
  • Save mdizo/fad84e1f1ca8632a57dc0474e825105c to your computer and use it in GitHub Desktop.
Save mdizo/fad84e1f1ca8632a57dc0474e825105c to your computer and use it in GitHub Desktop.
An opinionated mpv config for mid-tier computers @ 1440p
# MPV - mpv.conf
# mdizo - 2023-04-12
# Tested on shinchiro's mpv 0.35.0-356-g9a8b3170 | win10
# Config designed for Nvidia 1660 Super @ 1440p using high-quality 1080p media
# References ======================================================================================
# https://mpv.io/manual/stable/ - MPV User Manual
# https://github.com/stax76/awesome-mpv - All things MPV
# https://github.com/stax76/awesome-mpv#shaders - Shaders
# https://github.com/mpv-player/mpv/wiki/User-Scripts - Extend MPV functions
# https://github.com/haasn/interpolation-samples - MPV interpolation
# User Configs / Credit ===========================================================================
# https://iamscum.wordpress.com/guides/videoplayback-guide/mpv-conf/
# https://github.com/classicjazz/mpv-config
# https://github.com/Tsubajashi/mpv-settings
# https://kohana.fi/article/mpv-for-anime
# https://kokomins.wordpress.com/2019/10/14/mpv-config-guide/
# https://artoriuz.github.io/blog/mpv_upscaling.html
# Fonts ===========================================================================================
# https://github.com/tom10271/cooper-hewitt-fixed-for-windows - Cooper Hewitt
# https://rsms.me/inter/ - Inter
# Scripts I Use ===================================================================================
# https://github.com/joaquintorres/autosubsync-mpv - Automatic subtitle sync
# https://github.com/mpv-player/mpv/blob/master/TOOLS/lua/autoload.lua - Creates playlist of files
# https://github.com/po5/thumbfast - Seekbar thumbnails
# https://github.com/tomasklaen/uosc - Proximity-based mpv UI
# General =========================================================================================
keep-open=yes # Don't close the player after finishing the video
snap-window=yes # Snap to corners on Windows
cursor-autohide=100 # Cursor hide in ms
save-position-on-quit # Remember position when closing the player
autofit=85%x85% # Start mpv with a % smaller resolution of your screen
border=no # Disable if using third-party OSC scripts such as uosc
msg-module=yes # [Terminal] Prepend module name to each console message.
video-sync=display-resample # Makes video run synchronously to your display Hz
# OSC/OSD =========================================================================================
osc=no # 'no' required for uosc
osd-bar=no # uosc provides its own seeking/volume indicators
osd-font='Inter Tight Medium' # Set a font for OSC
osd-font-size=30 # Set a font size
osd-color='#CCFFFFFF' # ARGB format
osd-border-color='#DD322640' # ARGB format
osd-bar-align-y=-1 # progress bar y alignment (-1 top, 0 centered, 1 bottom)
osd-border-size=2 # size for osd text and progress bar
osd-bar-h=1 # height of osd bar as a fraction of your screen height
osd-bar-w=60 # width of " " "
# Subtitles =======================================================================================
slang=eng,en,und # Language priority for subtitles
sub-auto=fuzzy # Load external subtitles containing the name as the video
subs-with-matching-audio=no # Won't ignore subtitles tagged as "Forced"
#sub-gauss=0.6 # Make VOB/PGS subtitles less pixelated
#sub-gray # Turn VOB/PGS subtitles from yellow to gray
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
demuxer-mkv-subtitle-preroll=yes # Try to correctly show embedded subs when seeking
sub-fix-timing=no # Don't fix gaps (which might make it worse in some cases).
# Enable if there are scenebleeds.
# // Subtitle Styles
sub-font="Cooper Hewitt Medium" # Falls back to sans-serif if font is not found
sub-font-size=46 # Text size
sub-blur=0.3 # Gaussian blur factor, 0.0 to 20.0, affects border as well
sub-border-color=0.0/0.0/0.0/0.8 # R/G/B/Alpha border color
sub-border-size=3.2 # Border size
sub-color=0.9/0.9/0.9/1.0 # R/G/B/Alpha text color
sub-margin-x=100 # How long a line of text before breaking into new line
# Screenshots =====================================================================================
screenshot-template="%x\Screens\Screenshot-%F-T%wH.%wM.%wS.%wT-F%{estimated-frame-number}"
screenshot-format=png # Set screenshot format
screenshot-png-compression=4 # Range is 0 to 10. 0 being no compression.
screenshot-tag-colorspace=yes # Tag screenshots with the appropriate colorspace
screenshot-high-bit-depth=yes # Same output bitdepth as the video
# Audio ===========================================================================================
# // Dynamic range compression (DRC)
# Notes: In theory, turns quieter stuff louder and louder stuff quieter, example scenarios are
# close nieghbors or even out quiet dialogue. Can possibly lead to overall worse results
af="acompressor=ratio=4,loudnorm"
audio-stream-silence # Avoid audio popping on random seek
audio-file-auto=fuzzy # Load external audio with similar name as the video
audio-pitch-correction=yes # Insert scaletempo when playing with higher speed
alang=jpn,jp,eng,en,enUS,en-US # Language priority for audio
# Video ===========================================================================================
# // Video Output Driver
# Use "gpu" for a more stable output driver instead
# Keep in mind that some options won't work with "gpu"
# See: https://github.com/mpv-player/mpv/wiki/GPU-Next-vs-GPU
vo=gpu-next
# // GPU API
gpu-api=vulkan # Use "opengl" if you have compatibility issues.
# Hardware decoding for whatever your CPU/GPU supports (e.g. 8bit h264 / 10bit h265)
# Only should be used when your CPU/GPU are very old, else avoid using it
# Use "auto-copy-safe" for the safest result in trade of better performance
# Windows = "dxva2-copy" | Linux = "vaapi" / "vaapi-copy" | Nvidia = "nvdec" / "nvdec-copy"
hwdec=no
# Video ===========================================================================================
profile=gpu-hq # Lazy quality profile which sets some recommended settings
# All of the settings can be found further down in the guide
# Setting the profile is not needed, but it doesn't hurt.
# You can overwrite the settings without any issue
# Here is a list of the settings "gpu-hq" sets:
# * scale=spline36
# * cscale=spline36
# * dscale=mitchell
# * dither-depth=auto
# * correct-downscaling=yes
# * linear-downscaling=yes
# * sigmoid-upscaling=yes
# * deband=yes
# // Dither
dither-depth=auto # Falls back to 8 bit if output bit depth can't be detected
# // Deband
# Note: Set it to "no" if you rather handle it with profiles or a key (recommended)
# Debanding videos where it isn't needed can result in detail loss
# Recommended settings for anime:
# * 2:35:20:5 - General
# * 3:45:25:15 - Older DVD, badly mastered BD or WEB streams
# * 4:60:30:30 - Low quality streams or extreme loss of quality
deband=no # Activate debanding
deband-iterations=4 # Steps (More = Better quality, higher GPU cost)
deband-threshold=48 # Strength (More = Less banding, more detail loss)
deband-range=16 # Range (More = Less banding, higher GPU cost)
deband-grain=24 # Dynamic Grain (More = More dynamic grain)
# Set 0 if using static grain shader [Line 183]
# // Anti-Ringing
scale-antiring=0.7 # Luma upscale (Higher = Less ringing, more detail loss)
dscale-antiring=0.7 # Luma downscale (Higher = Less ringing, more detail loss)
cscale-antiring=0.7 # Chroma upscale (Higher = Less ringing, more detail loss)
# // Interpolation
# Note: See https://github.com/haasn/interpolation-samples for how interpolation should look in mpv
interpolation=no # Activate interpolation
# Note: From sharpest to smoothest [oversample, linear, catmull_rom, mitchell, gaussian, bicubic]
tscale=oversample # Interpolation method
# ! EXPERIMENTAL !
#tscale=sphinx
#tscale-blur=0.6991556596428412
# THIS OPTION HAS NO EFFECT WITH "vo=gpu"
interpolation-preserve=yes # Trade smoothness for performance,disables dynamic updates
# Shaders =========================================================================================
# See https://github.com/stax76/awesome-mpv#shaders to discover what shaders/scalers are available
# See https://github.com/bloc97/Anime4K/blob/master/md/GLSL_Instructions_Windows.md to have an idea
# on how to set up keybinds to make it easier when comparing different shaders
# Note: Choosing a shader comes down to personal taste and what you are willing to compromise.
# // Static Grain
# Note: If using static grain make sure to set deband-grain to 0 [Line 152]
#glsl-shader="~~/shaders/noise_static_luma.hook"
#glsl-shader="~~/shaders/noise_static_chroma.hook"
# Scaling =========================================================================================
# See https://artoriuz.github.io/blog/mpv_upscaling.html for a detailed comparison among scalers
# Note: If you have a 1440p monitor, some shaders such as FSRCNNX will only upscale at a certain
# threshold for 1080p media e.g for FSRCNNX, replace all instances of 1.400 with 1.300 in the glsl
#linear-downscaling=yes # Light downscaling method
linear-upscaling=yes # Light upscaling method
sigmoid-upscaling=yes # Creates less ringing and better results overall
correct-downscaling=yes # Extend filter size when downscaling with convolution
# filters. Increases quality, less performance.
# // Luma Up
# Note: ML based shaders e.g FSRCNNX, RAVU, nnedi3 are best for accuracy but requires more compute
# power where as generic algorithms e.g FSR/Nvidia aims to provide satisfying results with far less
# resources. FSR/Nvidia sharpness and other params can be adjusted by editing the glsl file itself
#glsl-shader="~~/shaders/FSRCNNX_x2_16-0-4-1.glsl" # Most accurate, diminishing returns
#glsl-shader="~~/shaders/FSRCNNX_x2_8-0-4-1.glsl" # Generally accurate, high gpu consumption
glsl-shader="~~/shaders/FSR.glsl" # Great perceived quality w/ sharpener
# // Luma Down
# Note: If downscaling factor is >= 2x (e.g 4k to 1080p) use SSIMDownscaler w/ dscale=mitchell
#glsl-shader="~~/shaders/SSimDownscaler.glsl"
linear-downscaling=no
dscale=lanczos # mitchell = anti-ringing, lanczos = perceived sharpness
# // Chroma Up + Down
# Note: Chroma subsampling means that chroma information is encoded at lower resolution than luma
# In MPV, chroma is upscaled to luma resolution (video size) and then the converted RGB is upscaled
# to target resolution (screen size).
# Perceived quality is negligible so only use a heavy scaler if you don't mind the performance cost
# for ultimate quality. I use lanczos here because sigmoid-upscaling theoretically dampens ringing
# artifacts when upscaling video and I mainly consume 1080p content
#glsl-shader="~~/shaders/KrigBilateral.glsl"
cscale=lanczos # mitchell = anti-ringing, lanczos = perceived sharpness
Copy link

ghost commented Apr 16, 2023

Hi, why you don't use Anime4K ?

@mdizo
Copy link
Author

mdizo commented Apr 16, 2023

Hi, why you don't use Anime4K ?

I do like Anime4K but I also watch live action media so I'd rather just stick with the one shader to cover everything instead of switching between profiles. In this case I picked FSR because it also has a sharpening filter which helps make the lines more defined without overemphasizing it. Looks good enough to me anyways.

Ultimately, picking a shader is a personal thing so choose one based on what works for you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment