File size: 937 Bytes
feac5ab
88a47de
e9dc948
e35e748
 
5a11dcd
e9dc948
4d1a407
7463d83
e35e748
 
2f1b8b0
4d1a407
7463d83
0f99c8e
e9dc948
7463d83
e35e748
 
 
 
7463d83
 
dbc5df6
7463d83
e5289fc
7463d83
e35e748
 
19f68b8
feac5ab
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import gradio as gr
import ffmpeg # cool

def interpolate_video(video, fps):
    input_path = video.name
    output_path = "framer_interpolated.mp4"

    # Интерполяция кадров с использованием фильтра minterpolate, сохраняя звук
    (
        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="Framer! - frame interpolation with FFmpeg!",
    description="Upload a video and adjust the slider to set the target frame rate (FPS) for interpolation."
)

if __name__ == "__main__":
    iface.launch()