[FFmpeg-user] Right audio channel shifted

Moritz Barsnick barsnick at gmx.net
Tue Oct 14 13:59:41 CEST 2014

Hi Alex,

> I guess there is somehing wrong with the channel mapping, but without the
> fliter_complex the mapping seems to be okay.

I think the filter_complex messes up the mapping. Note this mapping
from your output:
> Stream mapping:
>   Stream #0:2 (pcm_s24le) -> atrim
>   atrim -> Stream #0:0 (pcm_s24le)
>   Stream #0:0 -> #0:1 (copy)

and this result:
> Output #0, mxf, to 'test_new.mxf':
>     Stream #0:0: Audio: pcm_s24le, 48000 Hz, mono, s32 (24 bit), 1152 kb/s
>     Stream #0:1: Video: mpeg2video, yuv422p, 1920x1080 [SAR 1:1 DAR 16:9],

and this warning:
> [mxf @ 00000000003b69c0] there must be exactly one video stream and it must be the first one

I'm sure that's your issue. The filter seems to be messing up the
mapping, at least in this automatic case.

Instead of

> C:\>ffmpeg -i test.mxf -vcodec copy -map 0:v -acodec pcm_s24le -map 0:1 -map 0:2 -filter_complex "[a:1]atrim=start=0.035" test_new.mxf

you probably need something like

ffmpeg -i test.mxf -vcodec copy -map 0:v -acodec pcm_s24le -map 0:1 -filter_complex "[a:1]atrim=start=0.035[ashifted]" -map "[ashifted]" test_new.mxf

(Untested) Note that I'm trying to explicitly map the filter output to
a particular stream, avoiding automatic mapping. You may have to play
around a bit more with the map options.

Is this a bug, BTW? Documentation on "-map" states:
>    The first -map option on the command line specifies the source for
>    output stream 0, the second -map option specifies the source for
>    output stream 1, etc.

Digging further, documentation of "-filter_complex" clarifies:
>    Output link labels are referred to with ‘-map’. Unlabeled outputs
>    are added to the first output file.

So the first documentation section is somewhat unclear, as it is
"disturbed" by the second behavior. (And in the second section: "first
output file" -> "first output stream", right?)


More information about the ffmpeg-user mailing list