pyaaf icon indicating copy to clipboard operation
pyaaf copied to clipboard

Descriptive Marker

Open Toadman30 opened this issue 10 years ago • 18 comments

Is there a way to make a descriptive marker?

Toadman30 avatar Apr 22 '15 18:04 Toadman30

just added support in 4d6eac14945d0e9423202def2165b8d328871d06

import aaf
f = aaf.open()
marker = f.create.DescriptiveMarker()

markreidvfx avatar Apr 26 '15 00:04 markreidvfx

Thank You!

On Apr 25, 2015, at 5:36 PM, Mark Reid [email protected] wrote:

just added support in 4d6eac1

import aaf f = aaf.open() marker = f.create.DescriptiveMarker() — Reply to this email directly or view it on GitHub.

Toadman30 avatar Apr 26 '15 00:04 Toadman30

I'm getting the same error as the Selector when trying to append a marker to a sequence.

        # Marker
        marker = f.create.DescriptiveMarker()
        marker.media_kind = "picture"
        sequence1.append(marker)

Is there a way to add a comment to the marker?

Toadman30 avatar Apr 29 '15 10:04 Toadman30

the media_kind of the marker should be "DescriptiveMetadata" try:

sequence = f.create.Sequence("DescriptiveMetadata")
marker =  f.create.DescriptiveMarker()
marker.media_kind = "DescriptiveMetadata"
sequence.append(marker)

markreidvfx avatar May 05 '15 02:05 markreidvfx

Thanks that worked. Now can you add a comment, color or position?

Toadman30 avatar May 06 '15 16:05 Toadman30

to set a comment

d = f.create.DescriptiveMarker()
#print all the property available
print d.all_keys()
[u'Description', u'DescribedSlots', u'Annotation', u'Position', u'Comment', u'DataDefinition', u'Length', u'UserComments', u'KLVData', u'Attributes', u'Generation', u'ObjClass']
d['Comment'].value = "Some comment"

The position I think is determined by they Length, but I'm not entirely sure, I'd recommend taking a look at a aaf with markers exported from avid. You can use the aaf2xml.py to convert it to something readable.

markreidvfx avatar May 11 '15 03:05 markreidvfx

This is great, managed to get DescriptiveMarkers applied but wondered if you would be able to provide any insight as to how to get the other properties that Avid is looking for set through pyaaf. This is a dump of a marker from an Avid exported AAF:

[DescriptiveMarker ] DataDefinition: Descriptive Metadata UserComments: Strong Object Reference Array [2] of TaggedValue kAAFTypeID_TaggedValueStrongReferenceVector [0]: [ TaggedValue ] Name: "Comment" Value: (indirect type: aafString) "This is the first marker text" kAAFTypeID_TaggedValueStrongReferenceVector [1]: [ TaggedValue ] Name: "DatabaseID" Value: (indirect type: aafString) "060a2b340101010101010f0013-000000-5766066e2cd404e5-060e2b347f7f-2a80" Position: 18580 Comment: "This is the first marker text" DescribedSlots: Set[1] of aafUInt32 [0]: 1 CommentMarkerAttributeList: Strong Object Reference Array [8] of TaggedValue kAAFTypeID_TaggedValueStrongReferenceVector [0]: [ TaggedValue ] Name: "_ATN_CRM_LONG_CREATE_DATE" Value: (indirect type: aafInt32) 1466304031 kAAFTypeID_TaggedValueStrongReferenceVector [1]: [ TaggedValue ] Name: "_ATN_CRM_USER" Value: (indirect type: aafString) "USERNAME" kAAFTypeID_TaggedValueStrongReferenceVector [2]: [ TaggedValue ] Name: "_ATN_CRM_DATE" Value: (indirect type: aafString) "06/18/2016" kAAFTypeID_TaggedValueStrongReferenceVector [3]: [ TaggedValue ] Name: "_ATN_CRM_TIME" Value: (indirect type: aafString) "22:40" kAAFTypeID_TaggedValueStrongReferenceVector [4]: [ TaggedValue ] Name: "_ATN_CRM_COLOR" Value: (indirect type: aafString) "Red" kAAFTypeID_TaggedValueStrongReferenceVector [5]: [ TaggedValue ] Name: "_ATN_CRM_COM" Value: (indirect type: aafString) "This is the first marker text" kAAFTypeID_TaggedValueStrongReferenceVector [6]: [ TaggedValue ] Name: "_ATN_CRM_LONG_MOD_DATE" Value: (indirect type: aafInt32) 1466304042 kAAFTypeID_TaggedValueStrongReferenceVector [7]: [ TaggedValue ] Name: "_ATN_CRM_ID" Value: (indirect type: aafString) "060a2b340101010101010f0013-000000-5766066e2cd404e5-060e2b347f7f-2a80" CommentMarkerTime: "22:40" CommentMarkerDate: "06/18/2016" CommentMarkerUSer: "USERNAME" CommentMarkerColor: { 41471, 12134, 6564 }

As you can see, there are several additional properties other than the ones exposed by pyaaf:

CommentMarkerTime,Date,User,Color, etc. as well as CommentMarkerAttributeList, which is an array of TaggedValues. How can we create the array of TaggedValues to provide Avid Marker compatibility? Has Avid extended the AAF SDK in order to add these additional properties?

ertee avatar Aug 09 '16 22:08 ertee

Avid adds a lot of extensions. There are a couple of tests that show how to register new properties. It really annoying to do and unfortunately I haven't had time to implement all types. A work around is export a empty aaf from avid and use that as your base file.

markreidvfx avatar Aug 17 '16 23:08 markreidvfx

Hey there, I am trying to register a new string property to a DescriptiveMarker, so I can set the "User" attribute. I think I am going about it the correct way, but it doesn't look like string types are supported. Here's my snippet of code, (it never gets to the last line, but included it anyway). I've been through the examples in test_TypeDefVariableArray.py, and am aware of the workaround you mentioned above.

Can you explain it in some more detail please?

Thanks

import aaf
f = aaf.open('test.aaf', 'w')
marker = f.create.DescriptiveMarker()
type_id =  aaf.util.AUID.from_list([0xda60bb00, 0xba41, 0x11d4, 0xa8, 0x12, 0x8e, 0x54, 0x1b, 0x97, 0x2e, 0xa3 ])
typedef = f.dictionary.lookup_typedef("string")
strongref_typedef = aaf.define.TypeDefString(f, typedef, type_id, "TaggedValueStrongReference type")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "aaf/base.pyx", line 19, in aaf.base.AAFBase.__init__ (aaf/base.cpp:2762)
TypeError: TypeDefString cannot be instantiated from Python
propery_def = component_classdef.register_optional_propertydef(strongref_typedef, marker.class_auid, "User")

Liametc avatar Sep 05 '16 15:09 Liametc

yup I see what you mean. I just add a init to TypeDefString in the dev branch. see test_TypeDefString for a example.

markreidvfx avatar Sep 05 '16 23:09 markreidvfx

I still don't think thats what your looking for let me take a deeper look

markreidvfx avatar Sep 06 '16 00:09 markreidvfx

I added test_CommentMaker in the dev branch, in it shows a example of how to add most of those properties

markreidvfx avatar Sep 06 '16 01:09 markreidvfx

Thanks Mark, I'll give it a try, it looks like exactly what I need :)

Liametc avatar Sep 06 '16 06:09 Liametc

Works great, thanks!

Just one question, are the uuids you are using totally random or is there a reason behind them? AUID("urn:uuid:c4c45d9a-0967-11d4-a08a-006094eb75cb") for most of the attrs, AUID("urn:uuid:c72cc817-aac5-499b-af34-bc47fec1eaa8") for the attr list id and "060a2b340101010101010f0013-000000-5766066e2cd404e5-060e2b347f7f-2a80" for the crm id?

Thanks

Liametc avatar Sep 08 '16 08:09 Liametc

They should be the correct ones unless I made a mistake. There are couple ways to get them. I converted a avid exported aaf to XML via aaf2xml.py and got the ids from the extension section.

markreidvfx avatar Sep 08 '16 09:09 markreidvfx

Nice one. Guessing the crm id/database id is unique each time? Just don't want to screw up a project by using incorrect data.

Liametc avatar Sep 08 '16 10:09 Liametc

I don't know, you'll have to check a couple files to make sure. I don't know what the crm id/database id tags are used for.

markreidvfx avatar Sep 08 '16 11:09 markreidvfx

no worries. Thanks for the help though, really means a lot

Liametc avatar Sep 08 '16 11:09 Liametc