Open arximboldi opened 3 months ago
@arximboldi
class KillableListener(Listener, KillableThreadMixin):
"""
A killable version of pyinput.keyboard.Listener, as joining()
seems to hang on some systems even after properly calling close().
"""
pass
in https://github.com/arximboldi/video2x/blob/realesrgan/video2x/video2x.py#L131C1-L136C9 causes a fail where pynput is not available. Because Python tries to subclass from Listener. You should define that class in a scoped way.
@arximboldi Also when I try running with realesrgan on Google Colab, I get
Unrecognized option 'fps_mode'. Error splitting the argument list: Option not found
(which seems to be referenced in https://github.com/arximboldi/video2x/blob/realesrgan/video2x/decoder.py )
Turns out that 'fps_mode' is a relatively new option in ffmpeg, and the standard Google Colab environment installs an older ffmpeg. But I was able to work around it with:
# Install system dependencies
!apt-get update
!apt-get install -y --no-install-recommends \
python3-pip libvulkan-dev glslang-dev glslang-tools \
build-essential swig ninja-build nvidia-driver-535 \
mpv xserver-xorg-video-dummy xvfb libomp5
!sudo curl -L https://github.com/BtbN/FFmpeg-Builds/releases/download/latest/ffmpeg-master-latest-linux64-gpl.tar.xz -o /usr/local/bin/ffmpeg.tar.xz
%cd /usr/local/bin/
!7z e /usr/local/bin/ffmpeg.tar.xz -aoa
!7z e /usr/local/bin/ffmpeg.tar -aoa
!sudo chmod a+rx /usr/local/bin/ffmpeg
Similarly, to work around the poor integration of Listener
, I was able to work around it in Google Colab by providing:
%env DISPLAY=:0
class Listener:
pass
from video2x import Video2X
video2x = Video2X()
But that’s not how it should work :)
This picks up the work in #1102 by @aa-ko to introduce Real-ESRGAN support, adding support for all models exposed by
realesrgan-ncnn-py
and testing it outside of a Docker container.Additionally, I have fixed a few issues that I've found. I wasn't sure whether you prefer to have multiple smaller PR, or to just review all at once. The work is separated into multiple commits so I can still split into multiple PR's if you prefer.
These are the highlights from this PR:
There are also some smaller changes that I'm not sure you agree with, but that I think are quite convenient:
shell.nix
environment that allows installing all the system dependencies in an isolated environment, by simply runningnix-shell
. This was crucial for me to be able to run and test the program locally outside of a Docker container-l
flag, and introduction of a new-L
flag).Thank you @aa-ko for starting the work on integrating Real-ESRGAN. It's model
realesr-animevideov3
is giving me incredible results, with image quality comparable or better for anime thanrealcugan
, yet much faster!Thank you @k4yt3x for this incredible tool. Looking into the code has shown me how much love there is into it and it is working super well for me now!