Reputation: 307
I am struggling with manipulation of audio channels in Python. Specifically, how to convert stereo .flac into mono .flac file in Python?
I know this method: https://trac.ffmpeg.org/wiki/AudioChannelManipulation#stereomonostream but i am looking for something which can be done directly in Python.
Any help will be appreciated.
Upvotes: 2
Views: 1889
Reputation: 659
Have you tried the ffmpeg-python package?
You can install it with pip install ffmpeg-python
. And this might solve your problem:
import ffmpeg
ffmpeg.input('stereo.flac').output('mono.flac', ac=1).run()
There are some examples in the GitHub repository.
Another option could be to use the subprocess module:
import subprocess
subprocess.run('ffmpeg -i stereo.flac -ac 1 mono.flac', shell=True)
Be careful when using shell=True.
Upvotes: 3