|
import gradio as gr |
|
import ffmpeg |
|
|
|
def interpolate_video(video, fps): |
|
input_path = video.name |
|
output_path = "interpolated_video.mp4" |
|
|
|
|
|
( |
|
ffmpeg |
|
.input(input_path) |
|
.filter('minterpolate', fps=fps) |
|
.output(output_path, acodec='copy') |
|
.run(overwrite_output=True) |
|
) |
|
|
|
return output_path |
|
|
|
iface = gr.Interface( |
|
fn=interpolate_video, |
|
inputs=[ |
|
gr.File(label="Upload Video"), |
|
gr.Slider(minimum=24, maximum=60, step=1, value=60, label="Frame Rate (FPS)") |
|
], |
|
outputs=gr.Video(label="Interpolated Video"), |
|
title="Frame Interpolation App", |
|
description="Upload a video and adjust the slider to set the target frame rate (FPS) for interpolation." |
|
) |
|
|
|
if __name__ == "__main__": |
|
iface.launch() |