Added width, height and fps to videoUpscaler
This commit is contained in:
@@ -5,6 +5,7 @@ class videoUpscaler:
|
||||
RUNWARE_VUPSCALER_MODELS = {
|
||||
"Bria Video Upscaler": "bria:50@1",
|
||||
"Bytedance Video Upscaler": "bytedance:50@1",
|
||||
"Topaz Labs Starlight Precise 2.5": "topazlabs:starlight-precise@2.5",
|
||||
}
|
||||
|
||||
@classmethod
|
||||
@@ -24,12 +25,43 @@ class videoUpscaler:
|
||||
"tooltip": "Enable to explicitly set the upscale factor for the request.",
|
||||
"default": False,
|
||||
}),
|
||||
"useFps": ("BOOLEAN", {
|
||||
"label_on": "Yes",
|
||||
"label_off": "No",
|
||||
"tooltip": "Enable to explicitly set FPS for the output video.",
|
||||
"default": False,
|
||||
}),
|
||||
"useDimension": (["none", "custom"], {
|
||||
"tooltip": "Choose whether to send custom width and height.",
|
||||
"default": "none",
|
||||
}),
|
||||
},
|
||||
"optional": {
|
||||
"upscaleFactor": ([2, 4], {
|
||||
"tooltip": "Integer scale factor for upscaling (2x or 4x).",
|
||||
"default": 2,
|
||||
}),
|
||||
"fps": ("INT", {
|
||||
"default": 24,
|
||||
"min": 1,
|
||||
"max": 240,
|
||||
"step": 1,
|
||||
"tooltip": "Output frames per second (1-240). Used when useFps is enabled.",
|
||||
}),
|
||||
"width": ("INT", {
|
||||
"default": 1920,
|
||||
"min": 1,
|
||||
"max": 8192,
|
||||
"step": 1,
|
||||
"tooltip": "Custom output width in pixels. Used when useDimension is custom.",
|
||||
}),
|
||||
"height": ("INT", {
|
||||
"default": 1080,
|
||||
"min": 1,
|
||||
"max": 8192,
|
||||
"step": 1,
|
||||
"tooltip": "Custom output height in pixels. Used when useDimension is custom.",
|
||||
}),
|
||||
"Output Format": (["mp4", "webm"], {
|
||||
"default": "mp4",
|
||||
"tooltip": "Choose the output video format.",
|
||||
@@ -47,6 +79,11 @@ class videoUpscaler:
|
||||
video_uuid = kwargs.get("Video")
|
||||
useUpscaleFactor = kwargs.get("useUpscaleFactor", False)
|
||||
upscaleFactor = kwargs.get("upscaleFactor")
|
||||
useFps = kwargs.get("useFps", False)
|
||||
fps = kwargs.get("fps", 24)
|
||||
useDimension = kwargs.get("useDimension", "none")
|
||||
width = kwargs.get("width", 1920)
|
||||
height = kwargs.get("height", 1080)
|
||||
modelName = kwargs.get("Model", "Bria Video Upscaler")
|
||||
outputFormat = kwargs.get("Output Format", "mp4")
|
||||
|
||||
@@ -75,6 +112,21 @@ class videoUpscaler:
|
||||
else:
|
||||
raise ValueError("upscaleFactor must be 2 or 4 when useUpscaleFactor is enabled.")
|
||||
|
||||
if useFps:
|
||||
if isinstance(fps, int) and 1 <= fps <= 240:
|
||||
task_payload["fps"] = fps
|
||||
else:
|
||||
raise ValueError("fps must be an integer between 1 and 240 when useFps is enabled.")
|
||||
|
||||
if useDimension == "custom":
|
||||
if isinstance(width, int) and isinstance(height, int) and width > 0 and height > 0:
|
||||
task_payload["width"] = width
|
||||
task_payload["height"] = height
|
||||
else:
|
||||
raise ValueError("width and height must be positive integers when useDimension is custom.")
|
||||
elif useDimension != "none":
|
||||
raise ValueError("useDimension must be either 'none' or 'custom'.")
|
||||
|
||||
genConfig = [task_payload]
|
||||
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user