Skip to content

Step By Step Tutorial

k4yt3x edited this page Feb 11, 2022 · 1 revision

WARNING: This article is considered obsolete. It may be updated in the future following the Video2X 5.0 release. For now, please use the 4.8.1 full release.

Last Edit

Date: March 26, 2019

Module Version
Video2X 2.6.3
FFMPEG 4.1.1
waifu2x-caffe 1.2.0.2
waifu2x-converter-cpp 5.2.4

Python Environment

Video2X relies on Python 3 to run. If you don't have Python installed already, you'll need to get it from Python Releases for Windows. Once there, go ahead and download the latest Python 3 release for Windows as shown below.

image

image

After downloading the Python installer, run it and follow the instructions to install Python. It's highly recommended to check the box for "Add Python X.X to PATH", as it makes using Python in command line much easier. The rest of the tutorial will assume that you have this box checked during installation. [1]

image

Downloading Video2X to Your Computer

There are several ways to download Video2X to your computer. For people who know how to use git and has git installed on their computer, you can use git to clone the Video2X repository:

git clone https://github.com/K4YT3X/video2x.git

For those who don't have git and only wants to use the program, you can download the zip file of the repository by clicking the following button on the website of the Video2X repository:

image

If you chose to download the zip file, extract it to anywhere you would like on the system, and it should look something like this:

image

Setting Video2X Up

Before running Video2X, we need to install all its dependencies first. Open up a command line window and enter the folder that contains the Video2X Python files. Here's how you should do it:

  1. Open a command line window by pressing Windows+R, type cmd in the window popped up and click "OK".
  2. In file explorer, navigate to the bin folder within the Video2X folder, and click on the address bar of file explorer and copy everything using Ctrl+C.
  3. Type cd[space] in the command line window, press Ctrl+V to paste the path we just copied and hit Enter.
  4. You can optionally run the dir command to check if you're in the right folder (You are if the files shown in the terminal matches what's in the folder in your file explorer).

image

Now that you are in the folder containing the Video2X Python files, we need to install all dependencies by executing the video2x_setup.py script. By default, the scirpt will download and configure both waifu2x-caffe and waifu2x-converter-cpp. If you would like to specify a certain driver, you may append -d waifu2x_caffe or -d waifu2x_converter to the end of this command.

python video2x_setup.py

image

If everything finishes successfully, you should see the script saying "Script finished successfully". Now you're ready to move on to running Video2X for the first time.

Command Line Paths Short Introduction

If you're unfamiliar with folders (directories) in command lines, then here's a short section that might help you to get started.

For example, if you downloaded the sample input video to C:\Users\[YourUsername]\Downloads, then the full path of your input video will be C:\Users\[YourUsername]\Downloads\sample_input.mp4, vice versa. The output path is also relative. If you want to export the output video to the current directory, just specify the output video name such as output.mp4. However, if you want to put the output video in a different directory, you should use relative or absolute path, such as C:\Users\[YourUsername]\Desktop\output.mp4.

Running Video2X for the First Time

Before running the script, make sure that you're in the bin folder of Video2X as mentioned above in the "Setting Video2X Up" section.

To run the script, you'll first need to construct a command. You can follow the following recipe to create create a command easily.

  1. Type python video2x.py -m gpu in the command line.
  2. Determine how big you want the output video to be. For example, if you want the video to be double the size of the original video, append -r 2 to the end of the command. Now the command should look something like python video2x.py -m gpu -r 2.
  3. If you want to use waifu2x-converter-cpp, append -d waifu2x_converter to the end of the command.
  4. You can also specify the output video size by directly specifying the width and height. To do this, append --width=[output video width] and --height=[output video height] to the end of the command. The command should then look something like this if the output video will have a size of 1920x1080: python video2x.py -m gpu --width=1920 --height=1080.
  5. Then, append -i to the command, type Space, and simply drag the video you want to enlarge into the command line window like this: image
  6. Finally, append -o to the command, type Space, and type in a path of where you want the output video to be stored, or simply drag the original video into the command line window again and change the name a little like such: image

With the command constructed, we can now execute Video2X and let it do its magic. Depending on your system and hardware setup, it might ask you some questions like:

image

In such cases, it's recommended to just press Enter and Video2X will choose an optimum value for whatever that's not quite appropriate for your system environment. Alternatively, you can also specify the -b or --batch option in the command, which will automatically select all the default values for you.

image

After that, you can just sit back and wait for the magic spell to finish. Depending on the length, the desired size of your video and your hardware's capability, it might take a really long time (hours even days) to complete. You'll be able to see a progress bar located at the bottom of your screen as it's running, which tells you the progress and the estimate time of finishing. If you want to abort the script at any time, press Ctrl+C. [2]

image

When the script finishes, you'll find the output video at your specified location. Have fun with your video! If you have any questions or suggestions, feel free to open a new issue.

image

Footnotes

[1]: To explain why this needs to be checked, if you don't add Python binary location into to PATH, you'll have to type the full path to the Python interpreter like: C:\Users\K4YT3X\AppData\Local\Programs\Python\Python37\python.exe. However, if you add the Python interpreter path into the PATH environment variable, you'll only have to execute python.

[2]: The program will attempt to shutdown gracefully, and if it gets stuck, you can also try closing the window directly. Closing the window will force the script to terminate, but it might fail to delete some temporary files, despite the fact that they should be deleted successfully most of the time. You can delete the files manually. They're located at %TEMP%\video2x (just type this into file explorer and hit Enter).