mirror of
https://github.com/k4yt3x/video2x.git
synced 2025-01-04 04:39:10 +00:00
renamed image_format to extracted_frame_format
This commit is contained in:
parent
765db2512b
commit
0b15fb7bd2
@ -2,9 +2,9 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
"""
|
"""
|
||||||
Name: Video2X Upscale Progress Monitor
|
Name: Video2X Upscale Progress Monitor
|
||||||
Author: BrianPetkovsek
|
Author: K4YT3X
|
||||||
Date Created: May 7, 2020
|
Date Created: May 7, 2020
|
||||||
Last Modified: May 10, 2020
|
Last Modified: June 7, 2020
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# built-in imports
|
# built-in imports
|
||||||
@ -37,7 +37,7 @@ class ProgressMonitor(threading.Thread):
|
|||||||
# get number of extracted frames
|
# get number of extracted frames
|
||||||
self.upscaler.total_frames = 0
|
self.upscaler.total_frames = 0
|
||||||
for directory in self.extracted_frames_directories:
|
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:
|
with tqdm(total=self.upscaler.total_frames, ascii=True, desc=_('Upscaling Progress')) as progress_bar:
|
||||||
# tqdm update method adds the value to the progress
|
# tqdm update method adds the value to the progress
|
||||||
@ -47,7 +47,7 @@ class ProgressMonitor(threading.Thread):
|
|||||||
while self.running:
|
while self.running:
|
||||||
|
|
||||||
with contextlib.suppress(FileNotFoundError):
|
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:
|
if len(upscaled_frames) >= 1:
|
||||||
self.upscaler.last_frame_upscaled = sorted(upscaled_frames)[-1]
|
self.upscaler.last_frame_upscaled = sorted(upscaled_frames)[-1]
|
||||||
self.upscaler.total_frames_upscaled = len(upscaled_frames)
|
self.upscaler.total_frames_upscaled = len(upscaled_frames)
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
Name: Video2X FFmpeg Controller
|
Name: Video2X FFmpeg Controller
|
||||||
Author: K4YT3X
|
Author: K4YT3X
|
||||||
Date Created: Feb 24, 2018
|
Date Created: Feb 24, 2018
|
||||||
Last Modified: May 14, 2020
|
Last Modified: June 7, 2020
|
||||||
|
|
||||||
Description: This class handles all FFmpeg related operations.
|
Description: This class handles all FFmpeg related operations.
|
||||||
"""
|
"""
|
||||||
@ -27,7 +27,7 @@ class Ffmpeg:
|
|||||||
and inserting audio tracks to videos.
|
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_settings = ffmpeg_settings
|
||||||
|
|
||||||
self.ffmpeg_path = pathlib.Path(self.ffmpeg_settings['ffmpeg_path'])
|
self.ffmpeg_path = pathlib.Path(self.ffmpeg_settings['ffmpeg_path'])
|
||||||
@ -35,7 +35,7 @@ class Ffmpeg:
|
|||||||
self.ffmpeg_probe_binary = self.ffmpeg_path / 'ffprobe'
|
self.ffmpeg_probe_binary = self.ffmpeg_path / 'ffprobe'
|
||||||
|
|
||||||
# video metadata
|
# 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.intermediate_file_name = pathlib.Path(self.ffmpeg_settings['intermediate_file_name'])
|
||||||
self.pixel_format = self.ffmpeg_settings['extract_frames']['output_options']['-pix_fmt']
|
self.pixel_format = self.ffmpeg_settings['extract_frames']['output_options']['-pix_fmt']
|
||||||
|
|
||||||
@ -133,7 +133,7 @@ class Ffmpeg:
|
|||||||
|
|
||||||
# specify output file
|
# specify output file
|
||||||
execute.extend([
|
execute.extend([
|
||||||
extracted_frames / f'extracted_%0d.{self.image_format}'
|
extracted_frames / f'extracted_%0d.{self.extracted_frame_format}'
|
||||||
])
|
])
|
||||||
|
|
||||||
return(self._execute(execute))
|
return(self._execute(execute))
|
||||||
@ -174,7 +174,7 @@ class Ffmpeg:
|
|||||||
# append input frames path into command
|
# append input frames path into command
|
||||||
execute.extend([
|
execute.extend([
|
||||||
'-i',
|
'-i',
|
||||||
upscaled_frames / f'extracted_%d.{self.image_format}'
|
upscaled_frames / f'extracted_%d.{self.extracted_frame_format}'
|
||||||
])
|
])
|
||||||
|
|
||||||
# read FFmpeg output options
|
# read FFmpeg output options
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
Name: Gifski Wrapper
|
Name: Gifski Wrapper
|
||||||
Creator: K4YT3X
|
Creator: K4YT3X
|
||||||
Date Created: May 11, 2020
|
Date Created: May 11, 2020
|
||||||
Last Modified: May 11, 2020
|
Last Modified: June 7, 2020
|
||||||
|
|
||||||
Description: High-level wrapper for Gifski.
|
Description: High-level wrapper for Gifski.
|
||||||
"""
|
"""
|
||||||
@ -22,7 +22,7 @@ class Gifski:
|
|||||||
def __init__(self, gifski_settings):
|
def __init__(self, gifski_settings):
|
||||||
self.gifski_settings = 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 = [
|
execute = [
|
||||||
self.gifski_settings['gifski_path'],
|
self.gifski_settings['gifski_path'],
|
||||||
'-o',
|
'-o',
|
||||||
@ -35,7 +35,7 @@ class Gifski:
|
|||||||
execute.extend(self._load_configuration())
|
execute.extend(self._load_configuration())
|
||||||
|
|
||||||
# append frames location
|
# append frames location
|
||||||
execute.extend([upscaled_frames / f'extracted_*.{image_format}'])
|
execute.extend([upscaled_frames / f'extracted_*.{extracted_frame_format}'])
|
||||||
|
|
||||||
return(self._execute(execute))
|
return(self._execute(execute))
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
Name: Waifu2x Caffe Driver
|
Name: Waifu2x Caffe Driver
|
||||||
Author: K4YT3X
|
Author: K4YT3X
|
||||||
Date Created: Feb 24, 2018
|
Date Created: Feb 24, 2018
|
||||||
Last Modified: May 11, 2020
|
Last Modified: June 7, 2020
|
||||||
|
|
||||||
Description: This class is a high-level wrapper
|
Description: This class is a high-level wrapper
|
||||||
for waifu2x-caffe.
|
for waifu2x-caffe.
|
||||||
@ -63,7 +63,7 @@ class WrapperMain:
|
|||||||
def load_configurations(self, upscaler):
|
def load_configurations(self, upscaler):
|
||||||
# use scale width and scale height if specified
|
# use scale width and scale height if specified
|
||||||
self.driver_settings['scale_ratio'] = upscaler.scale_ratio
|
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
|
# bit_depth will be 12 at this point
|
||||||
# it will up updated later
|
# it will up updated later
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
Name: Waifu2x Converter CPP Driver
|
Name: Waifu2x Converter CPP Driver
|
||||||
Author: K4YT3X
|
Author: K4YT3X
|
||||||
Date Created: February 8, 2019
|
Date Created: February 8, 2019
|
||||||
Last Modified: May 11, 2020
|
Last Modified: June 7, 2020
|
||||||
|
|
||||||
Description: This class is a high-level wrapper
|
Description: This class is a high-level wrapper
|
||||||
for waifu2x-converter-cpp.
|
for waifu2x-converter-cpp.
|
||||||
@ -69,7 +69,7 @@ class WrapperMain:
|
|||||||
def load_configurations(self, upscaler):
|
def load_configurations(self, upscaler):
|
||||||
self.driver_settings['scale-ratio'] = upscaler.scale_ratio
|
self.driver_settings['scale-ratio'] = upscaler.scale_ratio
|
||||||
self.driver_settings['jobs'] = upscaler.processes
|
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):
|
def upscale(self, input_directory, output_directory):
|
||||||
""" Waifu2x Converter Driver Upscaler
|
""" Waifu2x Converter Driver Upscaler
|
||||||
|
Loading…
Reference in New Issue
Block a user