Skip to content

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

Open
chaoz23 wants to merge 2 commits into
AcademySoftwareFoundation:mainfrom
chaoz23:add-cut-diff-example
Open

Add cut_diff example: structural editorial diff between two cuts#2030
chaoz23 wants to merge 2 commits 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

@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

codecov-commenter commented Jul 2, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.21%. Comparing base (73803ef) to head (1e9ceae).
⚠️ Report is 10 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2030      +/-   ##
==========================================
- Coverage   84.58%   83.21%   -1.38%     
==========================================
  Files         181      180       -1     
  Lines       13306    13465     +159     
  Branches     1221     1253      +32     
==========================================
- Hits        11255    11205      -50     
- Misses       1868     2088     +220     
+ Partials      183      172      -11     
Flag Coverage Δ
py-unittests 83.21% <ø> (-1.38%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.
see 13 files with indirect coverage changes


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...1e9ceae. Read the comment docs.

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

@jminor

jminor commented Jul 13, 2026

Copy link
Copy Markdown
Collaborator

See also: #1922

@chaoz23

chaoz23 commented Jul 14, 2026

Copy link
Copy Markdown
Author

Thanks — hadn't seen #1922. That's the ambitious integrated-tool path: an otiotool feature with a visual annotated-OTIO output, aimed at #26. From the outside it looks stalled, though — still a draft, no commits since Aug 2025, and currently conflicting with main.

This PR is deliberately narrower and at a different layer: a self-contained examples/cut_diff.py alongside conform.py and shot_detect.py. It touches no core code, CI is green, and it can land independently today. If #1922 revives later as the full integrated tool, this example points readers straight to it — they complement rather than compete. I've added a header note in the example cross-referencing otiotool/#1922 and #26.

Proposal: merge this as an example. If you'd rather hold it, I'll close it — no debate needed.

chaoz23 added 2 commits July 15, 2026 09:33
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>
@chaoz23 chaoz23 force-pushed the add-cut-diff-example branch from 1e9ceae to 6766750 Compare July 15, 2026 16:34
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.

3 participants