OpenTimelineIO icon indicating copy to clipboard operation
OpenTimelineIO copied to clipboard

OpenTimelineIO raises exception when trying to load AAF exported from Avid with "Use Selected Tracks" selected

Open austinwitherspoon opened this issue 1 year ago • 1 comments

Bug Report

I’ve found a bug in Avid Media Composer AAF file generation:

  • Make 3 video tracks
  • On the third track, place a clip with a marker
  • Deselect track 2
  • Export an AAF with “selected tracks only” setting Since track 2 is excluded from the AAF, track 3 gets assigned PhysicalTrackNumber = 2 in the AAF (reasonable!) BUT - the marker doesn’t get updated! The Marker in the AAF still points at track 3! If you try to import this AAF back into Avid, that marker just disappears. If you import that AAF into DaVinci Resolve, the marker gets added to the timeline itself instead of a clip.

Currently OTIO will raise an exception when trying to load this AAF:

raise AAFAdapterError(
    "Marker '{}' cannot be attached to an item. SlotID: '{}', "
    "PhysicalTrackNumber: '{}'".format(
        marker.name, slot_id, track_number
    )
)

Since this is a "valid" aaf generated by Avid Media Composer, OpenTimelineIO shouldn't explode when reading in the file.

To Reproduce

Here's an AAF file generated by Avid Media Composer 2021.12.2.55649.0, using the instructions above: bad_marker_track_from_avid.aaf.zip

Logs

Traceback (most recent call last):
  File "/Users/awitherspoon/src/studio/laika-editorial/venv/bin/otioview", line 8, in <module>
    sys.exit(main())
  File "/Users/awitherspoon/src/studio/laika-editorial/venv/lib/python3.9/site-packages/opentimelineview/console.py", line 300, in main
    window.load(args.input)
  File "/Users/awitherspoon/src/studio/laika-editorial/venv/lib/python3.9/site-packages/opentimelineview/console.py", line 191, in load
    file_contents = otio.adapters.read_from_file(
  File "/Users/awitherspoon/src/studio/laika-editorial/venv/lib/python3.9/site-packages/opentimelineio/adapters/__init__.py", line 137, in read_from_file
    return adapter.read_from_file(
  File "/Users/awitherspoon/src/studio/laika-editorial/venv/lib/python3.9/site-packages/opentimelineio/adapters/adapter.py", line 125, in read_from_file
    result = self._execute_function(
  File "/Users/awitherspoon/src/studio/laika-editorial/venv/lib/python3.9/site-packages/opentimelineio/plugins/python_plugin.py", line 153, in _execute_function
    return (getattr(self.module(), func_name)(**kwargs))
  File "/Users/awitherspoon/src/studio/laika-editorial/venv/lib/python3.9/site-packages/opentimelineio_contrib/adapters/advanced_authoring_format.py", line 1590, in read_from_file
    result = _attach_markers(result)
  File "/Users/awitherspoon/src/studio/laika-editorial/venv/lib/python3.9/site-packages/opentimelineio_contrib/adapters/advanced_authoring_format.py", line 1245, in _attach_markers
    raise AAFAdapterError(
opentimelineio.adapters.AAF.AAFAdapterError: Marker 'Marker on Track 3! When exported with Track 2 deselected and exported with "Selected Tracks Only", this marker will incorrectly point at track 2 in the AAF even though it doesn't exist (since the original track 2 was ommitted, and track 3 was renamed to 2 by avid!)' cannot be attached to an item. SlotID: '9', PhysicalTrackNumber: '3'

austinwitherspoon avatar Feb 14 '24 19:02 austinwitherspoon

PR OpenTimelineIO/otio-aaf-adapter/pull/41 in the AAF adapter repo addresses this

reinecke avatar Feb 15 '24 18:02 reinecke

PR https://github.com/OpenTimelineIO/otio-aaf-adapter/pull/41 merged - thanks!

reinecke avatar Mar 14 '24 17:03 reinecke