Spaces:
Runtime error
Runtime error
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") | |