-
-
Notifications
You must be signed in to change notification settings - Fork 973
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for Real-ESRGAN, plus various fixes (hangs, async video, etc.) #1133
base: master
Are you sure you want to change the base?
Conversation
Choosing realesrgan ignores noise flag for now and always uses the realesrgan-x4plus model.
A few scalers output a lot of crap like: 10% 25% 50% ... That messes with the progress bar indicator.
This allows a reproducible way to get all the needed dependencies and allows running the software in NixOS environments.
This solves a couple of issues: 1. The log level passed with -l was not properly applied to loguru, it was always using `debug`, the default. 2. When actually passing `-l debug` ffmpeg would flood us with too much information, it is better to have a separate option to debug ffmpeg issues.
This can actually lead to corrupted videos, or with bad synchronization or without skipping support. This option seems to do the right thing for this and is inocuous in our case.
...this would cause the whole application to hang during the teardown sequence of the application.
Since now these are only printed when passing -l debug, I think this is an acceptable compromise and can help debug the various problems that have existed with the application hanging
This problem used to be more severe, but has become less frequent with our fix for k4yt3x#1132 The problem happens because we used to take `frame_count` as an absolute truth, and we would iterate until we had processed that many frames. However, as we've learnt, this is just an estimate: it can happen that the `Decoder` thread is done before we hit that frame count. With this change, we detect that scenario, and gracefully finish the rendering process, making sure that all pending frames have been read and processed and get written in the final stream.
Some anime files in particular like to include custom fonts and stuff like that in these streams. I think it is useful to keep them as to keep the generated file as close to the original as possible.
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
(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:
|
Similarly, to work around the poor integration of
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!