[FFmpeg-user] AC-3 encoding questions

Carl Eugen Hoyos cehoyos at ag.or.at
Tue Nov 1 21:24:02 CET 2011

Thomas Worth <dev <at> rarevision.com> writes:

> > Please try:
> > ffmpeg -i Reel_02_0999.wav -ab 320k -y Reel_02_TEST.ac3
> >
> > That should work as expected. If not, please provide complete, uncut output
> > and explain what went wrong.
> The channel mapping seems to work.

Thank you.

Now back to your original question (how does -channel_layout work?) - I just
could not believe it is needed to convert a 5.1 sample to ac3:
If you look into libavutil/audioconvert.h, you will find defines for speaker
positions (in hex). If you add the values for the speakers that are in your
stream, you get the value for -channel_layout:
Stereo: 3
LRC: 7
Quad: 51

Note that channel order is always assumed to be wav order, you cannot specify a
different channel order (or in other words: FFmpeg internally only supports wav
channel order)!
Ticket #98 contains a sample (and an unfinished patch) that requires channel

Regarding your length problem: Please consider opening a ticket on trac, don't
forget to provide a command line including complete, uncut output that allows to
reproduce the problem.

Carl Eugen

More information about the ffmpeg-user mailing list