|
import os |
|
import gradio as gr |
|
import subprocess |
|
|
|
def increase_fps(input_video_path, target_fps=60): |
|
output_path = "output.mp4" |
|
|
|
|
|
command = [ |
|
'ffmpeg', '-i', input_video_path, |
|
'-vf', f"fps={target_fps},minterpolate='mi_mode=mci:mc_mode=aobmc:vsbmc=1'", |
|
'-c:v', 'libx264', '-preset', 'slow', '-crf', '18', output_path |
|
] |
|
|
|
|
|
subprocess.run(command, check=True) |
|
|
|
return output_path |
|
|
|
def process_video(video_path): |
|
return increase_fps(video_path) |
|
|
|
interface = gr.Interface( |
|
fn=process_video, |
|
inputs=gr.Video(label="Загрузите видео для обработки"), |
|
outputs=gr.Video(label="Видео с увеличенным FPS"), |
|
title="Увеличение FPS до 60", |
|
description="Этот инструмент увеличивает частоту кадров видео до 60 FPS с использованием интерполяции. Загрузите видео с низким FPS, чтобы получить плавный результат.", |
|
examples=[] |
|
) |
|
|
|
if __name__ == "__main__": |
|
interface.launch() |