9

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 ?

SebMa
  • 1,573
  • 2
  • 19
  • 25

2 Answers2

17

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

Using -map_channel

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.

Using pan audio filter

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

llogan
  • 57,139
  • 15
  • 118
  • 145
  • Hi, you said "Assuming the input only contains audio:". The problem is that my file contains both video and audio :) – SebMa Apr 13 '16 at 14:45
  • @SebMa This one reason why you need to include the complete console output from your commands so the answers can be more accurate and less based on assumptions. I edited the answer mentioning video. – llogan Apr 13 '16 at 15:53
  • Sorry I forgot to give it but ffmpeg didn't give any error anyway. In my question, you can notice I used `-map_channel 0.1.0` but this is not enough to get both channels point to the left one. – SebMa Apr 14 '16 at 16:43
  • @SebMa Using `-map_channel 0.1.0` works for me to make a mono audio file from the left channel of a stereo input (with video as the first stream). – llogan Apr 14 '16 at 17:33
  • I think it only works for audio files. For videos, you have to add `-ac 1` – SebMa Apr 30 '16 at 08:51
  • Hi, I think the best would be that I give the youtube URL of the video that I'm trying to convert to a mono video : https://www.youtube.com/watch?v=l9dPJCFXAes – SebMa May 03 '16 at 11:25
  • @SebMa What are you using to get a local copy of the video? – llogan May 03 '16 at 18:52
  • `youtube-dl`, but don't bother. I solved the pb. by replacing : `-map_channel 0.1.0 -map_channel -1` which actually muted the second audio channel, instead of just using : `-map_channel 0.1.0` Thanks for your help :) – SebMa May 07 '16 at 01:32
  • **Note:** You **cannot** use `-c copy` (codec copy) after the `-map_channel`. Doing so will ignore your changes. You must let it re-encode your audio. – Hatefiend Nov 01 '22 at 18:05
  • > if the audio is the second stream, such is often the case in a typical video file, then you would use 1 instead. How can you tell, if your audio is in the first stream or in the second/other stream? – rlittles Mar 13 '23 at 21:47
1

@LordNeckbeard : Found the reason why my resulting file had only audio on the left channel like my source file.

It was because I used :

-map_channel 0.1.0 -map_channel -1

which muted the second audio channel, instead of just using :

-map_channel 0.1.0

Thanks for your help :)

SebMa
  • 1,573
  • 2
  • 19
  • 25