Archenar
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -47,34 +47,29 @@ def cmdb_fb(a, b, c):
|
|
47 |
# print(tuning)
|
48 |
return f"-filter:v \"tblend\" -r {a} -preset {b} -tune {tuning}"
|
49 |
|
|
|
|
|
|
|
|
|
|
|
|
|
50 |
with gr.Blocks(title="FFmo - FFmpeg Online") as main:
|
51 |
with gr.Tabs():
|
52 |
-
with gr.TabItem("Main"):
|
53 |
-
with gr.Row():
|
54 |
-
with gr.Column() as inp_main:
|
55 |
-
input_textbox = gr.Textbox(label="FFMPEG Command")
|
56 |
-
input_video = gr.Video(label="Input Video")
|
57 |
-
with gr.Column() as out_main:
|
58 |
-
output_textbox = gr.Textbox(label="Output Logs", interactive=False)
|
59 |
-
output_video = gr.Video(label="Output Video", interactive=False)
|
60 |
-
startconv = gr.Button("Start", variant="primary").click(fn=convert, inputs=[input_video,input_textbox], outputs=[output_textbox, output_video])
|
61 |
-
clear_button = gr.ClearButton([input_textbox, input_video, output_textbox, output_video])
|
62 |
-
|
63 |
with gr.TabItem("Smooth Interpolation"):
|
64 |
with gr.Row():
|
65 |
with gr.Column() as inp_si:
|
66 |
input_fps = gr.Slider(1, 144, value=60, label="Frame Per Second (FPS)", info="Choose between 1 and 144 Fps")
|
67 |
input_preset = gr.Dropdown(["ultrafast", "superfast", "veryfast", "faster", "fast", "medium", "slow", "slower", "veryslow"], value=["veryslow"], label="Preset (Required)", info="Semakin lama (slow), semakin bagus hasilnya.")
|
68 |
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")
|
69 |
-
|
70 |
-
|
71 |
|
72 |
with gr.Column() as out_si:
|
73 |
-
|
74 |
-
|
75 |
-
buildcmd = gr.Button("Build FFMPEG Command", variant="primary").click(fn=cmdb_si, inputs=[input_fps,input_preset,input_tune], outputs=[
|
76 |
-
|
77 |
-
|
78 |
|
79 |
with gr.TabItem("Frame Blending"):
|
80 |
with gr.Row():
|
@@ -82,15 +77,31 @@ with gr.Blocks(title="FFmo - FFmpeg Online") as main:
|
|
82 |
input_fps2 = gr.Slider(1, 144, value=60, label="Frame Per Second (FPS)", info="Choose between 1 and 144 Fps")
|
83 |
input_preset2 = gr.Dropdown(["ultrafast", "superfast", "veryfast", "faster", "fast", "medium", "slow", "slower", "veryslow"], value=["veryslow"], label="Preset (Required)", info="Semakin lama (slow), semakin bagus hasilnya.")
|
84 |
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")
|
85 |
-
|
86 |
-
|
87 |
|
88 |
with gr.Column() as out_fb:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
89 |
output_textbox3 = gr.Textbox(label="Output Logs", interactive=False)
|
90 |
output_video3 = gr.Video(label="Output Video", interactive=False)
|
91 |
-
buildcmd2 = gr.Button("Build FFMPEG Command", variant="primary").click(fn=cmdb_fb, inputs=[input_fps2,input_preset2,input_tune2], outputs=[input_textbox3])
|
92 |
startconv3 = gr.Button("Start", variant="primary").click(fn=convert, inputs=[input_video3,input_textbox3], outputs=[output_textbox3, output_video3])
|
93 |
-
clear_button3 = gr.ClearButton([
|
94 |
|
95 |
# Launch the combined interface
|
96 |
if __name__ == "__main__":
|
|
|
47 |
# print(tuning)
|
48 |
return f"-filter:v \"tblend\" -r {a} -preset {b} -tune {tuning}"
|
49 |
|
50 |
+
# Command Builder: Advanced
|
51 |
+
def cmdb_adv(a, b):
|
52 |
+
tuning = c.split(" β")[0]
|
53 |
+
gr.Textbox.update(value=f"-preset {a} -tune {b}")
|
54 |
+
# return f"-preset {a} -tune {b}"
|
55 |
+
|
56 |
with gr.Blocks(title="FFmo - FFmpeg Online") as main:
|
57 |
with gr.Tabs():
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
58 |
with gr.TabItem("Smooth Interpolation"):
|
59 |
with gr.Row():
|
60 |
with gr.Column() as inp_si:
|
61 |
input_fps = gr.Slider(1, 144, value=60, label="Frame Per Second (FPS)", info="Choose between 1 and 144 Fps")
|
62 |
input_preset = gr.Dropdown(["ultrafast", "superfast", "veryfast", "faster", "fast", "medium", "slow", "slower", "veryslow"], value=["veryslow"], label="Preset (Required)", info="Semakin lama (slow), semakin bagus hasilnya.")
|
63 |
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")
|
64 |
+
input_video = gr.Video(label="Input Video")
|
65 |
+
input_textbox = gr.Textbox(label="FFMPEG Command")
|
66 |
|
67 |
with gr.Column() as out_si:
|
68 |
+
output_textbox = gr.Textbox(label="Output Logs", interactive=False)
|
69 |
+
output_video = gr.Video(label="Output Video", interactive=False)
|
70 |
+
buildcmd = gr.Button("Build FFMPEG Command", variant="primary").click(fn=cmdb_si, inputs=[input_fps,input_preset,input_tune], outputs=[input_textbox])
|
71 |
+
startconv = gr.Button("Start", variant="primary").click(fn=convert, inputs=[input_video,input_textbox], outputs=[output_textbox, output_video])
|
72 |
+
clear_button = gr.ClearButton([input_fps, input_preset, input_tune, input_video, input_textbox, output_textbox, output_video])
|
73 |
|
74 |
with gr.TabItem("Frame Blending"):
|
75 |
with gr.Row():
|
|
|
77 |
input_fps2 = gr.Slider(1, 144, value=60, label="Frame Per Second (FPS)", info="Choose between 1 and 144 Fps")
|
78 |
input_preset2 = gr.Dropdown(["ultrafast", "superfast", "veryfast", "faster", "fast", "medium", "slow", "slower", "veryslow"], value=["veryslow"], label="Preset (Required)", info="Semakin lama (slow), semakin bagus hasilnya.")
|
79 |
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")
|
80 |
+
input_video2 = gr.Video(label="Input Video")
|
81 |
+
input_textbox2 = gr.Textbox(label="FFMPEG Command")
|
82 |
|
83 |
with gr.Column() as out_fb:
|
84 |
+
output_textbox2 = gr.Textbox(label="Output Logs", interactive=False)
|
85 |
+
output_video2 = gr.Video(label="Output Video", interactive=False)
|
86 |
+
buildcmd2 = gr.Button("Build FFMPEG Command", variant="primary").click(fn=cmdb_fb, inputs=[input_fps2,input_preset2,input_tune2], outputs=[input_textbox2])
|
87 |
+
startconv2 = gr.Button("Start", variant="primary").click(fn=convert, inputs=[input_video2,input_textbox2], outputs=[output_textbox2, output_video2])
|
88 |
+
clear_button2 = gr.ClearButton([input_fps2, input_preset2, input_tune2, input_video2, input_textbox2, output_textbox2, output_video2])
|
89 |
+
|
90 |
+
with gr.TabItem("Advanced"):
|
91 |
+
with gr.Row():
|
92 |
+
with gr.Column() as inp_main:
|
93 |
+
input_preset3 = gr.Dropdown(["ultrafast", "superfast", "veryfast", "faster", "fast", "medium", "slow", "slower", "veryslow"], value=["veryslow"], label="Preset (Required)", info="Semakin lama (slow), semakin bagus hasilnya.")
|
94 |
+
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")
|
95 |
+
input_textbox3 = gr.Textbox(label="FFMPEG Command")
|
96 |
+
input_video3 = gr.Video(label="Input Video")
|
97 |
+
input_preset3.change(fn=cmdb_adv, inputs=[input_preset3, input_tune3], outputs=input_textbox3)
|
98 |
+
input_tune3.change(fn=cmdb_adv, inputs=[input_preset3, input_tune3], outputs=input_textbox3)
|
99 |
+
|
100 |
+
with gr.Column() as out_main:
|
101 |
output_textbox3 = gr.Textbox(label="Output Logs", interactive=False)
|
102 |
output_video3 = gr.Video(label="Output Video", interactive=False)
|
|
|
103 |
startconv3 = gr.Button("Start", variant="primary").click(fn=convert, inputs=[input_video3,input_textbox3], outputs=[output_textbox3, output_video3])
|
104 |
+
clear_button3 = gr.ClearButton([input_textbox3, input_video3, output_textbox3, output_video3])
|
105 |
|
106 |
# Launch the combined interface
|
107 |
if __name__ == "__main__":
|