Skip to content

Add cut_diff example: structural editorial diff between two cuts#2030

Open
chaoz23 wants to merge 1 commit into
AcademySoftwareFoundation:mainfrom
chaoz23:add-cut-diff-example
Open

Add cut_diff example: structural editorial diff between two cuts#2030
chaoz23 wants to merge 1 commit into
AcademySoftwareFoundation:mainfrom
chaoz23:add-cut-diff-example

Conversation

@chaoz23

@chaoz23 chaoz23 commented Jul 2, 2026

Copy link
Copy Markdown

This adds an examples/cut_diff.py script that answers "what changed between cut A and cut B" — which clips were added, removed, retimed, moved, or shifted — in the spirit of existing examples like conform.py and shot_detect.py. The OTIO docs list "Shots Added or Removed From The Cut" as a first-class use case; this example implements it.

Because both inputs go through adapters, the cuts don't need to share a format — an EDL can be diffed against an FCP XML export of the revision:

$ python cut_diff.py editors_cut.edl finishing.fcpxml
1 retimed, 1 shifted (7 unchanged)
  ~ ZZ100_503A shortened by 12f (28f -> 16f)
  . ZZ100_504C shifted 12f earlier

Design notes:

  • Clips are matched by identity (media target_url + source in-point), not timeline position — one insertion shifts every downstream timecode, so positional diffing reports everything as changed.
  • "Moved" is detected by relative order (longest increasing subsequence over matched clips), so a gap inserted by a lift-trim doesn't read as every downstream clip moving.
  • Ripple slides report as "shifted", separate from "retimed", so one trim doesn't read as N retimes.
  • Scope is structural editorial only (clips/timing/order); effects and transitions are intentionally out, per their tool-specific serialization.
  • --json output and diff(1) exit codes for scripting.

Validated against sample files from the cmx3600 and fcpx-xml adapter test suites, including hand-modified known-change cases. A packaged version with a test suite and an MCP server lives at chaoz23/otio-diff; this example is self-contained.

🤖 Generated with Claude Code

Matches clips by identity (media url + source in-point) rather than
position, then classifies added / removed / retimed / moved / shifted.
Works across formats via adapters (e.g. EDL vs FCP XML). Exit codes
follow diff(1).

Signed-off-by: chaoz23 <chaoz23@gmail.com>
@linux-foundation-easycla

linux-foundation-easycla Bot commented Jul 2, 2026

Copy link
Copy Markdown

CLA Signed
The committers listed above are authorized under a signed CLA.

  • ✅ login: chaoz23 / name: chaoz23 (d92cd00)

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 84.58%. Comparing base (73803ef) to head (d92cd00).

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #2030   +/-   ##
=======================================
  Coverage   84.58%   84.58%           
=======================================
  Files         181      181           
  Lines       13306    13306           
  Branches     1221     1221           
=======================================
  Hits        11255    11255           
  Misses       1868     1868           
  Partials      183      183           
Flag Coverage Δ
py-unittests 84.58% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.


Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 73803ef...d92cd00. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants