classicjazz / mpv-config

MPV configuration files for high quality rendering of traditional live TV and video disc formats
225 stars 22 forks source link

Not sure if the shaders are working #7

Closed Lorograch1 closed 5 months ago

Lorograch1 commented 1 year ago

Hi,

I followed the instructions and tweaked a little bit as provided in my mpv.config below. However, I am unsure if the shaders are enabled while playing a video except for Krig. Here's the screenshot of a 1080p video for your reference. Please advice. Thank you.

Note: I have placed the shaders folder containing the relevant shaders in mpv folder itself where the mpv.config is also present and hence the change in the glsl path.


# === General and Video ===
 
# Starts mpv in fullscreen mode [To Exit fullscreen press esc or f key]
fullscreen
# Keeps player open after file has finished playing.

keep-open=yes
# Title bar naming
title='${filename}'
# Displays file name instead of title name in On Screen Controller [OSC]
script-opts='osc-title=${filename}'
# Hide Cursor in ms
cursor-autohide=500

###########
# General #
###########

# Default profile
vo=gpu-next
profile=gpu-hq # used for any other OS on modern hardware
# profile=gpu-next # for future use

# Selected API: select either Vulkan (preferred) or OpenGL
gpu-api=vulkan 
vulkan-async-compute=yes
vulkan-async-transfer=yes
vulkan-queue-count=1
vd-lavc-dr=yes

reset-on-next-file=audio-delay,mute,pause,speed,sub-delay,video-aspect-override,video-pan-x,video-pan-y,video-rotate,video-zoom,volume

############
# Playback #
############

deinterlace=no # global reset of deinterlacing to off

##############
# Colorspace #
##############

# see https://github.com/mpv-player/mpv/wiki/Video-output---shader-stage-diagram
target-prim=auto
# target-prim=bt.709 # target Rec.709 for SDR TVs
# target-prim=bt.2020 # target Rec.2020 (wide color gamut) for HDR TVs
target-trc=auto
gamma-auto
vf=format=colorlevels=full:colormatrix=auto
video-output-levels=full

##########
# Dither #
##########

dither-depth=auto
temporal-dither=yes
dither=error-diffusion # preferable... mpv will fallback on fruit if compute shaders are not supported

#############
# Debanding #
#############

deband=yes # enabled by default 
deband-iterations=4 # deband steps
deband-threshold=48 # deband strength
deband-range=16 # deband range
deband-grain=48 # dynamic grain: set to "0" if using the static grain shader

#########################
# Motion Interpolation  #
#########################

video-sync=display-resample
interpolation=yes
tscale=oversample

################
# Anti-Ringing #
################

scale-antiring=0.7 # luma upscale deringing
dscale-antiring=0.7 # luma downscale deringing
cscale-antiring=0.7 # chroma upscale deringing

#############################################################
# Upscaling & Processing Based on Source Video's Resolution #
#############################################################

# 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)
# For detailed analysis of upscaler/downscaler quality, see https://artoriuz.github.io/blog/mpv_upscaling.html

fbo-format=rgba16hf
# fbo-format is not not supported in gpu-next profile
glsl-shaders-clr
# luma upscaling
# note: any FSRCNNX above FSRCNNX_x2_8-0-4-1 is not worth the additional computional overhead
glsl-shaders="~~/shaders/FSRCNNX_x2_8-0-4-1.glsl"
scale=ewa_lanczossharp
# luma downscaling
# note: ssimdownscaler is tuned for mitchell and downscaling=no
glsl-shaders-append="~~/SSimSuperRes.glsl"
glsl-shaders-append="~~/shaders/SSimDownscaler.glsl"
dscale=mitchell
linear-downscaling=no
# chroma upscaling and downscaling
glsl-shaders-append="~~/shaders/KrigBilateral.glsl" 
cscale=ewa_lanczossharp
sigmoid-upscaling=yes

#Anime Scaling
#glsl-shader="~~/shaders/ACNet.glsl"

# === Audio===
audio-channels=auto-safe
audio-samplerate=48000
lavfi=[loudnorm=i=-14.0:lra=13.0:tp=-1.0]
volume=100
volume-max=150
# Audio language priority
alang=eng,en,enUS,en-US,English,jpn,jp,jap,Japanese
# Load external audio with (almost) the same name as the video
audio-file-auto=fuzzy

############
# Profiles #
############

[4k60] # 2160p @ 60fps (3840x2160 UHDTV)
profile-desc=4k60
profile-cond=((width ==3840 and height ==2160) and p["estimated-vf-fps"]>=31)
# deband=yes # necessary to avoid blue screen with KrigBilateral.glsl
deband=no # turn off debanding because presume wide color gamut
interpolation=no # turn off interpolation because presume 60fps 
# UHD videos are already 4K so no luma upscaling is needed
# UHD videos are YUV420 so chroma upscaling is still needed
glsl-shaders-clr
# glsl-shaders="~~/shaders/KrigBilateral.glsl" # enable if your hardware can support it
interpolation=no # no motion interpolation required because 60fps is hardware ceiling
# no deinterlacer required because progressive

[4k30] # 2160p @ 24-30fps (3840x2160 UHDTV)
profile-cond=((width ==3840 and height ==2160) and p["estimated-vf-fps"]<31)
# deband=yes # necessary to avoid blue screen with KrigBilateral.glsl
deband=no # turn off debanding because presume wide color gamut
# UHD videos are already 4K so no luma upscaling is needed
# UHD videos are YUV420 so chroma upscaling is still needed
glsl-shaders-clr
# glsl-shaders="~~/shaders/KrigBilateral.glsl" # enable if your hardware can support it
# apply motion interpolation
video-sync=display-resample
interpolation=yes
tscale=oversample
# no deinterlacer required because progressive

[full-hd60] # 1080p @ 60fps (progressive ATSC)
profile-desc=full-hd60
profile-cond=((width ==1920 and height ==1080) and not p["video-frame-info/interlaced"] and p["estimated-vf-fps"]>=31)
# apply all luma and chroma upscaling and downscaling settings
glsl-shaders-clr
# luma upscaling
# note: any FSRCNNX above FSRCNNX_x2_8-0-4-1 is not worth the additional computional overhead
glsl-shaders="~~/shaders/FSRCNNX_x2_8-0-4-1.glsl"
scale=ewa_lanczossharp
# luma downscaling
# note: ssimdownscaler is tuned for mitchell and downscaling=no
glsl-shaders-append="~~/SSimSuperRes.glsl"
glsl-shaders-append="~~/shaders/SSimDownscaler.glsl"
dscale=mitchell
linear-downscaling=no
# chroma upscaling and downscaling
glsl-shaders-append="~~/shaders/KrigBilateral.glsl" 
cscale=ewa_lanczossharp
sigmoid-upscaling=yes
interpolation=no # no motion interpolation required because 60fps is hardware ceiling
# no deinterlacer required because progressive

[full-hd30] # 1080p @ 24-30fps (NextGen TV/ATSC 3.0, progressive Blu-ray)
profile-desc=full-hd30
profile-cond=((width ==1920 and height ==1080) and not p["video-frame-info/interlaced"] and p["estimated-vf-fps"]<31)
# apply all luma and chroma upscaling and downscaling settings
glsl-shaders-clr
# luma upscaling
# note: any FSRCNNX above FSRCNNX_x2_8-0-4-1 is not worth the additional computional overhead
glsl-shaders="~~/shaders/FSRCNNX_x2_8-0-4-1.glsl"
scale=ewa_lanczossharp
# luma downscaling
# note: ssimdownscaler is tuned for mitchell and downscaling=no
glsl-shaders-append="~~/SSimSuperRes.glsl"
glsl-shaders-append="~~/shaders/SSimDownscaler.glsl"
dscale=mitchell
linear-downscaling=no
# chroma upscaling and downscaling
glsl-shaders-append="~~/shaders/KrigBilateral.glsl" 
cscale=ewa_lanczossharp
sigmoid-upscaling=yes
# apply motion interpolation
video-sync=display-resample
interpolation=yes
tscale=oversample
# no deinterlacer required because progressive

[full-hd-interlaced] # 1080i @ 24-30fps (HDTV, interlaced Blu-rays)
profile-desc=full-hd-interlaced
profile-cond=((width ==1920 and height ==1080) and p["video-frame-info/interlaced"] and p["estimated-vf-fps"]<31)
# apply all luma and chroma upscaling and downscaling settings
glsl-shaders-clr
# luma upscaling
# note: any FSRCNNX above FSRCNNX_x2_8-0-4-1 is not worth the additional computional overhead
glsl-shaders="~~/shaders/FSRCNNX_x2_8-0-4-1.glsl"
scale=ewa_lanczossharp
# luma downscaling
# note: ssimdownscaler is tuned for mitchell and downscaling=no
glsl-shaders-append="~~/SSimSuperRes.glsl"
glsl-shaders-append="~~/shaders/SSimDownscaler.glsl"
dscale=mitchell
linear-downscaling=no
# chroma upscaling and downscaling
glsl-shaders-append="~~/shaders/KrigBilateral.glsl" 
cscale=ewa_lanczossharp
sigmoid-upscaling=yes
# apply motion interpolation
video-sync=display-resample
interpolation=yes
tscale=oversample
vf=bwdif # apply FFMPEG's bwdif deinterlacer

[hd] # 720p @ 60 fps (HDTV, Blu-ray - progressive)
profile-desc=hd
profile-cond=(width ==1280 and height ==720)
# apply all luma and chroma upscaling and downscaling settings
glsl-shaders-clr
# luma upscaling
# note: any FSRCNNX above FSRCNNX_x2_8-0-4-1 is not worth the additional computional overhead
glsl-shaders="~~/shaders/FSRCNNX_x2_8-0-4-1.glsl"
scale=ewa_lanczossharp
# luma downscaling
# note: ssimdownscaler is tuned for mitchell and downscaling=no
glsl-shaders-append="~~/SSimSuperRes.glsl"
glsl-shaders-append="~~/shaders/SSimDownscaler.glsl"
dscale=mitchell
linear-downscaling=no
# chroma upscaling and downscaling
glsl-shaders-append="~~/shaders/KrigBilateral.glsl" 
cscale=ewa_lanczossharp
sigmoid-upscaling=yes
interpolation=no # no motion interpolation required because 60fps is hardware ceiling
# no deinterlacer required because progressive

[sdtv-ntsc] # 640x480, 704x480, 720x480 @ 30fps (NTSC DVD - interlaced)
profile-desc=sdtv-ntsc
profile-cond=((width ==640 and height ==480) or (width ==704 and height ==480) or (width ==720 and height ==480))
# apply all luma and chroma upscaling and downscaling settings
glsl-shaders-clr
# luma upscaling
# note: any FSRCNNX above FSRCNNX_x2_8-0-4-1 is not worth the additional computional overhead
glsl-shaders="~~/shaders/FSRCNNX_x2_8-0-4-1.glsl"
scale=ewa_lanczossharp
# luma downscaling
# note: ssimdownscaler is tuned for mitchell and downscaling=no
glsl-shaders-append="~~/SSimSuperRes.glsl"
glsl-shaders-append="~~/shaders/SSimDownscaler.glsl"
dscale=mitchell
linear-downscaling=no
# chroma upscaling and downscaling
glsl-shaders-append="~~/shaders/KrigBilateral.glsl" 
cscale=ewa_lanczossharp
sigmoid-upscaling=yes
# apply motion interpolation
video-sync=display-resample
interpolation=yes
tscale=oversample
vf=bwdif # apply FFMPEG's bwdif deinterlacer

[sdtv-pal] # 352x576, 480x576, 544x576, 720x576 @ 30fps (PAL broadcast or DVD - interlaced)
profile-desc=sdtv-pal
profile-cond=((width ==352 and height ==576) or (width ==480 and height ==576) or (width ==544 and height ==576) or (width ==720 and height ==576))
# apply all luma and chroma upscaling and downscaling settings
glsl-shaders-clr
# luma upscaling
# note: any FSRCNNX above FSRCNNX_x2_8-0-4-1 is not worth the additional computional overhead
glsl-shaders="~~/shaders/FSRCNNX_x2_8-0-4-1.glsl"
scale=ewa_lanczossharp
# luma downscaling
# note: ssimdownscaler is tuned for mitchell and downscaling=no
glsl-shaders-append="~~/SSimSuperRes.glsl"
glsl-shaders-append="~~/shaders/SSimDownscaler.glsl"
dscale=mitchell
linear-downscaling=no
# chroma upscaling and downscaling
glsl-shaders-append="~~/shaders/KrigBilateral.glsl" 
cscale=ewa_lanczossharp
sigmoid-upscaling=yes
# apply motion interpolation
video-sync=display-resample
interpolation=yes
tscale=oversample
vf=bwdif # apply FFMPEG's bwdif deinterlacer

[default]

###################################
# Protocol Specific Configuration #
###################################

[protocol.http]
hls-bitrate=max # use max quality for HLS streams
cache=yes
no-cache-pause # don't pause when the cache runs low

[protocol.https]
profile=protocol.http

[protocol.ytdl]
profile=protocol.http

# Misc HDR Settings

hr-seek-framedrop=no
icc-profile-auto
lavfi=[cas=strength=0.30]

##############
# Cache #
##############

cache=yes
demuxer-max-bytes=1800M
demuxer-max-back-bytes=1200M
volume=100
speed=1.00
save-position-on-quit=yes
script-opts=ytdl_hook-ytdl_path=yt-dlp
ytdl-format=bestvideo[height<=720]+bestaudio
 
# === On Screen Display [OSD] ===
 
# Don't show a huge volume box on screen when turning the volume up/down or while seeking.
osd-bar=no
osd-font-size=20
osd-font='Source Sans Pro SemiBold'
osd-color='#CCFFFFFF'
osd-border-color='#DD322640'

# required so that the 2 UIs don't fight each other
osc=no
# uosc provides its own seeking/volume indicators, so you also don't need this
osd-bar=no
# uosc will draw its own window controls if you disable window border
border=no

# ===== Terminal =====

msg-color=yes # color log messages on terminal
term-osd-bar=yes # displays a progress bar on the terminal
cursor-autohide=1000 # autohides the cursor after 1s
 
# === Audio ===
 

 
# === Subtitle ===
 
--sub-font="Arial Regular"
--sub-font-size=47
--sub-color="#CDCDCD"
# Subtitle Language Priority
slang=eng,en,enUS,en-US,English
# Load external subtitles with (almost) the same name as the video 
sub-auto=fuzzy
 
# ===== Seeking =====

# Saves the seekbar position on exit
save-position-on-quit=yes
classicjazz commented 6 months ago

With the recent updates to mpv v0.37, I updated the config file and shaders and tested them on MacOS 14.1 with libplacebo and MoltenVK.

I confirmed that the shaders are properly invoked using "I" then "2".

Please let me know if you find any issues with v0.2 release of the new config and shaders.