accentometer / src /extractor.py
AmirFARES's picture
fixed video and audio to be temp
36dd881
raw
history blame contribute delete
314 Bytes
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