Sunday 22 October 2017

How to select the left audio channel with ffmpeg and downmix to mono?



I have an old "stereo" movie as a mp4 file.


The sound is only in the left channel, the right channel is silent.


I'd like to use ffmpeg to copy the video stream :


ffmpeg -hide_banner -i video.mp4 -c:v copy ...

and convert the audio to mono by selecting only the left channel :


-map_channel 0.1.0 -map_channel -1

But that didn't change anything :-(


What is the correct ffmpeg command line for that ?


Is it also possible to do that whithout re-encoding ?



Answer



There are at least two methods to select the left audio channel and output as mono.



Assuming the input only contains audio:


ffmpeg -i input -map_channel 0.0.0 output



  • The first number is the input file id: you only have one input so that will be 0. The second number is the stream specifier: if the audio is the second stream, such is often the case in a typical video file, then you would use 1 instead. The third number is the channel number: in a stereo input the first channel is usually the Front Left, and the second is usually the Front Right.




  • If you want the right channel instead use -map_channel 0.0.1.




  • If the input contains video, then the audio will likely (but not always) be listed as the second stream, so you would need to use 0.1.0 instead.





ffmpeg -i input -af "pan=mono|c0=FL" output


  • Alternatively, you could use pan=mono|c0=c0.

  • If you want the right channel instead use pan=mono|c0=FR (or pan=mono|c0=c1).


Also see



No comments:

Post a Comment

Where does Skype save my contact's avatars in Linux?

I'm using Skype on Linux. Where can I find images cached by skype of my contact's avatars? Answer I wanted to get those Skype avat...