Adityadn commited on
Commit
908cfbb
·
verified ·
1 Parent(s): 9cd4fcb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -1
app.py CHANGED
@@ -80,7 +80,14 @@ import ffmpeg
80
  # Function to convert video to audio using ffmpeg
81
  def convert_video_to_audio(video_path):
82
  try:
83
- output_path = f"flowly_ai_audio_converter{os.path.splitext(video_path)[0]}.mp3"
 
 
 
 
 
 
 
84
  ffmpeg.input(video_path).output(output_path).run()
85
  return output_path
86
  except Exception as e:
 
80
  # Function to convert video to audio using ffmpeg
81
  def convert_video_to_audio(video_path):
82
  try:
83
+ # Ensure the directory exists
84
+ output_dir = "flowly_ai_audio_converter"
85
+ os.makedirs(output_dir, exist_ok=True)
86
+
87
+ # Correctly construct the output file path
88
+ output_path = os.path.join(output_dir, os.path.splitext(os.path.basename(video_path))[0] + ".mp3")
89
+
90
+ # Run ffmpeg conversion
91
  ffmpeg.input(video_path).output(output_path).run()
92
  return output_path
93
  except Exception as e: