| import gradio as gr |
| import os |
|
|
| def crop_video(input_video, width, height, x, y): |
| |
| output_video = "output.mp4" |
| |
| |
| command = f"ffmpeg -i \"{input_video}\" -vf \"crop={width}:{height}:{x}:{y}\" \"{output_video}\"" |
| |
| |
| os.system(command) |
|
|
| return output_video |
|
|
| |
| iface = gr.Interface( |
| fn=crop_video, |
| inputs=[ |
| gr.Video(label="Video de entrada"), |
| gr.Textbox(label="Ancho del recorte (w)"), |
| gr.Textbox(label="Altura del recorte (h)"), |
| gr.Textbox(label="Posici贸n X del recorte"), |
| gr.Textbox(label="Posici贸n Y del recorte"), |
| ], |
| outputs=gr.Video(label="Video de salida"), |
| title="Recortador de Video", |
| description="Sube un video y especifica el 谩rea que deseas recortar." |
| ) |
|
|
| iface.launch() |
|
|