Suparnpreet commited on
Commit
83c1062
1 Parent(s): 476beb1

Update audioex.py

Browse files
Files changed (1) hide show
  1. audioex.py +10 -4
audioex.py CHANGED
@@ -13,12 +13,18 @@ def ex():
13
  print(mp4_file_path)
14
  os.rename(mp4_file_path, "video.mp4")
15
  print("Command started")
16
- result = subprocess.run("sudo apt install ffmpeg", capture_output=True, text=True, check=True, shell=True)
17
- print("Command Output of ffmpeg:\n", result.stdout)
18
- command2mp3 = "ffmpeg -i video.mp4 speech.mp3"
 
 
 
 
 
 
19
  result1 = subprocess.run(command2mp3, capture_output=True, text=True, check=True, shell=True)
20
  print("Command Output of mp3:\n", result1.stdout)
21
- command2wav = "ffmpeg -i speech.mp3 speech.wav"
22
  result2 = subprocess.run(command2wav, capture_output=True, text=True, check=True, shell=True)
23
  print("Command Output of wav:\n", result2.stdout)
24
  print("Command ended")
 
13
  print(mp4_file_path)
14
  os.rename(mp4_file_path, "video.mp4")
15
  print("Command started")
16
+ try:
17
+ result = subprocess.run(["sudo", "apt", "install", "ffmpeg"], capture_output=True, text=True, check=True)
18
+ print("FFmpeg installed successfully.")
19
+ print("Command Output of ffmpeg:\n", result.stdout)
20
+ except subprocess.CalledProcessError as e:
21
+ print(f"Error installing FFmpeg: {e}")
22
+ print(f"Return code: {e.returncode}")
23
+ print(f"Output: {e.output}")
24
+ command2mp3 = ["ffmpeg", "-i", "video.mp4", "speech.mp3"]
25
  result1 = subprocess.run(command2mp3, capture_output=True, text=True, check=True, shell=True)
26
  print("Command Output of mp3:\n", result1.stdout)
27
+ command2wav = ["ffmpeg", "-i", "speech.mp3", "speech.wav"]
28
  result2 = subprocess.run(command2wav, capture_output=True, text=True, check=True, shell=True)
29
  print("Command Output of wav:\n", result2.stdout)
30
  print("Command ended")