GNOME Bugzilla – Bug 691617
avenc_aac: errors out with "encoder not initialized"
Last modified: 2013-11-11 12:44:21 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.
Created attachment 233310 [details] PNG showing pipeline
GST_DEBUG log can be found here: http://uraeus.fedorapeople.org/files/output.txt.bz2
*** Bug 691615 has been marked as a duplicate of this bug. ***
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
If we don't manage to fix it anytime soon, we should just give the encoder a rank of NONE instead.
commit ed6561bee67a722eb0073aafb88d69d08688565b Author: Tim-Philipp Müller <tim.muller@collabora.co.uk> Date: Tue Jan 22 12:57:41 2013 +0000 avenc_aac: downgrade to RANK_NONE until it gets fixed Currently just fails to initialize. https://bugzilla.gnome.org/show_bug.cgi?id=691617
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.
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"
Hi Greg, is there any update about your proposal to fix this?
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.
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 @@ + GST_FFMPEGAUDENC_NORMAL = 0, + GST_FFMPEGAUDENC_UNOFFICIAL = -1, + GST_FFMPEGAUDENC_EXPERIMENTAL = -2 Use FF_COMPLIANCE_VERY_STRICT and the others instead of duplicating the values
Created attachment 257306 [details] [review] Changes to patch based on review Thanks for the review. Patch updated to reflect your comments
commit 13ffed87b1597fa60ccee293f71c3993ec59d1b2 Author: Greg Rutz <greg@gsr-tek.com> 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 https://bugzilla.gnome.org/show_bug.cgi?id=691617