mpv for anime


Opinionated settings (and some scripts) I've found to be great for anime with mpv. Surpassing the image quality of madvr (MPC-HC/NGU algorithm).

# TL;DR / Quick Guide

  1. Install mpv
  2. Download shaders and place them to mpv/shaders/:
    1. Luma Upscaler:
    2. Chroma Up/Downscaler: ArtCNN_C4F32_Chroma
  3. Copy & paste the image quality config below to mpv/mpv.conf
  4. Uncomment either ArtCNN_C4F32_Chroma at the Chroma section in the config if desired. Won't be too much of a difference as changes in Chroma are harder to notice.
  5. (Optional, Windows) Comment the two Vulkan lines and uncomment DirectX lines at the start of the config for better performance in some cases
  6. (Optional) Download and place scripts to mpv/scripts/

Links

Index

# mpv.conf for image quality

# Load mpv's default quality settings
profile=gpu-hq
 
# Not too useful on modern hardware. 'auto-copy-safe' is a safe option to use if one wants to enable it. Defaults to 'no'.
#hwdec=no
 
# Video driver to use. The latest gpu-next is recommended.
vo=gpu-next
 
###### Vulkan on Linux, Windows or macOS (recommended)
gpu-api=vulkan
 
###### DirectX on Windows (recommended if issues on Vulkan on Windows)
#gpu-api=d3d11
 
###### Shaders ######
 
###### Luma up (use ArtCNN_C4F32 if the GPU can handle it)
glsl-shader="~~/shaders/ArtCNN_C4F16.glsl"
#glsl-shader="~~/shaders/ArtCNN_C4F32.glsl"
scale=ewa_lanczos
scale-blur=0.981251
 
###### Luma down
dscale=catmull_rom
 
###### Chroma up + down (not important but if the GPU is not being used much anyway, might as well)
#glsl-shader="~~/shaders/ArtCNN_C4F32_Chroma.glsl"
 
# fruit: 8-Bit/8-Bit+FRC display
# ordered: true 10-Bit/12-Bit display
# error-diffusion: high-end GPUs
dither=error-diffusion
dither-depth=auto
error-diffusion=sierra-lite # uncomment if not 'error-diffusion'
 
###### Antiring
scale-antiring=0.5
dscale-antiring=0.5
cscale-antiring=0.5
 
###### Debanding
deband=yes
deband-iterations=4
deband-threshold=35
deband-range=16
deband-grain=4

# Other settings in my mpv.conf

###### General
autofit=50%       # Open mpv as half the monitor resolution
keep-open=yes
snap-window=yes       # Snap to corners on Windows
cursor-autohide=1000
save-position-on-quit # Remember position when closing the player
osd-bar=no            # No huge box on screen when turning the volume
osd-font-size=32
volume=100
volume-max=100
audio-exclusive=no    # A hotkey for this inside input.conf (k cycle audio-exclusive)
 
###### Language & subtitles
sub-visibility=no      # Hide subtitles by default
alang=jp,jpn,ja,en,eng # Language priority for audio
slang=jp,jpn,ja,en,eng # Language priority for subtitles
sub-auto=fuzzy
sub-font='Arial'
sub-font-size=40
sub-border-size=1
sub-shadow-color=0.0/0.0/0.0/0.50
sub-shadow-offset=2
 
###### High-quality screenshots
screenshot-format=webp
screenshot-webp-lossless=yes
screenshot-high-bit-depth=yes
screenshot-sw=no
screenshot-directory="~~/screenshots"
screenshot-template="%f-%wH.%wM.%wS.%wT-#%#00n"

# input.conf

##### General
z          ignore
w          no-osd cycle sub-visibility
s          cycle sub
S          cycle sub down
F1         add sub-delay -0.1   
F2         add sub-delay +0.1
F5         no-osd screenshot
k          cycle audio-exclusive
p          add panscan -0.1
P          add panscan +0.1
 
WHEEL_UP   add volume   2
WHEEL_DOWN add volume  -2
RIGHT      seek   2 exact
LEFT       seek  -2 exact
UP         seek   5 exact
DOWN       seek  -5 exact
Ctrl+RIGHT seek  20 exact
Ctrl+LEFT  seek -20 exact
 
##### mpvacious
q          script-binding mpvacious-sub-seek-back
e          script-binding mpvacious-sub-seek-forward
x          script-binding mpvacious-sub-rewind
 
##### Better Chapters
MOUSE_BTN7 script_binding chapter_prev
MOUSE_BTN8 script_binding chapter_next
 
##### Bookmarker Menu
B          script_message bookmarker-menu
b          script_message bookmarker-quick-save
ctrl+b     script_message bookmarker-quick-load

# Refresh rate in mpv.conf

If for some reason (e.g. to have an exact match) you want to have the refresh rate to be specified, comment out these two lines. Can cause problems especially if the fps doesn't match with the display. mpv is usually pretty good at estimating the fps anyway so no real need to use these.

Refresh rate reported by the OS can be verified with testufo.

# Refresh rate of the monitor (143.856 = 6* 23.976, which is the standard video framerate)
override-display-fps=143.856
 
# 'display-vdrop' is basically the same as 'audio', but with better debugging in Shift+i menu
# Read more about this here: https://mpv.io/manual/master/#options-video-sync
video-sync=display-vdrop

# CHANGELOG

=================================
+ Added
- Removed or disabled
* Change/information
=================================
=== 2024-07-08
+ Added ArtCNN
+ Added a strong recommendation for 'gpu-next'
+ Added dither options
- Removed Anime4K section
- Removed FSRCNN, KrigBilateral and SSim references in favour of ArtCNN and built-in shaders
* Updated to mpv 38.0
* Changed the structure of the config
* Adjusted (lowered) antiring and deband values\
* Simplified the guide a bit
=== 2022-07-11
+ Added a bit about hwdec and vo to the config
+ Added a step to the tl;dr guide to uncomment the Luma up shader in the config
=== 2022-04-03
+ Added more comments to explain some of the config options
* Make Vulkan default option with an optional step for Windows to switch to DirectX
* Changed how paths are defined to make them work out of the box
=== 2022-03-14
+ Added a bit about the mpv version this guide is based on
+ Added gamut-mapping-mode in mpv git to the config
* Commented out gamut clipping settings by default
=== 2022-02-22
* Fixed section title links
* Modified some phrasings
- Removed API (DirectX, OpenGL, Vulkan) partiality
=== 2021-12-18
+ Added a quick guide
* Modified comments and structure of the config
=== 2021-10-24
+ Added gamut-clipping and hdr-compute-peak to the config
=== 2021-09-26
* Fixed a typo
=== 2021-08-31
* More about anime4K
* Fixed anchor links
=== 2021-08-01 ===
+ Added a bit about Adaptive Sharpening
=== 2021-07-10 ===
+ Added autosubsync script
+ Added a new source: artoriuz.github.io
+ Added a comparison: slow.pics/c/NTryj7wb
+ Added index
+ Added changelog
+ Added FSRCNNX
+ Added correct-downscaling=yes
- Disabled ThinLines
* Made the structure a bit clearer
* Moved the bit about refresh rates to its own section
 
=== Initial version ===

執筆Marko Leinikka

(更新 )

文字数:7174
6分で読めます