diff --git a/src/upscaler.py b/src/upscaler.py
index 3d741b5..100d02a 100755
--- a/src/upscaler.py
+++ b/src/upscaler.py
@@ -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
diff --git a/src/video2x.py b/src/video2x.py
index dbda134..2f46f73 100755
--- a/src/video2x.py
+++ b/src/video2x.py
@@ -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
diff --git a/src/video2x.yaml b/src/video2x.yaml
index 527762d..f7abba3 100644
--- a/src/video2x.yaml
+++ b/src/video2x.yaml
@@ -1,7 +1,7 @@
# Name: Video2X Configuration File
# Creator: K4YT3X
# Date Created: October 23, 2018
-# Last Modified: June 7, 2020
+# Last Modified: June 30, 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
@@ -170,6 +170,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
diff --git a/src/video2x_gui.py b/src/video2x_gui.py
index d789204..3e2605f 100755
--- a/src/video2x_gui.py
+++ b/src/video2x_gui.py
@@ -4,7 +4,7 @@
Creator: Video2X GUI
Author: K4YT3X
Date Created: May 5, 2020
-Last Modified: June 8, 2020
+Last Modified: June 30, 2020
"""
# local imports
@@ -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')
@@ -475,6 +476,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'])
@@ -943,10 +945,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
diff --git a/src/video2x_gui.ui b/src/video2x_gui.ui
index 2445d14..c33c362 100644
--- a/src/video2x_gui.ui
+++ b/src/video2x_gui.ui
@@ -6,8 +6,8 @@
0
0
- 727
- 908
+ 724
+ 936
@@ -142,11 +142,11 @@
-
-
+
- Other Paths Selection
+ Output Selection
-
+
-
-
@@ -187,6 +187,45 @@
+ -
+
+
-
+
+
+
+ 63
+ 0
+
+
+
+ Output File Name Format String
+
+
+
+ -
+
+
+ <html><head/><body><p>Format string used to generate output file name(s).</p><p>For example, if the input is "sample.mp4", and the format string is "{original_file_name}_output{extension}", then the output file name will be "sample_output.mp4".</p></body></html>
+
+
+ {original_file_name}_output{extension}
+
+
+ Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter
+
+
+
+
+
+
+
+
+ -
+
+
+ Other Paths Selection
+
+
-
-
@@ -2835,7 +2874,7 @@
0
0
- 727
+ 724
21