Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I use the following command to extract video parts of an '.MTS' record (video).

ffmpeg -i 00402.MTS -s 1280x720 -r 25 -ss 0:00:05.38608 -vcodec libxvid -qscale:v 2 -acodec ac3 -ar 48000 -ab 256k -t 0:00:06.613917 m001_mono.avi

The audio stream is stereo but the right channel only recorded noise. Here are the input informations:

Stream #0.0[0x1011]: Video: h264 (High), yuv420p, 1440x1080 [PAR 4:3 DAR 16:9], 50 fps, 50 tbr, 90k tbn, 50 tbc
Stream #0.1[0x1100]: Audio: ac3, 48000 Hz, stereo, s16, 256 kb/s

I would like the output's audio stream to be mono (with the original left channel only). I already made tests using '-ac 1' option, but in this case the two channels are merged and I lose ~6dB of gain.

What option should I use to discard right channel and output with mono audio stream ?

EDIT: ffmpeg output with map_channel option

/home/eric/buildsys/ffmpeg-2.0.1/ffmpeg -i 00402.MTS -s 1280x720 -r 25 -ss 0:00:05.38608    -vcodec libxvid -qscale:v 2 -acodec ac3 -ar 48000 -ab 256k -t 0:00:06.61391 -map_channel -1 -map_channel 0.1.0 m001_test.avi
ffmpeg version 2.0.1 Copyright (c) 2000-2013 the FFmpeg developers
 built on Sep 24 2013 05:31:18 with gcc 4.8 (Debian 4.8.1-10)
configuration: --extra-cflags=-I../static/include --extra-ldflags='-L../static/lib -static' --enable-gpl --enable-version3 --enable-static --disable-shared --disable-debug --enable-runtime-cpudetect --enable-libmp3lame --enable-libx264 --enable-libspeex --enable-libvorbis --enable-libvpx --enable-libfreetype --enable-libxvid --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-gray --enable-libopenjpeg --disable-ffserver
libavutil      52. 38.100 / 52. 38.100
libavcodec     55. 18.102 / 55. 18.102
libavformat    55. 12.100 / 55. 12.100
libavdevice    55.  3.100 / 55.  3.100
libavfilter     3. 79.101 /  3. 79.101
libswscale      2.  3.100 /  2.  3.100
libswresample   0. 17.102 /  0. 17.102
libpostproc    52.  3.100 / 52.  3.100
Input #0, mpegts, from '00402.MTS':
Duration: 00:01:18.25, start: 0.455556, bitrate: 12217 kb/s
Program 1 
Stream #0:0[0x1011]: Video: h264 (High) (HDMV / 0x564D4448), yuv420p, 1440x1080 [SAR 4:3 DAR 16:9], 25 fps, 50 tbr, 90k tbn, 50 tbc
Stream #0:1[0x1100]: Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, stereo, fltp, 256 kb/s
File 'm001_test.avi' already exists. Overwrite ? [y/N] y
-map_channel is forwarded to lavfi similarly to -af pan=0x3:c1=c0.
[pan @ 0x248a560] This syntax is deprecated. Use '|' to separate the list items.
[pan @ 0x248a560] Pure channel mapping detected: M 0
Output #0, avi, to 'm001_test.avi':
Metadata:
ISFT            : Lavf55.12.100
Stream #0:0: Video: mpeg4 (libxvid) (xvid / 0x64697678), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 200 kb/s, 25 tbn, 25 tbc
Stream #0:1: Audio: ac3 ([0] [0][0] / 0x2000), 48000 Hz, stereo, fltp, 256 kb/s
Stream mapping:
Stream #0:0 -> #0:0 (h264 -> libxvid)
Stream #0:1 -> #0:1 (ac3 -> ac3)
Press [q] to stop, [?] for help
frame=  166 fps= 23 q=2.0 Lsize=    4012kB time=00:00:06.64 bitrate=4950.3kbits/s    
video:3787kB audio:207kB subtitle:0 global headers:0kB muxing overhead 0.464949%
share|improve this question

3 Answers 3

Manipulating audio channels with ffmpeg

Chapter Mute a channel

This example will mute the first channel (the left channel) but keep the second channel as is:

ffmpeg -i stereo.wav -map_channel -1 -map_channel 0.0.1 output.wav

in your case its need to mute right channel. right?

share|improve this answer
    
Unrecognized option 'map_channel'. –  Eric Jan 16 at 14:11
1  
@Eric I'm guessing (since you haven't included the output) that your ffmpeg version is too old, or it's actually from Libav and not FFmpeg. Try with a newer one: ffmpeg.org/download.html –  slhck Jan 16 at 14:34
    
@ArcherGodson - Can we UnMute the muted channel back by modifying same ffmpeg coammnd –  Prakash V Holkar May 21 at 8:37

I solved the problem using the last version of Ffmpeg (2.0.1). The following command line makes the work:

/home/eric/buildsys/ffmpeg-2.0.1/ffmpeg -i 00402.MTS -s 1280x720 -ss 0:00:05.38608 -vcodec libxvid -qscale:v 2 -acodec ac3 -ar 48000 -ab 256k -t 0:00:06.61391 -af pan=1:c0=c0 m001_mono.avi

Btw, this post was very instructive!

share|improve this answer

The following is a confirmed working example with ffmpeg version 2.4.1-tessus:

ffmpeg -i stereo.wav -map_channel 0.0.0 left.wav

More info on FFMPEG's Audio Channel Page.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.