Jeffgold commited on
Commit
8e9450c
·
1 Parent(s): 785f173

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -59,13 +59,14 @@ def convert_video(video_file: File, quality, aspect_ratio, video_url):
59
  ffmpeg_command = f"ffmpeg -i {video_file} -c:v libx264 -crf {quality} -f hls -aspect {aspect_ratio} {output_path}"
60
 
61
  try:
62
- subprocess.run(ffmpeg_command, shell=True)
 
 
 
63
  except FileNotFoundError:
64
  print("ffmpeg is not installed.")
65
  return None
66
 
67
- time.sleep(2)
68
-
69
  # Return the output file directly
70
  return components.Video(output_path)
71
 
 
59
  ffmpeg_command = f"ffmpeg -i {video_file} -c:v libx264 -crf {quality} -f hls -aspect {aspect_ratio} {output_path}"
60
 
61
  try:
62
+ subprocess.run(ffmpeg_command, shell=True, timeout=10)
63
+ except subprocess.TimeoutExpired:
64
+ print("ffmpeg timed out")
65
+ return None
66
  except FileNotFoundError:
67
  print("ffmpeg is not installed.")
68
  return None
69
 
 
 
70
  # Return the output file directly
71
  return components.Video(output_path)
72