renamed image_format to extracted_frame_format

This commit is contained in:
k4yt3x 2020-06-07 23:35:17 -04:00
parent 765db2512b
commit 0b15fb7bd2
5 changed files with 16 additions and 16 deletions

View File

@ -2,9 +2,9 @@
# -*- coding: utf-8 -*-
"""
Name: Video2X Upscale Progress Monitor
Author: BrianPetkovsek
Author: K4YT3X
Date Created: May 7, 2020
Last Modified: May 10, 2020
Last Modified: June 7, 2020
"""
# built-in imports
@ -37,7 +37,7 @@ class ProgressMonitor(threading.Thread):
# get number of extracted frames
self.upscaler.total_frames = 0
for directory in self.extracted_frames_directories:
self.upscaler.total_frames += len([f for f in directory.iterdir() if str(f).lower().endswith(self.upscaler.image_format.lower())])
self.upscaler.total_frames += len([f for f in directory.iterdir() if str(f).lower().endswith(self.upscaler.extracted_frame_format.lower())])
with tqdm(total=self.upscaler.total_frames, ascii=True, desc=_('Upscaling Progress')) as progress_bar:
# tqdm update method adds the value to the progress
@ -47,7 +47,7 @@ class ProgressMonitor(threading.Thread):
while self.running:
with contextlib.suppress(FileNotFoundError):
upscaled_frames = [f for f in self.upscaler.upscaled_frames.iterdir() if str(f).lower().endswith(self.upscaler.image_format.lower())]
upscaled_frames = [f for f in self.upscaler.upscaled_frames.iterdir() if str(f).lower().endswith(self.upscaler.extracted_frame_format.lower())]
if len(upscaled_frames) >= 1:
self.upscaler.last_frame_upscaled = sorted(upscaled_frames)[-1]
self.upscaler.total_frames_upscaled = len(upscaled_frames)

View File

@ -4,7 +4,7 @@
Name: Video2X FFmpeg Controller
Author: K4YT3X
Date Created: Feb 24, 2018
Last Modified: May 14, 2020
Last Modified: June 7, 2020
Description: This class handles all FFmpeg related operations.
"""
@ -27,7 +27,7 @@ class Ffmpeg:
and inserting audio tracks to videos.
"""
def __init__(self, ffmpeg_settings, image_format='png'):
def __init__(self, ffmpeg_settings, extracted_frame_format='png'):
self.ffmpeg_settings = ffmpeg_settings
self.ffmpeg_path = pathlib.Path(self.ffmpeg_settings['ffmpeg_path'])
@ -35,7 +35,7 @@ class Ffmpeg:
self.ffmpeg_probe_binary = self.ffmpeg_path / 'ffprobe'
# video metadata
self.image_format = image_format
self.extracted_frame_format = extracted_frame_format
self.intermediate_file_name = pathlib.Path(self.ffmpeg_settings['intermediate_file_name'])
self.pixel_format = self.ffmpeg_settings['extract_frames']['output_options']['-pix_fmt']
@ -133,7 +133,7 @@ class Ffmpeg:
# specify output file
execute.extend([
extracted_frames / f'extracted_%0d.{self.image_format}'
extracted_frames / f'extracted_%0d.{self.extracted_frame_format}'
])
return(self._execute(execute))
@ -174,7 +174,7 @@ class Ffmpeg:
# append input frames path into command
execute.extend([
'-i',
upscaled_frames / f'extracted_%d.{self.image_format}'
upscaled_frames / f'extracted_%d.{self.extracted_frame_format}'
])
# read FFmpeg output options

View File

@ -4,7 +4,7 @@
Name: Gifski Wrapper
Creator: K4YT3X
Date Created: May 11, 2020
Last Modified: May 11, 2020
Last Modified: June 7, 2020
Description: High-level wrapper for Gifski.
"""
@ -22,7 +22,7 @@ class Gifski:
def __init__(self, gifski_settings):
self.gifski_settings = gifski_settings
def make_gif(self, upscaled_frames: pathlib.Path, output_path: pathlib.Path, framerate: float, image_format: str) -> subprocess.Popen:
def make_gif(self, upscaled_frames: pathlib.Path, output_path: pathlib.Path, framerate: float, extracted_frame_format: str) -> subprocess.Popen:
execute = [
self.gifski_settings['gifski_path'],
'-o',
@ -35,7 +35,7 @@ class Gifski:
execute.extend(self._load_configuration())
# append frames location
execute.extend([upscaled_frames / f'extracted_*.{image_format}'])
execute.extend([upscaled_frames / f'extracted_*.{extracted_frame_format}'])
return(self._execute(execute))

View File

@ -4,7 +4,7 @@
Name: Waifu2x Caffe Driver
Author: K4YT3X
Date Created: Feb 24, 2018
Last Modified: May 11, 2020
Last Modified: June 7, 2020
Description: This class is a high-level wrapper
for waifu2x-caffe.
@ -63,7 +63,7 @@ class WrapperMain:
def load_configurations(self, upscaler):
# use scale width and scale height if specified
self.driver_settings['scale_ratio'] = upscaler.scale_ratio
self.driver_settings['output_extention'] = upscaler.image_format
self.driver_settings['output_extention'] = upscaler.extracted_frame_format
# bit_depth will be 12 at this point
# it will up updated later

View File

@ -4,7 +4,7 @@
Name: Waifu2x Converter CPP Driver
Author: K4YT3X
Date Created: February 8, 2019
Last Modified: May 11, 2020
Last Modified: June 7, 2020
Description: This class is a high-level wrapper
for waifu2x-converter-cpp.
@ -69,7 +69,7 @@ class WrapperMain:
def load_configurations(self, upscaler):
self.driver_settings['scale-ratio'] = upscaler.scale_ratio
self.driver_settings['jobs'] = upscaler.processes
self.driver_settings['output-format'] = upscaler.image_format.lower()
self.driver_settings['output-format'] = upscaler.extracted_frame_format.lower()
def upscale(self, input_directory, output_directory):
""" Waifu2x Converter Driver Upscaler