Nixic commited on
Commit
5c96ec2
Β·
1 Parent(s): 1dc060a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -7
app.py CHANGED
@@ -57,7 +57,7 @@ def cmdb_si(a, b, c, d):
57
  else:
58
  tuning = ""
59
  # print(tuning)
60
- return 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
63
  def cmdb_fb(a, b, c, d):
@@ -68,7 +68,7 @@ def cmdb_fb(a, b, c, d):
68
  else:
69
  tuning = ""
70
  # print(tuning)
71
- return f"-filter:v \"tblend\" -r {a} -preset {b} {tuning}"
72
 
73
  # Command Builder: Advanced
74
  def cmdb_adv(a, b, c):
@@ -79,7 +79,7 @@ def cmdb_adv(a, b, c):
79
  else:
80
  tuning = ""
81
  #gr.Textbox.update(value=f"-preset {a} -tune {b}")
82
- return f"-preset {a} {tuning}"
83
 
84
  with gr.Blocks(title="FFmo - FFmpeg Online", theme=gr.themes.Soft()) as main:
85
  gr.Markdown(
@@ -100,14 +100,15 @@ 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
- buildcmd = gr.Button("Build FFMPEG Command", variant="primary").click(fn=cmdb_si, inputs=[input_fps,input_preset,input_tune,input_video], outputs=[input_textbox])
 
104
  # input_video.change()
105
 
106
  with gr.Column() as out_si:
107
  output_textbox = gr.Textbox(label="Output Logs", interactive=False)
108
  output_video = gr.Video(label="Output Video", interactive=False)
109
 
110
- startconv = gr.Button("Start", variant="primary").click(fn=convert, inputs=[input_video,input_textbox], outputs=[output_textbox, output_video])
111
  clear_button = gr.ClearButton([input_fps, input_preset, input_tune, input_video, input_textbox, output_textbox, output_video])
112
 
113
  with gr.TabItem("Frame Blending"):
@@ -118,7 +119,8 @@ with gr.Blocks(title="FFmo - FFmpeg Online", theme=gr.themes.Soft()) as main:
118
  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")
119
  input_video2 = gr.Video(label="Input Video")
120
  input_textbox2 = gr.Textbox(label="FFMPEG Command")
121
- buildcmd2 = gr.Button("Build FFMPEG Command", variant="primary").click(fn=cmdb_fb, inputs=[input_fps2,input_preset2,input_tune2, input_video2], outputs=[input_textbox2])
 
122
 
123
  with gr.Column() as out_fb:
124
  output_textbox2 = gr.Textbox(label="Output Logs", interactive=False)
@@ -134,7 +136,8 @@ with gr.Blocks(title="FFmo - FFmpeg Online", theme=gr.themes.Soft()) as main:
134
  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")
135
  input_video3 = gr.Video(label="Input Video")
136
  input_textbox3 = gr.Textbox(label="FFMPEG Command")
137
- buildcmd3 = gr.Button("Build FFMPEG Command", variant="primary").click(fn=cmdb_adv, inputs=[input_preset3,input_tune3, input_video3], outputs=[input_textbox3])
 
138
 
139
  with gr.Column() as out_main:
140
  output_textbox3 = gr.Textbox(label="Output Logs", interactive=False)
 
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
63
  def cmdb_fb(a, b, c, d):
 
68
  else:
69
  tuning = ""
70
  # print(tuning)
71
+ return [a, f"-filter:v \"tblend\" -r {a} -preset {b} {tuning}"]
72
 
73
  # Command Builder: Advanced
74
  def cmdb_adv(a, b, c):
 
79
  else:
80
  tuning = ""
81
  #gr.Textbox.update(value=f"-preset {a} -tune {b}")
82
+ return [a, f"-preset {a} {tuning}"]
83
 
84
  with gr.Blocks(title="FFmo - FFmpeg Online", theme=gr.themes.Soft()) as main:
85
  gr.Markdown(
 
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
 
107
  with gr.Column() as out_si:
108
  output_textbox = gr.Textbox(label="Output Logs", interactive=False)
109
  output_video = gr.Video(label="Output Video", interactive=False)
110
 
111
+ startconv = gr.Button("Start", variant="primary").click(fn=convert, inputs=[tempf_path,input_textbox], outputs=[output_textbox, output_video])
112
  clear_button = gr.ClearButton([input_fps, input_preset, input_tune, input_video, input_textbox, output_textbox, output_video])
113
 
114
  with gr.TabItem("Frame Blending"):
 
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:
126
  output_textbox2 = gr.Textbox(label="Output Logs", interactive=False)
 
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:
143
  output_textbox3 = gr.Textbox(label="Output Logs", interactive=False)