CreateEssence to External Video files

  • arjen123

    arjen123 - 2005-12-21


    I am trying to change one of the provided examples, so I can link to an external (raw) video file. The format of the video file could be anything.

    My CreateEssence() function looks like this:

      1, /* Slot ID */,
      pDdefPicture, /* MediaKind */
      kAAFCodecDef_None, /* could be anything */
      editrate, samplerate,
      kAAFCompressionDisable, /* Could be both? */
      locator, /* the locator object holding the fname */
      kAAFContainerDef_External, /* an external link

    This always fails though with an invalid codec error. The reason being that it tries to load a plug (a la wave, aifc, cdci), but there isn't one available for the codec of type None.

    Has anyone here managed to link to external media in AAF files? An example of something similar would already be very helpful!

    Thank you,


    • John Emmas

      John Emmas - 2005-12-23

      kAAFCodecDef_None, /* could be anything */

      I don't understand what you mean by this... do you mean that any codec can decode the essence data - or do you mean that the required codec wasn't known by the exporting application?

      Either way, how would an importing application know which codec it needed to read the data?

      • arjen123

        arjen123 - 2005-12-23

        Hi John,

        First of all thanks for your reply.

        I want to link to an external video and/or audio file, this could either be another AAF file, MXF file or perhaps a WAV or DV file. The exporting application doesn't know the format of the external file. My thinking is that an importing application would know how to read the data as the description is part of the external file. So pointing to e.g. an MXF container should be enough as it can be played by itself.

        What I am trying to do is probably different from a lot of people. I am initially using the AAF format to store metadata in a timeline, and at a later stage I want to link video/audio to it.

        Is this at all possible? I'm trying to figure out what files I can link to, preferably something like MXF or another AAF file. I want to keep the original AAF files small (as in bytes) and don't want to embed the video/audio essence.

        Perhaps I'm on the wrong track here. Any ideas are appreciated.


        • John Emmas

          John Emmas - 2005-12-23

          Hi Arjen,

          It’s an unusual approach and I don’t think you’ll achieve it using CAAFMasterMob::CreateEssence(…) or any of its variants. Via a circuitous route, CreateEssence(…) eventually goes on to create the Source Mob and codec, so the only alternative way I can think to do this would be to create the Master Mob and Source Mob separately (without creating a codec) and then add a source reference to the Master Mob (in the form of a timeline slot) making sure that the Master Mob slot references the Source Mob that you created separately. It’s a bit long winded but it could be done. Try looking at ImplAAFEssenceAccess::CreateEx(..) to see what you’d need to create.

          Having said all that, you’ll still end up with a problem inasmuch as any importing application would probably have no idea how to handle your media data. It’s all very well to say that “an importing application would know how to read the data as the description is part of the external file.” - but that isn’t the way it works. Importing apps know which codec to use because the AAF file tells them what kind to expect. If they waited until they eventually found the data file, how could they be certain it was the correct data? A WAV file, for example, could easily get substituted for another file which, although it had the right name, it might have the wrong sample rate, or the wrong number of channels, the wrong bit-depth, the wrong byte-order or whatever. It could easily be completely the wrong media but if the size of the file was approximately right, the importing app would have no way of knowing this.

          Good luck - but unless the intended result is just for internal use only, I think you're probably wasting your time here...



Log in to post a comment.