Spaces:
Sleeping
Sleeping
File size: 314 Bytes
5f7fae9 36dd881 5f7fae9 | 1 2 3 4 5 6 7 8 9 10 | from moviepy import VideoFileClip
def extract_audio(video_path: str, output_path: str = "audio.wav") -> str:
# Force output path to be in /tmp
output_path = f"/tmp/{output_path}"
video = VideoFileClip(video_path)
video.audio.write_audiofile(output_path, codec="pcm_s16le")
return output_path
|