mirror of
https://github.com/k4yt3x/video2x.git
synced 2026-02-08 13:34:45 +08:00
Compare commits
22 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
68e6331672 | ||
|
|
188a44ce38 | ||
|
|
5621eb306a | ||
|
|
07a6356836 | ||
|
|
ef4269bbcd | ||
|
|
898d45e4b5 | ||
|
|
01493068e1 | ||
|
|
e44264bb6b | ||
|
|
06355441ea | ||
|
|
9b9da1ba5a | ||
|
|
78fa5e8c07 | ||
|
|
b2d7415a2c | ||
|
|
75d342f145 | ||
|
|
fae08dfb11 | ||
|
|
a0745e2196 | ||
|
|
986619165f | ||
|
|
78b0420e07 | ||
|
|
1eba4f2187 | ||
|
|
6e1315f2ed | ||
|
|
29a776d049 | ||
|
|
da4bfe9827 | ||
|
|
00c391b46c |
28
.github/ISSUE_TEMPLATE/bug-report.md
vendored
28
.github/ISSUE_TEMPLATE/bug-report.md
vendored
@@ -7,26 +7,20 @@ assignees: K4YT3X
|
||||
|
||||
---
|
||||
|
||||
## Environment Information
|
||||
## Component Versions
|
||||
|
||||
|Module|Version|
|
||||
|-|-|
|
||||
|`Video2X`||
|
||||
|`FFmpeg`||
|
||||
|`waifu2x-caffe`||
|
||||
|`waifu2x-converter-cpp`||
|
||||
|`waifu2x-ncnn-vulkan`||
|
||||
Please at least fill in the release version and GUI or CLI version.
|
||||
|
||||
- **Video2X release version**:
|
||||
- **Upscaler version**:
|
||||
- **GUI version**:
|
||||
- **CLI version**:
|
||||
|
||||
## Symptom
|
||||
|
||||
Briefly describe what's going on.
|
||||
In this section, briefly describe what's going on.
|
||||
|
||||
## Screenshots or Error Messages
|
||||
## Error Log or Screenshots
|
||||
|
||||
Please paste screenshots or error messages here.
|
||||
Include as much details as you can, as this greatly helps debugging the problem.
|
||||
|
||||
Please paste your error message in the code block down below:
|
||||
|
||||
```
|
||||
```
|
||||
Please upload or paste the error log here. You may also include screenshots.
|
||||
**It is highly recommended to include your error log.**
|
||||
|
||||
2
.github/ISSUE_TEMPLATE/feature_request.md
vendored
2
.github/ISSUE_TEMPLATE/feature_request.md
vendored
@@ -9,7 +9,7 @@ assignees: K4YT3X
|
||||
|
||||
## Description
|
||||
|
||||
Briefly describe the feature you want to be added into `video2x`.
|
||||
Briefly describe the feature that you'd like Video2X to have.
|
||||
|
||||
## Sources
|
||||
|
||||
|
||||
54
.github/workflows/codeql-analysis.yml
vendored
Normal file
54
.github/workflows/codeql-analysis.yml
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
name: "CodeQL"
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [master, ]
|
||||
pull_request:
|
||||
# The branches below must be a subset of the branches above
|
||||
branches: [master]
|
||||
schedule:
|
||||
- cron: '0 4 * * 5'
|
||||
|
||||
jobs:
|
||||
analyse:
|
||||
name: Analyse
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
# We must fetch at least the immediate parents so that if this is
|
||||
# a pull request then we can checkout the head.
|
||||
fetch-depth: 2
|
||||
|
||||
# If this run was triggered by a pull request event, then checkout
|
||||
# the head of the pull request instead of the merge commit.
|
||||
- run: git checkout HEAD^2
|
||||
if: ${{ github.event_name == 'pull_request' }}
|
||||
|
||||
# Initializes the CodeQL tools for scanning.
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v1
|
||||
# Override language selection by uncommenting this and choosing your languages
|
||||
# with:
|
||||
# languages: go, javascript, csharp, python, cpp, java
|
||||
|
||||
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
||||
# If this step fails, then you should remove it and run the build manually (see below)
|
||||
- name: Autobuild
|
||||
uses: github/codeql-action/autobuild@v1
|
||||
|
||||
# ℹ️ Command-line programs to run using the OS shell.
|
||||
# 📚 https://git.io/JvXDl
|
||||
|
||||
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
|
||||
# and modify them (or add more) to build your code if your project
|
||||
# uses a compiled language
|
||||
|
||||
#- run: |
|
||||
# make bootstrap
|
||||
# make release
|
||||
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@v1
|
||||
@@ -7,7 +7,7 @@
|
||||
# Last Modified: May 24, 2020
|
||||
|
||||
# Editor: K4YT3X
|
||||
# Last Modified: June 5, 2020
|
||||
# Last Modified: June 13, 2020
|
||||
|
||||
# using Ubuntu LTS 19.10
|
||||
# Ubuntu 20.x is incompatible with Nvidia libraries
|
||||
@@ -24,7 +24,7 @@ RUN apt-get update \
|
||||
&& git clone --recurse-submodules --progress https://github.com/k4yt3x/video2x.git /tmp/video2x/video2x \
|
||||
&& bash -e /tmp/video2x/video2x/src/video2x_setup_ubuntu.sh /
|
||||
|
||||
WORKDIR /video2x/src
|
||||
WORKDIR /host
|
||||
ENTRYPOINT ["python3.8", "/video2x/src/video2x.py"]
|
||||
|
||||
ENV NVIDIA_DRIVER_CAPABILITIES all
|
||||
|
||||
10
README.md
10
README.md
@@ -33,6 +33,10 @@ Nightly builds are built automatically every time a new commit is pushed to the
|
||||
|
||||
To download the latest nightly build, go to the [GitHub Actions](https://github.com/k4yt3x/video2x/actions) tab, enter the last run of workflow "Video2X Nightly Build, and download the artifacts generated from the run.
|
||||
|
||||
## [Docker Image](https://hub.docker.com/r/k4yt3x/video2x)
|
||||
|
||||
Video2X Docker images are available on Docker Hub for easy and rapid Video2X deployment on Linux and macOS. If you already have Docker installed, then only one command is needed to start upscaling a video. For more information on how to use Video2X's Docker image, please refer to the [documentations](https://github.com/K4YT3X/video2x/wiki/Docker).
|
||||
|
||||
## Introduction
|
||||
|
||||
Video2X is a video/GIF/image upscaling software based on Waifu2X, Anime4K, SRMD and RealSR written in Python 3. It upscales videos, GIFs and images, restoring details from low-resolution inputs. Video2X also accepts GIF input to video output and video input to GIF output.
|
||||
@@ -184,10 +188,10 @@ python video2x.py -d waifu2x_caffe -- --help
|
||||
|
||||
### Running Video2X (Docker)
|
||||
|
||||
Video2X can be deployed via Docker.
|
||||
Video2X can be deployed via Docker. The following command upscales the video `sample_input.mp4` two times with Waifu2X NCNN Vulkan and outputs the upscaled video to `sample_output.mp4`. For more details on Video2X Docker image usages, please refer to the [documentations](https://github.com/K4YT3X/video2x/wiki/Docker).
|
||||
|
||||
```shell
|
||||
docker pull k4yt3x/video2x
|
||||
docker run --rm -it --gpus all -v /dev/dri:/dev/dri -v $PWD:/host k4yt3x/video2x:4.6.0 -d waifu2x_ncnn_vulkan -r 2 -i sample_input.mp4 -o sample_output.mp4
|
||||
```
|
||||
|
||||
---
|
||||
@@ -239,7 +243,7 @@ Are you interested in how the idea of Video2X was born? Do you want to know the
|
||||
### --log LOG
|
||||
log file path (default: program_directory\video2x_%Y-%m-%d_%H-%M-%S.log)
|
||||
|
||||
### --nolog
|
||||
### --disable_logging
|
||||
disable logging (default: False)
|
||||
|
||||
### -v, --version
|
||||
|
||||
21
src/README.md
Normal file
21
src/README.md
Normal file
@@ -0,0 +1,21 @@
|
||||
# Directory Listing
|
||||
|
||||
- [**images**](images): image assets such as executable icons
|
||||
- [**locale**](locale): language locale files (.po, .mo)
|
||||
- [**pyinstaller**](pyinstaller): PyInstaller-specific files
|
||||
- [**wrappers**](wrappers): binary Python wrappers/bindings
|
||||
- [**bilogger.py**](bilogger.py): bidirectional logger
|
||||
- [**build.ps1**](build.ps1): release building script
|
||||
- [**exceptions.py**](exceptions.py): custom exceptions
|
||||
- [**image_cleaner.py**](image_cleaner.py): upscaled images cleaner
|
||||
- [**progress_monitor.py**](progress_monitor.py): upscaling progress monitor
|
||||
- [**requirements.txt**](requirements.txt): Python requirements for pip
|
||||
- [**upscaler.py**](upscaler.py): main upscaler class
|
||||
- [**video2x.pot**](video2x.pot): project i18n POT translation file
|
||||
- [**video2x.py**](video2x.py): command line interface
|
||||
- [**video2x.yaml**](video2x.yaml): configuration file
|
||||
- [**video2x_gui.py**](video2x_gui.py): graphical user interface
|
||||
- [**video2x_gui.pyproject**](video2x_gui.pyproject): QtCreator project file
|
||||
- [**video2x_gui.ui**](video2x_gui.ui): GUI UI file (defines GUI layout)
|
||||
- [**video2x_setup.py**](video2x_setup.py): automatic setup script for Windows
|
||||
- [**video2x_setup_ubuntu.sh**](video2x_setup_ubuntu.sh): automatic setup script for Ubuntu
|
||||
@@ -4,7 +4,7 @@
|
||||
Creator: Video2X Bidirectional Logger
|
||||
Author: K4YT3X
|
||||
Date Created: June 4, 2020
|
||||
Last Modified: June 4, 2020
|
||||
Last Modified: July 17, 2020
|
||||
"""
|
||||
|
||||
# built-in imports
|
||||
@@ -27,7 +27,7 @@ class BiLogger(object):
|
||||
logfile (pathlib.Path): target log file path object
|
||||
"""
|
||||
self.terminal = terminal
|
||||
self.log = logfile.open(mode='a+')
|
||||
self.log = logfile.open(mode='a+', encoding='utf-8')
|
||||
|
||||
def write(self, message: str):
|
||||
""" write message to original terminal output and log file
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
Name: Video2X Upscaler
|
||||
Author: K4YT3X
|
||||
Date Created: December 10, 2018
|
||||
Last Modified: June 8, 2020
|
||||
Last Modified: June 29, 2020
|
||||
|
||||
Description: This file contains the Upscaler class. Each
|
||||
instance of the Upscaler class is an upscaler on an image or
|
||||
@@ -85,6 +85,7 @@ class Upscaler:
|
||||
processes: int = 1,
|
||||
video2x_cache_directory: pathlib.Path = pathlib.Path(tempfile.gettempdir()) / 'video2x',
|
||||
extracted_frame_format: str = 'png',
|
||||
output_file_name_format_string: str = '{original_file_name}_output{extension}',
|
||||
image_output_extension: str = '.png',
|
||||
video_output_extension: str = '.mp4',
|
||||
preserve_frames: bool = False
|
||||
@@ -103,6 +104,7 @@ class Upscaler:
|
||||
self.processes = processes
|
||||
self.video2x_cache_directory = video2x_cache_directory
|
||||
self.extracted_frame_format = extracted_frame_format
|
||||
self.output_file_name_format_string = output_file_name_format_string
|
||||
self.image_output_extension = image_output_extension
|
||||
self.video_output_extension = video_output_extension
|
||||
self.preserve_frames = preserve_frames
|
||||
@@ -478,13 +480,13 @@ class Upscaler:
|
||||
# set default output file suffixes
|
||||
# if image type is GIF, default output suffix is also .gif
|
||||
if input_file_mime_type == 'image/gif':
|
||||
output_path = self.output / (input_path.stem + '.gif')
|
||||
output_path = self.output / self.output_file_name_format_string.format(original_file_name=input_path.stem, extension='.gif')
|
||||
|
||||
elif input_file_type == 'image':
|
||||
output_path = self.output / (input_path.stem + self.image_output_extension)
|
||||
output_path = self.output / self.output_file_name_format_string.format(original_file_name=input_path.stem, extension=self.image_output_extension)
|
||||
|
||||
elif input_file_type == 'video':
|
||||
output_path = self.output / (input_path.stem + self.video_output_extension)
|
||||
output_path = self.output / self.output_file_name_format_string.format(original_file_name=input_path.stem, extension=self.video_output_extension)
|
||||
|
||||
# if file is none of: image, image/gif, video
|
||||
# skip to the next task
|
||||
|
||||
@@ -13,7 +13,7 @@ __ __ _ _ ___ __ __
|
||||
Name: Video2X Controller
|
||||
Creator: K4YT3X
|
||||
Date Created: Feb 24, 2018
|
||||
Last Modified: June 8, 2020
|
||||
Last Modified: June 29, 2020
|
||||
|
||||
Editor: BrianPetkovsek
|
||||
Last Modified: June 17, 2019
|
||||
@@ -81,7 +81,7 @@ language = gettext.translation(DOMAIN, LOCALE_DIRECTORY, [default_locale], fallb
|
||||
language.install()
|
||||
_ = language.gettext
|
||||
|
||||
CLI_VERSION = '4.1.1'
|
||||
CLI_VERSION = '4.2.0'
|
||||
|
||||
LEGAL_INFO = _('''Video2X CLI Version: {}
|
||||
Upscaler Version: {}
|
||||
@@ -207,6 +207,7 @@ gifski_settings['gifski_path'] = os.path.expandvars(gifski_settings['gifski_path
|
||||
|
||||
# load video2x settings
|
||||
extracted_frame_format = config['video2x']['extracted_frame_format'].lower()
|
||||
output_file_name_format_string = config['video2x']['output_file_name_format_string']
|
||||
image_output_extension = config['video2x']['image_output_extension']
|
||||
video_output_extension = config['video2x']['video_output_extension']
|
||||
preserve_frames = config['video2x']['preserve_frames']
|
||||
@@ -250,6 +251,7 @@ try:
|
||||
processes=video2x_args.processes,
|
||||
video2x_cache_directory=video2x_cache_directory,
|
||||
extracted_frame_format=extracted_frame_format,
|
||||
output_file_name_format_string=output_file_name_format_string,
|
||||
image_output_extension=image_output_extension,
|
||||
video_output_extension=video_output_extension,
|
||||
preserve_frames=preserve_frames
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# Name: Video2X Configuration File
|
||||
# Creator: K4YT3X
|
||||
# Date Created: October 23, 2018
|
||||
# Last Modified: June 7, 2020
|
||||
# Last Modified: August 18, 2020
|
||||
# Values here are the default values. Change the value here to
|
||||
# save the default value permanently.
|
||||
# Items commented out are parameters irrelevant to this context
|
||||
@@ -106,10 +106,16 @@ anime4kcpp:
|
||||
postFilters: 40 # Enhancement filter, only working when postProcessing is true,there are 5 options by binary:Median blur=0000001, Mean blur=0000010, CAS Sharpening=0000100, Gaussian blur weak=0001000, Gaussian blur=0010000, Bilateral filter=0100000, Bilateral filter faster=1000000, you can freely combine them, eg: Gaussian blur weak + Bilateral filter = 0001000 | 0100000 = 0101000 = 40(D), so you can put 40 to enable Gaussian blur weak and Bilateral filter, which also is what I recommend for image that < 1080P, 48 for image that >= 1080P, and for performance I recommend to use 72 for video that < 1080P, 80 for video that >=1080P (unsigned int [=40])
|
||||
GPUMode: false # Enable GPU acceleration
|
||||
CNNMode: false # Enable ACNet
|
||||
HDN: false # Enable HDN mode for ACNet
|
||||
HDNLevel: 1 # Set HDN level (int [=1])
|
||||
listGPUs: null # list GPUs
|
||||
platformID: 0 # Specify the platform ID (unsigned int [=0])
|
||||
deviceID: 0 # Specify the device ID (unsigned int [=0])
|
||||
codec: mp4v # Specify the codec for encoding from mp4v(recommended in Windows), dxva(for Windows), avc1(H264, recommended in Linux), vp09(very slow), hevc(not support in Windowds), av01(not support in Windowds) (string [=mp4v])
|
||||
forceFps: 0 # Set output video fps to the specifying number, 0 to disable (float [=0])
|
||||
disableProgress: false # disable progress display
|
||||
webVideo: null # process the video from URL
|
||||
alpha: false # preserve the Alpha channel for transparent image
|
||||
ffmpeg:
|
||||
ffmpeg_path: '%LOCALAPPDATA%\video2x\ffmpeg-latest-win64-static\bin'
|
||||
intermediate_file_name: 'intermediate.mkv'
|
||||
@@ -120,7 +126,7 @@ ffmpeg:
|
||||
'-y': true
|
||||
input_options: {} # empty dict, expand if necessary
|
||||
output_options:
|
||||
'-pix_fmt': rgba64be # extracted frames pixel format
|
||||
'-pix_fmt': rgb24 # extracted frames pixel format
|
||||
'-qscale:v': null # output image quality control for JPEG (1-31, 1 being highest)
|
||||
# Step 2: Video Assembly
|
||||
# assemble all frames back into a video with only a video track
|
||||
@@ -170,6 +176,7 @@ gifski:
|
||||
video2x:
|
||||
video2x_cache_directory: null # default: %TEMP%\video2x, directory where cache files are stored, will be deleted if preserve_frames is not set to true
|
||||
extracted_frame_format: png # png/jpg intermediate file format used for extracted frames during video processing
|
||||
output_file_name_format_string: "{original_file_name}_output{extension}" # format string to use for generating output file names
|
||||
image_output_extension: .png # image output extension during batch processing
|
||||
video_output_extension: .mp4 # video output extension during batch processing
|
||||
preserve_frames: false # if set to true, the cache directory won't be cleaned upon task completion
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
Creator: Video2X GUI
|
||||
Author: K4YT3X
|
||||
Date Created: May 5, 2020
|
||||
Last Modified: June 8, 2020
|
||||
Last Modified: September 1, 2020
|
||||
"""
|
||||
|
||||
# local imports
|
||||
@@ -34,7 +34,7 @@ from PyQt5.QtGui import *
|
||||
from PyQt5.QtWidgets import *
|
||||
import magic
|
||||
|
||||
GUI_VERSION = '2.7.1'
|
||||
GUI_VERSION = '2.7.2'
|
||||
|
||||
LEGAL_INFO = f'''Video2X GUI Version: {GUI_VERSION}\\
|
||||
Upscaler Version: {UPSCALER_VERSION}\\
|
||||
@@ -277,6 +277,7 @@ class Video2XMainWindow(QMainWindow):
|
||||
self.driver_combo_box.currentTextChanged.connect(self.update_gui_for_driver)
|
||||
self.processes_spin_box = self.findChild(QSpinBox, 'processesSpinBox')
|
||||
self.scale_ratio_double_spin_box = self.findChild(QDoubleSpinBox, 'scaleRatioDoubleSpinBox')
|
||||
self.output_file_name_format_string_line_edit = self.findChild(QLineEdit, 'outputFileNameFormatStringLineEdit')
|
||||
self.image_output_extension_line_edit = self.findChild(QLineEdit, 'imageOutputExtensionLineEdit')
|
||||
self.video_output_extension_line_edit = self.findChild(QLineEdit, 'videoOutputExtensionLineEdit')
|
||||
self.preserve_frames_check_box = self.findChild(QCheckBox, 'preserveFramesCheckBox')
|
||||
@@ -394,6 +395,11 @@ class Video2XMainWindow(QMainWindow):
|
||||
self.anime4kcpp_post_processing_check_box = self.findChild(QCheckBox, 'anime4kCppPostProcessingCheckBox')
|
||||
self.anime4kcpp_gpu_mode_check_box = self.findChild(QCheckBox, 'anime4kCppGpuModeCheckBox')
|
||||
self.anime4kcpp_cnn_mode_check_box = self.findChild(QCheckBox, 'anime4kCppCnnModeCheckBox')
|
||||
self.anime4kcpp_hdn_check_box = self.findChild(QCheckBox, 'anime4kCppHdnCheckBox')
|
||||
self.anime4kcpp_hdn_level_spin_box = self.findChild(QSpinBox, 'anime4kCppHdnLevelSpinBox')
|
||||
self.anime4kcpp_force_fps_double_spin_box = self.findChild(QDoubleSpinBox, 'anime4kCppForceFpsDoubleSpinBox')
|
||||
self.anime4kcpp_disable_progress_check_box = self.findChild(QCheckBox, 'anime4kCppDisableProgressCheckBox')
|
||||
self.anime4kcpp_alpha_check_box = self.findChild(QCheckBox, 'anime4kCppAlphaCheckBox')
|
||||
|
||||
# FFmpeg settings
|
||||
# global options
|
||||
@@ -475,6 +481,7 @@ class Video2XMainWindow(QMainWindow):
|
||||
self.config['video2x']['video2x_cache_directory'] = str((pathlib.Path(tempfile.gettempdir()) / 'video2x').absolute())
|
||||
self.cache_line_edit.setText(self.config['video2x']['video2x_cache_directory'])
|
||||
|
||||
self.output_file_name_format_string_line_edit.setText(self.config['video2x']['output_file_name_format_string'])
|
||||
self.image_output_extension_line_edit.setText(self.config['video2x']['image_output_extension'])
|
||||
self.video_output_extension_line_edit.setText(self.config['video2x']['video_output_extension'])
|
||||
|
||||
@@ -555,6 +562,11 @@ class Video2XMainWindow(QMainWindow):
|
||||
self.anime4kcpp_post_processing_check_box.setChecked(settings['postprocessing'])
|
||||
self.anime4kcpp_gpu_mode_check_box.setChecked(settings['GPUMode'])
|
||||
self.anime4kcpp_cnn_mode_check_box.setChecked(settings['CNNMode'])
|
||||
self.anime4kcpp_hdn_check_box.setChecked(settings['HDN'])
|
||||
self.anime4kcpp_hdn_level_spin_box.setValue(settings['HDNLevel'])
|
||||
self.anime4kcpp_force_fps_double_spin_box.setValue(settings['forceFps'])
|
||||
self.anime4kcpp_disable_progress_check_box.setChecked(settings['disableProgress'])
|
||||
self.anime4kcpp_alpha_check_box.setChecked(settings['alpha'])
|
||||
|
||||
# ffmpeg
|
||||
# global options
|
||||
@@ -664,6 +676,11 @@ class Video2XMainWindow(QMainWindow):
|
||||
self.config['anime4kcpp']['postprocessing'] = bool(self.anime4kcpp_post_processing_check_box.isChecked())
|
||||
self.config['anime4kcpp']['GPUMode'] = bool(self.anime4kcpp_gpu_mode_check_box.isChecked())
|
||||
self.config['anime4kcpp']['CNNMode'] = bool(self.anime4kcpp_cnn_mode_check_box.isChecked())
|
||||
self.config['anime4kcpp']['HDN'] = bool(self.anime4kcpp_hdn_check_box.isChecked())
|
||||
self.config['anime4kcpp']['HDNLevel'] = self.anime4kcpp_hdn_level_spin_box.value()
|
||||
self.config['anime4kcpp']['forceFps'] = self.anime4kcpp_force_fps_double_spin_box.value()
|
||||
self.config['anime4kcpp']['disableProgress'] = bool(self.anime4kcpp_disable_progress_check_box.isChecked())
|
||||
self.config['anime4kcpp']['alpha'] = bool(self.anime4kcpp_alpha_check_box.isChecked())
|
||||
|
||||
# ffmpeg
|
||||
self.config['ffmpeg']['ffmpeg_path'] = os.path.expandvars(self.ffmpeg_path_line_edit.text())
|
||||
@@ -943,10 +960,10 @@ class Video2XMainWindow(QMainWindow):
|
||||
else:
|
||||
suffix = input_path.suffix
|
||||
|
||||
output_path = input_path.parent / f'{input_path.stem}_output{suffix}'
|
||||
output_path = input_path.parent / self.output_file_name_format_string_line_edit.text().format(original_file_name=input_path.stem, extension=suffix)
|
||||
|
||||
elif input_path.is_dir():
|
||||
output_path = input_path.parent / f'{input_path.stem}_output'
|
||||
output_path = input_path.parent / self.output_file_name_format_string_line_edit.text().format(original_file_name=input_path.stem, extension='')
|
||||
|
||||
# try a new name with a different file ID
|
||||
output_path_id = 0
|
||||
|
||||
5061
src/video2x_gui.ui
5061
src/video2x_gui.ui
File diff suppressed because it is too large
Load Diff
@@ -2,7 +2,7 @@
|
||||
# Name: Video2X Setup Script (Ubuntu)
|
||||
# Creator: K4YT3X
|
||||
# Date Created: June 5, 2020
|
||||
# Last Modified: June 7, 2020
|
||||
# Last Modified: July 25, 2020
|
||||
|
||||
# help message if input is incorrect of if -h/--help is specified
|
||||
if [ "$1" == "-h" ] || [ "$1" == "--help" ] || [ "$#" -gt 2 ]; then
|
||||
@@ -12,16 +12,16 @@ fi
|
||||
|
||||
# set intallation path if specified
|
||||
if [ ! -z "$1" ]; then
|
||||
INSTALLATION_PATH=$1
|
||||
export INSTALLATION_PATH=$1
|
||||
else
|
||||
INSTALLATION_PATH="$HOME/.local/share"
|
||||
export INSTALLATION_PATH="$HOME/.local/share"
|
||||
fi
|
||||
|
||||
# set temp directory location if specified
|
||||
if [ ! -z "$2" ]; then
|
||||
TEMP=$2
|
||||
export TEMP=$2
|
||||
else
|
||||
TEMP="/tmp/video2x"
|
||||
export TEMP="/tmp/video2x"
|
||||
fi
|
||||
|
||||
# environment variables
|
||||
@@ -64,9 +64,8 @@ apt-fast install -y --no-install-recommends autoconf build-essential cmake gcc-8
|
||||
git clone --recurse-submodules --depth=1 --progress --recurse-submodules https://github.com/nagadomi/waifu2x-caffe-ubuntu.git $TEMP/waifu2x-caffe-ubuntu
|
||||
git clone --recurse-submodules --progress --depth=1 https://github.com/nagadomi/caffe.git $TEMP/waifu2x-caffe-ubuntu/caffe
|
||||
|
||||
apt-get purge -y gcc g++
|
||||
ln -s /usr/bin/gcc-8 /usr/bin/gcc
|
||||
ln -s /usr/bin/g++-8 /usr/bin/g++
|
||||
export CC=/usr/bin/gcc-8
|
||||
export CXX=/usr/bin/g++-8
|
||||
mkdir -v -p $TEMP/waifu2x-caffe-ubuntu/build
|
||||
cd $TEMP/waifu2x-caffe-ubuntu/build
|
||||
cmake .. -DCMAKE_INSTALL_PREFIX=/usr
|
||||
@@ -76,12 +75,13 @@ mv -v /tmp/video2x/waifu2x-caffe-ubuntu/bin $INSTALLATION_PATH/video2x/src/depen
|
||||
mv -v /tmp/video2x/waifu2x-caffe-ubuntu/build/waifu2x-caffe $INSTALLATION_PATH/video2x/src/dependencies/waifu2x-caffe/waifu2x-caffe
|
||||
|
||||
# install waifu2x-converter-cpp
|
||||
apt-fast install -y --no-install-recommends build-essential cmake libopencv-dev ocl-icd-opencl-dev
|
||||
apt-fast install -y --no-install-recommends build-essential cmake libopencv-dev beignet-opencl-icd mesa-opencl-icd nvidia-cuda-toolkit ocl-icd-opencl-dev opencl-headers
|
||||
git clone --recurse-submodules --depth=1 --progress https://github.com/DeadSix27/waifu2x-converter-cpp $TEMP/waifu2x-converter-cpp
|
||||
mkdir -v $TEMP/waifu2x-converter-cpp/build
|
||||
cd $TEMP/waifu2x-converter-cpp/build
|
||||
cmake ..
|
||||
make -j$(nproc)
|
||||
ldconfig
|
||||
mv -v $TEMP/waifu2x-converter-cpp/build $INSTALLATION_PATH/video2x/src/dependencies/waifu2x-converter-cpp
|
||||
mv -v $TEMP/waifu2x-converter-cpp/models_rgb $INSTALLATION_PATH/video2x/src/dependencies/waifu2x-converter-cpp/models_rgb
|
||||
|
||||
@@ -181,43 +181,57 @@ wget "$download_link" -O "$realsr_ncnn_vulkan_zip"
|
||||
unzip "$realsr_ncnn_vulkan_zip" -d $TEMP/realsr-ncnn-vulkan
|
||||
mv -v $TEMP/realsr-ncnn-vulkan/realsr-ncnn-vulkan-*-linux $INSTALLATION_PATH/video2x/src/dependencies/realsr-ncnn-vulkan
|
||||
|
||||
# rewrite config file values
|
||||
python3.8 - << EOF
|
||||
import yaml
|
||||
# install anime4kcpp
|
||||
#apt-fast install -y --no-install-recommends build-essential cmake libopencv-dev beignet-opencl-icd mesa-opencl-icd ocl-icd-opencl-dev opencl-headers
|
||||
#git clone --recurse-submodules --depth=1 --progress https://github.com/TianZerL/Anime4KCPP.git $TEMP/anime4kcpp
|
||||
#mkdir -v $TEMP/anime4kcpp/build
|
||||
#cd $TEMP/anime4kcpp/CLI/build
|
||||
#cmake -DBuild_GUI=OFF ..
|
||||
#make -j$(nproc)
|
||||
#mv -v $TEMP/anime4kcpp/build $INSTALLATION_PATH/video2x/src/dependencies/anime4kcpp
|
||||
#mv -v $TEMP/anime4kcpp/models_rgb $INSTALLATION_PATH/video2x/src/dependencies/anime4kcpp/models_rgb
|
||||
|
||||
with open('/video2x/src/video2x.yaml', 'r') as template:
|
||||
# rewrite config file values
|
||||
python3.8 - <<EOF
|
||||
import yaml
|
||||
import os
|
||||
|
||||
|
||||
INSTALLATION_PATH = os.environ['INSTALLATION_PATH']
|
||||
|
||||
with open('{}/video2x/src/video2x.yaml'.format(INSTALLATION_PATH), 'r') as template:
|
||||
template_dict = yaml.load(template, Loader=yaml.FullLoader)
|
||||
template.close()
|
||||
|
||||
template_dict['ffmpeg']['ffmpeg_path'] = '/usr/bin'
|
||||
template_dict['gifski']['gifski_path'] = '/root/.cargo/bin/gifski'
|
||||
template_dict['waifu2x_caffe']['path'] = '/video2x/src/dependencies/waifu2x-caffe/waifu2x-caffe'
|
||||
template_dict['waifu2x_converter_cpp']['path'] = '/video2x/src/dependencies/waifu2x-converter-cpp/waifu2x-converter-cpp'
|
||||
template_dict['waifu2x_ncnn_vulkan']['path'] = '/video2x/src/dependencies/waifu2x-ncnn-vulkan/waifu2x-ncnn-vulkan'
|
||||
template_dict['srmd_ncnn_vulkan']['path'] = '/video2x/src/dependencies/srmd-ncnn-vulkan/srmd-ncnn-vulkan'
|
||||
template_dict['realsr_ncnn_vulkan']['path'] = '/video2x/src/dependencies/realsr-ncnn-vulkan/realsr-ncnn-vulkan'
|
||||
template_dict['anime4kcpp']['path'] = '/video2x/src/dependencies/anime4kcpp/anime4kcpp'
|
||||
template_dict['waifu2x_caffe']['path'] = '{}/video2x/src/dependencies/waifu2x-caffe/waifu2x-caffe'.format(INSTALLATION_PATH)
|
||||
template_dict['waifu2x_converter_cpp']['path'] = '{}/video2x/src/dependencies/waifu2x-converter-cpp/waifu2x-converter-cpp'.format(INSTALLATION_PATH)
|
||||
template_dict['waifu2x_ncnn_vulkan']['path'] = '{}/video2x/src/dependencies/waifu2x-ncnn-vulkan/waifu2x-ncnn-vulkan'.format(INSTALLATION_PATH)
|
||||
template_dict['srmd_ncnn_vulkan']['path'] = '{}/video2x/src/dependencies/srmd-ncnn-vulkan/srmd-ncnn-vulkan'.format(INSTALLATION_PATH)
|
||||
template_dict['realsr_ncnn_vulkan']['path'] = '{}/video2x/src/dependencies/realsr-ncnn-vulkan/realsr-ncnn-vulkan'.format(INSTALLATION_PATH)
|
||||
template_dict['anime4kcpp']['path'] = '{}/video2x/src/dependencies/anime4kcpp/anime4kcpp'.format(INSTALLATION_PATH)
|
||||
|
||||
# write configuration into file
|
||||
with open('/video2x/src/video2x.yaml', 'w') as config:
|
||||
with open('{}/video2x/src/video2x.yaml'.format(INSTALLATION_PATH), 'w') as config:
|
||||
yaml.dump(template_dict, config)
|
||||
EOF
|
||||
|
||||
# clean up temp directory
|
||||
# purge default utilities
|
||||
apt-get purge -y git-core curl wget ca-certificates gnupg2 python3-dev python3-pip python3-setuptools
|
||||
# apt-get purge -y git-core curl wget ca-certificates gnupg2 python3-dev python3-pip python3-setuptools
|
||||
|
||||
# purge waifu2x-caffe build dependencies
|
||||
apt-get purge -y autoconf build-essential cmake gcc-8 libatlas-base-dev libboost-atomic-dev libboost-chrono-dev libboost-date-time-dev libboost-filesystem-dev libboost-iostreams-dev libboost-python-dev libboost-system-dev libboost-thread-dev libcudnn7 libcudnn7-dev libgflags-dev libgoogle-glog-dev libhdf5-dev libleveldb-dev liblmdb-dev libopencv-dev libprotobuf-dev libsnappy-dev protobuf-compiler python-numpy texinfo yasm zlib1g-dev
|
||||
# apt-get purge -y autoconf build-essential cmake gcc-8 libatlas-base-dev libboost-atomic-dev libboost-chrono-dev libboost-date-time-dev libboost-filesystem-dev libboost-iostreams-dev libboost-python-dev libboost-system-dev libboost-thread-dev libcudnn7 libcudnn7-dev libgflags-dev libgoogle-glog-dev libhdf5-dev libleveldb-dev liblmdb-dev libopencv-dev libprotobuf-dev libsnappy-dev protobuf-compiler python-numpy texinfo yasm zlib1g-dev
|
||||
|
||||
# purge waifu2x-converter-cpp build dependencies
|
||||
apt-get purge -y libopencv-dev ocl-icd-opencl-dev
|
||||
# apt-get purge -y libopencv-dev ocl-icd-opencl-dev
|
||||
|
||||
# purge waifu2x/srmd/realsr-ncnn-vulkan build dependencies
|
||||
apt-get purge -y unzip jq
|
||||
# apt-get purge -y unzip jq
|
||||
|
||||
# run autoremove and purge all unused packages
|
||||
apt-get autoremove --purge -y
|
||||
# apt-get autoremove --purge -y
|
||||
|
||||
# remove temp directory
|
||||
rm -vrf $TEMP
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
Name: Waifu2x Caffe Driver
|
||||
Name: Anime4KCPP Driver
|
||||
Author: K4YT3X
|
||||
Date Created: May 3, 2020
|
||||
Last Modified: May 11, 2020
|
||||
Last Modified: September 1, 2020
|
||||
|
||||
Description: This class is a high-level wrapper
|
||||
for waifu2x-caffe.
|
||||
for Anime4KCPP.
|
||||
"""
|
||||
|
||||
# built-in imports
|
||||
@@ -60,10 +60,16 @@ class WrapperMain:
|
||||
parser.add_argument('-e', '--postFilters', type=int, help='Enhancement filter, only working when postProcessing is true,there are 5 options by binary:Median blur=0000001, Mean blur=0000010, CAS Sharpening=0000100, Gaussian blur weak=0001000, Gaussian blur=0010000, Bilateral filter=0100000, Bilateral filter faster=1000000, you can freely combine them, eg: Gaussian blur weak + Bilateral filter = 0001000 | 0100000 = 0101000 = 40(D), so you can put 40 to enable Gaussian blur weak and Bilateral filter, which also is what I recommend for image that < 1080P, 48 for image that >= 1080P, and for performance I recommend to use 72 for video that < 1080P, 80 for video that >=1080P')
|
||||
parser.add_argument('-q', '--GPUMode', action='store_true', help='Enable GPU acceleration')
|
||||
parser.add_argument('-w', '--CNNMode', action='store_true', help='Enable ACNet')
|
||||
parser.add_argument('-H', '--HDN', action='store_true', help='Enable HDN mode for ACNet')
|
||||
parser.add_argument('-L', '--HDNLevel', type=int, help='Set HDN level')
|
||||
parser.add_argument('-l', '--listGPUs', action='store_true', help='list GPUs')
|
||||
parser.add_argument('-h', '--platformID', type=int, help='Specify the platform ID')
|
||||
parser.add_argument('-d', '--deviceID', type=int, help='Specify the device ID')
|
||||
parser.add_argument('-C', '--codec', type=str, help='Specify the codec for encoding from mp4v(recommended in Windows), dxva(for Windows), avc1(H264, recommended in Linux), vp09(very slow), hevc(not support in Windowds), av01(not support in Windowds) (string [=mp4v])')
|
||||
parser.add_argument('-F', '--forceFps', type=float, help='Set output video fps to the specifying number, 0 to disable')
|
||||
parser.add_argument('-D', '--disableProgress', action='store_true', help='disable progress display')
|
||||
parser.add_argument('-W', '--webVideo', type=str, help='process the video from URL')
|
||||
parser.add_argument('-A', '--alpha', action='store_true', help='preserve the Alpha channel for transparent image')
|
||||
return parser.parse_args(arguments)
|
||||
|
||||
def load_configurations(self, upscaler):
|
||||
@@ -84,6 +90,10 @@ class WrapperMain:
|
||||
height {int} -- output video height
|
||||
"""
|
||||
|
||||
# change the working directory to the binary's parent directory
|
||||
# so the binary can find shared object files and other files
|
||||
os.chdir(pathlib.Path(self.driver_settings['path']).parent)
|
||||
|
||||
# overwrite config file settings
|
||||
self.driver_settings['input'] = input_file
|
||||
self.driver_settings['output'] = output_file
|
||||
|
||||
@@ -65,6 +65,10 @@ class WrapperMain:
|
||||
ratio {int} -- output video ratio
|
||||
"""
|
||||
|
||||
# change the working directory to the binary's parent directory
|
||||
# so the binary can find shared object files and other files
|
||||
os.chdir(pathlib.Path(self.driver_settings['path']).parent)
|
||||
|
||||
# overwrite config file settings
|
||||
self.driver_settings['i'] = input_directory
|
||||
self.driver_settings['o'] = output_directory
|
||||
|
||||
@@ -66,6 +66,10 @@ class WrapperMain:
|
||||
ratio {int} -- output video ratio
|
||||
"""
|
||||
|
||||
# change the working directory to the binary's parent directory
|
||||
# so the binary can find shared object files and other files
|
||||
os.chdir(pathlib.Path(self.driver_settings['path']).parent)
|
||||
|
||||
# overwrite config file settings
|
||||
self.driver_settings['i'] = input_directory
|
||||
self.driver_settings['o'] = output_directory
|
||||
|
||||
@@ -13,6 +13,7 @@ for waifu2x-caffe.
|
||||
# built-in imports
|
||||
import argparse
|
||||
import os
|
||||
import pathlib
|
||||
import shlex
|
||||
import subprocess
|
||||
import threading
|
||||
@@ -73,6 +74,10 @@ class WrapperMain:
|
||||
""" start upscaling process
|
||||
"""
|
||||
|
||||
# change the working directory to the binary's parent directory
|
||||
# so the binary can find shared object files and other files
|
||||
os.chdir(pathlib.Path(self.driver_settings['path']).parent)
|
||||
|
||||
# overwrite config file settings
|
||||
self.driver_settings['input_path'] = input_directory
|
||||
self.driver_settings['output_path'] = output_directory
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
Name: Waifu2x Converter CPP Driver
|
||||
Author: K4YT3X
|
||||
Date Created: February 8, 2019
|
||||
Last Modified: June 7, 2020
|
||||
Last Modified: June 13, 2020
|
||||
|
||||
Description: This class is a high-level wrapper
|
||||
for waifu2x-converter-cpp.
|
||||
@@ -82,6 +82,10 @@ class WrapperMain:
|
||||
threads {int} -- number of threads
|
||||
"""
|
||||
|
||||
# change the working directory to the binary's parent directory
|
||||
# so the binary can find shared object files and other files
|
||||
os.chdir(pathlib.Path(self.driver_settings['path']).parent)
|
||||
|
||||
# overwrite config file settings
|
||||
self.driver_settings['input'] = input_directory
|
||||
self.driver_settings['output'] = output_directory
|
||||
|
||||
@@ -69,6 +69,10 @@ class WrapperMain:
|
||||
ratio {int} -- output video ratio
|
||||
"""
|
||||
|
||||
# change the working directory to the binary's parent directory
|
||||
# so the binary can find shared object files and other files
|
||||
os.chdir(pathlib.Path(self.driver_settings['path']).parent)
|
||||
|
||||
# overwrite config file settings
|
||||
self.driver_settings['i'] = input_directory
|
||||
self.driver_settings['o'] = output_directory
|
||||
|
||||
Reference in New Issue
Block a user