0

I have some .wav files and I would like to convert their frequency (fs) and number of channels (nchannels). I am using ffmpeg on a jupyter notebook, python3.6 but using linux command line with a system call. I used the following command and it works.

cmd= 'ffmpeg -i %s -ar %d -ac %d %s.wav'%(filepath,fs,nchannel,wavfilename)
os.system(cmd)

However, when converting two channels into a single channel, I just want ffmpeg takes only left (or right) channel instead of an average of two signal? If I use map channel as follow would that be correct? This creates wav files but I am not sure if only one channel is taken.

'ffmpeg -i %s -ar %d -map_channel 0.0.0 %s.wav(filepath,fs,wavfilename)'

If not, how can I modify my code above to achieve that? I also tried;

'ffmpeg -i %s -af channelsplit=channel_layout=stereo:channels=FL -ar %d %s.wav'%(filepath,fs,wavfilename)'

but this created empty wav files.

thanks

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.