def write_wav(self, video_obj, target_wav_file):
'''
Writes the audio stream of a video as a wav suitable as input to HTK
----------
video_obj: a moviepy VideoFileClip
target_wav_file: path to write the wav file to
Returns
-------
None
'''
assert isinstance(video_obj, VideoFileClip), "video needs to be a instance of VideoFileClip"
# Write audio stream of video to file in the desired format
video_obj.audio.write_audiofile(target_wav_file, fps=16000, # Set fps to 16k
codec='pcm_s16le',
ffmpeg_params=['-ac', '1']) # Convert to mono
评论列表
文章目录