MergeRGB

From Avisynth wiki
(Difference between revisions)
Jump to: navigation, search
(typo)
 
(formatting)
 
(7 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{Template:Func2Def|MergeARGB(clip ''clipA'', clip ''clipR'', clip ''clipG'', clip ''clipB'')|MergeRGB(clip ''clipR'', clip ''clipG'', clip ''clipB'' [, string ''pixel_type''])}}
+
<div style="max-width:62em" >
 +
{{Func2Def
 +
|MergeARGB(clip ''clipA'', clip ''clipR'', clip ''clipG'', clip ''clipB'')
 +
|MergeRGB(clip ''clipR'', clip ''clipG'', clip ''clipB'' [, string ''pixel_type'' ] )
 +
}}
  
These filters makes it possible to merge the alpha and color channels from the source videoclips into the output videoclip.
+
Merge the ''alpha'' (transparency) and color channels from the source video clips into the output video clip.
  
''clipA'' is the clip that provided the alpha data to merge into the output clip. For a YUV format input clip the data is taken from the Luma channel. For a RGB32 format input clip the data is taken from the Alpha channel. It may not be in RGB24 format.
+
:{{Par2|clipA|clip|}}
 +
::Provides the alpha data to merge into the output clip.  
 +
::* For a [[YUV]] format clip, the data is taken from the ''Y'' (luma) channel.  
 +
::* For an [[RGB32]] format clip, the data is taken from the ''A'' (alpha) channel.  
 +
::* [[RGB24]] clips cannot be used.
  
''clipR'', ''clipG'' and ''clipB'' are the clips that provided the R, G and B data respectively to merge into the output clip. For YUV format input clips the data is taken from the Luma channel. For RGB format input clips the data is taken from the respective source channel. i.e. R to R, G to G, B to B. The unused chroma or color channels of the input clips are ignored.
+
:{{Par2|clipR|clip|}}
 +
:{{Par2|clipG|clip|}}
 +
:{{Par2|clipB|clip|}}
 +
::Provide the ''R'', ''G'' and ''B'' data respectively to merge into the output clip. Input clips may be a mixture of all formats.
 +
::* For [[YUV]] format clips, the data is taken from the ''Y'' (luma) channel. Source data should be full range (0{{D}}-255{{D}}).
 +
::* For [[RGB]] format clips, the data is taken from the respective source channel: ''R'' to ''R'', ''G'' to ''G'' and ''B'' to ''B''.  
  
All YUV luma pixel data is assumed to be pc-range, [0..255], there is no tv-range, [16..235], scaling. Chroma data from YUV clips is ignored. Input clips may be a mixture of all formats. YV12 is the most efficient format for transporting single channels thru any required filter chains.
+
:{{Par2|pixel_type|string|"RGB32"}}
 +
::Specifies the output pixel format. Valid values are "RGB32", "RGB24".
 +
::{{AvsPluscon}} also supports "RGB48", "RGB64"
  
''pixel_type'' default RGB32, optionally RGB24, specifies the output pixel format.
+
The unused channels of the input clips are ignored. Audio, [[Clip_properties|FrameRate]] and [[Clip_properties|FrameCount]] are taken from the first clip.
  
The audio, framerate and framecount are taken from the first clip.
+
=== Examples ===
 
+
<div {{BoxWidthIndent|46|0}} >
'''Examples:'''
+
  # Blur the Green channel only.
 
+
  [[DGDecode/MPEG2Source|MPEG2Source]]("main.d2v")
  # This will only blur the Green channel.
+
  MPEG2source("c:\apps\avisynth\main.d2v")
+
 
  [[ConvertToRGB24]]()
 
  [[ConvertToRGB24]]()
  MergeRGB(Last, Blur(0.5), Last)
+
  MergeRGB(Last, [[Blur]](0.5), Last)
 +
</div>
  
  # This will swap the red and blue channels and
+
<div {{BoxWidthIndent|46|0}} >
  # load the alpha from a second video sources.
+
  # Swap the red and blue channels;
  vid1 = [[AviSource]]("c:\apps\avisynth\main.avi")
+
  # load the alpha from a second source.
  vid2 = AviSource("c:\apps\avisynth\alpha.avi")
+
  vid1 = [[AviSource]]("main.avi")
  MergeARGB(vid2, vid1.[[ShowBlue]]("YV12"), vid1, vid1.[[ShowRed]]("YV12"))
+
  vid2 = AviSource("alpha.avi")
 +
  MergeARGB(
 +
\    vid2,  
 +
\    vid1.[[ShowBlue]]("YV12"),  
 +
\    vid1,  
 +
\    vid1.[[ShowRed]]("YV12")
 +
\ )
 
  [[AudioDub]](vid1)
 
  [[AudioDub]](vid1)
 +
</div>
  
'''Changelog:'''
+
=== Changelog ===
 
{| border="1"
 
{| border="1"
 
|-  
 
|-  
Line 33: Line 54:
 
| Initial release.
 
| Initial release.
 
|}
 
|}
 +
</div>
  
  
 
[[Category:Internal filters]]
 
[[Category:Internal filters]]
 +
[[Category:Levels_and_Chroma_filters]]

Latest revision as of 11:58, 3 October 2017

MergeARGB(clip clipA, clip clipR, clip clipG, clip clipB)
MergeRGB(clip clipR, clip clipG, clip clipB [, string pixel_type ] )

Merge the alpha (transparency) and color channels from the source video clips into the output video clip.

clip  clipA =
Provides the alpha data to merge into the output clip.
  • For a YUV format clip, the data is taken from the Y (luma) channel.
  • For an RGB32 format clip, the data is taken from the A (alpha) channel.
  • RGB24 clips cannot be used.
clip  clipR =
clip  clipG =
clip  clipB =
Provide the R, G and B data respectively to merge into the output clip. Input clips may be a mixture of all formats.
  • For YUV format clips, the data is taken from the Y (luma) channel. Source data should be full range (0d-255d).
  • For RGB format clips, the data is taken from the respective source channel: R to R, G to G and B to B.
string  pixel_type = "RGB32"
Specifies the output pixel format. Valid values are "RGB32", "RGB24".
AVS+ also supports "RGB48", "RGB64"

The unused channels of the input clips are ignored. Audio, FrameRate and FrameCount are taken from the first clip.

[edit] Examples

# Blur the Green channel only.
MPEG2Source("main.d2v")
ConvertToRGB24()
MergeRGB(Last, Blur(0.5), Last)
# Swap the red and blue channels;
# load the alpha from a second source.
vid1 = AviSource("main.avi")
vid2 = AviSource("alpha.avi")
MergeARGB(
\    vid2, 
\    vid1.ShowBlue("YV12"), 
\    vid1, 
\    vid1.ShowRed("YV12")
\ )
AudioDub(vid1)

[edit] Changelog

v2.56 Initial release.
Personal tools