added Gifski settings, added config filter for ffmpeg

This commit is contained in:
k4yt3x 2020-05-14 20:17:10 -04:00
parent 99abb4f6df
commit 0882f44e1f
4 changed files with 44 additions and 4 deletions

View File

@ -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()]

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 4.12.0, 2020-05-14T14:57:32. -->
<!-- Written by QtCreator 4.12.0, 2020-05-14T20:16:43. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>

View File

@ -2213,7 +2213,11 @@
</widget>
</item>
<item>
<widget class="QSpinBox" name="gifskiWidthSpinBox"/>
<widget class="QSpinBox" name="gifskiWidthSpinBox">
<property name="maximum">
<number>99999</number>
</property>
</widget>
</item>
</layout>
</item>
@ -2227,7 +2231,11 @@
</widget>
</item>
<item>
<widget class="QSpinBox" name="gifskiHeightSpinBox"/>
<widget class="QSpinBox" name="gifskiHeightSpinBox">
<property name="maximum">
<number>99999</number>
</property>
</widget>
</item>
</layout>
</item>

View File

@ -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