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

replace_frames

replace_frames(
  input: Clip,
  #{
    first: Int,
    last: Int,
    replacement: Int,
  }
)

Replaces an inclusive range of output frames with one source frame from the same input clip. Frames outside the range keep their original source-frame mapping.

The input must be one fixed-format planar Gray, YUV, or planar RGB clip with a finite frame count. first and last are zero-indexed output-frame positions. replacement is a zero-indexed source frame from the input clip. Each index must be non-negative and less than the input frame count. first must not be greater than last.

Examples

# Replace frames 100 through 120 with frame 99.
output = source("input.mkv").std.replace_frames(#{ first: 100, last: 120, replacement: 99 })
# Hold frame 12 for a single output frame at index 42.
output = source("input.mkv").std.replace_frames(#{ first: 42, last: 42, replacement: 12 })

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 count, frame rate, and per-frame metadata behavior, with frames in the selected range sourced from replacement.

Options

  • first (Int) – First zero-indexed output frame to replace.
  • last (Int) – Last zero-indexed output frame to replace, inclusive.
  • replacement (Int) – Zero-indexed input frame used for every frame from first through last.