1 Reply Latest reply on Apr 4, 2016 4:31 PM by phonetic

    AMF_VIDEO_ENCODER_EXTRADATA always NULL

    phonetic

      Hi I'm trying to get the AMF_VIDEO_ENCODER_EXTRADATA from AMF (SDK 1.1) encoder.

       

      Excerpt:

      ...

      res = pimpl->encoder->SetProperty(AMF_VIDEO_ENCODER_USAGE, AMF_VIDEO_ENCODER_USAGE_LOW_LATENCY);

      res = pimpl->encoder->Init(pimpl->formatIn, inputWidth_, inputHeight_);

       

      amf::AMFBufferPtr extradata;

       

      if (pimpl->encoder->HasProperty(AMF_VIDEO_ENCODER_EXTRADATA) == AMF_OK)

      {

      res = pimpl->encoder->GetProperty(AMF_VIDEO_ENCODER_EXTRADATA, reinterpret_cast<amf::AMFInterfacePtr*>(&extradata));

       

      if (res == AMF_OK && extradata != nullptr)

      {

      // process

      }

      }

       

      Problem is that it is always NULL. I also have AMF_VIDEO_ENCODER_INSERT_SPS, AMF_VIDEO_ENCODER_INSERT_PPS and is verified to be present in the output stream.

       

      Also please whitelist. Thanks in advance.

       

       

       

        • Re: AMF_VIDEO_ENCODER_EXTRADATA always NULL
          phonetic

          OK we figured it out.

           

          That comment "// AMFInterface* - > AMFBuffer*; SPS/PPS buffer - read-only" is quite misleading. You actually have to push a buffer on the property before calling Init(oO) it seems (so much for read-only)

          Then you have to GetProperty on an AMFVariant and not AMFInterface in order to get your AMFBuffer (by calling AMFVariant::ToInterface() -> cast) and finally GetNative() to get your pointer.

          We are still checking if the SPS/PPS is correct, because it seems a little fishy too.