Spaces:
Runtime error
Runtime error
File size: 686 Bytes
b9ee697 db493e0 b9ee697 8db6f99 00f831f b9ee697 00f831f b9ee697 8db6f99 db493e0 254fd6a |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
import os
from moviepy.editor import VideoFileClip
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")
video = VideoFileClip("video.mp4")
audio = video.audio
audio.write_audiofile("speech.wav")
audio.close()
video.close()
print("Command ended")
|