Spaces:
Runtime error
Runtime error
File size: 633 Bytes
af1695b 32b1f1e af1695b 32b1f1e af1695b 32b1f1e af1695b 32b1f1e af1695b 32b1f1e af1695b 32b1f1e | 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 subprocess
import uuid
import os
OUTPUT_DIR = "outputs"
os.makedirs(OUTPUT_DIR, exist_ok=True)
def webm_to_mp4(video):
output_name = f"{uuid.uuid4()}.mp4"
output_path = os.path.join(OUTPUT_DIR, output_name)
subprocess.run([
"ffmpeg",
"-y",
"-i", video,
"-movflags", "faststart",
"-pix_fmt", "yuv420p",
output_path
], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
return output_path
app = gr.Interface(
fn=webm_to_mp4,
inputs=gr.File(file_types=[".webm"]),
outputs=gr.File(),
api_name="convert"
)
app.launch() |