From 9b4ee89aeef416e80e0c6600bc0a2c3d7054dc5a Mon Sep 17 00:00:00 2001 From: k4yt3x Date: Tue, 12 May 2020 20:31:58 -0400 Subject: [PATCH] added FFmpeg Settings tab and Tools tab and FFprobe tool --- src/video2x_gui.py | 22 ++++++++++++++++++++-- src/video2x_gui.ui | 31 ++++++++++++++++++++++++++++++- 2 files changed, 50 insertions(+), 3 deletions(-) diff --git a/src/video2x_gui.py b/src/video2x_gui.py index 97fe8ff..f285a8e 100755 --- a/src/video2x_gui.py +++ b/src/video2x_gui.py @@ -4,14 +4,16 @@ Creator: Video2X GUI Author: K4YT3X Date Created: May 5, 2020 -Last Modified: May 11, 2020 +Last Modified: May 12, 2020 """ # local imports from upscaler import Upscaler +from wrappers.ffmpeg import Ffmpeg # built-in imports import contextlib +import json import os import pathlib import sys @@ -342,7 +344,14 @@ class Video2XMainWindow(QMainWindow): self.anime4kcpp_post_processing_check_box = self.findChild(QCheckBox, 'anime4kCppPostProcessingCheckBox') self.anime4kcpp_gpu_mode_check_box = self.findChild(QCheckBox, 'anime4kCppGpuModeCheckBox') - # load configurations + # FFmpeg settings + pass + + # Tools + self.ffprobe_plain_text_edit = self.findChild(QPlainTextEdit, 'ffprobePlainTextEdit') + self.ffprobe_plain_text_edit.dropEvent = self.show_ffprobe_output + + # load configurations after GUI initialization self.load_configurations() def dragEnterEvent(self, event): @@ -364,6 +373,15 @@ class Video2XMainWindow(QMainWindow): line_edit.dragEnterEvent = self.dragEnterEvent line_edit.dropEvent = lambda event: line_edit.setText(str(pathlib.Path(event.mimeData().urls()[0].toLocalFile()).absolute())) + def show_ffprobe_output(self, event): + input_paths = [pathlib.Path(u.toLocalFile()) for u in event.mimeData().urls()] + if not input_paths[0].is_file(): + return + + ffmpeg_object = Ffmpeg(self.ffmpeg_settings) + file_info_json = ffmpeg_object.probe_file_info(input_paths[0]) + self.ffprobe_plain_text_edit.setPlainText(json.dumps(file_info_json, indent=2)) + @staticmethod def read_config(config_file: pathlib.Path) -> dict: """ read video2x configurations from config file diff --git a/src/video2x_gui.ui b/src/video2x_gui.ui index 05b846a..2588b15 100644 --- a/src/video2x_gui.ui +++ b/src/video2x_gui.ui @@ -33,7 +33,7 @@ - 0 + 3 @@ -1519,6 +1519,35 @@ + + + FFmpeg Settings + + + + + Tools + + + + + + 0 + + + + FFprobe + + + + + + + + + + +