diff --git a/src/video2x_gui.py b/src/video2x_gui.py index 2bdf2f1..814aeeb 100755 --- a/src/video2x_gui.py +++ b/src/video2x_gui.py @@ -377,6 +377,14 @@ class Video2XMainWindow(QMainWindow): self.ffmpeg_migrate_streams_hardware_acceleration_check_box = self.findChild(QCheckBox, 'ffmpegMigrateStreamsHardwareAccelerationCheckBox') # Gifski settings + self.gifski_path_line_edit = self.findChild(QLineEdit, 'gifskiPathLineEdit') + self.enable_line_edit_file_drop(self.gifski_path_line_edit) + self.gifski_quality_spin_box = self.findChild(QSpinBox, 'gifskiQualitySpinBox') + self.gifski_width_spin_box = self.findChild(QSpinBox, 'gifskiWidthSpinBox') + self.gifski_height_spin_box = self.findChild(QSpinBox, 'gifskiHeightSpinBox') + self.gifski_fast_check_box = self.findChild(QCheckBox, 'gifskiFastCheckBox') + self.gifski_once_check_box = self.findChild(QCheckBox, 'gifskiOnceCheckBox') + self.gifski_quiet_check_box = self.findChild(QCheckBox, 'gifskiQuietCheckBox') # Tools self.ffprobe_plain_text_edit = self.findChild(QPlainTextEdit, 'ffprobePlainTextEdit') @@ -544,6 +552,17 @@ class Video2XMainWindow(QMainWindow): settings = self.config['ffmpeg']['migrate_streams'] self.ffmpeg_migrate_streams_output_options_pixel_format_line_edit.setText(settings['output_options']['-pix_fmt']) + # Gifski + settings = self.config['gifski'] + self.gifski_path_line_edit.setText(str(pathlib.Path(os.path.expandvars(settings['gifski_path'])).absolute())) + self.gifski_quality_spin_box.setValue(settings['quality']) + if isinstance(settings['width'], int) and isinstance(settings['height'], int): + self.gifski_width_spin_box.setValue(settings['width']) + self.gifski_height_spin_box.setValue(settings['height']) + self.gifski_fast_check_box.setChecked(settings['fast']) + self.gifski_once_check_box.setChecked(settings['once']) + self.gifski_quiet_check_box.setChecked(settings['quiet']) + def resolve_driver_settings(self): # waifu2x-caffe @@ -680,6 +699,19 @@ class Video2XMainWindow(QMainWindow): else: self.config['ffmpeg']['migrate_streams'].pop('-hwaccel', None) + # Gifski + self.config['gifski']['gifski_path'] = os.path.expandvars(self.gifski_path_line_edit.text()) + self.config['gifski']['quality'] = self.gifski_quality_spin_box.value() + if self.gifski_width_spin_box.value() > 0 and self.gifski_height_spin_box.value() > 0: + self.config['gifski']['width'] = self.gifski_width_spin_box.value() + self.config['gifski']['height'] = self.gifski_height_spin_box.value() + else: + self.config['gifski']['width'] = None + self.config['gifski']['height'] = None + self.config['gifski']['fast'] = self.gifski_fast_check_box.isChecked() + self.config['gifski']['once'] = self.gifski_once_check_box.isChecked() + self.config['gifski']['quiet'] = self.gifski_quiet_check_box.isChecked() + def update_gui_for_driver(self): current_driver = AVAILABLE_DRIVERS[self.driver_combo_box.currentText()] diff --git a/src/video2x_gui.pyproject.user b/src/video2x_gui.pyproject.user index 22e63d9..25ddc8c 100644 --- a/src/video2x_gui.pyproject.user +++ b/src/video2x_gui.pyproject.user @@ -1,6 +1,6 @@ - + EnvironmentId diff --git a/src/video2x_gui.ui b/src/video2x_gui.ui index 54ad3ad..ebaa81d 100644 --- a/src/video2x_gui.ui +++ b/src/video2x_gui.ui @@ -2213,7 +2213,11 @@ - + + + 99999 + + @@ -2227,7 +2231,11 @@ - + + + 99999 + + diff --git a/src/wrappers/ffmpeg.py b/src/wrappers/ffmpeg.py index 19fdfba..c1d4f93 100644 --- a/src/wrappers/ffmpeg.py +++ b/src/wrappers/ffmpeg.py @@ -257,7 +257,7 @@ class Ffmpeg: value = self.ffmpeg_settings[phase][key] # null or None means that leave this option out (keep default) - if value is None or value is False or isinstance(value, dict): + if value is None or value is False or isinstance(value, dict) or value == '': continue # if the value is a list, append the same argument and all values