Change AAF link to MXF content

  • Craig Brown
    Craig Brown

    I have an AAF file that links to content in an MXF file.

    I noticed in the MXF file the following package UID:

    PackageUID = [060a2b34.0101.0101.01010420],13,00,00,00,{2bd40c1a-1ef9-0442-a828-dcdb2f5f5e84}

    I want to change the AAF file to point to a different MXF file.  I changed the networkfilelocator in the AAF file, but Avid Media Composer didn't appear to look at the pathname.

    I then noticed the above UID in the AAF file:

    Object of Class: SourceMob
    MobID: { {0x6,0xa,0x2b,0x34,0x1,0x1,0x1,0x1,0x1,0x1,0x4,0x20}0x13, 0x0, 0x0, 0x0, { 0x2bd40c1a, 0x1ef9, 0x0442, { 0xa8, 0x28, 0xdc, 0xdb, 0x2f, 0x5f, 0x5e, 0x84 } } }


            Object of Class: SourceClip
            DataDefinition: Picture
            Length: 251
            SourceID: { {0x6,0xa,0x2b,0x34,0x1,0x1,0x1,0x1,0x1,0x1,0x4,0x20}0x13, 0x0, 0x0, 0x0, { 0x2bd40c1a, 0x1ef9, 0x0442, { 0xa8, 0x28, 0xdc, 0xdb, 0x2f, 0x5f, 0x5e, 0x84 } } }

    I tried calling SetMobID and SetSourceID respectively to change the IDs in the AAF file to the ID in the new MXF file (assuming this will then make the AAF file reference my new MXF file).

    Glitch is the SetMobID call succeeds, and I save the file, but then nothing including the AAF toolkit will read the modified file.

    % InfoDumper test02_mod2.aaf
    File test02_mod2.aaf is not an AAF file

    Any help pointing me in the right direction would be greatly appreciated.

    • When saving the modifed file does the call to IAAFFile::Save() succeed?


    • Craig Brown
      Craig Brown

      der - should have checked that hey.

      Yep - the save failed.  Error code 0x8000000B.  I don't suppose you could help with what this means?


    • This looks like WIN32's ERROR_BAD_FORMAT. But more likely it's SSTG_ERROR_CHILD_NOT_FOUND returned by the Schecmasof Structured Storage implementation. I have no idea what this means.

      Assuming that the only calls that change the contents of the file are SetMobID() and SetSourceID(), can you comment them out, one by one, to see which one breaks the save?


    • Craig Brown
      Craig Brown

      Yep - already done that.  The SetSourceID works fine.  The SetMobID with the same argument I pass to SetSourceID causes the error.  BTW: I'm doing this on 32bit Linux.

      Child not found huh.... I'll keep looking.  Any more ideas are greatly appreciated.

    • I would need more time get to the source of this problem, unfortunately. It looks like a bug in the toolkit rather than in Schemasoft Structured Storage - I guess that's good. It fails on OS X with Schemasoft and on Windows with both the Schemasoft and the native Windows implementations of Structured Storage. I changed the toolkit's OpenExistingModify test to call SetMobID when modifying an existing file and Save() failed with the same errors as in your case. The way SetMobID works, it removes the mob you're modifying from the content storage, changes its ID, and then adds the mob back to the content storage. It looks like the essence descriptor that lives in the mob gets busted during this process and fails to save later. What's interesting is that if you replace the essence descriptor in the modified mob with a different one the save succeeds.

      Can you open the MXF file with the toolkit? If so I suggest trying the following workaround. Copy the source mob from the MXF file to the AAF file using IAAFMob::CloneExternal(). You probably want to specify 'follow dependencies' so that the physical file mobs referenced by the source mob you're copying get copied as well. After that remove the old source mob and update the source clips that point to it.


      • Tim Bingham
        Tim Bingham

        Could this be a reference counting problem ?

        When the Mob is temporarily removed and resinserted (ImplAAFMob.cpp line 491 etc) what is the reference count after the call to RemoveMob ?


    • No it didn't seem like it. I looked at the EssenceDescriptor after the mob is removed from Content Storage - it appears to be intact. And the mob reference count after the RemoveMob() call is 2, so it doesn't get deleted either.


    • Craig Brown
      Craig Brown

      Hi Alexey,

      Sorry for the delay, I got caught up doing other things.

      Your suggestion to dup the mob in the MXF file worked like a charm - thanks for all the help.

      I did try setting the underlying mob id property first using the lower level functions, but that that failed dismally.


  • PiedPiper

    Just thought i would mention that i too am having this same problem.
    I am trying to do the same thing as the original poster, ie. Modify an AAF to point to different MXF source files.   (using IIAFMob2::SetMobID  )

    I will try the solution suggested in this thread however i have also tried
    IAAFMob2::ChangeRef (oldMobID,newMobID) - which i expected to update the Mob in questions with the new MobID, - using this function allows me to save the file and read it again however no information appears to have changed within the AAF?  
    Perhaps i am using it incorrectly ( still new to this) but thought i would add my input to the issue.


  • Craig Brown
    Craig Brown

    duplicating the content out of the new mxf has been working fine for me for a couple years now.