OpenTimelineIO icon indicating copy to clipboard operation
OpenTimelineIO copied to clipboard

Avid Media Composer AAF fails when reading group clips

Open russellaugust opened this issue 5 years ago • 3 comments

I'm experimenting with OTIO for AAF roundtrips in Avid and doing some programmatic reordering of clips. Pretty simple stuff, let's say sorting the clips alphabetically.

I am running into problems with group clips. Sometimes they work, sometimes they don't. It's unclear when there is a problem.

Are AAF Group Clips from Avid supported in the current adapter set? Any guidance in getting this working? Or maybe some hints as to where to look?

ISSUE 1

Traceback (most recent call last):
  File "Python/opentimelinio-testing/controller.py", line 3, in <module>
    timeline = otio.adapters.read_from_file("/Users/russellanderson/Desktop/thetest.aaf")
  File "Python/opentimelinio-testing/venv/lib/python3.9/site-packages/opentimelineio/adapters/__init__.py", line 140, in read_from_file
    return adapter.read_from_file(
  File "Python/opentimelinio-testing/venv/lib/python3.9/site-packages/opentimelineio/adapters/adapter.py", line 137, in read_from_file
    result = self._execute_function(
  File "Python/opentimelinio-testing/venv/lib/python3.9/site-packages/opentimelineio/plugins/python_plugin.py", line 174, in _execute_function
    return (getattr(self.module(), func_name)(**kwargs))
  File "Python/opentimelinio-testing/venv/lib/python3.9/site-packages/opentimelineio_contrib/adapters/advanced_authoring_format.py", line 1147, in read_from_file
    result = _transcribe(top, parents=list(), edit_rate=None)
  File "Python/opentimelinio-testing/venv/lib/python3.9/site-packages/opentimelineio_contrib/adapters/advanced_authoring_format.py", line 562, in _transcribe
    result.append(_transcribe(child, parents + [item], edit_rate, indent + 2))
  File "Python/opentimelinio-testing/venv/lib/python3.9/site-packages/opentimelineio_contrib/adapters/advanced_authoring_format.py", line 247, in _transcribe
    track = _transcribe(slot, parents + [item], edit_rate, indent + 2)
  File "Python/opentimelinio-testing/venv/lib/python3.9/site-packages/opentimelineio_contrib/adapters/advanced_authoring_format.py", line 448, in _transcribe
    child = _transcribe(item.segment, parents + [item], edit_rate, indent + 2)
  File "Python/opentimelinio-testing/venv/lib/python3.9/site-packages/opentimelineio_contrib/adapters/advanced_authoring_format.py", line 434, in _transcribe
    child = _transcribe(component, parents + [item], edit_rate, indent + 2)
  File "Python/opentimelinio-testing/venv/lib/python3.9/site-packages/opentimelineio_contrib/adapters/advanced_authoring_format.py", line 497, in _transcribe
    alternates = [
  File "Python/opentimelinio-testing/venv/lib/python3.9/site-packages/opentimelineio_contrib/adapters/advanced_authoring_format.py", line 498, in <listcomp>
    _transcribe(alt, parents + [item], edit_rate, indent + 2)
  File "Python/opentimelinio-testing/venv/lib/python3.9/site-packages/opentimelineio_contrib/adapters/advanced_authoring_format.py", line 262, in _transcribe
    mobs = _find_timecode_mobs(item)
  File "Python/opentimelinio-testing/venv/lib/python3.9/site-packages/opentimelineio_contrib/adapters/advanced_authoring_format.py", line 130, in _find_timecode_mobs
    for c in item.walk():
  File "Python/opentimelinio-testing/venv/lib/python3.9/site-packages/aaf2/components.py", line 204, in walk
    raise NotImplementedError("Sequence returned {} not "
NotImplementedError: Sequence returned <class 'aaf2.components.Sequence'> not implemented

ISSUE 2

Untitled SourceClip_MUTED
Untitled SourceClip
Untitled SourceClip
Untitled SourceClip_MUTED
Untitled SourceClip
Untitled SourceClip
Traceback (most recent call last):
  File "Python/opentimelinio-testing/controller.py", line 11, in <module>
    anything = otio.adapters.write_to_file(timeline, "/Users/russellanderson/Desktop/mydemo.aaf")
  File "Python/opentimelinio-testing/venv/lib/python3.9/site-packages/opentimelineio/adapters/__init__.py", line 191, in write_to_file
    return adapter.write_to_file(
  File "Python/opentimelinio-testing/venv/lib/python3.9/site-packages/opentimelineio/adapters/adapter.py", line 194, in write_to_file
    result = self._execute_function(
  File "Python/opentimelinio-testing/venv/lib/python3.9/site-packages/opentimelineio/plugins/python_plugin.py", line 174, in _execute_function
    return (getattr(self.module(), func_name)(**kwargs))
  File "Python/opentimelinio-testing/venv/lib/python3.9/site-packages/opentimelineio_contrib/adapters/advanced_authoring_format.py", line 1174, in write_to_file
    aaf_writer.validate_metadata(timeline)
  File "Python/opentimelinio-testing/venv/lib/python3.9/site-packages/opentimelineio_contrib/adapters/aaf_adapter/aaf_writer.py", line 200, in validate_metadata
    raise AAFValidationError("\n" + "\n".join(
opentimelineio_contrib.adapters.aaf_adapter.aaf_writer.AAFValidationError: 
Untitled SourceClip_MUTED<class 'opentimelineio._otio.Clip'> Clip.media_reference.available_range.duration.rate does not exist, 'NoneType' object has no attribute 'duration'
Untitled SourceClip_MUTED<class 'opentimelineio._otio.Clip'> Clip.media_reference.available_range.start_time.rate does not exist, 'NoneType' object has no attribute 'start_time'
Untitled SourceClip<class 'opentimelineio._otio.Clip'> Clip.media_reference.available_range.duration.rate does not exist, 'NoneType' object has no attribute 'duration'
Untitled SourceClip<class 'opentimelineio._otio.Clip'> Clip.media_reference.available_range.start_time.rate does not exist, 'NoneType' object has no attribute 'start_time'
Untitled SourceClip<class 'opentimelineio._otio.Clip'> Clip.media_reference.available_range.duration.rate does not exist, 'NoneType' object has no attribute 'duration'
Untitled SourceClip<class 'opentimelineio._otio.Clip'> Clip.media_reference.available_range.start_time.rate does not exist, 'NoneType' object has no attribute 'start_time'
Untitled SourceClip_MUTED<class 'opentimelineio._otio.Clip'> Clip.media_reference.available_range.duration.rate does not exist, 'NoneType' object has no attribute 'duration'
Untitled SourceClip_MUTED<class 'opentimelineio._otio.Clip'> Clip.media_reference.available_range.start_time.rate does not exist, 'NoneType' object has no attribute 'start_time'
Untitled SourceClip<class 'opentimelineio._otio.Clip'> Clip.media_reference.available_range.duration.rate does not exist, 'NoneType' object has no attribute 'duration'
Untitled SourceClip<class 'opentimelineio._otio.Clip'> Clip.media_reference.available_range.start_time.rate does not exist, 'NoneType' object has no attribute 'start_time'
Untitled SourceClip<class 'opentimelineio._otio.Clip'> Clip.media_reference.available_range.duration.rate does not exist, 'NoneType' object has no attribute 'duration'
Untitled SourceClip<class 'opentimelineio._otio.Clip'> Clip.media_reference.available_range.start_time.rate does not exist, 'NoneType' object has no attribute 'start_time'

russellaugust avatar Oct 30 '20 01:10 russellaugust

Hi Russel, thanks for joining the community!

@andewmoore-nz has been doing some fixes that seem to help a lot of cases with reading AAFs, would you mind testing with the branch we've been working on: https://github.com/reinecke/OpenTimelineIO/tree/MB_Fixes

I'm by no means the AAF expert in the community, but I know this branch seems to address issues for a lot of cases, it would be great to know if it helps you out.

reinecke avatar Oct 30 '20 15:10 reinecke

thanks @reinecke I'll test this today! I did a quick test and the warnings and errors were all gone but the simple roundtrip was producing some errors within Avid. I'll post detail later.

russellaugust avatar Oct 30 '20 18:10 russellaugust

Here are the results of a few quick test. Sequences are very basic, 5 or 6 edits, single tracks. If you feel like taking a look, here's the media I was working with:

https://www.dropbox.com/sh/s2ajd9j97nf3btl/AABIonb2HNQOn1dlguGhxsNTa?dl=0

And the code:

import opentimelineio as otio

timeline = otio.adapters.read_from_file("test-footage/AAFs/CUT1-GROUPCLIP.aaf")
#timeline = otio.adapters.read_from_file("test-footage/AAFs/CUT1-MASTERCLIP.aaf")
#timeline = otio.adapters.read_from_file("test-footage/AAFs/CUT1-SUBCLIP.aaf")


for clip in timeline.each_clip():
  print (clip.name)

anything = otio.adapters.write_to_file(timeline, "my-results.aaf")

Importing the AAFs results in some strange behavior that also seems a little random. Sometimes it brings in new master clips / sub clips / group clips, sometimes it linked back to the correct media. Any time I brought in an AAF that had sub clips or group clips, I had this dialog:

on group clip sequence import

The AAF contain just master clips seemed to work fine, no errors and it appears to have linked correctly.

russellaugust avatar Oct 31 '20 06:10 russellaugust