diff --git a/bin/ffmpeg.py b/bin/ffmpeg.py index 565730b..1c8cccf 100644 --- a/bin/ffmpeg.py +++ b/bin/ffmpeg.py @@ -150,6 +150,14 @@ class Ffmpeg: # read FFmpeg input options execute.extend(self._read_configuration(phase='frames_to_video', section='input_options')) + # WORKAROUND FOR WAIFU2X-NCNN-VULKAN + import re + import shutil + regex = re.compile(r'\.png\.png$') + for raw_frame in os.listdir(upscaled_frames): + shutil.move(os.path.join(upscaled_frames, raw_frame), os.path.join(upscaled_frames, regex.sub('.png', raw_frame))) + # END WORKAROUND + # append input frames path into command execute.extend([ '-i', diff --git a/bin/video2x.json b/bin/video2x.json index 8ba70eb..eb3791e 100644 --- a/bin/video2x.json +++ b/bin/video2x.json @@ -47,7 +47,9 @@ "scale-ratio": null, "tile-size": 400, "model-path": null, - "gpu": 0 + "gpu": 0, + "load-proc-save_threads": null, + "verbose": null }, "ffmpeg": { "ffmpeg_path": "C:\\Users\\K4YT3X\\AppData\\Local\\video2x\\ffmpeg-latest-win64-static\\bin", diff --git a/bin/waifu2x_ncnn_vulkan.py b/bin/waifu2x_ncnn_vulkan.py index 38f188b..72f3baa 100644 --- a/bin/waifu2x_ncnn_vulkan.py +++ b/bin/waifu2x_ncnn_vulkan.py @@ -67,37 +67,38 @@ class Waifu2xNcnnVulkan: 'scale-ratio': '-s', 'tile-size': '-t', 'model-path': '-m', - 'gpu': '-g' + 'gpu': '-g', + 'load-proc-save_threads': '-j', + 'verbose': '-v' } - for raw_frame in os.listdir(input_directory): - execute = [self.waifu2x_settings['waifu2x_ncnn_vulkan_path']] - for key in self.waifu2x_settings.keys(): - value = self.waifu2x_settings[key] - if key == 'waifu2x_ncnn_vulkan_path': - continue - elif key == 'input': - execute.append(waifu2x_ncnn_vulkan_opt_flag[key]) - execute.append(os.path.join(input_directory, raw_frame)) - elif key == 'output': - execute.append(waifu2x_ncnn_vulkan_opt_flag[key]) - execute.append(os.path.join(output_directory, raw_frame)) - elif key == 'scale-ratio': - execute.append(waifu2x_ncnn_vulkan_opt_flag[key]) - # waifu2x_ncnn_vulkan does not accept an arbitrary scale ratio, max is 2 - if scale_ratio == 1: - execute.append('1') - else: - execute.append('2') - # allow upper if cases to take precedence - elif value is None or value is False: - continue + execute = [self.waifu2x_settings['waifu2x_ncnn_vulkan_path']] + for key in self.waifu2x_settings.keys(): + value = self.waifu2x_settings[key] + if key == 'waifu2x_ncnn_vulkan_path': + continue + elif key == 'input': + execute.append(waifu2x_ncnn_vulkan_opt_flag[key]) + execute.append(input_directory) + elif key == 'output': + execute.append(waifu2x_ncnn_vulkan_opt_flag[key]) + execute.append(output_directory) + elif key == 'scale-ratio': + execute.append(waifu2x_ncnn_vulkan_opt_flag[key]) + # waifu2x_ncnn_vulkan does not accept an arbitrary scale ratio, max is 2 + if scale_ratio == 1: + execute.append('1') else: - execute.append(waifu2x_ncnn_vulkan_opt_flag[key]) - execute.append(str(value)) + execute.append('2') + # allow upper if cases to take precedence + elif value is None or value is False: + continue + else: + execute.append(waifu2x_ncnn_vulkan_opt_flag[key]) + execute.append(str(value)) - Avalon.debug_info(f'Executing: {execute}') - subprocess.run(execute, check=True, stderr=subprocess.DEVNULL) + Avalon.debug_info(f'Executing: {execute}') + subprocess.run(execute, check=True, stderr=subprocess.DEVNULL) # print thread exiting message self.print_lock.acquire()