Merge

From Avisynth wiki
(Difference between revisions)
Jump to: navigation, search
 
m (1 revision)

Revision as of 17:02, 9 May 2013

Merge(clip clip1, clip clip2 [, float weight])
MergeChroma(clip clip1, clip clip2 [, float weight])
MergeLuma(clip clip1, clip clip2 [, float weight])

These filters make it possible to merge pixels (or, for YUV clips only, just the luma or chroma) from one videoclip into another. There is an optional weighting, so a percentage between the two clips can be specified. Merge is present in v2.56.

clip1 is the clip that has the appropriate data merged INTO (based on which filter you use). In the case of MergeLuma or MergeChroma, that means that the OTHER channel (chroma or luma respectively) is completely untouched.

clip2 is the one from which the pixel data must be taken. In MergeChroma, this is where the Chroma will be taken from, and vice-versa for MergeLuma. It must be the same colorspace as clip1; i.e. you cannot merge from a YV12 clip into a YUY2 clip.

The weight defines how much influence the new clip should have. Range is 0.0 to 1.0, where 0.0 is no influence and 1.0 will completely overwrite the specified channel. The default is 0.5 for Merge and 1.0 for MergeChroma and MergeLuma. The filter will be slightly slower when a weight other than 0.0, 0.5 or 1.0 is specified.

The audio, framerate and framecount are taken from the first clip.

Nb, prior to v2.60 there was no weight argument for MergeChroma and MergeLuma: you needed to use ChromaWeight for MergeChroma() and LumaWeight for MergeLuma(). Since v2.60 you can also use the weight argument.

Examples:

# Will only blur the Luma channel.
mpeg2source("c:\apps\avisynth\main.d2v")
lumvid = Blur(1.0)
MergeLuma(lumvid)
# This will do a Spatial Smooth on the Chroma channel
# that will be mixed 50/50 with the original image.
mpeg2source("c:\apps\avisynth\main.d2v")
chromavid = SpatialSmoother(2,3) 
MergeChroma(chromavid,0.5)
# This will run a temporalsmoother and a soft spatial
# smoother on the Luma channel, and a more agressive
# spatial smoother on the Chroma channel.
# The original luma channel is then added with the
# smoothed version at 75%. The chroma channel is
# fully replaced with the blurred version.
mpeg2source("c:\apps\avisynth\main.d2v")
luma = TemporalSmoother(2,3)
luma = luma.Spatialsmoother(3,10,10)
chroma = Spatialsmoother(3,40,40)
MergeLuma(luma,0.75)
MergeChroma(chroma)
# This will average two video sources.
AviSource("c:\apps\avisynth\main.avi")
vid2 = AviSource("c:\apps\avisynth\main2.avi")
Merge(vid2)

Changelog:

v2.60 Added alias "Weight" for "ChromaWeight" and "LumaWeight".
v2.56 Added Merge.
Personal tools