[FFmpeg-user] More on audio stream mapping

Clément Bœsch ubitux at gmail.com
Sat Dec 17 10:08:35 CET 2011


On Fri, Dec 16, 2011 at 12:11:50PM +0000, Tim Nicholson wrote:
> I have a file containing 1 video and 4 mono audio streams, and wish
> to create a file with 1 video and 2 stereo audio streams.
> 
> Under the old API the extra audio stream was added after the output
> filename, but now it is supposed to be done via the -map and
> -map_channel commands.
> 
> It therefore seems that the correct way to now achieve this is:-
> 
> ffmpeg -i archive.gxf -c:v copy \
> -c:a libfaac -b:a 96k -ar 48k \
> -map 0:0 -map 0:1 -map 0:2 \
> -ac 2 -map_channel 0.1.0:0.1 -map_channel 0.2.0:0.1 \
> -ac 2 -map_channel 0.3.0:0.2 -map_channel 0.4.0:0.2 \
> out.mp4
> 
> From my reading of the documentation the:-
> 
> -map 0:0 -map 0:1 -map 0:2
> 
> maps the video and first two audio streams to the output file, which
> is not the mapping I actually want but is the only way I can see to
> add the extra output audio stream. Then the:-
> 
> -map_channel 0.1.0:0.1
> 
> commands overwrite this mapping to put the audio channels where I want them.
> 
> Adding streams by performing a mapping that is not wanted seems to
> me to be counter intuitive. Or have I misunderstood things?
> 
> It also appears that you cannot use -c:a copy if using -map_channel
> as the copy copies the stream as is, and not the channel.
> 

You can't unfortunately ATM have an output stream composed of multiple
input streams (internally an output stream is associated with only one
input stream); I though I added a note in the documentation, but my
wording is certainly approximative as ever.

But this might be possible through the filters when the merge filter will
be upstream (there is a pending patch on the mailing list). One could also
write some stream preprocessing code to merge the streams.

Anyway, you just hit a limitation...

-- 
Clément B.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-user/attachments/20111217/d5ab04b5/attachment.asc>


More information about the ffmpeg-user mailing list