Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
ryanrapsys opened this issue Mar 28, 2024 · 0 comments
Open

Comments

@ryanrapsys
Copy link

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()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant