Spaces:
Runtime error
Runtime error
File size: 1,406 Bytes
b9ee697 8db6f99 00f831f b9ee697 00f831f b9ee697 8db6f99 83c1062 476beb1 8b73986 83c1062 476beb1 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 25 26 27 28 29 30 31 |
import subprocess
import os
import shutil
def ex():
print("Started ex")
video_directory = "video"
video_files = [f for f in os.listdir(video_directory) if f.endswith(".mp4")]
print(f"Founded Video Files is : {video_files}")
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")
try:
result = subprocess.run(["sudo", "apt", "install", "ffmpeg"], capture_output=True, text=True, check=True)
print("FFmpeg installed successfully.")
print("Command Output of ffmpeg:\n", result.stdout)
except subprocess.CalledProcessError as e:
print(f"Error installing FFmpeg: {e}")
print(f"Return code: {e.returncode}")
print(f"Output: {e.output}")
command2mp3 = ["ffmpeg", "-i", "video.mp4", "speech.mp3"]
result1 = subprocess.run(command2mp3, capture_output=True, text=True, check=True, shell=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, shell=True)
print("Command Output of wav:\n", result2.stdout)
print("Command ended")
|