[FFmpeg-user] Unable to encode to 7.1 ALAC

Moritz Barsnick barsnick at gmx.net
Tue May 12 18:33:57 CEST 2015

On Tue, May 12, 2015 at 18:08:59 +0200, Moritz Barsnick wrote:
> Furthermore, please show us your command line, and why you think the
> result is incorrect.

I'm sorry, I now see why it is incorrect. I failed to see the "6.1" in
ffmpeg's output.

I can reproduce with:

$ ffmpeg -f lavfi -i sine -filter_complex "[0:a][0:a][0:a][0:a][0:a][0:a][0:a][0:a]amerge=inputs=8" -c:a pcm_s16le -t 2 test.wav
$ ffmpeg -loglevel debug -i test.wav -map 0 -c:a alac test.m4a -y

The interesting output line is this:
[auto-inserted resampler 0 @ 0x9ed4120] ch:8 chl:7.1 fmt:s16 r:44100Hz -> ch:7 chl:6.1 fmt:s16p r:44100Hz

Why this happens, the experts will have to say. To me it isn't obvious
why ffmpeg's alac shouldn't (or should) support 7.1.

I couldn't find much documentation on ffmpeg's alac decoder, but I
found this:

$ ffmpeg -help encoder=alac | grep layouts
    Supported channel layouts: mono stereo 3.0 4.0 5.0 5.1 6.1 7.1(wide)

Taking that info, I managed to fool the filters by manually inserting a
resample to "7.1(wide)":

$ ffmpeg -loglevel debug -i test.wav -map 0 -c:a alac -af "aformat=channel_layouts=7.1(wide)" test.m4a -y
This now reports an output stream as such:
     Stream #0:0: Audio: alac (alac / 0x63616C61), 44100 Hz, 7.1(wide), s16p, 128 kb/s

That doesn't explain why ffmpeg doesn't manage to choose that layout by
itself, but it should help you along.


More information about the ffmpeg-user mailing list