Merge

From Avisynth wiki
(Difference between revisions)
Jump to: navigation, search
(formatting, links, phrasing)
m
 
(4 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 +
<div {{BlueBox2|40|0|3px solid purple}} >
 +
{{AvsPlusFullname}}<br>
 +
Up-to-date documentation: [https://avisynthplus.readthedocs.io/en/latest/avisynthdoc/corefilters/merge.html https://avisynthplus.readthedocs.io]
 +
</div>
 +
 +
 
__TOC__
 
__TOC__
  
 +
== Usage ==
 +
<div style="max-width:62em" >
 
{{FuncDefH4|Merge}}
 
{{FuncDefH4|Merge}}
 
{{FuncDef
 
{{FuncDef
Line 6: Line 14:
 
}}
 
}}
  
''Merge (blend) one video clip into another.''
+
Merges pixels from one videoclip into another.<br>
 +
There is an optional weighting, so a percentage between the two clips can be specified.
  
 
:{{Par2|clip1|clip|(required)}}
 
:{{Par2|clip1|clip|(required)}}
 +
::The clip that has the pixels merged into (the base clip).
 
:{{Par2|clip2|clip|(required)}}
 
:{{Par2|clip2|clip|(required)}}
::Base clip, overlay clip.  
+
::The clip from which the pixel data is taken (the overlay clip).  
  
 
:{{Par2|weight|float|0.5}}
 
:{{Par2|weight|float|0.5}}
::Strength of effect. Range is 0.0&ndash;1.0.
+
::Defines how much influence the new clip should have. Range is 0.0&ndash;1.0.
 
::*At 0.0, {{FuncArg|clip2}} has no influence on the output.
 
::*At 0.0, {{FuncArg|clip2}} has no influence on the output.
 
::*At 1.0, {{FuncArg|clip2}} replaces {{FuncArg|clip1}} completely.
 
::*At 1.0, {{FuncArg|clip2}} replaces {{FuncArg|clip1}} completely.
 
::*Default is 0.5; output is average of {{FuncArg|clip1}} and {{FuncArg|clip2}}.
 
::*Default is 0.5; output is average of {{FuncArg|clip1}} and {{FuncArg|clip2}}.
  
*Clips must be in the same [[Convert|colorspace]].  
+
*Clips must have the same pixel-type.  
 
*Audio, [[Clip_properties|FrameRate]] and [[Clip_properties|FrameCount]] are taken from the first clip.  
 
*Audio, [[Clip_properties|FrameRate]] and [[Clip_properties|FrameCount]] are taken from the first clip.  
  
Line 24: Line 34:
 
{{FuncDefH4|MergeChroma}}
 
{{FuncDefH4|MergeChroma}}
 
{{Func2Def
 
{{Func2Def
|MergeChroma(clip ''clip1'', clip ''clip2'' [, float ''chromaweight'' ] )
+
|MergeChroma(clip ''clip1'', clip ''clip2'' [, float ''chromaweight'' ] ) (depreciated since v2.60)
 
|MergeChroma(clip ''clip1'', clip ''clip2'' [, float ''weight'' ] ) (*v2.60 only)
 
|MergeChroma(clip ''clip1'', clip ''clip2'' [, float ''weight'' ] ) (*v2.60 only)
 
}}
 
}}
  
''Merge ''chroma'' from one video clip into another.''
+
Merges the ''chroma'' from one videoclip into another.<br>
 +
There is an optional weighting, so a percentage between the two clips can be specified.
  
 
:{{Par2|clip1|clip|(required)}}
 
:{{Par2|clip1|clip|(required)}}
 +
::The clip that has the chroma pixels merged into (the base clip).
 
:{{Par2|clip2|clip|(required)}}
 
:{{Par2|clip2|clip|(required)}}
::Base clip, chroma overlay clip.  
+
::The clip from which the chroma pixel data is taken (the overlay clip).  
  
 
:{{Par2|chromaweight|float|1.0}}
 
:{{Par2|chromaweight|float|1.0}}
 
:{{Par2|weight|float|1.0}}
 
:{{Par2|weight|float|1.0}}
::Strength of effect. Range is 0.0&ndash;1.0.
+
::Defines how much influence the new clip should have. Range is 0.0&ndash;1.0.
 
::*At 0.0, {{FuncArg|clip2}} has no influence on the output.
 
::*At 0.0, {{FuncArg|clip2}} has no influence on the output.
 
::*At 1.0, {{FuncArg|clip2}} replaces {{FuncArg|clip1}} chroma completely.
 
::*At 1.0, {{FuncArg|clip2}} replaces {{FuncArg|clip1}} chroma completely.
Line 42: Line 54:
 
::*Alternate name ''weight'' added in AviSynth v2.60
 
::*Alternate name ''weight'' added in AviSynth v2.60
  
*Clips must be in the same [[Convert|colorspace]] and [[YUV]] only.  
+
*Clips must have the same pixel-type and be [[YUV]] only.  
 
*Audio, [[Clip_properties|FrameRate]] and [[Clip_properties|FrameCount]] are taken from the first clip.
 
*Audio, [[Clip_properties|FrameRate]] and [[Clip_properties|FrameCount]] are taken from the first clip.
  
Line 48: Line 60:
 
{{FuncDefH4|MergeLuma}}
 
{{FuncDefH4|MergeLuma}}
 
{{Func2Def
 
{{Func2Def
|MergeLuma(clip ''clip1'', clip ''clip2'' [, float ''lumaweight'' ] )
+
|MergeLuma(clip ''clip1'', clip ''clip2'' [, float ''lumaweight'' ] ) (depreciated since v2.60)
 
|MergeLuma(clip ''clip1'', clip ''clip2'' [, float ''weight'' ] ) (*v2.60 only)
 
|MergeLuma(clip ''clip1'', clip ''clip2'' [, float ''weight'' ] ) (*v2.60 only)
 
}}
 
}}
  
''Merge ''luma'' from one video clip into another.''
+
Merges the ''luma'' from one videoclip into another.<br>
 +
There is an optional weighting, so a percentage between the two clips can be specified.
  
 
:{{Par2|clip1|clip|(required)}}
 
:{{Par2|clip1|clip|(required)}}
 +
::The clip that has the luma pixels merged into (the base clip).
 
:{{Par2|clip2|clip|(required)}}
 
:{{Par2|clip2|clip|(required)}}
::Base clip, luma overlay clip.  
+
::The clip from which the luma pixel data is taken (the overlay clip).  
  
 
:{{Par2|lumaweight|float|1.0}}
 
:{{Par2|lumaweight|float|1.0}}
 
:{{Par2|weight|float|1.0}}
 
:{{Par2|weight|float|1.0}}
::Strength of effect. Range is 0.0&ndash;1.0.
+
::Defines how much influence the new clip should have. Range is 0.0&ndash;1.0.
 
::*At 0.0, {{FuncArg|clip2}} has no influence on the output.
 
::*At 0.0, {{FuncArg|clip2}} has no influence on the output.
 
::*At 1.0, {{FuncArg|clip2}} replaces {{FuncArg|clip1}} luma completely.
 
::*At 1.0, {{FuncArg|clip2}} replaces {{FuncArg|clip1}} luma completely.
Line 66: Line 80:
 
::*Alternate name ''weight'' added in AviSynth v2.60
 
::*Alternate name ''weight'' added in AviSynth v2.60
  
*Clips must be in the same [[Convert|colorspace]] and [[YUV]] only.  
+
*Clips must have the same pixel-type and be [[YUV]] only.  
 
*Audio, [[Clip_properties|FrameRate]] and [[Clip_properties|FrameCount]] are taken from the first clip.
 
*Audio, [[Clip_properties|FrameRate]] and [[Clip_properties|FrameCount]] are taken from the first clip.
 +
</div>
  
  
 
== Examples ==
 
== Examples ==
<div {{BoxWidthIndent|56|2}} >
+
<div style="max-width:62em" >
 +
<div {{BoxWidthIndent|46|0}} >
 
  # Blur the Luma channel.
 
  # Blur the Luma channel.
 
  [[DGDecode/MPEG2Source|MPEG2Source]]("main.d2v")
 
  [[DGDecode/MPEG2Source|MPEG2Source]]("main.d2v")
Line 78: Line 94:
 
</div>
 
</div>
  
<div {{BoxWidthIndent|56|2}} >
+
<div {{BoxWidthIndent|46|0}} >
 
  # Do a spatial smooth on the  chroma channel
 
  # Do a spatial smooth on the  chroma channel
 
  # that will be mixed 50/50 with the original image.
 
  # that will be mixed 50/50 with the original image.
Line 86: Line 102:
 
</div>
 
</div>
  
<div {{BoxWidthIndent|56|2}} >
+
<div {{BoxWidthIndent|46|0}} >
 
  # Run a temporal smoother and a soft spatial
 
  # Run a temporal smoother and a soft spatial
 
  # smoother on the luma channel, and a more aggressive
 
  # smoother on the luma channel, and a more aggressive
Line 101: Line 117:
 
</div>
 
</div>
  
<div {{BoxWidthIndent|56|2}} >
+
<div {{BoxWidthIndent|46|0}} >
 
  # Average two video sources.
 
  # Average two video sources.
 
  vid1 = [[AviSource]]("main.avi")
 
  vid1 = [[AviSource]]("main.avi")
Line 107: Line 123:
 
  Merge(vid1, vid2)
 
  Merge(vid1, vid2)
 
</div>
 
</div>
 +
</div>
 +
  
 
== Changelog ==
 
== Changelog ==

Latest revision as of 07:23, 18 September 2022

AviSynth+
Up-to-date documentation: https://avisynthplus.readthedocs.io


Contents


[edit] Usage

Merge

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

Merges pixels from one videoclip into another.
There is an optional weighting, so a percentage between the two clips can be specified.

clip  clip1 = (required)
The clip that has the pixels merged into (the base clip).
clip  clip2 = (required)
The clip from which the pixel data is taken (the overlay clip).
float  weight = 0.5
Defines how much influence the new clip should have. Range is 0.0–1.0.
  • At 0.0, clip2 has no influence on the output.
  • At 1.0, clip2 replaces clip1 completely.
  • Default is 0.5; output is average of clip1 and clip2.
  • Clips must have the same pixel-type.
  • Audio, FrameRate and FrameCount are taken from the first clip.


MergeChroma

MergeChroma(clip clip1, clip clip2 [, float chromaweight ] ) (depreciated since v2.60)
MergeChroma(clip clip1, clip clip2 [, float weight ] ) (*v2.60 only)

Merges the chroma from one videoclip into another.
There is an optional weighting, so a percentage between the two clips can be specified.

clip  clip1 = (required)
The clip that has the chroma pixels merged into (the base clip).
clip  clip2 = (required)
The clip from which the chroma pixel data is taken (the overlay clip).
float  chromaweight = 1.0
float  weight = 1.0
Defines how much influence the new clip should have. Range is 0.0–1.0.
  • At 0.0, clip2 has no influence on the output.
  • At 1.0, clip2 replaces clip1 chroma completely.
  • Default is 1.0; output chroma taken only from clip2.
  • Alternate name weight added in AviSynth v2.60
  • Clips must have the same pixel-type and be YUV only.
  • Audio, FrameRate and FrameCount are taken from the first clip.


MergeLuma

MergeLuma(clip clip1, clip clip2 [, float lumaweight ] ) (depreciated since v2.60)
MergeLuma(clip clip1, clip clip2 [, float weight ] ) (*v2.60 only)

Merges the luma from one videoclip into another.
There is an optional weighting, so a percentage between the two clips can be specified.

clip  clip1 = (required)
The clip that has the luma pixels merged into (the base clip).
clip  clip2 = (required)
The clip from which the luma pixel data is taken (the overlay clip).
float  lumaweight = 1.0
float  weight = 1.0
Defines how much influence the new clip should have. Range is 0.0–1.0.
  • At 0.0, clip2 has no influence on the output.
  • At 1.0, clip2 replaces clip1 luma completely.
  • Default is 1.0; output luma taken only from clip2.
  • Alternate name weight added in AviSynth v2.60
  • Clips must have the same pixel-type and be YUV only.
  • Audio, FrameRate and FrameCount are taken from the first clip.


[edit] Examples

# Blur the Luma channel.
MPEG2Source("main.d2v")
clipY = Blur(1.0)
MergeLuma(clipY )
# Do a spatial smooth on the  chroma channel
# that will be mixed 50/50 with the original image.
MPEG2Source("main.d2v")
clipC = SpatialSoften(2,3) 
MergeChroma(clipC , 0.5)
# Run a temporal smoother and a soft spatial
# smoother on the luma channel, and a more aggressive
# 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("main.d2v")
clipY = TemporalSoften(2,3)
\       .SpatialSoften(3,10,10)
clipC = SpatialSoften(3,40,40)
MergeLuma(clipY, 0.75)
MergeChroma(clipC)
# Average two video sources.
vid1 = AviSource("main.avi")
vid2 = AviSource("main2.avi")
Merge(vid1, vid2)


[edit] Changelog

v2.60 Added alias weight for chromaweight and lumaweight.
v2.56 Added Merge.
Personal tools