Spaces:
Runtime error
Runtime error
import subprocess | |
import os | |
import shutil | |
def ex(): | |
print("Started ex") | |
video_directory = os.getcwd() | |
video_files = [f for f in os.listdir(video_directory) if f.endswith(".mp4")] | |
for mp4_file in video_files: | |
# Full path to the mp4 file | |
mp4_file_path = os.path.join(video_directory, mp4_file) | |
print(mp4_file_path) | |
os.rename(mp4_file_path, "video.mp4") | |
print("Command started") | |
subprocess.run("sudo apt install ffmpeg", shell=True) | |
command2mp3 = "ffmpeg -i video.mp4 speech.mp3" | |
command2wav = "ffmpeg -i speech.mp3 speech.wav" | |
subprocess.run(command2mp3, shell=True) | |
subprocess.run(command2wav, shell=True) | |
print("Command ended") | |