Optimize a .riv file (lossless)
riv_optimizeShrink a .riv file without altering its visuals by removing unreferenced data and thinning redundant linear keyframes. Preview the plan with dry-run mode before applying changes.
Instructions
Shrink a .riv without changing its visual output: remove unreferenced objects (dangling easing interpolators, fired-events nothing points to, empty keyframe tracks left over from prior edits) and thin redundant keyframes on strictly-linear-interpolation runs within a tolerance. Only runs where every segment is linear are touched — any run touching hold/cubic easing is left alone, so no easing gets shifted (see keyed_property.cpp semantics: a KeyFrame's interpolationType applies to the segment going INTO the next frame). Colors and id-keyframes (soloActive) are never thinned, only numeric (KeyFrameDouble) tracks. All steps are opt-in booleans (default: all on) and idempotent/safe to run repeatedly. Use dryRun=true to see the removal/thinning plan without writing anything. Run riv_lint afterwards if in doubt.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | Source .riv path | |
| dryRun | No | Report the plan only; don't write anything (default false) | |
| outPath | No | Output path (default: overwrite source) | |
| tolerance | No | Thinning tolerance as a ratio of each track's own value range (default 0.01 = 1%, conservative) | |
| thinKeyframes | No | Douglas-Peucker thin redundant keyframes on linear-only runs (default true) | |
| removeUnreferenced | No | Remove unreferenced interpolators/events/empty tracks (default true) |