Jeffgold commited on
Commit
c137773
·
1 Parent(s): f8f7bf0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -40,11 +40,11 @@ video_url = gr.inputs.Textbox(label="Video URL")
40
 
41
  def convert_video(video_file: File, quality, aspect_ratio, video_url):
42
  if video_file is None:
43
- output_path = f"{temp_dir}/{Path(video_url).name}.m3u8"
44
- else:
45
- output_path = f"{temp_dir}/{Path(video_file).name}.m3u8"
46
 
47
- ffmpeg_command = f"ffmpeg -i {video_file or video_url} -c:v libx264 -crf {quality} -f hls -aspect {aspect_ratio} {temp_dir}/{output_path}"
 
 
48
  subprocess.run(ffmpeg_command, shell=True)
49
 
50
  return components.Video(output_path)
 
40
 
41
  def convert_video(video_file: File, quality, aspect_ratio, video_url):
42
  if video_file is None:
43
+ video_file = Path(video_url)
 
 
44
 
45
+ output_path = f"{temp_dir}/{video_file.name}.m3u8"
46
+
47
+ ffmpeg_command = f"ffmpeg -i {video_file} -c:v libx264 -crf {quality} -f hls -aspect {aspect_ratio} {output_path}"
48
  subprocess.run(ffmpeg_command, shell=True)
49
 
50
  return components.Video(output_path)