Functions Index :: S :: SplitVideoChannels
Module:
Definition:
SplitVideoChannels(clip c, string "pixel_type")
Description:
Splits clip c into an array containing the individual clip's channels (R, G, B[, A] or Y, U, V depending on c's colorspace) and (at index 0) a pixel type string description (thus the array returned is a mixed-type array).[1]
The optional pixel_type argument can be used to convert c to a different colorspace on the fly before returning the channels.
To access the channels inside the array it is best to use the ChannelIndex() helper function.
Examples:
#open a clip and split into channels converting to YV12
ch = SplitVideoChannels(AVISource(…), "YV12")
# process the Y channel
#don't forget to update the array
yid = ChannelIndex("Y")
ch.ArraySet(yid, ch.ArrayGet(yid).Levels(…))
# do further processing
...
# merge channels when done
rst = MergeVideoChannels(ch)
[1]:Batch processing of the entire array is still possible. Simply make the custom function to accept a val (ie any) Avisynth type and process an element only if IsClip returns true.