INNER CODE UNIT · TypeScript
cutTo
vargHQ/sdk · src/ai-sdk/providers/editly/index.ts:116
const cutTo = Math.min(
videoLayer.cutTo ?? videoDuration,
videoDuration,
);
// Clamp the layer's cutTo so the FFmpeg trim filter also respects
// the actual source duration (prevents freeze frames at the tail)
videoLayer.cutTo = cutTo;
const effectiveDuration = cutTo - cutFrom;
if (!clip.duration) {
// No explicit duration — derive from the video layer
duration = effectiveDuration;
} else if (effectiveDuration < duration) {
// Explicit duration exceeds actual video length — clamp to avoid
// freeze frames and xfade offset misalignment
duration = effectiveDuration;
}