File size: 884 Bytes
88c7481
 
 
2b87ea6
838164d
9571046
88c7481
 
 
 
9571046
 
 
88c7481
 
9571046
88c7481
 
 
9571046
88c7481
 
 
 
2b87ea6
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
import gradio as gr
import ffmpeg

from gradio.components import File, Output

def transcode_video(video_file, output_file, output_format, output_fps):
  """Transcodes a video file to m3u8 using ffmpeg.

  Args:
    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.
  """

  # Transcode the video file.
  ffmpeg.input(video_file).output(output_file, format=output_format, fps=output_fps).run()

  # Return the path to the transcoded file.
  return output_file

gr.Interface(transcode_video, inputs={"video_file": File("Select a video file", accept="video/*", multiple=False), "output_file": Output("Output file", accept=".m3u8", mode="upload")}).launch()