[FFmpeg-user] map_channel with H264/AAC input question

Robert Reinhardt robert at theMakers.com
Wed Feb 29 17:12:08 CET 2012

Tim and Nicholas, thank you for your feedback! I appreciate the validation--I just wanted to make sure I wasn't specifying map_channel options incorrectly. (There's an example in the FFMPEG docs for separating two channel audio to two stream tracks, but the example didn't make any assertions about the source input format.)

If anyone is looking to do this, here's the ffmpeg command I ended up using:

ffmpeg -y -i sample.mp4 -f lavfi -i "amovie=sample.mp4:si=1,pan=1:c0=c0" -c:a pcm_s16le -f lavfi -i "amovie=sample.mp4:si=1,pan=1:c0=c1" -c:a pcm_s16le -map 0:0 -c:v copy -map 1:0 -c:a libfaac -ac 1 -ab 48000 -map 2:0 -c:a libfaac -ac 1 -ab 48000 remuxed.mp4

This example will copy the existing video track from one H.264 file into another, and remap the left audio channel to a separate program/track, and remap the right audio channel to a third track.


Robert Reinhardt
The difference knowledge + experience makes | Consultant @ [theMAKERS]
{ work: http://www.theMakers.com }
{ video:  http://videoRx.com }
{ blog: http://probablyjustme.com }
{ more: http://linkedin.com/in/adaptivestreaming }

From: ffmpeg-user-bounces at ffmpeg.org [ffmpeg-user-bounces at ffmpeg.org] on behalf of Tim Nicholson [nichot20 at yahoo.com]
Sent: Wednesday, February 29, 2012 3:37 AM
To: FFmpeg user questions and RTFMs
Subject: Re: [FFmpeg-user] map_channel with H264/AAC input question

On 29/02/12 07:46, Robert Reinhardt wrote:
> I have an H264/AAC video with an audio program that has two channels (left/right), and I'd like to separate these channels into discrete program tracks (left channel as mono to one track, right channel as mono to another track). I was hoping the map_channel option would work without needing to reencode the audio, but I can only seem to get this type of channel mapping by using avfilter / pan option, which reencodes the audio to pcm_s16le first, and then encode back to AAC.

ISTR that AAC will encode stereo in a kind of M/S mode rather than A/B for
efficiency purposes. Therefore it is unlikely that you will be able to avoid a

> Many thanks in advance for any suggestions.
> Best,
> Robert

ffmpeg-user mailing list
ffmpeg-user at ffmpeg.org

More information about the ffmpeg-user mailing list