k4yt3x / video2x

A lossless video/GIF/image upscaler achieved with waifu2x, Anime4K, SRMD and RealSR. Started in Hack the Valley II, 2018.
https://video2x.org
GNU Affero General Public License v3.0
9.68k stars 950 forks source link

How to setup on Ubuntu 20.xx Linux? #540

Closed omikron88 closed 2 years ago

omikron88 commented 3 years ago

When I clone the git repo, go to src dir and run

sudo ./video2x_setup_ubuntu.sh

it installs some dependencies but then

Installing collected packages: pyyaml, python-magic, pyqt5, pillow, patool, colorama, avalon-framework Attempting uninstall: pyyaml Found existing installation: PyYAML 5.3.1 ERROR: Cannot uninstall 'PyYAML'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.

There were some changes in Python between Ubuntu 18 LTS and Ubuntu 20 LTS, ie. switching Python2 to Python3 as the default.

Does anybody run Video2x on Ubuntu 20 LTS and may give me an receipt for installation, please?

k4yt3x commented 3 years ago

The easier way would be to use the Docker image. If you would like to run it on bare metal, then you'll have to recompile all of the components. In version 4.x.x, there isn't an elegant way to do this. The upcoming 5.0.0 version, on the other hand, will be delivered as a Python package which can be installed pretty easily. Before that happens, I'd suggest you to stick with the Docker container.

If you don't mind playing around a bit though, I have a bundle of drivers compiled for 5.0.0 + Ubuntu. You can try setting that up as well. If you're inclined, I can walk you through it.

tonym1995 commented 3 years ago

@omikron88 I had the same problem and solved it by using apt to uninstall pyqt5-dev and python3-pyqt5. I then reinstalled pyqt5 using pip then uninstalled using pip.

Although that is not the end of the problems. There are a number of breaking changes that prevent compilation in files /tmp/video2x/waifu2x-caffe-ubuntu/common/waifu2x.cpp, /tmp/video2x/waifu2x-caffe-ubuntu/caffe/src/caffe/layers/window_data_layer.cpp, /tmp/video2x/waifu2x-caffe-ubuntu/caffe/src/caffe/util/io.cpp and /tmp/video2x/waifu2x-caffe-ubuntu/common/stImage.cpp

I managed to fix them all by copying the files fixing them and them copying then back when the compilation started.

That worked but then I got a linking error:

[ 81%] Linking CXX executable convert_imageset
/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libboost_python38.so.1.71.0: undefined reference to `PyUnicode_InternFromString'
/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libboost_python38.so.1.71.0: undefined reference to `_Py_Dealloc'
/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libboost_python38.so.1.71.0: undefined reference to `PyModule_Create2'
/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libboost_python38.so.1.71.0: undefined reference to `PyType_GetFlags'
/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libboost_python38.so.1.71.0: undefined reference to `_Py_fopen'
/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libboost_python38.so.1.71.0: undefined reference to `PyUnicode_FromString'
/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libboost_python38.so.1.71.0: undefined reference to `PyBytes_AsString'
/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libboost_python38.so.1.71.0: undefined reference to `PyBytes_Size'
/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libboost_python38.so.1.71.0: undefined reference to `PyUnicode_AsWideChar'
/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libboost_python38.so.1.71.0: undefined reference to `PyUnicode_FromEncodedObject'
/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libboost_python38.so.1.71.0: undefined reference to `PyUnicode_AsUTF8'
/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libboost_python38.so.1.71.0: undefined reference to `PyUnicode_AsUTF8String'
/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libboost_python38.so.1.71.0: undefined reference to `PyUnicode_FromFormat'
/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libboost_python38.so.1.71.0: undefined reference to `_Py_tracemalloc_config'
/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libboost_python38.so.1.71.0: undefined reference to `PyUnicode_FromStringAndSize'
/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libboost_python38.so.1.71.0: undefined reference to `_PyTraceMalloc_NewReference'
collect2: error: ld returned 1 exit status

That has finally beaten me unless I find a solution. I've been at this for over 12 hours so I'm quitting for now.

@k4yt3x

What is the docker app? I might try that. If you can send information on your ubuntu bundle for 5.0.0 I would be interested to give it a go.

I've got a bunch of VCR captured home videos from the 90's of varying quality I would like to improve if possible. It would be great to get it working.

As a matter of interest I found these guys https://audo.ai/ for fixing up sound. I uploaded a 2 minute sound file extracted from a vhs capture with a lot of mains power hum an poor volume on the voices. It removed the background noise completely. It wasn't 100% perfect but close. Just thought I'd mention it in case anyone is doing the same thing.

Many Thanks

k4yt3x commented 3 years ago

Please refer to this and this for a quick-start on the usage of the Docker image.

Pre-compiled drivers are required for the beta version. You can download them here. You will need to roughly follow the following steps:

# clone this project's git repo
git clone https://github.com/k4yt3x/video2x
cd video2x/video2x
git checkout -t origin/5.0.0-beta

# download the pre-compiled wrappers
wget https://files.k4yt3x.com/Projects/Video2X/wrappers.tar.gz
tar xzf wrappers.tar.gz

You'll need to install some Python packages, but some of the repos in the requirements.txt are still WIP. You can manually install these packages with a pip command.

image

After these commands, you should have a directory structure similar to this.

image

Then, you can up one level in the directory structure back to the root of this repo. You will end up in video2x/video2x from the last step, and you'll need to go back to just video2x. Finally, you can run video2x as a python module. The command below upscales input.mp4 with waifu2x-ncnn-vulkan with noise=3 into output.mp4. The ratio is determined dynamically and automatically. You will only need to specify the height or width and it will calculate the rest.

python -m video2x -i input.mp4 -o output.mp4 -p5 upscale -h 1440 -d waifu2x -n3

A more granular breakdown:

python -m video2x \
       -i input.mp4 \     # input file path
       -o output.mp4 \    # output file path
       -p5 \              # launch 5 processes
       upscale \          # operation (the other option is `interpolate`)
       -h 1440 \          # output video height
       -d waifu2x \       # use waifu2x
       -n3                # noise=3

P.S. enclose your console text in a pair of ```s so they're easier to read.

tonym1995 commented 3 years ago

Hi,

Thanks for your detailed email. I followed your steps but got an error.

@.:~/video2x/video2x$ pip install -r requirements.txt Defaulting to user installation because normal site-packages is not writeable Collecting @. (from -r requirements.txt (line 2)) Cloning git://github.com/media2x/waifu2x-ncnn-vulkan-python (to revision master) to /tmp/pip-req-build-xmn6mh_g Running command git clone -q git:// github.com/media2x/waifu2x-ncnn-vulkan-python /tmp/pip-req-build-xmn6mh_g Resolved git://github.com/media2x/waifu2x-ncnn-vulkan-python to commit ca536a286ec7972b8542e9d8bfaf498fae301dd8 Running command git submodule update --init --recursive -q Installing build dependencies ... done Getting requirements to build wheel ... error ERROR: Command errored out with exit status 1: command: /usr/bin/python3.8 /usr/local/lib/python3.8/dist-packages/pip/_vendor/pep517/in_process/_in_process.py get_requires_for_build_wheel /tmp/tmpl4ytn6vr cwd: /tmp/pip-req-build-xmn6mh_g Complete output (16 lines): Traceback (most recent call last): File "/usr/local/lib/python3.8/dist-packages/pip/_vendor/pep517/in_process/_in_process.py", line 349, in main() File "/usr/local/lib/python3.8/dist-packages/pip/_vendor/pep517/in_process/_in_process.py", line 331, in main json_out['return_val'] = hook(**hook_input['kwargs']) File "/usr/local/lib/python3.8/dist-packages/pip/_vendor/pep517/in_process/_in_process.py", line 117, in get_requires_for_build_wheel return hook(config_settings) File "/tmp/pip-build-env-rqhpuopw/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 154, in get_requires_for_build_wheel return self._get_build_requires( File "/tmp/pip-build-env-rqhpuopw/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 135, in _get_build_requires self.run_setup() File "/tmp/pip-build-env-rqhpuopw/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 150, in run_setup exec(compile(code, file, 'exec'), locals()) File "setup.py", line 24, in import cmake_build_extension ModuleNotFoundError: No module named 'cmake_build_extension'

WARNING: Discarding git+git:// @.*** Command errored out with exit status 1: /usr/bin/python3.8 /usr/local/lib/python3.8/dist-packages/pip/_vendor/pep517/in_process/_in_process.py get_requires_for_build_wheel /tmp/tmpl4ytn6vr Check the logs for full command output. ERROR: Command errored out with exit status 1: /usr/bin/python3.8 /usr/local/lib/python3.8/dist-packages/pip/_vendor/pep517/in_process/_in_process.py get_requires_for_build_wheel /tmp/tmpl4ytn6vr Check the logs for full command output.

The directory structure at the moment is:

@.:~/video2x/video2x$ ls -al total 464288 drwxrwxr-x 3 tony tony 4096 Sep 7 20:37 . drwxrwxr-x 5 tony tony 4096 Sep 7 20:37 .. -rwxrwxr-x 1 tony tony 3813 Sep 7 20:29 decoder.py -rwxrwxr-x 1 tony tony 4112 Sep 7 20:29 encoder.py -rwxrwxr-x 1 tony tony 251 Sep 7 20:29 init.py -rwxrwxr-x 1 tony tony 3410 Sep 7 20:29 interpolator.py -rwxrwxr-x 1 tony tony 218 Sep 7 20:29 main.py -rw-rw-r-- 1 tony tony 366 Sep 7 20:29 requirements.txt -rwxrwxr-x 1 tony tony 6711 Sep 7 20:29 upscaler.py -rwxrwxr-x 1 tony tony 13098 Sep 7 20:29 video2x.py drwxr-xr-x 6 tony tony 4096 Jul 6 10:48 wrappers -rw-rw-r-- 1 tony tony 475358536 Sep 6 20:20 wrappers.tar.gz @.:~/video2x/video2x$ ls -al wrappers total 28 drwxr-xr-x 6 tony tony 4096 Jul 6 10:48 . drwxrwxr-x 3 tony tony 4096 Sep 7 20:37 .. -rwxr-xr-x 1 tony tony 2190 Jul 6 10:48 gifski.py drwxr-xr-x 4 tony tony 4096 Jul 6 10:48 realsr_ncnn_vulkan_python drwxr-xr-x 4 tony tony 4096 Jul 6 10:48 rife_ncnn_vulkan_python drwxr-xr-x 4 tony tony 4096 Jul 6 10:48 srmd_ncnn_vulkan_python drwxr-xr-x 3 tony tony 4096 Jul 6 10:48 waifu2x_ncnn_vulkan_python

Thanks, Tony

On Mon, Sep 6, 2021 at 8:40 PM K4YT3X @.***> wrote:

Please refer to this https://github.com/k4yt3x/video2x/#docker-image and this https://github.com/K4YT3X/video2x/wiki/Docker for a quick-start on the usage of the Docker image.

Pre-compiled drivers are required for the beta version. You can download them here https://files.k4yt3x.com/Projects/Video2X/wrappers.tar.gz. You will need to roughly follow the following steps:

clone this project's git repo

git clone https://github.com/k4yt3x/video2xcd video2x/video2x git checkout -t origin/5.0.0-beta

download the pre-compiled wrappers

wget https://files.k4yt3x.com/Projects/Video2X/wrappers.tar.gz tar xzf wrappers.tar.gz

You'll need to install some Python packages, but some of the repos in the requirements.txt are still WIP. You can manually install these packages with a pip command.

[image: image] https://user-images.githubusercontent.com/21986859/132204290-94d457ac-69a0-4f38-816b-10c198010ea9.png

After these commands, you should have a directory structure similar to this.

[image: image] https://user-images.githubusercontent.com/21986859/132203658-f7bc2367-82c2-4b0f-935d-46f4ce3d535b.png

Then, you can up one level in the directory structure back to the root of this repo. You will end up in video2x/video2x from the last step, and you'll need to go back to just video2x. Finally, you can run video2x as a python module. The command below upscales input.mp4 with waifu2x-ncnn-vulkan with noise=3 into output.mp4. The ratio is determined dynamically and automatically. You will only need to specify the height or width and it will calculate the rest.

python -m video2x -i input.mp4 -o output.mp4 -p5 upscale -h 1440 -d waifu2x -n3

A more granular breakdown:

python -m video2x \ -i input.mp4 \ # input file path -o output.mp4 \ # output file path -p5 \ # launch 5 processes upscale \ # operation (the other option is interpolate) -h 1440 \ # output video height -d waifu2x \ # use waifu2x -n3 # noise=3

P.S. enclose your console text in a pair of ```s so they're easier to read.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/k4yt3x/video2x/issues/540#issuecomment-913545082, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAUZNTXJ6BS7VHAM6DDDCYDUASLC7ANCNFSM5DCNH6LA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

k4yt3x commented 3 years ago

@tonym1995

You'll need to install some Python packages, but some of the repos in the requirements.txt are still WIP. You can manually install these packages with a pip command.

tonym1995 commented 3 years ago

I installed manually using pip install ffmpeg-python loguru opencv-python pillow rich tqdm

After successful installation I tried the command and got the following error.

python -m video2x -i /media/tony/data-drive/VideoRecordings/input.mkv -o /media/tony/data-drive/VideoRecordings/output.mkv -p5 upscale -h 1440 -d waifu2x -n3 Traceback (most recent call last): File "/usr/lib/python2.7/runpy.py", line 163, in _run_module_as_main mod_name, _Error) File "/usr/lib/python2.7/runpy.py", line 119, in _get_module_details code = loader.get_code(mod_name) File "/usr/lib/python2.7/pkgutil.py", line 281, in get_code self.code = compile(source, self.filename, 'exec') File "/home/tony/video2x/video2x/video2x.py", line 68 from rich import print ^ SyntaxError: invalid syntax

Is there anything else I need to do?

Thanks, Tony

On Wed, Sep 8, 2021 at 7:52 AM K4YT3X @.***> wrote:

@tonym1995 https://github.com/tonym1995

You'll need to install some Python packages, but some of the repos in the requirements.txt are still WIP. You can manually install these packages with a pip command.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/k4yt3x/video2x/issues/540#issuecomment-914652281, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAUZNTWDK3YUSTVGP4LS453UA2CQPANCNFSM5DCNH6LA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

k4yt3x commented 3 years ago

Python 2 is deprecated. This project is written with Python 3. I am using python in my commands because on Arch python is now Python 3. You might need to use python3 and pip3.

tonym1995 commented 2 years ago

Getting closer.

@.***:~/video2x/video2x$ python3 -m video2x -i /media/tony/data-drive/VideoRecordings/input.mkv -o /media/tony/data-drive/VideoRecordings/output.mkv -p5 upscale -h 1440 -d waifu2x -n3 Traceback (most recent call last): File "/usr/lib/python3.8/runpy.py", line 194, in _run_module_as_main return _run_code(code, main_globals, None, File "/usr/lib/python3.8/runpy.py", line 87, in _run_code exec(code, run_globals) File "/home/tony/video2x/video2x/video2x.py", line 52, in from .decoder import VideoDecoder ImportError: attempted relative import with no known parent package

On Thu, Sep 9, 2021 at 2:23 AM K4YT3X @.***> wrote:

Python 2 is deprecated. This project is written with Python 3. I am using python in my commands because on Arch python is now Python 3. You might need to use python3 and pip3.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/k4yt3x/video2x/issues/540#issuecomment-915384049, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAUZNTWVIJN7KJ3TNPAMCE3UA6EY3ANCNFSM5DCNH6LA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

k4yt3x commented 2 years ago

I think I know what's wrong. The latest commit is not at a working stage. I'll have to change a few things for it to work properly.

image

k4yt3x commented 2 years ago

Hey sorry it took me this long. My semester has started and I'm getting quite busy.

It should work if you revert back to this commit: f283a12a0b430e5226d09bb75851f3d3982dec24 (f283a12a0b430e5226d09bb75851f3d3982dec24)

If it still doesn't work, I'll write up a new version that does work properly and send you a ZIP.

dyanakiev commented 2 years ago

Can i just run the commands from the Video2X_on_Colab.ipynb https://github.com/k4yt3x/video2x#google-colab on Ubuntu/Debian i will try that in the following days i suspect it should be working without docker?

k4yt3x commented 2 years ago

The thing is setting it up without docker requires you configure everything properly on your host. It is 1) a complex process to ensure everything is configured properly, 2) creates a lot of files on your system that are difficult to cleanup later. A docker container can be installed and removed like...well, a container, so none of these issues exist.

k4yt3x commented 2 years ago

Since this thread has been idle for a while, I'll close the issue for now for housekeeping purposes. Feel free to keep posting.