Functions Index :: S :: StackToFit

[<< up one level]


filters :: stack


StackToFit(string clips, int target_w, int target_h, int "mode", string "pixel_type", clip "audio", string "resizer", val "rsz_param1", val "rsz_param2", bool "interlaced")


Stacks the clips contained in clips array to a rectangular matrix such as the resulting clip has target_w width and target_h height. The clips contained in clips array are enlarged or shrinked as necessary.

Clips are converted to the dominant colorspace, unless a specific setting is enforced by the pixel_type argument.

The output clip has the audio of the first clip, unless a clip is passed in by the audio argument.

Clips must have the same framerate, else an error occurs. They can though have different dimensions.


mode (optional): Has the same function as the ResizeToFit() filter for each individual clip in the matrix [1].

resizer, rsz_param1, rsz_param2, interlaced (optional): Have the same function as the Resize() filter.

Notes and conditions on arguments relations:

1] The filter uses internally the Resize filter in order to execute clip resizing when needed. To control which specific Avisynth resizer will be used by the filter place a call to SetDefaultResizer with appropriate parameters before calling the filter.


clp = ArrayCreate(AVISource(.), ..., AVISource(.))


stack in a 720x480 clip, without changing aspect ratio or cropping

black areas between clips may appear

c1 = StackToFit(clp, 720, 480, RTF_ZOOM)

stack in a 720x480 clip, without changing aspect ratio and without

allowing for black areas between clips; take audio from 2nd clip

c2 = StackToFit(clp, 720, 480, RTF_CROP, audio=clp.ArrayGet(1)))


[<< top]


[1]: Each clip of the array resizes individually within the bounds calculated by the partitioning of the target_w x target_h rectangle to cells with mode supplied by the mode argument (zoom, crop, stretch - default is zoom). Thus, clips are allowed to have different dimensions and aspect ratios.