Spaces:
Sleeping
Sleeping
Aditya DN
commited on
Update app.py
Browse files
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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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:
|