Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion src/py-opentimelineio/opentimelineio/adapters/cmx_3600.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,7 @@ def add_transition(self, clip_handler, transition, data):
if transition not in ['C']:
md = clip_handler.clip.metadata.setdefault("cmx_3600", {})
md["transition"] = transition
md["transition_duration"] = float(data)

def parse_edl(self, edl_string, rate=24):
# edl 'events' can be comprised of an indeterminate amount of lines
Expand Down Expand Up @@ -665,7 +666,18 @@ def _expand_transitions(timeline):
"currently.".format(transition_type)
)

transition_duration = clip.duration()
# Using transition data for duration (with clip duration as backup.)
# Link: https://ieeexplore.ieee.org/document/7291839
# Citation: "ST 258:2004 - SMPTE Standard - For Television — Transfer
# of Edit Decision Lists," in ST 258:2004 , vol., no., pp.1-37,
# 6 April 2004, doi: 10.5594/SMPTE.ST258.2004.
if clip.metadata.get("cmx_3600", {}).get("transition_duration"):
transition_duration = opentime.RationalTime(
clip.metadata["cmx_3600"]["transition_duration"],
clip.duration().rate
)
else:
transition_duration = clip.duration()

# EDL doesn't have enough data to know where the cut point was, so
# this arbitrarily puts it in the middle of the transition
Expand Down
8 changes: 8 additions & 0 deletions tests/sample_data/transition_duration.edl
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
TITLE: TRANSITION_DURATION_TEST
FCM: NON-DROP FRAME
001 ABC0100. V C 01:00:12:15 01:00:17:01 01:00:48:20 01:00:53:06
002 ABC0200. V C 01:00:11:07 01:00:14:09 01:00:53:06 01:00:56:08
003 ABC0200. V C 01:00:14:09 01:00:14:09 01:00:56:08 01:00:56:08
003 ABC0300. V D 026 01:00:10:08 01:00:13:09 01:00:56:08 01:00:59:09
* BLEND, DISSOLVE
004 ABC0400. V C 01:00:11:09 01:00:17:20 01:00:59:09 01:01:05:20
9 changes: 9 additions & 0 deletions tests/test_cmx_3600_adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
"speed_effects_small.edl"
)
MULTIPLE_TARGET_AUDIO_PATH = os.path.join(SAMPLE_DATA_DIR, "multi_audio.edl")
TRANSITION_DURATION_TEST = os.path.join(SAMPLE_DATA_DIR, "transition_duration.edl")


class EDLAdapterTest(unittest.TestCase, otio_test_utils.OTIOAssertions):
Expand Down Expand Up @@ -1038,6 +1039,14 @@ def test_speed_effects(self):
)
)

def test_transition_duration(self):
tl = otio.adapters.read_from_file(TRANSITION_DURATION_TEST)
self.assertEqual(len(tl.tracks[0]), 5)

self.assertIsInstance(tl.tracks[0][2], otio.schema.Transition)

self.assertEqual(tl.tracks[0][2].duration().value, 26.0)


if __name__ == "__main__":
unittest.main()