diff --git a/main.py b/main.py index 8a3ce2de..b81eb181 100755 --- a/main.py +++ b/main.py @@ -682,7 +682,16 @@ def setEnsembleMode(self): ): self.ui.EnsembleCheckBox.show() self.ui.ensembleHelpButton.show() - + def TurnOffCustomFPSMultiplierIfImageExtraction(self): + if self.ui.ImageExtractionCheckBox.isChecked(): + self.ui.FPSTo.show() + self.ui.FPSFrom.show() + self.ui.FPSToSign.show() + + else: + self.ui.FPSTo.hide() + self.ui.FPSFrom.hide() + self.ui.FPSToSign.hide() def greyOutRifeTimes(self): if ( "v4" in self.ui.Rife_Model.currentText() @@ -691,8 +700,7 @@ def greyOutRifeTimes(self): self.ui.Rife_Times.setEnabled(True) self.setEnsembleMode() - self.ui.FPSFrom.show() - self.ui.FPSTo.show() + self.TurnOffCustomFPSMultiplierIfImageExtraction() else: self.ui.FPSFrom.hide() @@ -939,6 +947,7 @@ def setDisableEnable(self, mode): self.ui.InstallModelsFrame.setDisabled(mode) self.ui.SettingsMenus.setDisabled(mode) self.ui.modeCombo.setDisabled(mode) + self.ui.ImageExtractionCheckBox.setDisabled(mode) def endRife( self, diff --git a/mainwindow.ui b/mainwindow.ui index 42f049a5..ce5bd0ae 100644 --- a/mainwindow.ui +++ b/mainwindow.ui @@ -595,6 +595,13 @@ + + + + Image Extraction + + + @@ -885,7 +892,7 @@ 0 0 - 479 + 126 192 diff --git a/modules/CUGAN.py b/modules/CUGAN.py index fc48c8b2..32394a1b 100644 --- a/modules/CUGAN.py +++ b/modules/CUGAN.py @@ -52,6 +52,7 @@ def modelOptions(self): self.ui.Rife_Times.currentIndexChanged.connect(self.cuganDenoiseLevel) self.ui.denoiseLevelSpinBox.valueChanged.connect(self.incrementcuganDenoiseLevel) self.ui.EnsembleCheckBox.hide() + self.ui.ImageExtractionCheckBox.hide() self.ui.Rife_Times.addItem("2X") self.ui.Rife_Times.addItem("3X") self.ui.Rife_Times.addItem("4X") diff --git a/modules/CustomModelsCUDA.py b/modules/CustomModelsCUDA.py index 45856ffd..24a0ead1 100644 --- a/modules/CustomModelsCUDA.py +++ b/modules/CustomModelsCUDA.py @@ -38,6 +38,7 @@ def modelOptions(self): self.ui.Rife_Model.addItems(os.listdir(f"{thisdir}/models/custom-models-cuda")) self.ui.Rife_Times.setEnabled(True) self.ui.EnsembleCheckBox.hide() + self.ui.ImageExtractionCheckBox.hide() try: self.ui.Rife_Model.currentIndexChanged.disconnect() diff --git a/modules/CustomModelsNCNN.py b/modules/CustomModelsNCNN.py index 08e099d6..092199d4 100644 --- a/modules/CustomModelsNCNN.py +++ b/modules/CustomModelsNCNN.py @@ -39,7 +39,7 @@ def modelOptions(self): self.ui.Rife_Model.addItem(i.replace(".bin", "")) self.ui.EnsembleCheckBox.hide() - + self.ui.ImageExtractionCheckBox.hide() try: self.ui.Rife_Model.currentIndexChanged.disconnect() except: diff --git a/modules/ESRGAN.py b/modules/ESRGAN.py index 4ad715e0..7ff092e1 100644 --- a/modules/ESRGAN.py +++ b/modules/ESRGAN.py @@ -35,6 +35,7 @@ def modelOptions(self): self.ui.FPSPreview.setText("RES:") self.ui.Rife_Model.addItem("Animation") self.ui.EnsembleCheckBox.hide() + self.ui.ImageExtractionCheckBox.hide() self.ui.ensembleHelpButton.hide() self.ui.Rife_Model.setCurrentIndex(0) diff --git a/modules/GMFSSCUDA.py b/modules/GMFSSCUDA.py index e0dc3e6d..dad0d9e6 100644 --- a/modules/GMFSSCUDA.py +++ b/modules/GMFSSCUDA.py @@ -34,6 +34,7 @@ def modelOptions(self): self.ui.Rife_Times.clear() self.ui.FPSPreview.setText("FPS:") self.ui.ensembleHelpButton.hide() + self.ui.ImageExtractionCheckBox.hide() self.ui.Rife_Times.addItem("2X") model_list = ["gmfss-fortuna"] diff --git a/modules/IFRNET.py b/modules/IFRNET.py index 4a7eaffd..ee856ca8 100644 --- a/modules/IFRNET.py +++ b/modules/IFRNET.py @@ -36,6 +36,7 @@ def modelOptions(self): self.ui.ensembleHelpButton.hide() self.ui.Rife_Times.addItem("2X") self.ui.EnsembleCheckBox.hide() + self.ui.ImageExtractionCheckBox.hide() try: self.ui.Rife_Model.currentIndexChanged.disconnect() diff --git a/modules/RealESRGANCUDA.py b/modules/RealESRGANCUDA.py index ac6b96df..fac0b79e 100644 --- a/modules/RealESRGANCUDA.py +++ b/modules/RealESRGANCUDA.py @@ -51,7 +51,7 @@ def modelOptions(self): self.ui.Rife_Times.setCurrentIndex(0) self.ui.denoiseLevelLabel.hide() self.ui.denoiseLevelSpinBox.hide() - + self.ui.ImageExtractionCheckBox.hide() try: self.ui.RifeStart.clicked.disconnect() except: diff --git a/modules/Rife.py b/modules/Rife.py index 7521daae..56e6e0c6 100644 --- a/modules/Rife.py +++ b/modules/Rife.py @@ -55,7 +55,11 @@ def modelOptions(self): if "ensemble" not in i: models.append(i) models.sort() + + # Custom options self.ui.EnsembleCheckBox.show() + self.ui.ensembleHelpButton.show() + self.ui.ImageExtractionCheckBox.show() if len(self.get_models_from_dir("rife")) > 0: self.ui.Rife_Model.addItems(models) model_list = [] diff --git a/modules/RifeCUDA.py b/modules/RifeCUDA.py index 39f298f1..434898ca 100644 --- a/modules/RifeCUDA.py +++ b/modules/RifeCUDA.py @@ -60,6 +60,7 @@ def modelOptions(self, trt=False): self.ui.Rife_Model.addItems(model_list) self.ui.Rife_Times.setEnabled(True) self.ui.EnsembleCheckBox.show() + self.ui.ImageExtractionCheckBox.hide() if self.output_folder == "": outputpath = settings.OutputDir else: diff --git a/modules/SPANNCNN.py b/modules/SPANNCNN.py index 93cb470d..4a43ab15 100644 --- a/modules/SPANNCNN.py +++ b/modules/SPANNCNN.py @@ -36,6 +36,7 @@ def modelOptions(self): self.ui.Rife_Model.addItem("ClearReality4x") self.ui.EnsembleCheckBox.hide() self.ui.EnsembleCheckBox.hide() + self.ui.ImageExtractionCheckBox.hide() self.ui.FPSFrom.hide() self.ui.FPSToSign.hide() self.ui.FPSTo.hide() diff --git a/modules/Waifu2X.py b/modules/Waifu2X.py index 4a7c35e3..f5ff0f01 100644 --- a/modules/Waifu2X.py +++ b/modules/Waifu2X.py @@ -47,6 +47,7 @@ def modelOptions(self): self.greyOutRealSRTimes() self.ui.EnsembleCheckBox.hide() + self.ui.ImageExtractionCheckBox.hide() self.ui.RifeStart.clicked.connect( lambda: upscale.start_upscale(self, "waifu2x-ncnn-vulkan") ) diff --git a/modules/interpolate.py b/modules/interpolate.py index 01691dd7..b4b705fb 100644 --- a/modules/interpolate.py +++ b/modules/interpolate.py @@ -80,11 +80,18 @@ def initializeInterpolation( log(f"ERROR: {e} {traceback_info}") self.showDialogBox(e) - +def changeRifeToFrameExtraction(self,AI): + frameExtraction = self.ui.ImageExtractionCheckBox.isChecked() + if AI == "rife-ncnn-python" and frameExtraction: + AI = "rife-ncnn-vulkan" + return AI def start_interpolation( self, AI ): # command directly connected to the rife start button + + AI = changeRifeToFrameExtraction(self,AI) try: + if self.input_file != "": self.render = "rife" has_enough_space, predicted_space, total_space = ( @@ -98,7 +105,7 @@ def start_interpolation( self.input_file, self.render, self.times ) ) - if "cuda" not in AI: + if "cuda" not in AI or "ncnn-python" not in AI: if has_enough_space or not_enough_storage( self, predicted_space, total_space ): diff --git a/modules/realsr.py b/modules/realsr.py index 6970923f..50a180c3 100644 --- a/modules/realsr.py +++ b/modules/realsr.py @@ -37,6 +37,7 @@ def modelOptions(self): self.ui.FPSToSign.hide() self.ui.FPSTo.hide() self.ui.ensembleHelpButton.hide() + self.ui.ImageExtractionCheckBox.hide() self.ui.Rife_Model.setCurrentIndex(0) try: self.ui.Rife_Model.currentIndexChanged.disconnect() @@ -54,6 +55,6 @@ def modelOptions(self): self.ui.Rife_Times.clear() self.ui.denoiseLevelLabel.hide() self.ui.denoiseLevelSpinBox.hide() - + self.ui.Rife_Times.addItem("4X") self.ui.Rife_Times.setCurrentIndex(0) diff --git a/src/misc/onProgramStart.py b/src/misc/onProgramStart.py index 7936ce39..3750c9e4 100644 --- a/src/misc/onProgramStart.py +++ b/src/misc/onProgramStart.py @@ -80,6 +80,7 @@ def bindButtons(self): self.ui.gpuThreadingHelpButton.clicked.connect(lambda: vram_help(self)) self.ui.logButton.clicked.connect(lambda: viewLogs(self)) self.ui.RifeResume.clicked.connect(self.resume_render) + self.ui.ImageExtractionCheckBox.clicked.connect(self.TurnOffCustomFPSMultiplierIfImageExtraction) self.ui.sceneChangeSensativityButton.clicked.connect( lambda: show_scene_change_help(self) ) diff --git a/src/runAI/workers.py b/src/runAI/workers.py index cb5a815d..6f31bb7e 100644 --- a/src/runAI/workers.py +++ b/src/runAI/workers.py @@ -534,7 +534,7 @@ def finishRenderSetup(self): # 3rd and final call, called from interpolate.py # run transition detection start if self.main.AI == "rife-ncnn-vulkan": - if "v4" in self.model: + if "v4" in self.model and self.main.ui.ImageExtractionCheckBox.isChecked(): self.main.times = ( self.main.ui.FPSTo.value() / self.main.ui.FPSFrom.value() ) @@ -551,6 +551,7 @@ def Render(self, model, times, videopath, outputpath): self.log.emit(f"Model: {self.main.ui.Rife_Model.currentText()}") vram = int(calculateVRAM(self)) if "-ncnn-vulkan" in self.main.AI: + self.main.start_time = time.time() self.input_frames = len( os.listdir( f"{settings.RenderDir}/{self.main.videoName}_temp/input_frames/"