pyaaf2 icon indicating copy to clipboard operation
pyaaf2 copied to clipboard

About AMA linking

Open hasielhassan opened this issue 6 years ago • 13 comments

Hi

I'm struggling a little with the ama linking and AVID, specially because I'm dealing with an old version (6.5.4)

I'm trying to replicate the structure that AVID used when it export its own AAF files, where if the media was linked as "ama" an import of that file properly relink the media again. But all my attempts end with offline media on Avid.

I indeed see some differences between the file from avid and the one that I'm getting from pyaaf2:

  • In pyaaf2 descriptors use a "MediaContainerGUID" while onthe Avid file I see a "MediaStreamPluginGUID", for this I found that you was previously using that: https://github.com/markreidvfx/pyaaf2/commit/0d526d1d1e4b1e50a0e05042942b3190093c5058#diff-2f38143c704c632c6111a64d8c2a6b82 So not sure which one is the correct for my case, for now I modified pyaaf2 to use the the MediaStreamPluginGUID with the UUID from the AVID file.

  • There are a lot of TaggedValues in the Avid file, some of them pointing to AMA values, but there is one that I'm not sure how to replicate, the "_IMPORTSETTING" which have a value "__AttributeList" and a bunch of other TaggedValues linked to it.

  • There is also the differences in attributes for the CDCI and PCM Descriptors, but I'm hoping that those not necessary affect the "ama" linking behavior.

Right now I'm using the create_ama_link method to create the whole thing, but Im thinking that I will need to do it manually...

aaf_file = aaf2.open(output_aaf, "w")
source_path = "s01-ep02.scd020_030_editorial_v001.mov"

meta = probe(source_path)
# Note that I modified create_ama_link to use the MediaStreamPluginGUID 
master_mob, src_mob, tape_mob = aaf_file.content.create_ama_link(source_path, meta)

master_mob.comments.append(aaf_file.create.TaggedValue("_IMPORTED_AMA", 1))
master_mob.comments.append(aaf_file.create.TaggedValue("_AMA_METADATA_COUNT", 0))
master_mob.comments.append(aaf_file.create.TaggedValue("Video File Format", "MOV"))
master_mob.comments.append(aaf_file.create.TaggedValue("Video", "Photo - JPEG"))
master_mob.comments.append(aaf_file.create.TaggedValue("Audio Format", "LPCM"))
master_mob.comments.append(aaf_file.create.TaggedValue("Field Ordering", "Default"))

src_mob.comments.append(aaf_file.create.TaggedValue("_VERSION", 2))
src_mob.comments.append(aaf_file.create.TaggedValue("_AMA_FILE_DATE_TIME", 1483575123))

tape_mob.comments.append(aaf_file.create.TaggedValue("_VERSION", 2))

aaf_file.save()
aaf_file.close()

Here you can find some diagrams:

From PyAAF2 pyaaf2

From Avid avid

And both AAF files attached as zip aafs.zip

Hopefully you have a better idea of how to aproach this. Thansk in advaned!

hasielhassan avatar Apr 05 '18 02:04 hasielhassan

Haven't taken a look at this yet but a quick gotcha with ama linking is after you import the aaf into avid you might need to close and reopen the bin.

markreidvfx avatar Apr 05 '18 03:04 markreidvfx

Thats definitelly something i need to try xD But its curious that that is not requiered for Avid aaf files.

I will try it and let you know.

hasielhassan avatar Apr 05 '18 03:04 hasielhassan

After saving, closing and opening the bin, is still the same. I even restarted Avid with the same result.

And just for reference, on which Avid versions you are sure that the ama links from the pyaaf2 methods are working properly? I might give a try to update xD

hasielhassan avatar Apr 05 '18 17:04 hasielhassan

Its also not working for 8.5.3

hasielhassan avatar Apr 05 '18 19:04 hasielhassan

Sorry, don't have access to my dev computer at the moment, but I've been using the lastest version 2018.1 I think. Do the aaf generated by the test_ama.py work for you?

markreidvfx avatar Apr 05 '18 21:04 markreidvfx

Same thing, but I'm not sure if affects when that path point to the network drive: file://Y:\eng\hasielhassan\Development\aaftests\sandbox\tests\results\samples\ama_prores_proxy.mov

From my tests with the aaf exported from Avid, seems that they store the unc path instead, but even trying to replicate that was not succesful.

hasielhassan avatar Apr 05 '18 22:04 hasielhassan

Looks suspect, perhaps it's windows, I've done most of my dev work on Linux/Mac. I've seen MC do all different types of paths in the network locator. I see your original has a space in the file path too, some times is see that coverted to %20 like a web url. My advice is to try hard code it what avid does a see if that works.

markreidvfx avatar Apr 05 '18 23:04 markreidvfx

Checking the release notes from 8.5 to 8.10 (and 2018.1), I don't see anything related to aaf, but I understand that on 8.6 they implemented the "Source Browser", not sure if that changed the way they stored/read the values in the aaf files.

I also have a osx to work with, thats why I pushed the unc path in the first place, but event in osx with unc paths is not working (and a web browser is properly reading the files from those paths).

Can I know why you replaced the "MediaStreamPluginGUID" with the "MediaContainerGUID"?

I will verify the paths again, just to be sure....

Thanks for your help!!

hasielhassan avatar Apr 05 '18 23:04 hasielhassan

Any luck? I changed the name because it got changed in newer versions of MC. It shouldn't matter as the uuids are the same, I've been meaning to implement aliases for property names jus haven't gotten to it yet.

markreidvfx avatar Apr 10 '18 04:04 markreidvfx

I'm still having the same issues, and seems that the url paths in the Locators are the same for both aaf files (from avid and from pyaaf2): file://qnod/corp\projects/eng/Development/aaftests/sandbox/s01-ep02.scd020_030_editorial_v001.mov

I was curious of the baskslash path separator between "corp" and "projects" instead of slash, and tried using the slash separator but it was the same, and that exact path string is in the aaf from avid.

About the the media guid names, in my case the uuids are also different that those on pyaaf2 code: MediaStreamPluginGUID (in avid aaf): 781f84b7-b989-4534-8a07c595cb9a6fb8 MediaContainerGUID (in pyaaf2): b22697a2-3442-44e8-bb8f7a1cd290ebf1

But as i mention, i even tried replacing the values in pyaaf2 without luck.

One thing that i still need to try is to replicate the whole structure, but i'm still not sure how to define a Tagged value for another Tagged value, like the "__AttributeList" one in the aaf from avid. And maybe i also need to verify both dictionaries?

I leaving this for now, (i already spend more than a week trying to get them working xD) and i'm using embedded media instead for now, maybe we can try the latest version of MC after NAB and see if it works there.

hasielhassan avatar Apr 10 '18 17:04 hasielhassan

Can you share the aaf with the different UUID? I think we might be confusing the UUID of the property with the property value. The UUID in the model is the uuid of the property. It's value is set here https://github.com/markreidvfx/pyaaf2/blob/master/aaf2/ama.py#L275

That UUID you show is the QuickTime one https://github.com/markreidvfx/pyaaf2/blob/master/aaf2/ama.py#L31

The one pyaaf2 is setting looks like the generic, and I don't think it exists in those versions on MC

markreidvfx avatar Apr 10 '18 22:04 markreidvfx

Both files (from MC and from PyAAF) are in the original post: https://github.com/markreidvfx/pyaaf2/files/1878389/aafs.zip

I understand that in those files, the one from PyAAF is the one with the values that I modified, so here is one using the default PyAAF: pyaaf2.zip

Here is also the metadata from ffprobe: meta.zip

And a diagram of the aaf file structure: pyaaf2

Checking at the code you pointed, I now realize that the uuid is just indicating the media type right? I first thought that it was kind of an instruction to mark that as an AMA link :/

So yes, it seems that is taking the generic one because the codec_name is not 'prores', but apparently MC is taking it as QuickTime, maybe because of the Container (format_long_name, format_name)? QuickTime / MOV I did a test, just changing the get_container_guid function, based on the format_long_name instead of the codec_name, the resulted aaf file now get the proper uuid but is still as offline in MC.

Not sure if the name string of that uuid (MediaContainerGUID vs MediaStreamPluginGUID ) can affect the behavior in MC.

hasielhassan avatar Apr 12 '18 01:04 hasielhassan