[FFmpeg-devel] [PATCH 4/4] lavc/audiotoolboxdec: fix a number of config and timestamp issues

Rodger Combs rodger.combs at gmail.com
Thu Mar 24 16:40:05 CET 2016

> On Mar 24, 2016, at 03:55, Carl Eugen Hoyos <cehoyos at ag.or.at> wrote:
> Rodger Combs <rodger.combs <at> gmail.com> writes:
>> - Channel layouts were never exported
>> - Channel mappings were incorrect beyond stereo
> What happens if you don't pass a channel layout?
> Does the encoder work? Does it return a channel 
> layout?

Oh, I thought lavc set a default channel layout if one wasn't specified, but it looks like that's not the case (it's ffmpeg_filter that does that).
Fixed with this patch:
--- a/libavcodec/audiotoolboxenc.c
+++ b/libavcodec/audiotoolboxenc.c
@@ -271,6 +271,9 @@ static av_cold int ffat_init_encoder(AVCodecContext *avctx)
         return AVERROR_UNKNOWN;
+    if (!avctx->channel_layout)
+        avctx->channel_layout = av_get_default_channel_layout(avctx->channels);
     if ((status = remap_layout(channel_layout, avctx->channel_layout, avctx->channels)) < 0) {
         av_log(avctx, AV_LOG_ERROR, "Invalid channel layout\n");

This will error if the user passes an unsupported channel layout (e.g. 5POINT1_BACK or 7POINT1); this seems to be the usual behavior.

> Does the AAC encoder support more than one channel 
> layout for a given number of input channels?

Yes; see the aac_at_channel_layouts array.

> Carl Eugen
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

More information about the ffmpeg-devel mailing list