Spaces:
Runtime error
Runtime error
File size: 715 Bytes
20bee2f 709adea 289931f 709adea 289931f 709adea abdd75f 709adea |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
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() |