import subprocess import os import shutil def ex(): video_directory = "video" 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") command2mp3 = f"ffmpeg -i video.mp4 speech.mp3" command2wav = "ffmpeg -i speech.mp3 speech.wav" subprocess.run(command2mp3, shell=True) subprocess.run(command2wav, shell=True)