mirror of
https://github.com/k4yt3x/video2x.git
synced 2025-01-01 10:29:09 +00:00
update waifu2x_ncnn_vulkan wrapper for directory as input
add workaround for the double file extension
This commit is contained in:
parent
9429b04528
commit
40a4d3a602
@ -150,6 +150,14 @@ class Ffmpeg:
|
|||||||
# read FFmpeg input options
|
# read FFmpeg input options
|
||||||
execute.extend(self._read_configuration(phase='frames_to_video', section='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
|
# append input frames path into command
|
||||||
execute.extend([
|
execute.extend([
|
||||||
'-i',
|
'-i',
|
||||||
|
@ -47,7 +47,9 @@
|
|||||||
"scale-ratio": null,
|
"scale-ratio": null,
|
||||||
"tile-size": 400,
|
"tile-size": 400,
|
||||||
"model-path": null,
|
"model-path": null,
|
||||||
"gpu": 0
|
"gpu": 0,
|
||||||
|
"load-proc-save_threads": null,
|
||||||
|
"verbose": null
|
||||||
},
|
},
|
||||||
"ffmpeg": {
|
"ffmpeg": {
|
||||||
"ffmpeg_path": "C:\\Users\\K4YT3X\\AppData\\Local\\video2x\\ffmpeg-latest-win64-static\\bin",
|
"ffmpeg_path": "C:\\Users\\K4YT3X\\AppData\\Local\\video2x\\ffmpeg-latest-win64-static\\bin",
|
||||||
|
@ -67,10 +67,11 @@ class Waifu2xNcnnVulkan:
|
|||||||
'scale-ratio': '-s',
|
'scale-ratio': '-s',
|
||||||
'tile-size': '-t',
|
'tile-size': '-t',
|
||||||
'model-path': '-m',
|
'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']]
|
execute = [self.waifu2x_settings['waifu2x_ncnn_vulkan_path']]
|
||||||
for key in self.waifu2x_settings.keys():
|
for key in self.waifu2x_settings.keys():
|
||||||
value = self.waifu2x_settings[key]
|
value = self.waifu2x_settings[key]
|
||||||
@ -78,10 +79,10 @@ class Waifu2xNcnnVulkan:
|
|||||||
continue
|
continue
|
||||||
elif key == 'input':
|
elif key == 'input':
|
||||||
execute.append(waifu2x_ncnn_vulkan_opt_flag[key])
|
execute.append(waifu2x_ncnn_vulkan_opt_flag[key])
|
||||||
execute.append(os.path.join(input_directory, raw_frame))
|
execute.append(input_directory)
|
||||||
elif key == 'output':
|
elif key == 'output':
|
||||||
execute.append(waifu2x_ncnn_vulkan_opt_flag[key])
|
execute.append(waifu2x_ncnn_vulkan_opt_flag[key])
|
||||||
execute.append(os.path.join(output_directory, raw_frame))
|
execute.append(output_directory)
|
||||||
elif key == 'scale-ratio':
|
elif key == 'scale-ratio':
|
||||||
execute.append(waifu2x_ncnn_vulkan_opt_flag[key])
|
execute.append(waifu2x_ncnn_vulkan_opt_flag[key])
|
||||||
# waifu2x_ncnn_vulkan does not accept an arbitrary scale ratio, max is 2
|
# waifu2x_ncnn_vulkan does not accept an arbitrary scale ratio, max is 2
|
||||||
|
Loading…
Reference in New Issue
Block a user