I am using moviepy to extract a wav file like this:
ac = AudioFileClip(video_path)
clip = ac.subclip(start_ts, end_ts)
clip.write_audiofile(audio_path)
from the API, which part I should tune to make the output mono wav? if it is not possible using this write_audiofile method, is there anyother way to do it? thanks
write_audiofile(filename, fps=44100, nbytes=2, buffersize=2000, codec=None,
bitrate=None, ffmpeg_params=None, write_logfile=False,
verbose=True, progress_bar=True)
The ffmpeg_params
of the write_audiofile
method allows you to pass additional parameters to ffmpeg
.
To convert an X-channel audio file to mono, you can do ffmpeg -i stereo.wav -ac 1 mono.wav
.
So, passing ffmpeg_params=["-ac", "1"]
to write_audiofile
should do.