Spaces:
Sleeping
Sleeping
import gradio as gr | |
import ffmpeg | |
def trim_video(input_video, start_time, end_time): | |
output_video = f"{start_time}_{end_time}.mp4" | |
stream = ffmpeg.input(input_video) | |
stream = ffmpeg.trim(stream, start=start_time, end=end_time) | |
stream = ffmpeg.output(stream, output_video) | |
ffmpeg.run(stream, overwrite_output=True) | |
return output_video | |
interface = gr.Interface( | |
trim_video, | |
inputs=[ | |
gr.File(label="Upload Video"), | |
gr.Number(label="Start Time (seconds)"), | |
gr.Number(label="End Time (seconds)"), | |
], | |
outputs=gr.File(label="Trimmed Video"), | |
title="Video Trimmer", | |
description="Trim videos by specifying start and end times.", | |
) | |
interface.launch() |