markreidvfx / pyaaf

Python Bindings for the Advanced Authoring Format (AAF)
http://markreidvfx.github.io/pyaaf
MIT License
49 stars 9 forks source link

Media Composer thinks media is wrong format when linking #42

Closed ding-hub closed 6 years ago

ding-hub commented 6 years ago

I've been trying to get an aaf file with linked mxf following the example baselight_multiaaf.py but the problem is that even though the mxf is correct (145 1080i) when I use the AMA plugin, when I use the script media composer thinks the file is 1:1 1080p and refuses to play the files. It gives me error "Exception: The sequence or one of its source elements is too long to be played" I would like to know if anyone has had success using a linked xmf. I have been spending so much time trying to get this to work without any success. I have even tried to add a TapeDescriptor along with the CDCIDescriptor with no joy. I have even used the baselight_multiaaf.py and had no luck. Any help would be greatly appreciated.

markreidvfx commented 6 years ago

Could you provide a sample of AAF file of what your trying to match?

ding-hub commented 6 years ago

sure. MatteTest.mov (With Alpha).aaf.zip

ding-hub commented 6 years ago

Im trying to do this https://github.com/markreidvfx/pyaaf/issues/41 but with linked mxf files instead of importing the essence

ding-hub commented 6 years ago

here is what the code looks like.

def add_clips(path):
    data = probe(path)
    filename = ntpath.basename(path)

    format = data['format']
    metadata = format['tags']
    stream = data['streams'][0]
    stream_metadata = stream['tags']

    file_package_umid = stream_metadata['file_package_umid']
    material_name = metadata['material_package_name']
    file_package_name = 'file_package_name'

    file_package_mob_id, reel_mob_id,clip_start_timecode = mxfinfo(path)
    codec_type = stream['codec_type']
    rate = fractions.Fraction(stream['avg_frame_rate'])
    duration = stream['duration_ts']

    media_kind = "picture"
    width = int(stream['width'])
    height = int(stream['height'])

    mastermob = f.create.MasterMob(material_name)
    print material_name
    mastermob['AppCode'].value = 1
    f.storage.add_mob(mastermob)

    media_kind = "picture"
    width = int(stream['width'])
    height = int(stream['height'])

    descriptor = f.create.CDCIDescriptor()

    descriptor['ImageAspectRatio'].value = fractions.Fraction(width, height)
    descriptor['FrameLayout'].value = 'SeparateFields'
    descriptor['StoredWidth'].value = width
    descriptor['StoredHeight'].value = height
    descriptor['Length'].value = duration
    descriptor['SampleRate'].value = rate

    src_mob = f.create.SourceMob(file_package_name)
    src_mob.mobID = file_package_mob_id
    src_mob.essence_descriptor = descriptor
    src_mob.add_nil_ref(1, duration, media_kind, rate)
    f.storage.add_mob(src_mob)

    source_clip = src_mob.create_clip(1)

    mastermob.append_new_timeline_slot(rate, source_clip, 1)
    clip = mastermob.create_clip(1)

    clip_type = 'Source'

    if '_alpha.mxf' in filename:
        clip_type = 'Alpha'

    composite[clip_type] = clip
    return duration
ding-hub commented 6 years ago

the error I'm getting is actually "Exception: MXF_DIDMapperSegmented::GetParsedIndexTableSegmented - Unable to parse the Index Table" the previous error was a framerate problem I posted by mistake

ding-hub commented 6 years ago

What is interesting is if I delete the clips in my bin and delete the database files and use the media tool I can see the mxf's and play them back properly as dnxhd 145 but as soon as I delete the database file again and import the aaf avid gets confused again and thinks the files are 1:1 and wont play them back. Its like the aaf forces the database to see these files in a different format. I just don't know how to tell avid these files are the proper format. I have looked all over the place to find any api calls that tells the descriptor to make the app see the proper format with no success.

markreidvfx commented 6 years ago

I haven't had a chance to look into this, but my initial hunch is the compression ID on the descriptor. I have a list based off the CID in pyaaf2 here. CID is in the header of the raw dnxhd frame. You can also match AUIDs from a aaf exported from media composer.

ding-hub commented 6 years ago

Gave it a go with no joy. descriptor['Compression'].value = uuid.UUID("04010202-7108-0000-060e-2b340401010a") it matches the original xml but it doesnt work. I even tried this with no luck. descriptor['ResolutionID'].value = 1242

ding-hub commented 6 years ago

After deleting all media from the drive and clearing the database one more time and making sure to delete all references from all projects I think it is working with the compression descriptor. Lets see tomorrow how it shakes out.