Spaces:
Runtime error
Runtime error
Update audioex.py
Browse files- audioex.py +16 -16
audioex.py
CHANGED
@@ -1,16 +1,16 @@
|
|
1 |
-
import subprocess
|
2 |
-
import os
|
3 |
-
import shutil
|
4 |
-
|
5 |
-
def ex():
|
6 |
-
video_directory =
|
7 |
-
video_files = [f for f in os.listdir(video_directory) if f.endswith(".mp4")]
|
8 |
-
for mp4_file in video_files:
|
9 |
-
# Full path to the mp4 file
|
10 |
-
mp4_file_path = os.path.join(video_directory, mp4_file)
|
11 |
-
print(mp4_file_path)
|
12 |
-
os.rename(mp4_file_path, "video.mp4")
|
13 |
-
command2mp3 = f"ffmpeg -i video.mp4 speech.mp3"
|
14 |
-
command2wav = "ffmpeg -i speech.mp3 speech.wav"
|
15 |
-
subprocess.run(command2mp3, shell=True)
|
16 |
-
subprocess.run(command2wav, shell=True)
|
|
|
1 |
+
import subprocess
|
2 |
+
import os
|
3 |
+
import shutil
|
4 |
+
|
5 |
+
def ex():
|
6 |
+
video_directory = os.chdir()
|
7 |
+
video_files = [f for f in os.listdir(video_directory) if f.endswith(".mp4")]
|
8 |
+
for mp4_file in video_files:
|
9 |
+
# Full path to the mp4 file
|
10 |
+
mp4_file_path = os.path.join(video_directory, mp4_file)
|
11 |
+
print(mp4_file_path)
|
12 |
+
os.rename(mp4_file_path, "video.mp4")
|
13 |
+
command2mp3 = f"ffmpeg -i video.mp4 speech.mp3"
|
14 |
+
command2wav = "ffmpeg -i speech.mp3 speech.wav"
|
15 |
+
subprocess.run(command2mp3, shell=True)
|
16 |
+
subprocess.run(command2wav, shell=True)
|