AcademySoftwareFoundation / AcademySoftwareFoundation/OpenTimelineIO

Cannot trim in the middle of a transition

Open
#1,947 2 comments 0 reactions 0 assignees View on GitHub
help wanted
Dominant language
C++
Stars
2k
Forks
351
Avg merge
1d 12h
Merged PRs (30d)
1

Description

When flattening multiple tracks into one, there are sometimes clips which overlap transitions on lower tracks, which leads to an error preventing the flattening operation. Specifically an exception is thrown and no result is returned.

Here is a repro case. This is a production example that was redacted with `otiotool --redact` to remove sensitive names, but the structure is left intact.

[redacted.otio.zip](https://github.com/user-attachments/files/22569628/redacted.otio.zip)

Repro steps:
- Download and unzip the attached redacted.otio file
- Run `otiotool -i redacted.otio --flatten video -o flat.otio`

Actual result:
```
Traceback (most recent call last):
File "/Users/joshm/.local/bin/otiotool", line 8, in
sys.exit(main())
File "/Users/joshm/.local/share/uv/tools/opentimelineio/lib/python3.9/site-packages/opentimelineio/console/otiotool.py", line 98, in main
flatten_timeline(
File "/Users/joshm/.local/share/uv/tools/opentimelineio/lib/python3.9/site-packages/opentimelineio/console/otiotool.py", line 601, in flatten_timeline
flat_track = otio.algorithms.flatten_stack(tracks_to_flatten[:])
ValueError: cannot trim transition: Cannot trim in the middle of a transition
```

Expected result:
A flat.otio with one video track.

For the case of the bisected transition, the transition itself should be shortened, or discarded with a warning.

Contributor guide

Open the contributing guide

Research direction

Reproduce the failure with `otiotool -i redacted.otio --flatten video -o flat.otio`, then start at the `flatten_timeline` entry point shown in the traceback and trace the flattening operation. Done means the command produces `flat.otio` with one video track; a bisected transition should be shortened or discarded with a warning.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.