import gradio as gr import ffmpeg import os def convert_to_mp4(input_video): output_filename = "output.mp4" # Convert video to mp4 using FFmpeg stream = ffmpeg.input(input_video.name) stream = ffmpeg.output(stream, output_filename, vcodec='libx264', acodec='aac') ffmpeg.run(stream) return output_filename # Gradio interface iface = gr.Interface( fn=convert_to_mp4, inputs=gr.inputs.File(type="file", label="Upload Video"), outputs=gr.outputs.Video(label="Converted MP4 Video"), title="Video to MP4 Converter", description="A simple tool to convert videos to MP4 format using FFmpeg." ) if __name__ == "__main__": iface.launch()