Jeffgold commited on
Commit
88280cc
·
1 Parent(s): 0c96b87

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -6
app.py CHANGED
@@ -99,15 +99,14 @@ def convert_video(video_file, quality, aspect_ratio, video_url, api_key, upload)
99
  ]
100
 
101
  try:
102
- logging.info("Running command: %s", " ".join(ffmpeg_command))
103
- subprocess.run(ffmpeg_command, check=True, timeout=600, stderr=subprocess.PIPE)
104
  except subprocess.CalledProcessError as e:
105
- logging.exception("ffmpeg command failed.")
106
- error_file_path = temp_dir / "error.txt"
107
  with open(error_file_path, 'w') as error_file:
108
- error_file.write("ffmpeg command failed:\n")
109
- error_file.write(e.stderr.decode())
110
  return error_file_path
 
111
  except subprocess.TimeoutExpired:
112
  logging.exception("ffmpeg command timed out.")
113
  return "ffmpeg command timed out."
 
99
  ]
100
 
101
  try:
102
+ result = subprocess.run(ffmpeg_command, check=True, timeout=600, capture_output=True, text=True)
 
103
  except subprocess.CalledProcessError as e:
104
+ logging.error("ffmpeg command failed with the following error:\n%s", e.stderr)
105
+ error_file_path = tempfile.gettempdir() + "/error.txt"
106
  with open(error_file_path, 'w') as error_file:
107
+ error_file.write("ffmpeg command failed with the following error:\n" + e.stderr)
 
108
  return error_file_path
109
+
110
  except subprocess.TimeoutExpired:
111
  logging.exception("ffmpeg command timed out.")
112
  return "ffmpeg command timed out."