This commit is contained in:
2023-03-15 19:41:25 +01:00
parent 35328dcb54
commit 0466c9db9d
2 changed files with 10 additions and 8 deletions

View File

@@ -49,7 +49,6 @@ class Handler:
self.tmppath += "fsru/" self.tmppath += "fsru/"
else: else:
self.tmppath += '/fsru/' self.tmppath += '/fsru/'
self.ffmpegpath = config["PathSettings"]["ffmpeg"]
# checking for spaces in filepath (for use with terminal commands) # checking for spaces in filepath (for use with terminal commands)
self.filepath = "" self.filepath = ""
for self.letter in filepath: for self.letter in filepath:
@@ -61,7 +60,7 @@ class Handler:
# Determining filetype # Determining filetype
if str(filepath)[len(filepath) - 4:] == ".mp4" or str(filepath)[len(filepath) - 4:] == ".mkv": if str(filepath)[len(filepath) - 4:] == ".mp4" or str(filepath)[len(filepath) - 4:] == ".mkv":
print("upscaling video") print("upscaling video")
self.video_scaling(self.ffmpegpath, fsrpath, filepath, quality_mode, quality_setting, output_path) self.video_scaling(fsrpath, filepath, quality_mode, quality_setting, output_path)
elif str(filepath)[len(filepath) - 4:] == ".JPG" or str(filepath)[len(filepath) - 4:] == ".png" or str(filepath)[len(filepath) - 4:] == ".jpg" or str(filepath)[len(filepath) - 5:] == ".jpeg": elif str(filepath)[len(filepath) - 4:] == ".JPG" or str(filepath)[len(filepath) - 4:] == ".png" or str(filepath)[len(filepath) - 4:] == ".jpg" or str(filepath)[len(filepath) - 5:] == ".jpeg":
print("upscaling image") print("upscaling image")
self.photo_scaling(fsrpath, filepath, quality_mode, quality_setting, output_path) self.photo_scaling(fsrpath, filepath, quality_mode, quality_setting, output_path)
@@ -92,7 +91,7 @@ class Handler:
os.system(self.command) os.system(self.command)
print("photo upscaled") print("photo upscaled")
def video_scaling(self, ffmpegpath, fsrpath, filepath, quality_mode, quality_setting, output_path): def video_scaling(self, fsrpath, filepath, quality_mode, quality_setting, output_path):
# DO NOT CALL THIS! Use Handler().handler() instead! # DO NOT CALL THIS! Use Handler().handler() instead!
# if ( sys.platform == 'win32' ): # if ( sys.platform == 'win32' ):
# self.videometa = ffmpeg.probe(str(filepath))["streams"].pop(0) # self.videometa = ffmpeg.probe(str(filepath))["streams"].pop(0)
@@ -222,7 +221,7 @@ class Handler:
if self.os_type == "linux": if self.os_type == "linux":
self.command = f"ffmpeg -i {self.filepath} -vn -acodec copy {self.tmppath}audio.aac" self.command = f"ffmpeg -i {self.filepath} -vn -acodec copy {self.tmppath}audio.aac"
elif self.os_type == "win32": elif self.os_type == "win32":
self.command = f"{ffmpegpath} -i {self.filepath} -vn -acodec copy {self.tmppath}audio.aac" self.command = f"ffmpeg -i {self.filepath} -vn -acodec copy {self.tmppath}audio.aac"
else: else:
print("OS CURRENTLY UNSUPPORTED!") print("OS CURRENTLY UNSUPPORTED!")
return False return False
@@ -233,7 +232,7 @@ class Handler:
if self.os_type == "linux": if self.os_type == "linux":
self.command = f"ffmpeg -framerate {self.framerate} -i {self.tmppath}sc/ig%08d.png {output_path} -i {self.tmppath}audio.aac" self.command = f"ffmpeg -framerate {self.framerate} -i {self.tmppath}sc/ig%08d.png {output_path} -i {self.tmppath}audio.aac"
elif self.os_type == "win32": elif self.os_type == "win32":
self.command = f"{ffmpegpath} -framerate {self.framerate} -i {self.tmppath}sc/ig%08d.png {output_path} -i {self.tmppath}audio.aac" self.command = f"ffmpeg -framerate {self.framerate} -i ${self.tmppath}sc/ig%08d.png {output_path} -i {self.tmppath}audio.aac"
else: else:
print("OS CURRENTLY UNSUPPORTED!") print("OS CURRENTLY UNSUPPORTED!")
return False return False

View File

@@ -18,7 +18,10 @@ args = ap.parse_args()
handler = bin.handler.Handler() handler = bin.handler.Handler()
if ( args.scalefactor ):
if ( args.scalefactor[ len(args.scalefactor) -1: ] == 'x' ): if ( args.scalefactor[ len(args.scalefactor) -1: ] == 'x' ):
handler.handler( 'bin/lib/FidelityFX_CLI.exe', args.inputfile, 'custom', args.scalefactor, args.outputfile ) handler.handler( 'bin/lib/FidelityFX_CLI.exe', args.inputfile, 'custom', args.scalefactor, args.outputfile )
else: else:
raise NameError( 'Argument Scale does require to be of form 2x! (it has to end in x)' ) raise NameError( 'Argument Scale does require to be of form 2x! (it has to end in x)' )
else:
handler.handler( 'bin/lib/FidelityFX_CLI.exe', args.inputfile, 'custom', '2x', args.outputfile )