File size: 1,034 Bytes
b9ee697
 
 
 
 
8db6f99
6ac39e0
b9ee697
 
 
 
 
 
8db6f99
8b73986
 
83c840b
8b73986
 
b9ee697
8b73986
 
8db6f99
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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")
        result = subprocess.run("sudo apt install ffmpeg", capture_output=True, text=True, check=True)
        print("Command Output of ffmpeg:\n", result.stdout)
        command2mp3 = "ffmpeg -i video.mp4 speech.mp3"
        result1 = subprocess.run(command2mp3, capture_output=True, text=True, check=True)
        print("Command Output of mp3:\n", result1.stdout)
        command2wav = "ffmpeg -i speech.mp3 speech.wav"
        result2 = subprocess.run(command2wav, capture_output=True, text=True, check=True)
        print("Command Output of wav:\n", result2.stdout)
        print("Command ended")