After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 691617 - avenc_aac: errors out with "encoder not initialized"
avenc_aac: errors out with "encoder not initialized"
Product: GStreamer
Classification: Platform
Component: gst-libav
Other Linux
: Normal critical
: 1.2.2
Assigned To: GStreamer Maintainers
GStreamer Maintainers
: 691615 (view as bug list)
Depends on:
Reported: 2013-01-12 17:27 UTC by Christian Fredrik Kalager Schaller
Modified: 2013-11-11 12:44 UTC
See Also:
GNOME target: ---
GNOME version: ---

PNG showing pipeline (610.38 KB, image/png)
2013-01-12 17:36 UTC, Christian Fredrik Kalager Schaller
gst-libav patch to add compliance property to all encoders (11.75 KB, patch)
2013-10-11 22:23 UTC, Greg Rutz
needs-work Details | Review
Changes to patch based on review (9.29 KB, patch)
2013-10-14 20:53 UTC, Greg Rutz
committed Details | Review

Description Christian Fredrik Kalager Schaller 2013-01-12 17:27:17 UTC
If I don't have the FAAC plugin installed the libav plugin gets used instead, but when that happens the pipeline hangs. Attached GST_DEBUG log and dotfile dump image.
Comment 1 Christian Fredrik Kalager Schaller 2013-01-12 17:36:15 UTC
Created attachment 233310 [details]
PNG showing pipeline
Comment 2 Christian Fredrik Kalager Schaller 2013-01-12 17:36:33 UTC
GST_DEBUG log can be found here:
Comment 3 Tim-Philipp Müller 2013-01-12 19:23:36 UTC
*** Bug 691615 has been marked as a duplicate of this bug. ***
Comment 4 Tim-Philipp Müller 2013-01-12 20:09:32 UTC
gst-launch-1.0 audiotestsrc ! audio/x-raw,channels=2 ! avenc_aac ! fakesink
ERROR: from element /GstPipeline:pipeline0/avenc_aac:avenc_aac0: GStreamer error: negotiation problem.
Additional debug info:
gstaudioencoder.c(1198): gst_audio_encoder_chain (): /GstPipeline:pipeline0/avenc_aac:avenc_aac0:
encoder not initialized
Comment 5 Tim-Philipp Müller 2013-01-12 20:12:21 UTC
If we don't manage to fix it anytime soon, we should just give the encoder a rank of NONE instead.
Comment 6 Tim-Philipp Müller 2013-01-22 12:59:01 UTC
commit ed6561bee67a722eb0073aafb88d69d08688565b
Author: Tim-Philipp Müller <>
Date:   Tue Jan 22 12:57:41 2013 +0000

    avenc_aac: downgrade to RANK_NONE until it gets fixed
    Currently just fails to initialize.
Comment 7 Greg Rutz 2013-05-03 17:09:55 UTC
I think is actually due to the fact that the AAC encoder in libav is marked as experimental.

When using avconv utility, you can enable experimental codecs by passing "-strict experimental".  However, I don't think there is a way to do this in GStreamer right now.

Since I'm building all GStreamer modules from source, my temporary fix is to remove the experimental flag from the codecs capabilities.  I'll post a patch in case anyone cares.
Comment 8 Greg Rutz 2013-05-03 18:01:16 UTC
More specifially, the "-strict" argument specifies how you would like the codec to behave with respect to its associated specification.  The strictness levels are described in avcodec.h:

     * strictly follow the standard (MPEG4, ...).
     * - encoding: Set by user.
     * - decoding: Set by user.
     * Setting this to STRICT or higher means the encoder and decoder will
     * generally do stupid things, whereas setting it to unofficial or lower
     * will mean the encoder might produce output that is not supported by all
     * spec-compliant decoders. Decoders don't differentiate between normal,
     * unofficial and experimental (that is, they always try to decode things
     * when they can) unless they are explicitly asked to behave stupidly
     * (=strictly conform to the specs)
    int strict_std_compliance;
#define FF_COMPLIANCE_VERY_STRICT   2 ///< Strictly conform to an older more strict version of the spec or reference software.
#define FF_COMPLIANCE_STRICT        1 ///< Strictly conform to all the things in the spec no matter what consequences.
#define FF_COMPLIANCE_NORMAL        0
#define FF_COMPLIANCE_UNOFFICIAL   -1 ///< Allow unofficial extensions
#define FF_COMPLIANCE_EXPERIMENTAL -2 ///< Allow nonstandardized experimental things.

After discussing with Tim, I will propose a real fix to this problem.  We will add a new enum property to all libav encoders (just encoders for now) that allows you to specify the strictness level for the AVCodecContext.  This will allow GStreamer users to 1) control the spec-adherence of their encoders and 2) more specific to this bug, allow the use of encoders marked as "experimental"
Comment 9 Javier Jardón (IRC: jjardon) 2013-10-08 12:22:10 UTC
Hi Greg, is there any update about your proposal to fix this?
Comment 10 Greg Rutz 2013-10-11 22:23:01 UTC
Created attachment 257060 [details] [review]
gst-libav patch to add compliance property to all encoders

Since there is no common base class for audio and video encoders in gst-libav, I had to duplicate this code in the video and audio encoder base class.
Comment 11 Sebastian Dröge (slomo) 2013-10-14 19:27:12 UTC
Review of attachment 257060 [details] [review]:

::: ext/libav/gstavaudenc.c
@@ +80,3 @@
+#define GST_TYPE_FFMPEGAUDENC_COMPLIANCE (gst_ffmpegaudenc_compliance_get_type ())
+static GType
+gst_ffmpegaudenc_compliance_get_type (void)

You could put this type into gstavcodecmap.c or something to share it

::: ext/libav/gstavaudenc.h
@@ +59,3 @@

Use FF_COMPLIANCE_VERY_STRICT and the others instead of duplicating the values
Comment 12 Greg Rutz 2013-10-14 20:53:19 UTC
Created attachment 257306 [details] [review]
Changes to patch based on review

Thanks for the review.  Patch updated to reflect your comments
Comment 13 Sebastian Dröge (slomo) 2013-10-15 07:27:44 UTC
commit 13ffed87b1597fa60ccee293f71c3993ec59d1b2
Author: Greg Rutz <>
Date:   Mon Oct 14 14:50:57 2013 -0600

    avenc: Add compliance property
    Add a new property to GstFFMpegVidEnc and GstFFMpegAudEnc to supply
    the "strict compliance" value to AVCodecContext