[gst-devel] AAC -> AC3 -> SPDIF (via Alsa)

Michal Benes michal.benes at itonis.tv
Mon May 22 02:57:11 CEST 2006

Hi Matt,

>  so I looked at the ffenc_ac3
> ffmpeg plugin and say that it's sink only accepted 2 channels
> (gst-inspect-0.10 ffenc_ac3).  So, I got the gst FFMPEG source and
> modified "gstffmpegcodecmap.c" and changed the 1, 2 to a 1, 8 as seen here
> #define GST_FF_AUD_CAPS_NEW(mimetype, ...)                      \
>     (context != NULL) ?                                         \
>     gst_caps_new_simple (mimetype,                              \
>         "rate", G_TYPE_INT, context->sample_rate,               \
>         "channels", G_TYPE_INT, context->channels,              \
>         __VA_ARGS__, NULL)                                      \
>     :                                                           \
>     gst_caps_new_simple (mimetype,                              \
>         "rate", GST_TYPE_INT_RANGE, 8000, 96000,                \
>         "channels", GST_TYPE_INT_RANGE, 1, 8,                   \
>         __VA_ARGS__, NULL)
> Now, I DO get 5.1 AC3 audio dynamically over the SPDIF with my AAC files.
> So, not being really familiar w/gst, my questions
> 0) I'm not sure if the way I changed the code will break anything else. 
> Is there a better way to change the ffenc_ac3 sink to accept [1,8]
> channels?

	I think that you have change the number of accepted channels for most
of audio encoders. Better way would be to change the capabilities in the
function gst_ffmpeg_codecid_to_caps (search for       
      if (encode) {
        /* FIXME: bitrate */
        caps = GST_FF_AUD_CAPS_NEW ("audio/x-ac3", NULL);

But I do not know if this is 100% correct either. Is ffmpeg format for
5.1 raw audio compatible with GStreamer one?

> 1) The video is jerky, even with a basic pipleline w/o AAC->AC3.  I think
> I didn't comple FFMPEG properly, as the libgstffmpeg.so file is 9.5MB (vs
> 3.2).  I just pulled it from CVS, and ran autogen.sh.  The sound seems ok,
> just the video is jerky.  Any hints on here?

In the case that you use B-frames, it will safer to put extra queue
before video sink. And even better: put queues before both audio and
video sink.

> 2) Is the pipeline above optimized?  Do I need to add clocks or buffers?

I do not see any problem problem with this pipe (except that you should
add the queues before sinks). 

> 3) The audio channel mappings are not correct. For example, the CENTER
> comes out the LeftRight speaker, etc.   Is there any way to remap
> channels?

This may be the reason why only 2 channels were enabled in gstffmpegenc.
Correct channel mapping between ffmpeg and gst is probably still to be

I am currently planning to add 5.1 encoding feature to gstffmpegenc too.
But I can not quarantee any timeframe now.



More information about the gstreamer-devel mailing list