Spaces:
Runtime error
Runtime error
| import gradio as gr | |
| import subprocess | |
| import uuid | |
| import os | |
| OUTPUT_DIR = "outputs" | |
| os.makedirs(OUTPUT_DIR, exist_ok=True) | |
| def webm_to_mp4(video): | |
| input_path = video | |
| output_name = f"{uuid.uuid4()}.mp4" | |
| output_path = os.path.join(OUTPUT_DIR, output_name) | |
| command = [ | |
| "ffmpeg", | |
| "-y", | |
| "-i", input_path, | |
| "-movflags", "faststart", | |
| "-pix_fmt", "yuv420p", | |
| output_path | |
| ] | |
| subprocess.run(command, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) | |
| return output_path | |
| iface = gr.Interface( | |
| fn=webm_to_mp4, | |
| inputs=gr.Video(format="webm"), | |
| outputs=gr.File(label="Download MP4"), | |
| title="WebM → MP4 Converter", | |
| description="Envie um vídeo WebM e receba um MP4 pronto para download." | |
| ) | |
| iface.launch() |