Spaces:
Paused
Paused
File size: 1,119 Bytes
88c7481 cb2c10c 838164d 6388cc6 b059570 88c7481 b059570 9571046 88c7481 9571046 88c7481 a64acd3 a16bdc2 a64acd3 88c7481 b059570 88c7481 fb7cfb1 7f52e8a 91fa878 45a6dfa 724f805 45a6dfa 1d5a2f0 724f805 91fa878 |
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 32 33 34 35 36 37 38 39 40 41 |
import gradio as gr
import ffmpeg
from gradio.components import File
import os
def transcode_video(input_video_file, output_file, output_format, output_fps):
"""Transcodes a video file to m3u8 using ffmpeg.
Args:
input_video_file: The path to the video file to transcode.
output_file: The path to the transcoded m3u8 file.
output_format: The output format of the transcoded file.
output_fps: The output framerate of the transcoded file.
Returns:
The path to the transcoded file.
"""
# Create a folder to save the transcoded video file to.
output_dir = os.path.dirname(output_file)
if not os.path.exists(output_dir):
os.makedirs(output_dir)
# Transcode the video file.
ffmpeg.input(input_video_file).output(output_file, format=output_format, fps=output_fps).run()
# Return the path to the transcoded file.
return output_file
# Remove unused keyword argument
input_video_file = File()
outputs={"output_file": File(input_video_file.path, accept=".m3u8")}
gr.Interface(
transcode_video,
inputs={"input_video_file": input_video_file},
outputs=outputs
).launch()
|