Skip to content

Simple AAF with embedded WAV file won't open in Avid Media Composer #132

@ryanrapsys

Description

@ryanrapsys

Hi Mark - thanks so much for this! I'm still new to pyaaf2, but starting to get the hang of it.

I'm trying to write some code that will take a wav file and embed it into an aaf file that will open in Avid Media Composer. It also adds some metadata (via Comments). I don't need a composition or timeline. It should just pull into a bin and show the Comments metadata that I add, and then can be added to timelines.

When I try to import into Avid Media Composer, I get this error: In-MediaOff: Error importing media for 'test.wav'. Error: 'Structured Exception'

It will let me proceed and the tag data appears (in Comments), but the embedded audio does not play back. Looking at the AAF dump for it after it's created, it appears to have all the relevant data, and the audio info is correct (sample rate, duration, etc.). I added additional info like codec and such to try to match an AAF that does import into Avid Media Composer, but I still get the Structured Exception error.

I'm hoping I'm just overlooking something simple!

Here is the dump of the aaf that was generated with this code: current_aaf dump.txt

Here is the relevant section of my code.

with aaf2.open(aaf_file, 'w') as f:
 filename = os.path.basename(wav_file)
 sample_rate = 48000
 frame_rate = 25
 
 master_mob = f.create.MasterMob(filename)
 master_mob.name = filename
 f.content.mobs.append(master_mob)

 essence_slot = master_mob.import_audio_essence(wav_file, sample_rate)
 essence_slot['PhysicalTrackNumber'].value = 1

 source_mob = None
 for slot in master_mob.slots:
     segment = slot.segment
     if isinstance(segment, aaf2.components.SourceClip):
         source_mob = next((mob for mob in f.content.mobs if hasattr(mob, 'mob_id') and mob.mob_id == segment.mob_id), None)
         if source_mob:
             break

 if source_mob:
     set_essence_descriptor_properties(f, source_mob)
     source_mob.slots[0]['PhysicalTrackNumber'].value = 1

 tag = f.create.TaggedValue("Test Header", "Test Value")
 master_mob['UserComments'].append(tag)
 
 f.save()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions