[FFmpeg-user] Audio Stream Mapping issue

Clément Bœsch ubitux at gmail.com
Tue Nov 15 17:33:52 CET 2011

On Tue, Nov 15, 2011 at 04:23:36PM +0000, Tim Nicholson wrote:
> On 15/11/11 16:08, Clément Bœsch wrote:
> >On Tue, Nov 15, 2011 at 03:27:48PM +0000, Tim Nicholson wrote:
> >>On 15/11/11 10:19, Clément Bœsch wrote:
> >>>On Tue, Nov 15, 2011 at 02:05:35AM -0800, hughht5 wrote:
> >>>>I would use the -map_channel option, however the documentation says it is
> >>>>limited at the moment:
> >>>>
> >>>>(From http://ffmpeg.org/ffmpeg.html)
> >>>>Note that "-map_channel" is currently limited to the scope of one input for
> >>>>each output; you can’t for example use it to pick multiple input audio files
> >>>>and mix them into one single output.
> >>>>
> >>>
> >>>AFAIU, Tim only has one file so it doesn't apply here.
> >>>
> >>
> >>Quite so.
> >>
> >>>Tim, I'm not sure to understand what you really want from your 4 stereo
> >>>audio streams. I can't tell if you want to pick only some (then -map) or
> >>>actually merge the channels of each streams into one single audio stream
> >>>(then what you need is indeed the -map_channel feature).
> >>>
> >>
> >>All I actually wanted to do was rewrap mxf->mov with no other
> >>changes. (They were in fact 4 mono streams mxf does not support
> >>stereo streams afaik)
> >>
> >
> >My bad, I misread it was mono.
> >
> >>ffmpeg -i in.mxf -map 0 -vcodec copy -acodec copy tim2.mov
> >>
> >>or more succinctly:-
> >>
> >>ffmpeg -i in.mxf -map 0 -c copy tim2.mov
> >>
> >>performs this.
> >>
> >>However according to the documentation the -map 0 *should* be
> >>unnecessary as the default *should* be "for audio the highest
> >>channel count" wheeras it seems to be the first audio stream only.
> >>
> >
> >The documenation sounds quite obvious to me; the selection pick "the
> >best", and in case of score equality, only the first one is picked. Maybe
> >it should indeed be explicited, or the behaviour changed.
> >
> In my experience, of much documentation writing and editing of
> others write ups, something that is abundantly clear to the writer
> can be completely misinterpreted by end users approaching things
> from a different starting point, it seems to be the way of things.

Sure, I think we all agree with that.

> That is why I first rasied the issue here to try and get a consensus
> of what the expected behaviour should be, and then try and
> understand how the documentation can be read to mean that...
> I am not sure where you get the 'pick "the best"' from the
> documentation, it only says this for video, not audio!

OK, let's quote this:

    By default ffmpeg tries to pick the "best" stream of each type present
    in input files and add them to each output file. For video, this means
    the highest resolution, for audio the highest channel count. For
    subtitle it's simply the first subtitle stream.

"pick the best stream of each type [...] For video, [...], for audio

I'm not sure where the confusion comes from…

> I am happy to contribute to better wording, once I understand what
> the "correct" behaviour is.

Quickly looking at ffmpeg.c (around L3934), the audio stream picking is
what we already suggested: it loops against all stream, pick the one with
the most number of channels (and thus *ignore* "score" equality) and add

So if you want to fix the documentation, you should IMO just reword in a
sense to explicit the "only one pick per stream type". I'm not a native
English speaker so I'm sure you will be able to propose a better wording
than me; feel free to send a patch on ffmpeg-devel. If you don't, I'll
take the time to of course.

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/20111115/94719bfe/attachment.asc>

More information about the ffmpeg-user mailing list