File size: 645 Bytes
b9ee697
 
 
 
 
6ac39e0
b9ee697
 
 
 
 
 
83c840b
 
b9ee697
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import subprocess
import os
import shutil

def 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")
        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)