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

interleave_frames

interleave_frames(
  input: [Clip, Clip, ...]
)

Interleaves frames from two or more clips in input order. For inputs with frames [A0 A1 A2 A3] and [B0 B1 B2 B3], the output is [A0 B0 A1 B1 A2 B2 A3 B3].

Use array input form: std.interleave_frames([a, b]). Every input clip must use fixed format, fixed resolution, finite frame count, and constant frame rate. All inputs must have identical format, resolution, frame count, and frame rate.

The output frame count is the input frame count multiplied by the number of inputs. The output frame rate is multiplied by the number of inputs so the output duration remains aligned with each source frame index.

Examples

a = source("angle-a.mkv")
b = source("angle-b.mkv")
output = std.interleave_frames([a, b])
a = source("a.mkv")
b = source("b.mkv")
c = source("c.mkv")
output = std.interleave_frames([a, b, c])

Input

Two or more fixed-format planar Gray, YUV, or planar RGB clips with matching resolution, frame count, and frame rate, passed in array form.

Output

A clip with the same format and resolution, interleaved frames, frame count multiplied by input count, and frame rate multiplied by input count. Per-frame metadata comes from the selected source frame.