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

Joshua Tidsbury Joshua.Tidsbury at bellmedia.ca
Sat May 26 16:58:24 CEST 2012


You should probably explicitly define the channel layout. Here are some notes from an internal app of mine that should assist in translating the various Dolby terminology into ffmpeg terminology:

ac3_center_dmix (-center_mixlev -ltrt_cmixlev -loro_cmixlev; float)
ac3_surround_dmix (-surround_mixlev -ltrt_surmixlev -loro_surmixlev; float)
ac3_copyright_bit (-copyright; 0 or 1)
ac3_dialnorm (-dialnorm; negative int)
ac3_original_stream (-original; 0 or 1)
ac3_dmix_mode (-dmix_mode; 0,1,2)

ac3_channel_l = 1
ac3_channel_r = 2
ac3_channel_c = 4
ac3_channel_lfe = 8
ac3_channel_ls = 16
ac3_channel_rs = 32
ac3_channel_lsb = 512
ac3_channel_rsb = 1024

-channel_layout: 1_0 = 4, 2_0 = 3, 2_1 = 11, 3_0 = 7, 3_1 = 15, 5_0 = 55, 5_1 = 63, 7_0 = 1591, 7_1 = 1599

And an example for converting a poly bwav into a fully formatted ac3 with metadata:

ffmpeg -i T-Vox\ Channel\ Ident.WAV -vn -acodec ac3 -ac 6 -ar 48000 -ab 448k -dialnorm -24 -dsur_mode 0 -original 1 -dmix_mode 2 -channel_layout 63 result.ac3

Hope that helps,
Josh


--------------
Josh Tidsbury | CTV
m: 416.433.3968

On 2012-05-26, at 10:13 AM, "Chase Patterson" <chapatt at gmail.com> wrote:

> So, the command I figured out (ffmpeg -i Session.flac -s:a 48k -ab
> 640k -acodec ac3 -ac 6 Session.ac3) works, but even though it does in
> fact have 6 channels, it plays in stereo. Am I missing an argument
> that maps the channels correctly? I also tried converting from a wav
> version of the file (that's also encoded in 5.1 surround, and plays as
> such), but with the same result.
> 
> Does anyone have any idea what I'm missing?
> 
> 
> Thanks,
> Chase
> 
> On Thu, May 24, 2012 at 7:28 PM, Chase Patterson <chapatt at gmail.com> wrote:
>> Hi,
>> 
>> I'm mixing audio for a movie on Ardour (an audio editing software), which
>> can't export to AC3, but it can export multiple channels to other formats,
>> e.g. FLAC. So I have it encoded in FLAC with 5.1 surround sound. I'd like to
>> use ffmpeg to convert it to AC3 at 48kHz and 640kb/s with 5.1 surround
>> (Dolby Digital).
>> 
>> Here's what I have so far, but I'd like to change (or make sure it's
>> correct) the channel layout.
>> 
>> ffmpeg -i Session.flac -s:a 48k -ab 640k -acodec ac3 -ac 6 Session.ac3
>> 
>> Which returns
>> 
>> ffmpeg version 0.10.3 Copyright (c) 2000-2012 the FFmpeg developers
>>   built on May  9 2012 17:51:07 with gcc 4.7.0 20120505 (prerelease)
>>   configuration: --prefix=/usr --enable-libmp3lame --enable-libvorbis
>> --enable-libxvid --enable-libx264 --enable-libvpx --enable-libtheora
>> --enable-libgsm --enable-libspeex --enable-postproc --enable-shared
>> --enable-x11grab --enable-libopencore_amrnb --enable-libopencore_amrwb
>> --enable-libschroedinger --enable-libopenjpeg --enable-librtmp
>> --enable-libpulse --enable-gpl --enable-version3 --enable-runtime-cpudetect
>> --disable-debug --disable-static
>>   libavutil      51. 35.100 / 51. 35.100
>>   libavcodec     53. 61.100 / 53. 61.100
>>   libavformat    53. 32.100 / 53. 32.100
>>   libavdevice    53.  4.100 / 53.  4.100
>>   libavfilter     2. 61.100 /  2. 61.100
>>   libswscale      2.  1.100 /  2.  1.100
>>   libswresample   0.  6.100 /  0.  6.100
>>   libpostproc    52.  0.100 / 52.  0.100
>> [flac @ 0x1c003a0] max_analyze_duration 5000000 reached at 5016000
>> Input #0, flac, from 'Session.flac':
>>   Duration: 00:00:14.00, bitrate: 1010 kb/s
>>     Stream #0:0: Audio: flac, 48000 Hz, 5.1, s32
>> Incompatible sample format 's32' for codec 'ac3', auto-selecting format
>> 'flt'
>> [ac3 @ 0x1c07920] channel_layout not specified
>> [ac3 @ 0x1c07920] No channel layout specified. The encoder will guess the
>> layout, but it might be incorrect.
>> Output #0, ac3, to 'test.ac3':
>>   Metadata:
>>     encoder         : Lavf53.32.100
>>     Stream #0:0: Audio: ac3, 48000 Hz, 5.1(side), flt, 640 kb/s
>> Stream mapping:
>>   Stream #0:0 -> #0:0 (flac -> ac3)
>> Press [q] to stop, [?] for help
>> size=    1095kB time=00:00:14.01 bitrate= 640.0kbits/s
>> video:0kB audio:1095kB global headers:0kB muxing overhead 0.000000%
>> 
>> That leads me to believe that it's using a channel layout of "5.1(side)"
>> (maybe assuming the surround speakers are on the sides, rather than behind,
>> as I want). Also, it automatically sets the sample format to "flt". Is this
>> what I want, or how can I change it?
>> 
>> Thank you!
>> 
>> 
>> Chase
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user


More information about the ffmpeg-user mailing list