diff --git a/.gitignore b/.gitignore index e982e63..497a920 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,5 @@ #==============================================================================# -# File extensions to be ignored anywhere in the tree. +# File extensions to be ignored anywhere in the tree. %TODO% #==============================================================================# *.o cache diff --git a/PKGBUILDS/tigervnc/PKGBUILD b/PKGBUILDS/tigervnc/PKGBUILD index 191452f..5d4de60 100644 --- a/PKGBUILDS/tigervnc/PKGBUILD +++ b/PKGBUILDS/tigervnc/PKGBUILD @@ -1,3 +1,4 @@ +#DEPRICATED#: CosmiciIndustries C05M1C # Maintainer: Sergej Pupykin # Maintainer: Uroš Vampl diff --git a/README.md b/README.md index bb8d70c..e6d8d2f 100644 --- a/README.md +++ b/README.md @@ -609,3 +609,129 @@ Everything that **\*I\*** did in `cdmpv` is under CC0 (Public Domain). [sugoi-web](https://arzeth.github.io/sugoi-web/) Web Frontend for Sugoi-Japanese-Translator (offline & better than DeepL). + +from: C05M1C +# cdmpv — Stabilized pipeline & troubleshooting notes (2025-12-26) + +## Summary + +Stabilized `cdmpv` live-desktop capture → `mpv` pipeline. Root cause analysis, fix applied and operational commands have been recorded here so the environment can be reproduced or rolled back. + +Work completed: + +* Identified and removed an invalid `mpv` profile (`qrawvideo`) that caused immediate `mpv` exit and subsequent `ffmpeg` broken-pipe failures. +* Replaced `live-desktop-mpv.sh` with a simplified, robust pipeline wrapper that uses only validated `ffmpeg` and `mpv` flags and writes a small persistent run log. +* Verified the service starts via user `systemd` (unit: `~/.config/systemd/user/cdmpv-live.service`) and confirmed `mpv` window appears with near real-time latency (~1s). +* Captured diagnostic outputs and patterns in the log for further tuning. + +## Root causes (concise) + +1. `mpv` was passed `--profile=qrawvideo` which does not exist on target system — `mpv` immediately exited. +2. `ffmpeg` produced frames while `mpv` was gone; pipe broke and `ffmpeg` failed with "Broken pipe" and "Conversion failed!". +3. systemd restarted the service repeatedly, producing a restart storm. + +## Files changed (updated) — locations + +* `~/cdmpv/live-desktop-mpv.sh` — **replaced** with a simplified robust pipeline (this file contains the runnable pipeline and logging). + +Other relevant files (unchanged but important): + +* `~/cdmpv/run-cdmpv-wrapper.sh` — wrapper used by the systemd unit. Keep executable. +* `~/.config/systemd/user/cdmpv-live.service` — user unit that launches the wrapper. +* Log: `~/.local/state/cdmpv/live-desktop-mpv.log` + +## How to start / stop / inspect + +Start (user unit): + +```bash +systemctl --user daemon-reload +systemctl --user enable --now cdmpv-live.service +``` + +Stop: + +```bash +systemctl --user stop cdmpv-live.service +``` + +Reset failed state (if systemd refuses to start after crashes): + +```bash +systemctl --user reset-failed cdmpv-live.service +systemctl --user restart cdmpv-live.service +``` + +Inspect logs: + +```bash +journalctl --user -u cdmpv-live.service -f +# and +tail -n 400 ~/.local/state/cdmpv/live-desktop-mpv.log +``` + +## Quick reproducible pipeline (manual test) + +Run this to test single-monitor capture and verify offsets without the systemd unit: + +```bash +# Find monitors and offsets +xrandr --listmonitors + +# Example: capture a 1920x1080 region on the second monitor offset (1920,0) +ffmpeg -hide_banner -nostdin -fflags nobuffer -f x11grab -video_size 1920x1080 -framerate 30 -i :0+1920,0 -pix_fmt yuv420p -f nut - | \ + mpv --demuxer-lavf-format=nut - --no-audio --force-window=yes --keep-open=yes --untimed +``` + +If that produces the expected single-monitor view in `mpv`, you can map those values into `live-desktop-mpv.sh` by setting the `HOST_DISPLAY` and `CAPTURE_OFFSET` (or by editing the script to pass a `:0+X,Y` capture target). + +## Known issue: infinite mirror (mirroring both screens) + +**Cause:** current pipeline captures the entire X root (`:0`) which on a multi-monitor X server is the combined desktop (all monitors arranged side-by-side). When `mpv` displays the upscaled result on the same X server, if the capture region includes the output window, you get a recursive mirror. + +**Mitigations (ordered):** + +1. **Capture a single monitor (recommended).** Use `-video_size WxH -i :0+X,Y` where `X,Y` are the top-left pixel of the target monitor. Use `xrandr --listmonitors` to obtain per-monitor geometry and offsets. + +2. **Create a small X screen / nested X server for capture.** Use an Xvfb/Xvnc nested instance dedicated solely to the guest environment you upscale; do not render the `mpv` window into that same X screen. + +3. **Move `mpv` output to a different display / fullscreen overlay.** Run `mpv` on a separate display (e.g. another virtual display or use Wayland XWayland trickery) so `ffmpeg` capturing `:0` will not include the `mpv` window. + +4. **Filter the capture area by window id.** Use `ffmpeg`'s `-i x11grab` with a window ID (if stable) or extract the window geometry and capture only that box — but this is fragile if `mpv` moves. + +**Immediate recommended fix (practical):** + +* Edit `~/cdmpv/live-desktop-mpv.sh` and set `CAPTURE_TARGET=':0+X,Y'` and `VIDEO_SIZE='WxH'` for the monitor you want to capture. Example values for a primary 1920×1080 monitor at X offset 0: + +```bash +VIDEO_SIZE=1920x1080 +CAPTURE_TARGET=':0+0,0' +``` + +* Or launch the manual test command above to discover correct offsets and sizes, then export those into the script or `config.sh`. + +## How to revert to previous script (git / backup) + +If you had the prior copy in Git, use `git checkout -- ~/cdmpv/live-desktop-mpv.sh`. +If not, keep a backup before editing in future: + +```bash +cp ~/cdmpv/live-desktop-mpv.sh ~/cdmpv/live-desktop-mpv.sh.bak.$(date -Is) +``` + +## Diagnostics snippets collected during the run (high-value lines) + +* `mpv` returned: `Unknown profile 'qrawvideo'` → fixed by removing profile. +* `ffmpeg` errors that followed were `Error muxing a packet` / `Error writing trailer: Broken pipe` — these were secondary to `mpv` exit. +* Current runtime log location: `~/.local/state/cdmpv/live-desktop-mpv.log` (first lines contain detection output and pipeline command line). + +## Next actions (suggested priorities) + +1. **Eliminate the mirror** by implementing the single-monitor capture described above. This is quick and low-risk. +2. **Add an automatic monitor-detection routine** to `live-desktop-mpv.sh` (use `xrandr --listmonitors` or `xdpyinfo` + `xrandr` parsing) and pick the monitor by name (e.g., `DP-2`, `HDMI-1`) or by index. +3. **Add a `--no-restart-on-failure` or `Restart=on-abnormal` guard** in the systemd unit while debugging to avoid restart storms during edits. +4. **Integrate shader upscaling & user settings** (shaders + toggles) once the single-monitor capture is stable. + + + + diff --git a/dgVoodoo-ini/createDgVoodooConf.sh b/dgVoodoo-ini/createDgVoodooConf.sh index b53e3e5..c334823 100755 --- a/dgVoodoo-ini/createDgVoodooConf.sh +++ b/dgVoodoo-ini/createDgVoodooConf.sh @@ -1,4 +1,5 @@ -#!/bin/bash +#DEPRICATED#: CosmiciIndutries C05M1C +##!/bin/bash DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" function usage () { diff --git a/dgVoodoo-ini/dgVoodoo.conf.template b/dgVoodoo-ini/dgVoodoo.conf.template index 7abad14..e4e3558 100644 --- a/dgVoodoo-ini/dgVoodoo.conf.template +++ b/dgVoodoo-ini/dgVoodoo.conf.template @@ -1,10 +1,11 @@ ;========================================================================== -; === Text based config file for dgVoodoo2 +; === Text based config file for dgVoodoo2 +; === ##Depricated## ( I assume this is for 32 bit machines) C05M1C ; === Use this file if you are a game modder/hacker or an experted user and ; want to modify some advanced properties not available via the CPL. ;========================================================================== -Version = 0x276 +Version = 0x277 ;-------------------------------------------------------------------------- @@ -319,3 +320,4 @@ Error = enable MaxTraceLevel = 0 LogToFile = false + diff --git a/live-desktop-mpv.sh b/live-desktop-mpv.sh new file mode 100644 index 0000000..651645c --- /dev/null +++ b/live-desktop-mpv.sh @@ -0,0 +1,65 @@ +#!/usr/bin/env bash +set -euo pipefail + +### CONFIG ### +FRAMERATE=30 +PRESET=ultrafast +DISPLAY=${DISPLAY:-:0} +PIPE=/tmp/cdmpv.pipe + +### Clean up any previous broken pipe ### +rm -f "$PIPE" +mkfifo "$PIPE" + +### Detect primary monitor ### +MONITOR=$(xrandr --listmonitors | awk '/\*/ {print $4; exit}') +[[ -n "$MONITOR" ]] || { echo "No active monitor detected"; exit 1; } + +echo "Capturing monitor: $MONITOR" + +### Get geometry safely ### +### Get exact geometry from xrandr line ### +GEOMETRY=$(xrandr | awk -v m="$MONITOR" ' +$0 ~ ("^"m" ") { + for (i=1;i<=NF;i++) { + if ($i ~ /^[0-9]+x[0-9]+\+[0-9]+\+[0-9]+$/) { + print $i; + exit + } + } +}') + + +WIDTH=${GEOMETRY%%x*} +REST=${GEOMETRY#*x} +HEIGHT=${REST%%+*} +OFFS=${GEOMETRY#*+} + +XOFF=${OFFS%%+*} +YOFF=${OFFS#*+} + +echo "Geometry: ${WIDTH}x${HEIGHT}+${XOFF}+${YOFF}" + +### Start ffmpeg ### +ffmpeg -y \ + -f x11grab \ + -framerate "$FRAMERATE" \ + -video_size "${WIDTH}x${HEIGHT}" \ + -i "${DISPLAY}+${XOFF},${YOFF}" \ + -c:v libx264 \ + -preset "$PRESET" \ + -tune zerolatency \ + -pix_fmt yuv420p \ + -f nut "$PIPE" & + +FFPID=$! + +### Wait for ffmpeg to initialize stream ### +sleep 0.4 + +### Start mpv ### +mpv --no-cache --profile=low-latency "$PIPE" + +### Cleanup ### +kill "$FFPID" 2>/dev/null || true +rm -f "$PIPE" diff --git a/mpvcfg/mpv.conf b/mpvcfg/mpv.conf index 455d621..0876320 100644 --- a/mpvcfg/mpv.conf +++ b/mpvcfg/mpv.conf @@ -1,359 +1,109 @@ -#https://www.svp-team.com/wiki/SVP:mpv -#hwdec=auto-copy -#hwdec-codecs=all +# mpv.conf — cleaned & optimized for Vulkan + shader upscaling workflow +# Preserves original behaviour while removing duplicates and consolidating network/audio/video settings. + +# ------------------------- +# Core / general +# ------------------------- +hwdec=auto-safe # safer auto hwdec selection for Vulkan setups no-resume-playback input-ipc-server=/tmp/mpvsocket hr-seek-framedrop=no -#end - -# Why are these disabled by default? msg-color=yes msg-module=yes - -#load-unsafe-playlists keepaspect=yes - -# Debugging: -#osd-level=2 -#osd-msg2="ds=${dscale}\nup=${scale}\nw${video-params/dw}→w${osd-width}\n${video-params/alpha}" - - framedrop=decoder+vo fullscreen border=no -#hwdec=nvdec +# Output / GPU vo=gpu profile=gpu-hq gpu-api=vulkan gpu-context=x11vk -spirv-compiler=shaderc - -#Do not terminate when playing or seeking beyond the end of the file -keep-open=yes +spirv-compiler=auto -#loop -#vd-lavc-fast -#vd-lavc-skipframe=all -#vd-lavc-skiploopfilter=all +# Vulkan / swap / pipeline +fbo-format=rgba16hf +swapchain-depth=1 +vulkan-async-compute=yes +vulkan-async-transfer=yes +vulkan-queue-count=1 +vulkan-swap-mode=immediate -#video-unscaled=downscale-big +# Keep-open so processes using mpv as a pipeline don't terminate unexpectedly +keep-open=yes -#secondary-sid=3 -#sub-ass-force-style=FontName=Linux Biolinum -#sub-font=Linux Biolinum O +# ------------------------- +# Subtitles +# ------------------------- sub-font=LinBiolinumOB -#sub-font=Linux Libertine Bold sub-font-size=52 - -gpu-shader-cache-dir="~~/shader_cache" - -#https://github.com/Tsubajashi/mpv-settings/blob/master/mpv_linux.conf -# Subs # -sub-ass-vsfilter-blur-compat=yes # Backward compatibility for vsfilter fansubs -sub-ass-scale-with-window=no # May have undesired effects with signs being misplaced. -sub-auto=fuzzy # external subs don't have to match the file name exactly to autoload -sub-file-paths-append=ass # search for external subs in these relative subdirectories +sub-ass-vsfilter-blur-compat=yes +sub-ass-scale-with-window=no +sub-auto=fuzzy +sub-file-paths-append=ass sub-file-paths-append=srt sub-file-paths-append=sub sub-file-paths-append=subs sub-file-paths-append=subtitles -demuxer-mkv-subtitle-preroll # try to correctly show embedded subs when seeking -embeddedfonts=yes # use embedded fonts for SSA/ASS subs -sub-fix-timing=no # do not try to fix gaps (which might make it worse in some cases). Enable if there are scenebleeds. +embeddedfonts=yes blend-subtitles=no -#end - - - - -#best are (from github): -#af=scaletempo=stride=28:overlap=.9:search=25 +# ------------------------- +# Audio +# ------------------------- af=scaletempo=stride=22:overlap=.55:search=12 -#if you decide to play FLAC 384 KHz (even with 1.0x speed) on a very slow CPU then run mpv --af="" - -#or maybe (untested)?: #af=rubberband - - -# when there are more number of channels than you have, -# mix them yours to your number of channels. ad-lavc-downmix=yes -alang=jpn,jp,eng,en,enUS,en-US,esp,es,esMX,es-MX,esES,es-ES -#ja? -slang=en -#ytdl-format=bestvideo+bestaudio -#todo: still prefers aac to opus -ytdl-format="137+251/bestvideo[ext=mp4]+bestaudio[ext=opus]/bestvideo[ext=mp4]+bestaudio[ext=m4a]/[ext=mp4]/best" - -# My mouse often is accidentally moved, -# which causes the controls to appear -osc=no -#osd-font='Pragmata Pro' -#osd-font-size=105 -osd-duration=450 -#cursor-autohide=always - -screenshot-format=png -screenshot-webp-lossless=yes -screenshot-webp-compression=1 -screenshot-webp-quality=100 -screenshot-high-bit-depth=yes -screenshot-directory=/tmp/ - -# Don't display cover images when playing files that don't have video -no-audio-display - -#scale=ewa_lanczossharp -#cscale=ewa_lanczossoft -#dscale=mitchell -scale-antiring=1.0 -cscale-antiring=0.7 - -#https://github.com/Tsubajashi/mpv-settings/blob/master/mpv_linux.conf -# scale=ewa_hanning -# scale-radius=3.2383154841662362 -# cscale=ewa_lanczossoft - +ao=pulse +audio-file-auto=fuzzy +stream-lavf-o="reconnect=1,reconnect_at_eof=1,reconnect_streamed=1,overrun_nonfatal=1" -# If KrigBilateral is in glsl-shaders, then cscale is KrigBilateral instead of what is in mpv.conf -# cscale is used when when color format is YUV but not YUV444. -# YUV is an alternative to RGB. If only one channel is used (Y), then the picture black-and-white. -# U channel and V channel make the picture colored. -# I am not sure but I think yuv420p means there's a black-and-white frame 1280x720 and a colored frame 640x360 +# ------------------------- +# Scaling / upscaling core settings +# ------------------------- cscale=lanczos -#1st non-glsl place is lanczos, 2nd is spline64 -# https://artoriuz.github.io/blog/mpv_upscaling.html#chroma -# https://artoriuz.github.io/blog/images/mpv_upscaling/chroma/tables/dog-psnr.png -# https://artoriuz.github.io/blog/images/mpv_upscaling/chroma/tables/dog-psnrhma.png -# https://artoriuz.github.io/blog/images/mpv_upscaling/chroma/tables/dog-psnrha.png - - - +cscale-antiring=0.7 scale=spline36 -#scale=lanczos -#fbo-format=rgba16hf #rgba16f for "gpu-api=opengl" -no-scaler-resizes-only # fixing the pixel shift - -#dscale=mitchell -#is 99.99% the same as dscale=ewa_robidoux - - -# https://artoriuz.github.io/blog/mpv_upscaling.html#downscaling -# https://artoriuz.github.io/blog/images/mpv_upscaling/downscaling/tables/brisque.png -# https://artoriuz.github.io/blog/images/mpv_upscaling/downscaling/tables/niqe_anime.png -#dscale=spline36 -#dscale=spline16 +scale-antiring=1.0 dscale=lanczos dscale-antiring=0.7 -#for spline16 antring should +0.1 more than catmull_rom (3FCla) -#for lanczos antiring should at least 0.3 (3FCla) -#lanczos gives more svg-like experience than catmull_rom -#gaussian is better than mitchell if and only if used after upscaling by shaders because shader likes to create borders between two BGs - -#scale-antiring=0 -#cscale-antiring=0 - -#by the way: https://github.com/Tsubajashi/mpv-settings/commit/fe0a259c5e4d049aea3d4565359b2f17ad1e38ab - -# sharp: oversample <-> linear (triangle) <-> catmull_rom <-> mitchell <-> gaussian <-> bicubic : smooth - - correct-downscaling=yes - linear-downscaling=no -#https://github.com/Tsubajashi/mpv-settings/blob/master/mpv_linux.conf has linear-downscaling=no -# if "no" and anime4k, then disadvantages: color noise in thin lines and worse fonts -# if "yes": edges are much brighter and/or thinner than in original - -# @igv: -# > Why is it better to set linear-downscaling to no here? Can this shader be rewritten to support linear downscaling and would it have any advantage? -# Less ringing artifacts. linear-downscaling should be used only with soft scalers (and only when it doesn't cause more aliasing artifacts). -# But you can use it with linear-downscaling if you like it and don't notice any artifacts. - - sigmoid-upscaling=yes +scale-antiring=1.0 - - -# https://github.com/Tsubajashi/mpv-settings/blob/master/mpv_linux.conf -# Screenshots # -#screenshot-template="/tmp/mpv-%F-T%wH.%wM.%wS.%wT-F%{estimated-frame-number}" -#screenshot-format=png # Set screenshot format -screenshot-png-compression=0 # Range is 0 to 10. 0 being no compression. +# ------------------------- +# Screenshots / OSD +# ------------------------- +screenshot-format=png +screenshot-directory=/tmp/ +screenshot-high-bit-depth=yes +screenshot-png-compression=0 screenshot-tag-colorspace=yes -#screenshot-high-bit-depth=yes # Same output bitdepth as the video - - -#dither-depth=auto -# https://github.com/Tsubajashi/mpv-settings/blob/master/mpv_linux.conf -#dither=error-diffusion -#dither-depth=8 -dither=no # because +30% - -# https://github.com/Tsubajashi/mpv-settings/blob/master/mpv_linux.conf -deband=no -#deband-iterations=2 -#deband-threshold=20 -#deband-range=16 -##deband-grain=0 - -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 - - -# https://github.com/Tsubajashi/mpv-settings/blob/master/mpv_linux.conf -vulkan-async-compute=yes -vulkan-async-transfer=yes -vulkan-queue-count=1 - - -# https://github.com/mpv-player/mpv/issues/2685#issuecomment-533639111 -tscale=box -tscale-window=quadric -tscale-clamp=0.0 -tscale-radius=1.1 -#tscale-radios=1.025 -interpolation=yes -video-sync=display-resample - -# https://github.com/mpv-player/mpv/issues/2685#issuecomment-537972869 -#tscale=box -#tscale-window=sphinx -#tscale-radius=1.0 -#tscale-clamp=0.0 - - -temporal-dither=yes - -#override-display-fps=75 - -# HDR -> SDR. Not perfect at all. -# https://github.com/mpv-player/mpv/issues/8484 -#hdr-compute-peak -# ^ hdr-compute-peak is disabled because it is bad -#tone-mapping=reinhard -#tone-mapping-param=0.5 - - -stop-screensaver=yes - - -#vf=format=fmt=bgr24:colorlevels=limited:colormatrix=auto colors break when zooming in; tsuba always doesn't work -#vf=format=fmt=yuv444p16:colorlevels=limited:colormatrix=auto - -# # icc-profile-auto=yes # enable for OLED displays -# 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 - - -#fbo-format=rgba16f # use with gpu-api=opengl -fbo-format=rgba16hf # use with gpu-api=vulkan -#fbo-format=rgba16hf -#fbo-format=rgba16f -#fbo-format=rgba32f - -swapchain-depth=1 - -# begin https://github.com/raShMan777/configs/blob/master/mpv/mpv.conf - - - - - -# Pretend to be Window Media Player, fixes playback when playlist and media file use the same URL. -#no-cache-pause -#cookies -#user-agent="Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:61.0) Gecko/20100101 Firefox/61.0" -# Pretend to be Winamp, fixes playback of some NSV streams -##user-agent="Winamp NSV Player/5.12 (ultravox/2.0)" - - -#------------------audio filters------------------ -ao=pulse -##mixer=pulse -audio-file-auto=fuzzy # external audio doesn't has to match the file name exactly to autoload -#audio-pitch-correction=yes # automatically insert scaletempo when playing with higher speed -#pulse-buffer=50 # using a large buffer causes seeking issues -#audio-normalize-downmix=yes -#audio-resample-linear=yes -#audio-delay=+0.084 -#hr-seek-framedrop=no -##ad=lavc:libdcadec - -stream-lavf-o="reconnect=1,reconnect_at_eof=1,reconnect_streamed=1,overrun_nonfatal=1" - - -#------------------cd & dvd settings-------------- -cdrom-device=/dev/sr1 -#dvd-device=/dev/sr1 -bluray-device=/dev/sr1 -cdda-paranoia=1 - - - -[protocol.dvdnav] -profile-desc="Profile for dvdnav:// streams" -profile=dvd -cache=no - -[protocol.cdda] -profile-desc="Profile for cdda:// streams" -cdda-speed=2 - -[protocol.tv] -profile-desc="Profile for tv:// streams" -#profile=deinterlace -cache=yes - -[protocol.dvb] -profile-desc="Profile for dvb:// streams" -profile=deinterlace -cache=yes - -[protocol.rtsp] -profile-desc="Profile for rtsp:// streams" -network-timeout=5 -force-window=immediate -hls-bitrate=max -cache=yes -no-cache-pause - -[protocol.rtmp] -profile-desc="Profile for rtmp:// streams" -network-timeout=5 -force-window=immediate -hls-bitrate=max -cache=yes -no-cache-pause -# end https://github.com/raShMan777/configs/blob/master/mpv/mpv.conf - - +osd-duration=450 -[extension.gif] +# ------------------------- +# Demuxer / rawvideo / low-latency profiles +# ------------------------- +# qrawvideo profile used for rawvideo cases (cdmpv pipe -> mpv) +[qrawvideo] +profile=low-latency cache=no +demuxer-readahead-secs=0 +no-correct-pts no-pause -loop-file=yes -#[subbegin arzet] -[extension.apng] -cache=no +demuxer-lavf-o-add="fflags=+nobuffer+fastseek+flush_packets" +demuxer-termination-timeout=5 +vd-lavc-threads=1 +vd-lavc-threads=1 no-pause -loop-file=yes -#[subend arzet] - -#tsuba begin +# ------------------------- +# Protocol / network: consolidated settings +# ------------------------- [protocol-network] network-timeout=2 -#force-window=immediate commented because of .pls hls-bitrate=max cache=yes demuxer-max-bytes=2000MiB @@ -364,153 +114,57 @@ profile=protocol-network [protocol.https] profile=protocol-network -#tsuba end - - - -#[protocol.file] -#network-timeout=0 -#force-window=yes -cache=yes -demuxer-max-bytes=2000MiB -demuxer-readahead-secs=300 -force-seekable=yes - - - -[qrawvideo] -profile=low-latency -network-timeout=0 -#force-window=yes -cache=no -#demuxer-max-bytes=1500MiB -demuxer-readahead-secs=0 -#demuxer-lavf-buffersize=1500MiB -#cache-secs=0.1 -#swapchain-depth=2 -#commented in order to fix nvidia vulkan resize bug -vulkan-swap-mode=immediate #default is fifo - -force-seekable=no - -demuxer-lavf-o-add="fflags=+nobuffer+fastseek+flush_packets" -#demuxer-lavf-o-add="start_at_zero=1" -#demuxer-lavf-o-add="copyts" -#demuxer-lavf-o-add="uuuuuuuuuuuuuuuuuuq=1" -#demuxer-lavf-o-add="avoid_negative_ts=make_zero" -#demuxer-lavf-o-add="use_wallclock_as_timestamps=1" -#demuxer-lavf-o-add="reconnect_streamed=true" -#af-add="lavfi=[aresample=async=1:min_hard_comp=0.1:first_pts=0]" -#initial-audio-sync=no -#(RTCTIME-RTCSTART)/(TB*1000000) -#demuxer-force-retry-on-eof=yes -demuxer-termination-timeout=5 -#speed=1.05 -#no-demuxer-thread -no-correct-pts -#untimed -#vd-lavc-threads=1 -#cache-pause=no -#demuxer-lavf-probe-info=nostreams -#demuxer-lavf-analyzeduration=0.1 -#interpolation=no -af="" -#no-audio -#video-latency-hacks=yes -#profile=low-latency -no-pause - -demuxer-lavf-o-add="fflags=+nobuffer+fastseek+flush_packets" - -[notime] -osd-msg3="ds=${dscale}\nup=${scale}\nw${video-params/dw}→w${osd-width}" -#osd-msg3="up=${scale}\nds=${dscale}" -#osd-margin-x=290 -#osd-margin-y=400 -#osd-duration=340000 - -[protocol.av] -profile=qrawvideo -profile=notime - -[extension.webp] -profile=notime -[extension.png] -profile=extension.webp -profile=notime +# ------------------------- +# Rawvideo handling +# ------------------------- [rawvideo] profile-cond=p["video-codec"] == "rawvideo" profile=qrawvideo profile=notime stop-screensaver=no -#glsl-shaders="~~/shaders/igv/KrigBilateral.glsl:~~/shaders/Anime4K_Clamp_Highlights.glsl:~~/shaders/chroma-save-MAIN.glsl:~~/shaders/luma-save-MAIN.glsl:~~/shaders/Anime4K_Upscale_CNN_x2_ULF-fastKrigBilateral_for_V_channel.glsl:~~/shaders/Anime4K_Restore_CNN_Light_S-YYY-half.glsl" - -#[width_min_805] -#profile-cond=(width >=805 and width <1900 and (get('estimated-frame-count', math.huge) < 2)) #>=865? +# ------------------------- +# Auto-profiles for different upscaling scenarios +# Each profile clears shaders first, then applies the intended chain. +# ------------------------- -# WITHAlpha and NoAlpha: only `vf` is different - -[justrepairWITHAlpha] +[justrepairNoAlpha] profile-desc=justrepair -profile-cond=(get("osd-width") and get("video-params/dw") and get("osd-width") / get("video-params/dw") <= 1.02 and (get("video-params/alpha") and (get("video-params/alpha") == "straight" or get("video-params/alpha") == "premul"))) +profile-cond=(get("osd-width") and get("video-params/dw") and get("osd-width") / get("video-params/dw") <= 1.02 and not (get("video-params/alpha") and (get("video-params/alpha") == "straight" or get("video-params/alpha") == "premul"))) dscale=lanczos dscale-antiring=0.7 -vf="format=fmt=gbrp:colorlevels=limited:colormatrix=auto" +vf="" glsl-shaders-clr glsl-shaders="~~/shaders/igv/KrigBilateral.glsl:~~/shaders/Anime4K_Restore_CNN_Light_Soft_M-YYY-percent70.glsl:~~/shaders/igv/SSimSuperRes.glsl" -[scale2xWITHAlphaSLOW] -profile-desc=scale2x -profile-cond=(get("osd-width") and get("video-params/dw") and not (get("video-params/dw") > 1579 and get("osd-width") / get("video-params/dw") <= 1.23) and get("osd-width") / get("video-params/dw") > 1.02 and get("osd-width") / get("video-params/dw") <= 2.02 and (get("video-params/alpha") and (get("video-params/alpha") == "straight" or get("video-params/alpha") == "premul"))) +[justrepairWITHAlpha] +profile-desc=justrepair +profile-cond=(get("osd-width") and get("video-params/dw") and get("osd-width") / get("video-params/dw") <= 1.02 and (get("video-params/alpha") and (get("video-params/alpha") == "straight" or get("video-params/alpha") == "premul"))) dscale=lanczos dscale-antiring=0.7 vf="format=fmt=gbrp:colorlevels=limited:colormatrix=auto" glsl-shaders-clr -glsl-shaders="~~/shaders/igv/KrigBilateral.glsl:~~/shaders/Anime4K_Clamp_Highlights.glsl:~~/shaders/chroma-save-MAIN.glsl:~~/shaders/luma-save-MAIN.glsl:~~/shaders/Anime4K_Upscale_CNN_x2_ULF-fastKrigBilateral_for_V_channel.glsl:~~/shaders/Anime4K_Restore_CNN_Light_S-YYY-half.glsl:~~/shaders/igv/SSimSuperRes.glsl" +glsl-shaders="~~/shaders/igv/KrigBilateral.glsl:~~/shaders/Anime4K_Restore_CNN_Light_Soft_M-YYY-percent70.glsl:~~/shaders/igv/SSimSuperRes.glsl" -[scale2xWITHAlphaFAST] +[scale2xNoAlphaFAST] profile-desc=scale2x -profile-cond=(get("osd-width") and get("video-params/dw") and (get("video-params/dw") > 1579 and get("osd-width") / get("video-params/dw") <= 1.23) and get("osd-width") / get("video-params/dw") > 1.02 and get("osd-width") / get("video-params/dw") <= 2.02 and (get("video-params/alpha") and (get("video-params/alpha") == "straight" or get("video-params/alpha") == "premul"))) -dscale=lanczos -dscale-antiring=0.7 -vf="format=fmt=gbrp:colorlevels=limited:colormatrix=auto" -glsl-shaders-clr -glsl-shaders="~~/shaders/igv/KrigBilateral.glsl:~~/shaders/Anime4K_Clamp_Highlights.glsl:~~/shaders/chroma-save-MAIN.glsl:~~/shaders/luma-save-MAIN.glsl:~~/shaders/Anime4K_Upscale_CNN_x2_ULF-fastKrigBilateral_for_V_channel.glsl:~~/shaders/igv/SSimSuperRes.glsl" - -[justrepairNoAlpha] -profile-desc=justrepair -profile-cond=(get("osd-width") and get("video-params/dw") and get("osd-width") / get("video-params/dw") <= 1.02 and not (get("video-params/alpha") and (get("video-params/alpha") == "straight" or get("video-params/alpha") == "premul"))) +profile-cond=(get("osd-width") and get("video-params/dw") and (get("video-params/dw") > 1579 and get("osd-width") / get("video-params/dw") <= 1.23) and get("osd-width") / get("video-params/dw") > 1.02 and get("osd-width") / get("video-params/dw") <= 2.02 and not (get("video-params/alpha") and (get("video-params/alpha") == "straight" or get("video-params/alpha") == "premul"))) dscale=lanczos dscale-antiring=0.7 -#vf=format=fmt=yuv444p10:colorlevels=limited:colormatrix=auto vf="" glsl-shaders-clr -glsl-shaders="~~/shaders/igv/KrigBilateral.glsl:~~/shaders/Anime4K_Restore_CNN_Light_Soft_M-YYY-percent70.glsl:~~/shaders/igv/SSimSuperRes.glsl" +glsl-shaders="~~/shaders/igv/KrigBilateral.glsl:~~/shaders/Anime4K_Clamp_Highlights.glsl:~~/shaders/chroma-save-MAIN.glsl:~~/shaders/luma-save-MAIN.glsl:~~/shaders/Anime4K_Upscale_CNN_x2_ULF-fastKrigBilateral_for_V_channel.glsl:~~/shaders/igv/SSimSuperRes.glsl" [scale2xNoAlphaSLOW] profile-desc=scale2x profile-cond=(get("osd-width") and get("video-params/dw") and not (get("video-params/dw") > 1579 and get("osd-width") / get("video-params/dw") <= 1.23) and get("osd-width") / get("video-params/dw") > 1.02 and get("osd-width") / get("video-params/dw") <= 2.02 and not (get("video-params/alpha") and (get("video-params/alpha") == "straight" or get("video-params/alpha") == "premul"))) dscale=lanczos dscale-antiring=0.7 -#vf=format=fmt=yuv444p10:colorlevels=limited:colormatrix=auto -#vf="format=fmt=gbrp:colorlevels=limited:colormatrix=auto" vf="" glsl-shaders-clr glsl-shaders="~~/shaders/igv/KrigBilateral.glsl:~~/shaders/Anime4K_Clamp_Highlights.glsl:~~/shaders/chroma-save-MAIN.glsl:~~/shaders/luma-save-MAIN.glsl:~~/shaders/Anime4K_Upscale_CNN_x2_ULF-fastKrigBilateral_for_V_channel.glsl:~~/shaders/Anime4K_Restore_CNN_Light_S-YYY-half.glsl:~~/shaders/igv/SSimSuperRes.glsl" -[scale2xNoAlphaFAST] -profile-desc=scale2x -profile-cond=(get("osd-width") and get("video-params/dw") and (get("video-params/dw") > 1579 and get("osd-width") / get("video-params/dw") <= 1.23) and get("osd-width") / get("video-params/dw") > 1.02 and get("osd-width") / get("video-params/dw") <= 2.02 and not (get("video-params/alpha") and (get("video-params/alpha") == "straight" or get("video-params/alpha") == "premul"))) -dscale=lanczos -dscale-antiring=0.7 -#vf=format=fmt=yuv444p10:colorlevels=limited:colormatrix=auto -#vf="format=fmt=gbrp:colorlevels=limited:colormatrix=auto" -vf="" -glsl-shaders-clr -glsl-shaders="~~/shaders/igv/KrigBilateral.glsl:~~/shaders/Anime4K_Clamp_Highlights.glsl:~~/shaders/chroma-save-MAIN.glsl:~~/shaders/luma-save-MAIN.glsl:~~/shaders/Anime4K_Upscale_CNN_x2_ULF-fastKrigBilateral_for_V_channel.glsl:~~/shaders/igv/SSimSuperRes.glsl" - [scale3x] profile-desc=scale3x profile-cond=(get("osd-width") and get("video-params/dw") and get("osd-width") / get("video-params/dw") > 2.02 and get("osd-width") / get("video-params/dw") <= 3.02) @@ -529,25 +183,34 @@ vf=format=fmt=yuv444p10:colorlevels=limited:colormatrix=auto glsl-shaders-clr glsl-shaders="~~/shaders/igv/KrigBilateral.glsl:~~/shaders/Anime4K_Clamp_Highlights-LUMA-first-init.glsl:~~/shaders/Anime4K_Upscale_GAN_x3_VL-LUMA.glsl:~~/shaders/Anime4K_Clamp_Highlights-LUMA-apply.glsl:~~/shaders/Anime4K_Restore_CNN_Moderate_VL-YYY.glsl:~~/shaders/Anime4K_Upscale_CNN_x2_L.glsl:~~/shaders/igv/SSimSuperRes.glsl" - - - +# ------------------------- +# HDR -> SDR mapping (preserved) +# ------------------------- [HDR2SDR] profile-desc=HDR映射 profile-cond=p["video-params/primaries"]=="bt.2020" profile-restore=copy -#icc-profile-auto # 使用icc色彩管理时可避免hdr下mpv默认--gamut-clipping 参数导致的色度偏移 - - #vf="zscale=transfer=linear,tonemap=tonemap=hable:param=1.0:desat=0:peak=10,zscale=transfer=bt709,format=yuv420p" # 此项用于清空vf列表恢复合理的HDR播放效果(如果启用 --vf=format:gamma=gamma2.2 的话会影响hdr的显示) - #https://www.svp-team.com/wiki/SVP:4K_and_HDR : - #vf="zscale=transfer=linear,tonemap=reinhard,zscale=transfer=bt709,format=yuv420p" - vf="" - #glsl-shaders-clr - #glsl-shaders="" +vf="" +# ------------------------- +# OpenGL fallback profile (kept for systems that prefer OpenGL) +# ------------------------- [opengl] gpu-api=opengl -gpu-context=x11 +gpu-context=x11vk fbo-format=rgba16f -#glsl-shaders="~~/shaders/igv/KrigBilateral.glsl:~~/shaders/TsubaUP.glsl:~~/shaders/Anime4K_Restore_CNN_Light_Soft_UL-YYY.glsl" -#glsl-shaders="~~/shaders/Anime4K_Clamp_Highlights.glsl:~~/shaders/igv/KrigBilateral.glsl:~~/shaders/TsubaUP.glsl:~~/shaders/Anime4K_Restore_CNN_Moderate_Soft_VL-YYY.glsl:~~/shaders/Anime4K_Upscale_CNN_x2_L.glsl" + +# ------------------------- +# Misc safe defaults for rawvideo / screenshots +# ------------------------- +[notime] +osd-msg3="ds=${dscale}\nup=${scale}\nw${video-params/dw}→w${osd-width}" + +[extension.webp] +profile=notime + +[extension.png] +profile=extension.webp +profile=notime + +# End of config diff --git a/run-cdmpv-wrapper.sh b/run-cdmpv-wrapper.sh new file mode 100644 index 0000000..d56e584 --- /dev/null +++ b/run-cdmpv-wrapper.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash +set -euo pipefail + +export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin +export DISPLAY=:0 +export XAUTHORITY=/home/user/.Xauthority +export XDG_RUNTIME_DIR="/run/user/$(id -u)" + +cd /home/user/cdmpv +exec /bin/bash /home/user/cdmpv/live-desktop-mpv.sh