Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

duplicate_frames

duplicate_frames(
  input: Clip,
  #{
    frames: Array<Int>,
  }
)

Duplicates specific source frames from an input clip. Each duplicate is inserted immediately after its source frame, and output frames are re-indexed after all duplications are applied.

The input must be one fixed-format planar Gray, YUV, or planar RGB clip with a finite frame count. frames contains zero-indexed source frame numbers from the input clip. The array may be empty, which returns a no-op clip. Entries must be non-negative and less than the input frame count. The array may contain the same frame multiple times; each entry adds one more duplicate of that source frame. Entry order does not change output order: duplicates are grouped with their source frame in source-timeline order.

Examples

output = source("input.mkv").std.duplicate_frames(#{ frames: [0, 10, 20] })
# Frame 12 appears three times total: the original plus two duplicates.
output = source("input.mkv").std.duplicate_frames(#{ frames: [12, 12] })
# No-op; useful when a script parameter expands to an empty duplicate list.
output = source("input.mkv").std.duplicate_frames(#{ frames: [] })

Input

One fixed-format planar Gray, YUV, or planar RGB clip with a finite frame count.

Output

A clip with the same format, resolution, frame rate, and per-frame metadata, containing all source frames plus requested duplicates inserted after their source frames.

Options

  • frames (Array<Int>) – Zero-indexed source frames to duplicate.