# ==========    GENERAL    ==========

profile=high-quality                            # Allows for higher quality playback on mpv
vo=gpu-next                                     # https://mpv.io/manual/stable/#video-output-drivers-gpu

# gpu-api=vulkan offers better overall performance, but it sometimes breaks playback
# For displaying HDR content (not HDR -> SDR) "d3d11" is recommended (Windows only)
gpu-api=vulkan                                  # https://mpv.io/manual/stable/#options-gpu-api
fullscreen=no                                   # Start in fullscreen
force-seekable=yes                              # If the player thinks that the media is not seekable, force enable seeking
keep-open=always                                # Don't close the player after finishing the video,
                                                # and playback will never automatically advance to the next file in the playlist
reset-on-next-file=pause                        # After playing the next file in the playlist,
                                                # it will automatically play the file instead of a paused state
hwdec=vulkan                                    # https://mpv.io/manual/stable/#options-hwdec
dither-depth=8                                  # This must be set to match your monitor's bit depth
scale-antiring=0.6                              # https://mpv.io/manual/stable/#options-scale-antiring


# ==========    SCALERS AND SHADERS    ==========

scale=ewa_lanczossharp                          # Luma upscaler
dscale=mitchell                                 # Luma downscaler
cscale=ewa_lanczossharp                         # Chroma up&downscaler
gpu-shader-cache-dir='~~/shaders/cache'         # https://mpv.io/manual/stable/#options-gpu-shader-cache-dir

# Only use these if you have high-end hardware
# glsl-shader="~~/shaders/nnedi3-nns128-win8x4.hook"
# glsl-shader="~~/shaders/ArtCNN_C4F32.glsl"


# ==========    DEBANDING    ==========

# Banding is a visual artifact, visual artifacts should never be in a video.
# Example of banding: https://imgur.com/32d77H0
# Debanding is the process of removing said banding.
# 6 minute explanation of what causes banding: https://www.youtube.com/watch?v=h9j89L8eQQk

deband=no                                       # Turn on only for videos with banding. (Keybind=d)
deband-iterations=2                             # https://mpv.io/manual/stable/#options-deband-iterations
deband-threshold=64                             # https://mpv.io/manual/stable/#options-deband-threshold
deband-range=17                                 # https://mpv.io/manual/stable/#options-deband-range
deband-grain=12                                 # https://mpv.io/manual/stable/#options-deband-grain


# ==========    ON SCREEN DISPLAY AND ON SCREEN CONTROLLER    ==========

osd-bar=no                                      # Don't show a huge volume box on screen when turning the volume up/down
osc=no                                          # Allows for custom OSC to be used  https://github.com/cyl0/mpv-osc-morden-x
border=no                                       # Optional for modern OSC, but recommended
cursor-autohide-fs-only=yes                     # If this option is given, the cursor is always visible in windowed mode
                                                # In fullscreen mode, the cursor is shown or hidden according to --cursor-autohide
cursor-autohide=300                             # Cursor hide in ms
osd-level=1                                     # https://mpv.io/manual/stable/#options-osd-level
osd-duration=1000                               # Set the duration of the OSD messages in ms
hr-seek=yes                                     # Select when to use precise seeks that are not limited to keyframes
                                                # https://mpv.io/manual/stable/#options-hr-seek

osd-font='Verdana'
osd-font-size=20
osd-color='#FFFFFF'                             # Hex code for white
osd-border-color='#000000'                      # Hex code for black
osd-border-size=0.6                             # Size for osd text and progress bar
osd-blur=0.2                                    # Gaussian blur factor. 0 means no blur applied (default)


# ==========    LANGUAGE PRIORITY    ==========

alang=ja,jp,jpn,en,eng                          # Audio language priority
slang=zh_cn,zh_tw,zh,chi,en,eng                 # Subtitle language priority


# ==========    AUDIO    ==========

volume=100                                      # default volume, 100 = unchanged
audio-file-auto=fuzzy                           # Load external audio with (almost) the same name as the video
volume-max=200                                  # Max volume of the player
audio-pitch-correction=yes                      # https://mpv.io/manual/stable/#options-audio-pitch-correction


# ==========    SUBTITLES    ==========

demuxer-mkv-subtitle-preroll=yes                # https://mpv.io/manual/stable/#options-demuxer-mkv-subtitle-preroll
sub-fix-timing=no                               # https://mpv.io/manual/stable/#options-sub-fix-timing
sub-auto=all                                    # https://mpv.io/manual/stable/#options-sub-auto

# The following options only apply to subtitles without own styling
sub-font='Noto Sans CJK SC'                     # Specify font to use for subtitles that do not themselves specify a particular font
sub-font-size=40
sub-color='#FFFFFFFF'
sub-border-color='#FF000000'
sub-border-size=2.0
sub-shadow-offset=0
sub-spacing=0.0


# ==========    SCREENSHOT    ==========

screenshot-format=png                           # Output format of screenshots
screenshot-high-bit-depth=yes                   # Same output bitdepth as the video. Set it "no" if you want to save disc space
screenshot-png-compression=1                    # Compression of the PNG picture (1-9).
                                                # Higher value means better compression, but takes more time
screenshot-directory="~/Pictures/mpv-screenshots"           # Output directory
screenshot-template="%f-%wH.%wM.%wS.%wT-#%#00n"             # Name format (filename-hour-minute-second-milisecond-number)


# ==========    INTERPOLATION    ==========

# blend-subtitles=yes                             # Subtitle blending in scenechanges (smoother effect)
# video-sync=display-resample                     # Set the fps as the max of your monitor refresh rate  (only useful and needed with "interpolation=yes)
# interpolation=yes                               # Enable interpolation
# tscale=oversample                               # Interpolation method


# ==========    CACHE    ==========
# cache=yes
# cache-on-disk=yes
# cache-dir="C:\mpv-cache"
# demuxer-max-bytes=1000MiB
# demuxer-readahead-secs=300
# demuxer-max-back-bytes=200MiB


# ==========    AUTO PROFILES    ==========

# Auto profile that automatically applies for WEB-DL anime that need some debanding
[WEB-DL]
    profile-desc=WEB-DL Anime (HatSubs, SubsPlease, HorribleSubs, Erai-raws)
    profile-cond=string.match(p.filename, "HatSubs")~=nil or string.match(p.filename, "SubsPlease")~=nil or string.match(p.filename, "HorribleSubs")~=nil or string.match(p.filename, "Erai%-raws")~=nil
    deband=yes
