435 lines
14 KiB
Plaintext
435 lines
14 KiB
Plaintext
# ===== 基础设置 =====
|
||
|
||
vo=gpu-next # 视频输出驱动
|
||
gpu-api=vulkan # 图形绘制接口
|
||
input-ime=no # 仅文本输入时激活 IME
|
||
autofit-smaller=40%x30% # 窗口最小占屏比例
|
||
idle=yes # 播放结束后保持运行
|
||
ontop # 窗口置顶
|
||
hr-seek=yes # 精确跳转
|
||
hr-seek-framedrop=no # 跳转时不丢帧,利于修正音频延迟
|
||
save-position-on-quit=yes # 退出时记住播放进度
|
||
write-filename-in-watch-later-config # 播放记录中写入文件名
|
||
resume-playback-check-mtime=yes # 校验文件修改时间防止误恢复
|
||
watch-later-dir="~~/cache/watch_later"
|
||
watch-later-options=start,vid,aid,sid
|
||
save-watch-history=yes # 保存播放历史(内置 select 脚本可浏览)
|
||
watch-history-path=~~/files/watch_history.jsonl
|
||
reset-on-next-file=vid,aid,sid,secondary-sid,vf,af,loop-file,deinterlace,contrast,brightness,gamma,saturation,hue,video-zoom,video-rotate,video-pan-x,video-pan-y,panscan,speed,audio-delay,sub-pos,sub-scale,sub-delay,sub-speed,sub-visibility,secondary-sub-visibility
|
||
input-ipc-server=/tmp/mpvsocket # IPC 套接字
|
||
directory-mode=ignore # 打开目录时忽略子目录
|
||
metadata-codepage=auto # 元数据编码自动检测
|
||
msg-level=all=info,auto_profiles=warn
|
||
title=${?pause==yes:⏸}${?mute==yes:🔇}${?ontop==yes:📌}${?demuxer-via-network==yes:${media-title}}${?demuxer-via-network==no:${filename}}
|
||
|
||
# ===== OSD =====
|
||
|
||
no-osd-bar
|
||
osd-on-seek=msg-bar
|
||
osd-bar-w=100
|
||
osd-bar-h=2
|
||
osd-bar-align-y=-1
|
||
osd-font="Noto Sans CJK SC;Noto Color Emoji"
|
||
osd-font-size=24
|
||
osd-color="#FFFFFF"
|
||
osd-outline-size=1.0
|
||
osd-outline-color="#1C1B1F"
|
||
osd-shadow-offset=0
|
||
osd-back-color="#1C1B1F"
|
||
osd-border-style=outline-and-shadow
|
||
osd-playlist-entry=filename
|
||
osd-status-msg=${playback-time/full} / ${duration/full} (${percent-pos}%)\nframe: ${estimated-frame-number} / ${estimated-frame-count}
|
||
osd-fractions=yes
|
||
osd-duration=2000
|
||
|
||
# ===== 色彩管理 =====
|
||
|
||
icc-profile-auto # 自动检测系统 ICC 配置文件
|
||
icc-intent=0 # 感知度映射意图
|
||
icc-force-contrast=1000 # 解决校色文件对比度问题
|
||
icc-3dlut-size=128x128x128 # 3D LUT 精度
|
||
icc-cache-dir="~~/cache/icc_cache"
|
||
use-embedded-icc-profile=yes # 使用嵌入式 ICC 配置文件
|
||
inverse-tone-mapping=yes # SDR→HDR 反向映射(仅 HDR 显示器有效)
|
||
target-colorspace-hint=auto # 自动配置显示器输出色彩空间
|
||
hdr-contrast-recovery=0.30 # HDR 对比度恢复强度
|
||
hdr-compute-peak=yes # 动态峰值检测
|
||
|
||
# ===== 音频 =====
|
||
|
||
audio-device=auto
|
||
audio-channels=7.1,5.1,stereo # 按优先级回退,避免多声道下混丢声道
|
||
ao=alsa
|
||
audio-exclusive=yes # 独占音频通道
|
||
audio-samplerate=96000 # 重采样至 96kHz
|
||
audio-format=s32 # 32位有符号整数
|
||
replaygain=album # 专辑增益优先,无专辑增益时回退到曲目增益
|
||
gapless-audio=no # 避免采样率锁定导致音质下降
|
||
audio-file-auto=fuzzy # 自动加载同名外部音轨
|
||
audio-file-paths=audio;audios;audio 5.1;audios 5.1;audio 7.1;audios 7.1;音轨
|
||
alang=japanese,jpn,jap,ja,jp,english,eng,en
|
||
|
||
# ===== 字幕 =====
|
||
|
||
sub-codepage=gb18030 # 非 UTF-8 字幕首先尝试 GB18030
|
||
sub-auto=fuzzy # 自动加载同名外部字幕
|
||
sub-file-paths=sub;subs;subtitles;字幕
|
||
slang=chs,sc,zh-Hans,zh-CN,cht,tc,zh-Hant,zh-HK,zh-TW,chi,zho,zh
|
||
sub-font="Noto Sans CJK SC;Noto Color Emoji"
|
||
sub-font-size=50
|
||
sub-bold=yes
|
||
sub-color="#FFFFFF"
|
||
sub-outline-size=0.5
|
||
sub-outline-color="#000000"
|
||
sub-shadow-offset=0.5
|
||
sub-back-color="#000000"
|
||
|
||
# ===== 截图 =====
|
||
|
||
screenshot-format=webp
|
||
screenshot-webp-quality=85
|
||
screenshot-webp-compression=6
|
||
screenshot-tag-colorspace=no
|
||
screenshot-template="~~/files/screen/%{media-title}-%P-%n"
|
||
|
||
# ===== 脚本与着色器 =====
|
||
|
||
gpu-shader-cache-dir="~~/cache/shaders_cache"
|
||
osc=no # 禁用内置 OSC,使用 uosc
|
||
ytdl=yes
|
||
ytdl-format=bestvideo[height<=?2160][vcodec!=?vp9.2][vcodec!=?vp9]+bestaudio/best
|
||
ytdl-raw-options-append=cookies-from-browser=Firefox
|
||
input-default-bindings=no # 禁用内置键位,在 input.conf 中自定义
|
||
|
||
# ===== 外部配置 =====
|
||
|
||
include="~~/profiles.conf" # 场景预设(游戏/电影/动画等,手动激活)
|
||
|
||
# =========================================
|
||
# Profile 激活
|
||
# =========================================
|
||
|
||
# 色彩管理(ICC 和 Target 二选一)
|
||
#profile=ICC # ICC 色彩管理,使用系统 ICC 配置文件
|
||
#profile=ICC+ # ICC 色彩管理,使用自定义 ICC 文件
|
||
profile=Target # Target 色彩管理,直接指定目标色彩空间
|
||
|
||
profile=Dither # 抖动算法(fruit)
|
||
#profile=Dither+ # 抖动算法(error-diffusion,更耗能)
|
||
|
||
profile=Tscale # 时域插值(oversample)
|
||
#profile=Tscale+ # 时域插值(sphinx,更平滑但略模糊)
|
||
|
||
profile=HQ # 高质量缩放算法组合
|
||
profile=DeBand-low # 去色带(低强度)
|
||
#profile=DeBand-medium
|
||
#profile=DeBand-high
|
||
|
||
profile=HDR2SDR # HDR 映射 SDR 参数
|
||
#profile=SDR2HDR # SDR 反向映射 HDR(仅 HDR 显示器)
|
||
#profile=SWscaler # 软件缩放备选方案
|
||
|
||
# 着色器(选一)
|
||
#profile=NNEDI3 # 通用场景(NNEDI3-32)
|
||
profile=NNEDI3+ # 通用场景(NNEDI3-64,更耗能)
|
||
#profile=ravu-zoom # 通用场景(ravu-zoom)
|
||
#profile=FSRCNNX # HD 场景
|
||
#profile=FSRCNNX+ # SD 场景(FSRCNNX 去伪影)
|
||
#profile=Ani4K # 动画(Ani4K V2,高性能开销)
|
||
#profile=AniSD # SD 动画(AniSD,高性能开销)
|
||
#profile=Anime4K # 动画(Anime4K 修复 + 去伪影)
|
||
#profile=SSIM # 低性能消耗
|
||
|
||
# =========================================
|
||
# Profile 定义:常规
|
||
# =========================================
|
||
|
||
[ICC]
|
||
# 使用系统 ICC 配置文件进行色彩管理
|
||
icc-profile=""
|
||
icc-profile-auto
|
||
icc-intent=0
|
||
icc-force-contrast=1000
|
||
icc-3dlut-size=auto
|
||
icc-cache-dir="~~/cache/icc_cache"
|
||
|
||
[ICC+]
|
||
# 使用自定义 ICC 文件(如 color.org 泛 ICC 或专业校色文件)
|
||
icc-profile="~~/icc/ITU-RBT709ReferenceDisplay.icc"
|
||
icc-intent=0
|
||
icc-force-contrast=no
|
||
icc-3dlut-size=auto
|
||
icc-cache-dir="~~/cache/icc_cache"
|
||
|
||
[Target]
|
||
# 不使用 ICC,直接指定目标色彩空间参数
|
||
icc-profile=""
|
||
icc-profile-auto=no
|
||
target-prim=auto
|
||
target-contrast=auto
|
||
#target-trc=gamma2.2 # 非 OLED 显示器建议启用
|
||
#target-peak=203 # SDR 显示器默认 203 nit
|
||
|
||
[Dither]
|
||
dither-depth=auto
|
||
dither=fruit
|
||
dither-size-fruit=6
|
||
|
||
[Dither+]
|
||
dither-depth=auto
|
||
dither=error-diffusion
|
||
error-diffusion=floyd-steinberg
|
||
|
||
[Tscale]
|
||
video-sync=display-resample
|
||
interpolation
|
||
tscale=oversample
|
||
|
||
[Tscale+]
|
||
video-sync=display-resample
|
||
interpolation
|
||
tscale=sphinx
|
||
tscale-blur=0.65
|
||
|
||
[HQ]
|
||
scale=ewa_lanczossharp
|
||
cscale=bilinear
|
||
dscale=catmull_rom
|
||
scale-antiring=0.5
|
||
dscale-antiring=0.5
|
||
linear-upscaling=no
|
||
sigmoid-upscaling=yes
|
||
correct-downscaling=yes
|
||
linear-downscaling=no
|
||
deband=no
|
||
|
||
[DeBand-low]
|
||
deband-iterations=1
|
||
deband-threshold=48
|
||
deband-range=16
|
||
deband-grain=16
|
||
|
||
[DeBand-medium]
|
||
deband-iterations=2
|
||
deband-threshold=64
|
||
deband-range=16
|
||
deband-grain=24
|
||
|
||
[DeBand-high]
|
||
deband-iterations=3
|
||
deband-threshold=64
|
||
deband-range=16
|
||
deband-grain=24
|
||
|
||
[HDR2SDR]
|
||
tone-mapping=auto
|
||
gamut-mapping-mode=auto
|
||
hdr-contrast-recovery=0.30
|
||
hdr-compute-peak=auto
|
||
hdr-peak-percentile=99.995
|
||
hdr-peak-decay-rate=100
|
||
hdr-scene-threshold-low=5.5
|
||
hdr-scene-threshold-high=10
|
||
allow-delayed-peak-detect=no
|
||
|
||
[SDR2HDR]
|
||
# SDR 反向映射 HDR,仅 HDR 显示器有效
|
||
icc-profile=""
|
||
icc-profile-auto=no
|
||
target-prim=auto
|
||
target-trc=auto
|
||
target-peak=auto
|
||
target-colorspace-hint=auto
|
||
inverse-tone-mapping=yes
|
||
|
||
[SWscaler]
|
||
sws-allow-zimg=no
|
||
sws-scaler=bicublin
|
||
zimg-scaler-chroma=bicubic
|
||
zimg-scaler=bicubic
|
||
zimg-scaler-param-a=1/3
|
||
zimg-scaler-param-b=1/3
|
||
zimg-fast=no
|
||
|
||
# --- 着色器 Profile ---
|
||
|
||
[NNEDI3]
|
||
profile-desc=通用场景(NNEDI3-32 + 自适应锐化)
|
||
glsl-shaders-append="~~/shaders/nnedi3/nnedi3-nns32-win8x4.glsl"
|
||
glsl-shaders-append="~~/shaders/igv/adaptive-sharpen_luma.glsl"
|
||
|
||
[NNEDI3+]
|
||
profile-desc=通用场景(NNEDI3-64 + 自适应锐化)
|
||
glsl-shaders-append="~~/shaders/nnedi3/nnedi3-nns64-win8x4.glsl"
|
||
glsl-shaders-append="~~/shaders/igv/adaptive-sharpen_luma.glsl"
|
||
|
||
[ravu-zoom]
|
||
profile-desc=通用场景(ravu-zoom + 自适应锐化)
|
||
glsl-shaders-append="~~/shaders/ravu/ravu-zoom-ar-r3.glsl"
|
||
glsl-shaders-append="~~/shaders/igv/adaptive-sharpen_luma.glsl"
|
||
|
||
[FSRCNNX]
|
||
profile-desc=HD 场景(FSRCNNX + 自适应锐化)
|
||
glsl-shaders-append="~~/shaders/igv/FSRCNNX_x2_8-0-4-1.glsl"
|
||
glsl-shaders-append="~~/shaders/igv/adaptive-sharpen_luma.glsl"
|
||
|
||
[FSRCNNX+]
|
||
profile-desc=SD 场景(NNEDI3 + FSRCNNX 去伪影)
|
||
glsl-shaders-append="~~/shaders/nnedi3/nnedi3-nns32-win8x4.glsl"
|
||
glsl-shaders-append="~~/shaders/igv/FSRCNNX_x1_16-0-4-1_distort.glsl"
|
||
|
||
[Ani4K]
|
||
profile-desc=动画(Ani4K V2,高性能开销)
|
||
glsl-shaders-append="~~/shaders/Ani4K/Ani4Kv2_ArtCNN_C4F32_i2.glsl"
|
||
|
||
[AniSD]
|
||
profile-desc=SD 动画(AniSD,高性能开销)
|
||
glsl-shaders-append="~~/shaders/Ani4K/AniSD_ArtCNN_C4F32_i4.glsl"
|
||
|
||
[Anime4K]
|
||
profile-desc=动画(Anime4K 修复 + 去伪影)
|
||
glsl-shaders-append="~~/shaders/igv/KrigBilateral.glsl"
|
||
glsl-shaders-append="~~/shaders/Anime4K/glsl/Restore/Anime4K_Restore_CNN_Soft_M.glsl"
|
||
glsl-shaders-append="~~/shaders/Anime4K/glsl/Restore/Anime4K_Clamp_Highlights.glsl"
|
||
|
||
[SSIM]
|
||
profile-desc=低性能消耗(SSIM 超分 + 缩小)
|
||
glsl-shaders-append="~~/shaders/igv/SSimSuperRes.glsl"
|
||
glsl-shaders-append="~~/shaders/igv/SSimDownscaler.glsl"
|
||
|
||
# =========================================
|
||
# Profile 定义:条件触发
|
||
# =========================================
|
||
|
||
[SD]
|
||
# 低清源(≤720p)自动启用 FSRCNNX+ 增强
|
||
profile-cond=height <= 720 or width <= 720
|
||
profile-restore=copy
|
||
profile=FSRCNNX+
|
||
|
||
[Deband]
|
||
# YUV420P10 以下自动开启去色带
|
||
profile-cond=get("video-params/average-bpp") < 24
|
||
profile-restore=copy
|
||
deband=yes
|
||
|
||
[hdr-2390]
|
||
profile-cond=p.tone_mapping == "bt.2390" and p.current_vo == "gpu-next"
|
||
profile-restore=copy
|
||
tone-mapping-param=2.0
|
||
|
||
[peak-percentile]
|
||
profile-cond=get("video-params/avg-pq-y") < 0.21 and p.current_vo == "gpu-next"
|
||
profile-restore=copy
|
||
hdr-peak-percentile=99.8
|
||
|
||
[SDR-gamut]
|
||
# SDR 非 BT.709 内容的色域映射
|
||
profile-cond=get("video-params/primaries") ~= "bt.709" and get("video-params/gamma") == "bt.1886"
|
||
profile-restore=copy
|
||
gamut-mapping-mode=clip
|
||
|
||
[SDR-target]
|
||
# SDR 显示目标配置
|
||
profile-cond=not get("video-params/max-luma") and not get("inverse-tone-mapping") and p.current_vo == "gpu-next"
|
||
profile-restore=copy
|
||
target-colorspace-hint=no
|
||
|
||
[HDR]
|
||
# HDR 内容自动配置
|
||
profile-cond=get("video-params/max-luma") > 203
|
||
profile-restore=copy
|
||
target-peak=auto
|
||
target-colorspace-hint=auto
|
||
blend-subtitles=no
|
||
deband=no
|
||
vf=""
|
||
|
||
[HDR-PASS]
|
||
# HDR 直通(仅 HDR 显示模式下生效)
|
||
profile-cond=get("video-params/max-luma") > 203 and get("video-target-params/max-luma") > 203 and p.current_vo == "gpu-next"
|
||
profile-restore=copy
|
||
icc-profile=""
|
||
icc-profile-auto=no
|
||
target-colorspace-hint=auto
|
||
inverse-tone-mapping=no
|
||
target-prim=auto
|
||
target-trc=auto
|
||
target-peak=auto
|
||
target-contrast=auto
|
||
|
||
[video-sync]
|
||
# 音频调速超过阈值时切换同步模式,避免明显音高变化
|
||
profile-cond=(speed * audio_speed_correction) > 0 and ((speed * audio_speed_correction) < 0.96 or (speed * audio_speed_correction) > 1.04) and not (get("estimated-vf-fps") > 240 or get("display-fps") > 240)
|
||
profile-restore=copy-equal
|
||
video-sync=display-tempo
|
||
|
||
[fps-fix]
|
||
# 极高帧率/刷新率时使用 audio 同步避免异常
|
||
profile-cond=get("estimated-vf-fps") > 240 or get("display-fps") > 240
|
||
profile-restore=copy
|
||
video-sync=audio
|
||
|
||
[pgs-fix]
|
||
# 修复宽屏视频 PGS 字幕比例错位
|
||
profile-cond=get("video-params/aspect") > 16 / 9
|
||
profile-restore=copy
|
||
stretch-image-subs-to-screen=yes
|
||
|
||
[audio-filter]
|
||
# 多声道音频自动启用动态范围调节(适用于双声道设备)
|
||
profile-cond=get("audio-params/channel-count") > 2
|
||
profile-restore=copy-equal
|
||
af-pre=@dynaudnorm:lavfi=[dynaudnorm=f=500:g=31:p=0.5:m=5:r=0.9]
|
||
|
||
[pause]
|
||
# 暂停时取消置顶
|
||
profile-cond=pause
|
||
profile-restore=copy
|
||
ontop=no
|
||
|
||
[maximized]
|
||
# 最大化时禁止窗口自动调整大小
|
||
profile-cond=window_maximized and vid and not get("current-tracks/video/albumart")
|
||
profile-restore=copy-equal
|
||
auto-window-resize=no
|
||
|
||
[minimized]
|
||
# 最小化时自动暂停
|
||
profile-cond=window_minimized and vid and not get("current-tracks/video/albumart")
|
||
profile-restore=copy-equal
|
||
pause
|
||
|
||
[end]
|
||
# 播放列表结束后退出全屏
|
||
profile-cond=idle_active
|
||
no-fullscreen
|
||
no-window-maximized
|
||
|
||
[media-title]
|
||
# 网络/磁力链接显示媒体标题
|
||
profile-cond=path:find('://') ~= nil or path:find('^magnet:') ~= nil
|
||
profile-restore=copy
|
||
title=${?pause==yes:⏸}${?mute==yes:🔇}${?ontop==yes:📌}${media-title}
|
||
osd-playlist-entry=title
|
||
|
||
# =========================================
|
||
# Profile 定义:网络优化
|
||
# =========================================
|
||
|
||
[network-optimize]
|
||
# 网络播放时自动启用
|
||
profile-cond=demuxer_via_network
|
||
profile-restore=copy
|
||
cache=yes
|
||
cache-secs=600
|
||
demuxer-max-bytes=1GiB
|
||
demuxer-readahead-secs=120
|
||
network-timeout=60
|
||
stream-buffer-size=2MiB
|
||
prefetch-playlist=yes
|
||
stream-lavf-o-append=reconnect=1
|
||
stream-lavf-o-append=reconnect_at_eof=1
|
||
stream-lavf-o-append=reconnect_streamed=1
|
||
stream-lavf-o-append=multiple_requests=1
|