[FFmpeg-user] AC-3 Dolby Digital 5.1 Encoding

Chase Patterson chapatt at gmail.com
Sun Jun 3 22:29:43 CEST 2012

Sorry for bringing this thread back from the dead, but I have a couple 
other inquiries regarding the same original problem (described by the 

The command below mostly works, but I'm still not completely satisfied.

ffmpeg -i original.wav -vn -acodec ac3 -ac 6 -ar 
48000 -ab 640k -dialnorm -24 -dsur_mode 0 -original 1 -dmix_mode 1 
-channel_layout 63 final.ac3

It outputs a valid 5.1-channel AC-3 file, but not all players recognize it 
as such; Some play it as stereo (e.g. VLC sees that it's 5.1, but Totem 
thinks it's stereo). Is there some metadata that some players require? 
I've tested it, and Totem can in fact play most 5.1 surround AC-3s 

The other thing is the -channel_layout value (generously prescribed by 
Joshua Tidsbury). A value of 63 indeed works, and ffmpeg prints that it's 
encoding in "5.1" (if I don't specify a -channel_layout, it prints 
"5.1(side)". So, my question is, where did this value come from?

I was reading in the documentation, and part of it led me to believe that it 
could be found in /libavutil/audioconvert.c, but I looked, and the values 
I find there are not accepted by ffmpeg, so I'd assume that is only for 
abuffer (which is the heading under which I found this info in the docs).


More information about the ffmpeg-user mailing list