shotcut icon indicating copy to clipboard operation
shotcut copied to clipboard

Fix Motion Tracker keyframes not applying after save/reload

Open skuznetsov opened this issue 5 months ago • 0 comments

Problem

After saving and reopening a project, Load Keyframes from Motion Tracker silently applies zero keyframes — the masked rectangle stays static instead of following the tracked motion.

Root cause

MotionTrackerModel::trackingData() parses each keyframe's time key with QString::toInt, which only accepts integer frame numbers (e.g. 5). When a project is saved, Shotcut serializes animated properties — including the opencv.tracker results — in clock time format (e.g. 00:00:00.167). After a save + reload, toInt then fails on every entry, so trackingData returns an empty list and applyTracking lays down no keyframes.

This is why tracking "works" right after Analyze (in-memory results are frame-numbered) but stops working once the project has been saved and reopened.

Fix

Accept both frame-number and clock/timecode time keys. The parsed frame value is not used downstream (only the rectangles are consumed by applyTracking/reset), so fall back to the running index when toInt fails.

Verification

On a real project whose tracker results were stored as clock timecodes, the parser yielded 0 rectangles before the change and all 46 after, and the masked filter's keyframes are applied across the whole clip as expected.

skuznetsov avatar Jun 27 '26 13:06 skuznetsov