Jeffgold commited on
Commit
b059570
·
1 Parent(s): 2dbca1a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -3,11 +3,11 @@ import ffmpeg
3
 
4
  from gradio.components import File
5
 
6
- def transcode_video(video_file, output_file, output_format, output_fps):
7
  """Transcodes a video file to m3u8 using ffmpeg.
8
 
9
  Args:
10
- video_file: The path to the video file to transcode.
11
  output_file: The path to the transcoded m3u8 file.
12
  output_format: The output format of the transcoded file.
13
  output_fps: The output framerate of the transcoded file.
@@ -22,7 +22,7 @@ def transcode_video(video_file, output_file, output_format, output_fps):
22
  os.makedirs(output_dir)
23
 
24
  # Transcode the video file.
25
- ffmpeg.input(video_file).output(output_file, format=output_format, fps=output_fps).run()
26
 
27
  # Return the path to the transcoded file.
28
  return output_file
@@ -33,4 +33,4 @@ def name_file(file_name):
33
  def get_file_name(file):
34
  return file.name
35
 
36
- gr.Interface(transcode_video, inputs={"video_file": File("video_file"), "output_file": File(get_file_name(video_file), accept=".m3u8", mode="upload")}).launch()
 
3
 
4
  from gradio.components import File
5
 
6
+ def transcode_video(input_video_file, output_file, output_format, output_fps):
7
  """Transcodes a video file to m3u8 using ffmpeg.
8
 
9
  Args:
10
+ input_video_file: The path to the video file to transcode.
11
  output_file: The path to the transcoded m3u8 file.
12
  output_format: The output format of the transcoded file.
13
  output_fps: The output framerate of the transcoded file.
 
22
  os.makedirs(output_dir)
23
 
24
  # Transcode the video file.
25
+ ffmpeg.input(input_video_file).output(output_file, format=output_format, fps=output_fps).run()
26
 
27
  # Return the path to the transcoded file.
28
  return output_file
 
33
  def get_file_name(file):
34
  return file.name
35
 
36
+ gr.Interface(transcode_video, inputs={"input_video_file": File("video.mp4")}).launch()