Update app.py
Browse files
app.py
CHANGED
@@ -6,6 +6,9 @@ import shortuuid
|
|
6 |
import re
|
7 |
from tempfile import _TemporaryFileWrapper
|
8 |
|
|
|
|
|
|
|
9 |
# Check Runtime to avoid Error
|
10 |
globalopt = []
|
11 |
limit = os.getenv("SYSTEM") == "spaces"
|
@@ -57,6 +60,7 @@ def cmdb_si(a, b, c, d):
|
|
57 |
else:
|
58 |
tuning = ""
|
59 |
# print(tuning)
|
|
|
60 |
return [a, f"-filter:v \"minterpolate='mi_mode=mci:mc_mode=aobmc:me_mode=bidir:vsbmc=1:fps={a}'\" -r {a} -preset {b} {tuning}"]
|
61 |
|
62 |
# Command Builder: Frame Blending
|
@@ -68,7 +72,8 @@ def cmdb_fb(a, b, c, d):
|
|
68 |
else:
|
69 |
tuning = ""
|
70 |
# print(tuning)
|
71 |
-
|
|
|
72 |
|
73 |
# Command Builder: Advanced
|
74 |
def cmdb_adv(a, b, c):
|
@@ -78,8 +83,9 @@ def cmdb_adv(a, b, c):
|
|
78 |
tuning = f"-tune {b.split(' β')[0]}"
|
79 |
else:
|
80 |
tuning = ""
|
|
|
81 |
#gr.Textbox.update(value=f"-preset {a} -tune {b}")
|
82 |
-
return
|
83 |
|
84 |
with gr.Blocks(title="FFmo - FFmpeg Online", theme=gr.themes.Soft()) as main:
|
85 |
gr.Markdown(
|
@@ -100,7 +106,6 @@ with gr.Blocks(title="FFmo - FFmpeg Online", theme=gr.themes.Soft()) as main:
|
|
100 |
input_tune = gr.Radio(["film β use for high quality movie content; lowers deblocking", "animation β good for cartoons; uses higher deblocking and more reference frames", "grain β preserves the grain structure in old, grainy film material", "stillimage β good for slideshow-like content", "fastdecode β allows faster decoding by disabling certain filters", "zerolatency β good for fast encoding and low-latency streaming", "psnr β ignore this as it is only used for codec development", "ssim β ignore this as it is only used for codec development"], value=["film β use for high quality movie content; lowers deblocking"], label="Tune (Required)", info="Tuning Setting")
|
101 |
input_video = gr.Video(label="Input Video")
|
102 |
input_textbox = gr.Textbox(label="FFMPEG Command")
|
103 |
-
tempf_path = ""
|
104 |
buildcmd = gr.Button("Build FFMPEG Command", variant="primary").click(fn=cmdb_si, inputs=[input_fps,input_preset,input_tune,input_video], outputs=[tempf_path, input_textbox])
|
105 |
# input_video.change()
|
106 |
|
@@ -119,7 +124,6 @@ with gr.Blocks(title="FFmo - FFmpeg Online", theme=gr.themes.Soft()) as main:
|
|
119 |
input_tune2 = gr.Radio(["film β use for high quality movie content; lowers deblocking", "animation β good for cartoons; uses higher deblocking and more reference frames", "grain β preserves the grain structure in old, grainy film material", "stillimage β good for slideshow-like content", "fastdecode β allows faster decoding by disabling certain filters", "zerolatency β good for fast encoding and low-latency streaming", "psnr β ignore this as it is only used for codec development", "ssim β ignore this as it is only used for codec development"], value=["film β use for high quality movie content; lowers deblocking"], label="Tune (Required)", info="Tuning Setting")
|
120 |
input_video2 = gr.Video(label="Input Video")
|
121 |
input_textbox2 = gr.Textbox(label="FFMPEG Command")
|
122 |
-
tempf_path = ""
|
123 |
buildcmd2 = gr.Button("Build FFMPEG Command", variant="primary").click(fn=cmdb_fb, inputs=[input_fps2,input_preset2,input_tune2, input_video2], outputs=[tempf_path, input_textbox2])
|
124 |
|
125 |
with gr.Column() as out_fb:
|
@@ -136,7 +140,6 @@ with gr.Blocks(title="FFmo - FFmpeg Online", theme=gr.themes.Soft()) as main:
|
|
136 |
input_tune3 = gr.Radio(["film β use for high quality movie content; lowers deblocking", "animation β good for cartoons; uses higher deblocking and more reference frames", "grain β preserves the grain structure in old, grainy film material", "stillimage β good for slideshow-like content", "fastdecode β allows faster decoding by disabling certain filters", "zerolatency β good for fast encoding and low-latency streaming", "psnr β ignore this as it is only used for codec development", "ssim β ignore this as it is only used for codec development"], value=["film β use for high quality movie content; lowers deblocking"], label="Tune (Required)", info="Tuning Setting")
|
137 |
input_video3 = gr.Video(label="Input Video")
|
138 |
input_textbox3 = gr.Textbox(label="FFMPEG Command")
|
139 |
-
tempf_path = ""
|
140 |
buildcmd3 = gr.Button("Build FFMPEG Command", variant="primary").click(fn=cmdb_adv, inputs=[input_preset3,input_tune3, input_video3], outputs=[tempf_path, input_textbox3])
|
141 |
|
142 |
with gr.Column() as out_main:
|
|
|
6 |
import re
|
7 |
from tempfile import _TemporaryFileWrapper
|
8 |
|
9 |
+
# Global Variables
|
10 |
+
tempf_path = ""
|
11 |
+
|
12 |
# Check Runtime to avoid Error
|
13 |
globalopt = []
|
14 |
limit = os.getenv("SYSTEM") == "spaces"
|
|
|
60 |
else:
|
61 |
tuning = ""
|
62 |
# print(tuning)
|
63 |
+
tempf_path = a
|
64 |
return [a, f"-filter:v \"minterpolate='mi_mode=mci:mc_mode=aobmc:me_mode=bidir:vsbmc=1:fps={a}'\" -r {a} -preset {b} {tuning}"]
|
65 |
|
66 |
# Command Builder: Frame Blending
|
|
|
72 |
else:
|
73 |
tuning = ""
|
74 |
# print(tuning)
|
75 |
+
tempf_path = a
|
76 |
+
return f"-filter:v \"tblend\" -r {a} -preset {b} {tuning}"
|
77 |
|
78 |
# Command Builder: Advanced
|
79 |
def cmdb_adv(a, b, c):
|
|
|
83 |
tuning = f"-tune {b.split(' β')[0]}"
|
84 |
else:
|
85 |
tuning = ""
|
86 |
+
tempf_path = a
|
87 |
#gr.Textbox.update(value=f"-preset {a} -tune {b}")
|
88 |
+
return f"-preset {a} {tuning}"
|
89 |
|
90 |
with gr.Blocks(title="FFmo - FFmpeg Online", theme=gr.themes.Soft()) as main:
|
91 |
gr.Markdown(
|
|
|
106 |
input_tune = gr.Radio(["film β use for high quality movie content; lowers deblocking", "animation β good for cartoons; uses higher deblocking and more reference frames", "grain β preserves the grain structure in old, grainy film material", "stillimage β good for slideshow-like content", "fastdecode β allows faster decoding by disabling certain filters", "zerolatency β good for fast encoding and low-latency streaming", "psnr β ignore this as it is only used for codec development", "ssim β ignore this as it is only used for codec development"], value=["film β use for high quality movie content; lowers deblocking"], label="Tune (Required)", info="Tuning Setting")
|
107 |
input_video = gr.Video(label="Input Video")
|
108 |
input_textbox = gr.Textbox(label="FFMPEG Command")
|
|
|
109 |
buildcmd = gr.Button("Build FFMPEG Command", variant="primary").click(fn=cmdb_si, inputs=[input_fps,input_preset,input_tune,input_video], outputs=[tempf_path, input_textbox])
|
110 |
# input_video.change()
|
111 |
|
|
|
124 |
input_tune2 = gr.Radio(["film β use for high quality movie content; lowers deblocking", "animation β good for cartoons; uses higher deblocking and more reference frames", "grain β preserves the grain structure in old, grainy film material", "stillimage β good for slideshow-like content", "fastdecode β allows faster decoding by disabling certain filters", "zerolatency β good for fast encoding and low-latency streaming", "psnr β ignore this as it is only used for codec development", "ssim β ignore this as it is only used for codec development"], value=["film β use for high quality movie content; lowers deblocking"], label="Tune (Required)", info="Tuning Setting")
|
125 |
input_video2 = gr.Video(label="Input Video")
|
126 |
input_textbox2 = gr.Textbox(label="FFMPEG Command")
|
|
|
127 |
buildcmd2 = gr.Button("Build FFMPEG Command", variant="primary").click(fn=cmdb_fb, inputs=[input_fps2,input_preset2,input_tune2, input_video2], outputs=[tempf_path, input_textbox2])
|
128 |
|
129 |
with gr.Column() as out_fb:
|
|
|
140 |
input_tune3 = gr.Radio(["film β use for high quality movie content; lowers deblocking", "animation β good for cartoons; uses higher deblocking and more reference frames", "grain β preserves the grain structure in old, grainy film material", "stillimage β good for slideshow-like content", "fastdecode β allows faster decoding by disabling certain filters", "zerolatency β good for fast encoding and low-latency streaming", "psnr β ignore this as it is only used for codec development", "ssim β ignore this as it is only used for codec development"], value=["film β use for high quality movie content; lowers deblocking"], label="Tune (Required)", info="Tuning Setting")
|
141 |
input_video3 = gr.Video(label="Input Video")
|
142 |
input_textbox3 = gr.Textbox(label="FFMPEG Command")
|
|
|
143 |
buildcmd3 = gr.Button("Build FFMPEG Command", variant="primary").click(fn=cmdb_adv, inputs=[input_preset3,input_tune3, input_video3], outputs=[tempf_path, input_textbox3])
|
144 |
|
145 |
with gr.Column() as out_main:
|