bloc97 / Anime4K

A High-Quality Real Time Upscaler for Anime Video
https://bloc97.github.io/Anime4K/
MIT License
18.21k stars 1.35k forks source link

MPV Black in Fullscreen #66

Open leon-204863 opened 4 years ago

leon-204863 commented 4 years ago

I followed the installation instructions and when using the MPV profiler i can see that the shaders are running However in fullscreen mode the video is completely black and i can only hear the audio track i tried various files and none of them are working Ialso tried to change the mpv.conf settings however i was not able to find a solution to the problem

bloc97 commented 4 years ago

Could you post the screenshots of the MPV profiler (pages 1 and 2), and tell us what GPU are you using? Also, MPV works without the shaders, correct?

leon-204863 commented 4 years ago

Screenshot (8) Screenshot (9)

MPV works without the shaders GPU: Nvidia Rtx 2070

bloc97 commented 4 years ago

This is strange. It looks like the shaders are not receiving anything, hence the 0.008ms timings on the ComputeMinMax passes. Have you tried older versions of Anime4K or any other shaders? Do they work?

You can pick random shaders from the official MPV repo. https://github.com/mpv-player/mpv/wiki/User-Scripts#user-shaders

leon-204863 commented 4 years ago

I tested the 4 releases and none of them worked i tried testing the noise shader from the official mpv repo and it works fine both in windowed mode and fullscreen mode i am using the lastest stable mpv release available "mpv-0.32.0-x86_64.7z"

bloc97 commented 4 years ago

Ah, I've just tested with their latest version, it does not work indeed. They must have changed the shader pipeline. I'll see what I can do to fix this.

bloc97 commented 4 years ago

For some reason GLSL if( ) functions do not function properly in the latest MPV 0.32 version. I can't remove them from Anime4K without causing significant slowdowns. I suggest downgrading to v0.31 (latest version that works). I will add a note in the installation instructions.

Edit: Also thank you for reporting this bug, you might have saved countless headaches for future users.

bloc97 commented 4 years ago

I've opened a ticket on the official mpv repo, if anyone has solutions or simply want to participate. https://github.com/mpv-player/mpv/issues/7500

deus0ww commented 4 years ago

2.0RC2 is working for me with MPV HEAD on macOS 10.14.6 with vo=libmpv. (I did have to modify it to work with FSRCNNX... but that's a different issue.)

2ndR commented 4 years ago

It doesn't seem to matter as long as it plays at the video resolution

bloc97 commented 4 years ago

It doesn't seem to matter as long as it plays at the video resolution

The shader doesn't run as long as it doesn't detect a 1.2x increase in resolution. //!WHEN OUTPUT.w LUMA.w / 1.200 > OUTPUT.h LUMA.h / 1.200 > *

deus0ww commented 4 years ago

I removed all the 'when' metadata and confirmed with the 2nd page of stats that the shaders are running. https://github.com/deus0ww/mpv-conf/blob/master/shaders/Anime4K_Hybrid_v2.0RC2.glsl

bloc97 commented 4 years ago

I removed all the 'when' metadata and confirmed with the 2nd page of stats that the shaders are running. https://github.com/deus0ww/mpv-conf/blob/master/shaders/Anime4K_Hybrid_v2.0RC2.glsl

Nice find, though I think this is a bug best solved on mpv's side as there is no reason why !WHEN metadata or if() functions should crash the shader. I could remove the metadata but it doesn't make sense to run the shader when the resolution increase is less than 1.2x, since the shader will skip its internal operations anyway using the edge detections.

Edit: I can confirm this workaround is working on my computer using the latest mpv version. I'll add this in the instructions in case some people can't downgrade their mpv version. I tested with the wrong version...

deus0ww commented 4 years ago

To be clear, the 'when' metadata wasn't crashing the shader. They were removed because I'm also using FSRCNNX. The 2.0RC2 release and the current head on master does not crash in anyway for me.

bloc97 commented 4 years ago

To be clear, the 'when' metadata wasn't crashing the shader. They were removed because I'm also using FSRCNNX. The 2.0RC2 release and the current head on master does not crash in anyway for me.

You are right, I tested with the wrong version. The WHEN is not what is causing the crash.

Artins90 commented 4 years ago

It works for me in 0.32 but I am using Vulkan. You can try my config file, you can find it attached. The stats show 0% usage under Vulkan, which is another known MPV bug, but the shader is working. The image is clearly sharper (switches on the wall, wheelchair): Screenshot (9) Screenshot (11)

mpv.zip

Seirdy commented 4 years ago

The bug does not appear on WaylandVK (Vulkan).

Output of mpv -V -v:

[cplayer] Command line options: '--profile=high-quality' '--version' '-v'
[cplayer] mpv 0.32.0-303-ge31fbbeeee Copyright © 2000-2020 mpv/MPlayer/mplayer2 projects
[cplayer]  built on Tue Mar 24 22:38:04 PDT 2020
[cplayer] FFmpeg library versions:
[cplayer]    libavutil       56.42.101
[cplayer]    libavcodec      58.76.100
[cplayer]    libavformat     58.42.100
[cplayer]    libswscale      5.6.101
[cplayer]    libavfilter     7.77.100
[cplayer]    libswresample   3.6.100
[cplayer] FFmpeg version: N-97044-ge5d25d1147
[cplayer] 
[cplayer] Configuration: ./waf configure --prefix=/home/rkumar/.local --datarootdir=/home/rkumar/.config --mandir=/home/rkumar/.local/man --confdir=/home/rkumar/.config --lua=luajit --disable-android --disable-audiounit --disable-cdda --disable-cocoa --disable-coreaudio --disable-cuda-hwaccel --disable-cuda-interop --disable-d3d-hwaccel --disable-d3d11 --disable-d3d9-hwaccel --disable-debug-build --disable-direct3d --disable-dvdnav --disable-egl-android --disable-egl-angle --disable-egl-angle-lib --disable-egl-angle-win32 --disable-egl-x11 --disable-gl-cocoa --disable-gl-dxinterop --disable-gl-dxinterop-d3d9 --disable-gl-win32 --disable-gl-x11 --disable-ios-gl --disable-libbluray --disable-macos-10-11-features --disable-macos-10-12-2-features --disable-macos-10-14-features --disable-macos-cocoa-cb --disable-macos-media-player --disable-macos-touchbar --disable-rpi --disable-rpi-mmal --disable-sdl2 --disable-swift --disable-tvos --disable-vaapi-x-egl --disable-vaapi-x11 --disable-vdpau-gl-x11 --disable-videotoolbox-gl --disable-wasapi --disable-win32-internal-pthreads --disable-x11 --disable-xv --enable-gl-wayland --enable-libarchive --enable-libmpv-shared --enable-vaapi-wayland --enable-wayland --enable-wayland-protocols --enable-wayland-scanner
[cplayer] List of enabled features: aligned_alloc alsa asm build-date caca cplayer cplugins drm egl egl-drm egl-helpers ffmpeg ffnvcodec gbm gbm.h gl gl-wayland glibc-thread-name glob glob-posix gpl iconv jack javascript jpeg lcms2 libarchive libass libavdevice libdl libm libmpv-shared libplacebo librt linux-fstatfs lua luajit memfd_create optimize oss-audio plain-gl posix posix-or-mingw posix-spawn posix-spawn-native pthreads pulse rubberband shaderc shaderc-shared stdatomic uchardet vaapi vaapi-drm vaapi-egl vaapi-vulkan vaapi-wayland vt.h vulkan wayland wayland-protocols zimg zlib
[cplayer] Built with NDEBUG.
[cplayer] Reading config file /home/rkumar/.config/encoding-profiles.conf
[cplayer] Applying profile 'default'...
[cplayer] Reading config file /home/rkumar/.config/mpv/mpv.conf
[cplayer] Applying profile 'default'...
[cplayer] Setting option 'border' = 'no' (flags = 4)
[cplayer] Setting option 'script-opts' = 'osc-windowcontrols=no' (flags = 4)
[cplayer] Setting option 'term-osd-bar' = '' (flags = 4)
[cplayer] Setting option 'load-scripts' = 'yes' (flags = 4)
[cplayer] Setting option 'osd-font' = 'Source Sans Pro' (flags = 4)
[cplayer] Setting option 'hwdec' = 'vaapi-copy' (flags = 4)
[cplayer] Setting option 'hwdec-codecs' = 'all' (flags = 4)
[cplayer] Setting option 'gpu-context' = 'wayland' (flags = 4)
[cplayer] Setting option 'cache' = 'yes' (flags = 4)
[cplayer] Setting option 'pulse-buffer' = '50' (flags = 4)
[cplayer] Setting option 'dither-depth' = 'auto' (flags = 4)
[cplayer] Setting option 'temporal-dither' = 'yes' (flags = 4)
[cplayer] Setting option 'sub-font' = 'Noto Sans Semibold' (flags = 4)
[cplayer] Setting option 'sub-font-size' = '45' (flags = 4)
[cplayer] Setting option 'sub-auto' = 'fuzzy' (flags = 4)
[cplayer] Setting option 'audio-file-auto' = 'fuzzy' (flags = 4)
[cplayer] Setting option 'sub-file-paths-append' = 'ass' (flags = 4)
[cplayer] Setting option 'sub-file-paths-append' = 'srt' (flags = 4)
[cplayer] Setting option 'sub-file-paths-append' = 'sub' (flags = 4)
[cplayer] Setting option 'sub-file-paths-append' = 'subs' (flags = 4)
[cplayer] Setting option 'sub-file-paths-append' = 'Subs' (flags = 4)
[cplayer] Setting option 'sub-file-paths-append' = 'subtitles' (flags = 4)
[cplayer] Setting option 'sub-color' = '0.9/0.7' (flags = 4)
[cplayer] Setting option 'sub-back-color' = '0.0/0.15' (flags = 4)
[cplayer] Setting option 'sub-blur' = '5.0' (flags = 4)
[cplayer] Setting option 'sub-ass-hinting' = 'light' (flags = 4)
[cplayer] Setting option 'sub-ass-force-style' = 'Kerning=yes' (flags = 4)
[cplayer] Setting option 'slang' = 'en,eng,english,enUS' (flags = 4)
[cplayer] Setting option 'alang' = 'en,eng,english,enUS' (flags = 4)
[cplayer] Setting option 'screenshot-format' = 'png' (flags = 4)
[cplayer] Setting option 'screenshot-template' = 'mpv-shot-%f-%p-%n' (flags = 4)
[cplayer] Setting option 'screenshot-tag-colorspace' = 'yes' (flags = 4)
[cplayer] Setting option 'screenshot-high-bit-depth' = 'yes' (flags = 4)
[cplayer] Setting option 'screenshot-png-compression' = '9' (flags = 4)
[cplayer] Setting option 'screenshot-directory' = '~/Pictures/mpv' (flags = 4)
[cplayer] Setting option 'speed' = '1.25125' (flags = 4)
[cplayer] Setting option 'profile' = 'mid-quality' (flags = 4)
[cplayer] Applying profile 'mid-quality'...
[cplayer] Setting option 'profile' = 'gpu-hq' (flags = 4)
[cplayer] Applying profile 'gpu-hq'...
[cplayer] Setting option 'scale' = 'spline36' (flags = 4)
[cplayer] Setting option 'cscale' = 'spline36' (flags = 4)
[cplayer] Setting option 'dscale' = 'mitchell' (flags = 4)
[cplayer] Setting option 'dither-depth' = 'auto' (flags = 4)
[cplayer] Setting option 'correct-downscaling' = 'yes' (flags = 4)
[cplayer] Setting option 'linear-downscaling' = 'yes' (flags = 4)
[cplayer] Setting option 'sigmoid-upscaling' = 'yes' (flags = 4)
[cplayer] Setting option 'deband' = 'yes' (flags = 4)
[cplayer] Setting option 'gpu-api' = 'opengl' (flags = 4)
[cplayer] Setting option 'profile' = 'high-quality' (flags = 8)
[cplayer] Applying profile 'high-quality'...
[cplayer] Setting option 'profile' = 'mid-quality' (flags = 12)
[cplayer] Applying profile 'mid-quality'...
[cplayer] Setting option 'profile' = 'gpu-hq' (flags = 12)
[cplayer] Applying profile 'gpu-hq'...
[cplayer] Setting option 'scale' = 'spline36' (flags = 12)
[cplayer] Setting option 'cscale' = 'spline36' (flags = 12)
[cplayer] Setting option 'dscale' = 'mitchell' (flags = 12)
[cplayer] Setting option 'dither-depth' = 'auto' (flags = 12)
[cplayer] Setting option 'correct-downscaling' = 'yes' (flags = 12)
[cplayer] Setting option 'linear-downscaling' = 'yes' (flags = 12)
[cplayer] Setting option 'sigmoid-upscaling' = 'yes' (flags = 12)
[cplayer] Setting option 'deband' = 'yes' (flags = 12)
[cplayer] Setting option 'gpu-api' = 'opengl' (flags = 12)
[cplayer] Setting option 'gpu-context' = 'waylandvk' (flags = 12)
[cplayer] Setting option 'gpu-api' = 'vulkan' (flags = 12)
[cplayer] Setting option 'fbo-format' = 'rgba16hf' (flags = 12)
[cplayer] Setting option 'vulkan-async-transfer' = 'yes' (flags = 12)
[cplayer] Setting option 'vulkan-async-compute' = 'yes' (flags = 12)
[cplayer] Setting option 'vd-lavc-threads' = '16' (flags = 12)
[cplayer] Setting option 'glsl-shaders' = '~~/shaders/mpv-prescalers/ravu-zoom-r4-yuv.hook' (flags = 12)
[cplayer] Setting option 'scale' = 'ewa_lanczossharp' (flags = 12)
[cplayer] Setting option 'glsl-shaders-append' = '~~/shaders/SSimDownscaler.glsl' (flags = 12)
[cplayer] Setting option 'dscale' = 'mitchell' (flags = 12)
[cplayer] Setting option 'linear-downscaling' = 'yes' (flags = 12)
[cplayer] Setting option 'glsl-shaders-append' = '~~/shaders/KrigBilateral.glsl' (flags = 12)
[cplayer] Setting option 'cscale' = 'mitchell' (flags = 12)
[cplayer] Setting option 'sigmoid-upscaling' = 'yes' (flags = 12)
[cplayer] Setting option 'correct-downscaling' = 'yes' (flags = 12)
[cplayer] Setting option 'scale-antiring' = '0.7' (flags = 12)
[cplayer] Setting option 'dscale-antiring' = '0.7' (flags = 12)
[cplayer] Setting option 'cscale-antiring' = '0.7' (flags = 12)
[cplayer] Setting option 'video-sync' = 'display-resample' (flags = 12)
[cplayer] Setting option 'interpolation' = 'yes' (flags = 12)
[cplayer] Setting option 'tscale' = 'box' (flags = 12)
[cplayer] Setting option 'tscale-window' = 'quadric' (flags = 12)
[cplayer] Setting option 'tscale-radius' = '1.025' (flags = 12)
[cplayer] Setting option 'tscale-clamp' = '0.0' (flags = 12)
[cplayer] Setting option 'interpolation-threshold' = '0.01' (flags = 12)
[cplayer] Setting option 'hls-bitrate' = 'max' (flags = 12)
[cplayer] Setting option 'demuxer-max-bytes' = '500000000' (flags = 12)
[cplayer] Setting option 'demuxer-max-back-bytes' = '250000000' (flags = 12)
[cplayer] Setting option 'demuxer-cache-wait' = 'no' (flags = 12)
[cplayer] Setting option 'hwdec-extra-frames' = '60' (flags = 12)
[cplayer] Setting option 'ytdl-format' = 'bestvideo[width>1920][ext=webm]+bestaudio[ext=webm]/bestvideo[width>1920]+bestaudio/bestvideo[ext=webm]+bestaudio[ext=webm]/bestvideo+bestaudio/best' (flags = 12)
[cplayer] Setting option 'version' = '' (flags = 8)
[cplayer] mpv 0.32.0-303-ge31fbbeeee Copyright © 2000-2020 mpv/MPlayer/mplayer2 projects
[cplayer]  built on Tue Mar 24 22:38:04 PDT 2020
[cplayer] FFmpeg library versions:
[cplayer]    libavutil       56.42.101
[cplayer]    libavcodec      58.76.100
[cplayer]    libavformat     58.42.100
[cplayer]    libswscale      5.6.101
[cplayer]    libavfilter     7.77.100
[cplayer]    libswresample   3.6.100
[cplayer] FFmpeg version: N-97044-ge5d25d1147
[cplayer] 

Built using mpv-player/mpv-build

ArtyomR0Bot commented 4 years ago

There is a problem with d3d11 API. On windows, d3d11 is used by default. If I use gpu-api=opengl or gpu-api=vulkan, it works fine.

I suggest to update https://github.com/bloc97/Anime4K/blob/master/GLSL_Instructions.md Do not incite users to use outdated version, suggest them to use either opengl or vulkan GPU API instead.

hooke007 commented 3 years ago

No problems here since 0.33 (win10 d3d11) Any more people tested that?