BlankClip

From Avisynth wiki
(Difference between revisions)
Jump to: navigation, search
m (1 revision)
(add link to avs+ documentation)
 
(14 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{Template:Func3Def|BlankClip([clip ''clip'', int ''length'', int ''width'', int ''height'', string ''pixel_type'', int ''fps'', int ''fps_denominator'', int ''audio_rate'', bool ''stereo'', bool ''sixteen_bit'', int ''color'', int ''color_yuv''])|BlankClip([clip ''clip'', int ''length'', int ''width'', int ''height'', string ''pixel_type'', int ''fps'', int ''fps_denominator'', int ''audio_rate'', int ''channels'', string ''sample_type'', int ''color'', int ''color_yuv''])|Blackness()}}
+
<div style="max-width:62em" >
  
The BlankClip filter produces a solid color, silent video clip of the specified length (in frames). The clip passed as an argument is used as a template for frame rate, image size, and so on, but you can specify all clip properties without having to provide a template. Color should be given as hexadecimal RGB values -- see [[Script_variables|script variables]]. Without any argument, BlankClip will produce a pitch-black 10 seconds clip ([[RGB32]]), 640x480, 24 fps, 16 bit 44100 Hz mono.
+
<div {{BlueBox2|40|0|3px solid purple}} >
 +
{{AvsPlusFullname}}<br>
 +
Up-to-date documentation: [https://avisynthplus.readthedocs.io/en/latest/avisynthdoc/corefilters/blankclip.html https://avisynthplus.readthedocs.io]
 +
</div>
  
''clip'': if present, the resulting clip will have the clip-properties of the template (bug: except color-format), except for the properties you define explicitly.  
+
'''BlankClip''' produces a solid color video clip with silent audio. The ''clip'' passed as an argument is used as a ''template'' - for frame rate, image size, and so on, but the template is optional. You can specify as many clip properties explicitly as you wish. By default, '''BlankClip''' will produce a pitch-black 10 second clip; 24 fps, 640x480, RGB32, with 16 bit, 44100 Hz, mono, silent audio.
  
''length'': length of the resulting clip (in frames).  
+
When supplying a template, '''BlankClip''' returns a clip with [[Clip_properties|properties]] copied from that template. If the template is audio-only, you get a blank audio-only clip, and if it's video-only you get a blank video-only clip. If you start to add parameters that force a video track (i.e. {{FuncArg|width}}, {{FuncArg|height}} or {{FuncArg|pixel_type}}) or audio track (i.e. {{FuncArg|audio_rate}}, {{FuncArg|channels}} or {{FuncArg|sample_type}}), the remaining parameters for that track will be the defaults. (AviSynth v2.60)
  
''width, height'': width and height of the resulting clip.  
+
'''Blackness''' is an ''alias'' for '''BlankClip'''. The parameters are the same.
 +
</div>
  
''pixel_type'': pixel type of the resulting clip, it can be "[[RGB24]]", "[[RGB32]]", "[[YUY2]]", "[[YV12]]", "[[YV16]]" (v2.60), "[[YV24]]" (v2.60), "[[YV411]]" (v2.60) or "[[Y8]]" (v2.60).
+
== Syntax and Parameters ==
 +
<div style="max-width:62em" >
 +
'''BlankClip( [clip ''clip'', int ''length'', int ''width'', int ''height'', string ''pixel_type'','''<br>
 +
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;''' float ''fps'', int ''fps_denominator'', int ''audio_rate'', bool ''stereo'', bool ''sixteen_bit'','''<br>
 +
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '''int ''color'', int ''color_yuv''] )''' ''(deprecated)''
  
''fps'': the framerate of the resulting clip.
+
{{FuncDef
 +
|BlankClip( [clip ''clip'', int ''length'', int ''width'', int ''height'', string ''pixel_type'',<br>
 +
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; float ''fps'', int ''fps_denominator'', int ''audio_rate'', int ''channels'', string ''sample_type'',<br>
 +
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int ''color'', int ''color_yuv''] )
 +
}}
  
''fps_denominator'': you can use this option if "fps" is not accurate enough. For example: fps = 30000, fps_denominator = 1001 (ratio = 29.97) or fps = 24000, fps_denominator = 1001 (ratio = 23.976). It is 1 by default.
+
{{FuncDef
 +
|Blackness( ...''same parameters as'' BlankClip )
 +
}}
  
''audio_rate'': samplerate of the silent audio of the clip.  
+
:{{Par2|clip|clip|}}
 +
::if supplied, the resulting clip will have the clip properties of the template, except for the properties you define explicitly.  
  
''channels'': specifies the number of audio channels of silent audio added to the blank clip (added in v2.58).
+
:{{Par2|length|int|240}}
 +
::Length of the resulting clip, in frames.  
  
''stereo'': (boolean) when set to true the silent audio is in stereo, when set to false a silent mono track is added. Deprecated! Use the ''channels'' parameter instead.
+
:{{Par2|width|int|640}}
 +
:{{Par2|height|int|480}}
 +
::Width and height of the resulting clip.  
  
''sample_type'': specifies the audio sample type of the resulting clip. It can be "8bit", "16bit", "24bit", "32bit" or "float" (added in v2.58).
+
:{{Par2|pixel_type|string|"RGB32"}}
 +
::Pixel type of the resulting clip; can be any of the following:
 +
:::{|class="wikitable" style="width:48em"
 +
|style="width:5em; text-align:center;"|[[RGB24]]
 +
|style="width:5em; text-align:center;"|[[RGB32]]
 +
|style="width:5em; text-align:center;"|[[YUY2]]
 +
|style="width:5em; text-align:center;"|[[YV12]]
 +
|style="width:5em; text-align:center;"|[[YV16]] '''*'''
 +
|style="width:5em; text-align:center;"|[[YV24]] '''*'''
 +
|style="width:5em; text-align:center;"|[[YV411]] '''*'''
 +
|style="width:5em; text-align:center;"|[[Y8]] '''*'''
 +
|-
 +
|align="left" colspan="9" |&nbsp;'''*''' AviSynth v2.60
 +
|}
 +
::{{AvsPluscon}} these [[Avisynthplus_color_formats|color formats]] are allowed:
 +
:::{| class="wikitable" style="width:48em"
 +
! style="width:4em" |''bits''
 +
!RGB(A)
 +
!YUV(A)444
 +
!YUV(A)422
 +
!YUV(A)420
 +
!YUV411
 +
!Y only
 +
|-
 +
|style="text-align:center" |32
 +
|RGBPS
 +
|
 +
|
 +
|
 +
|
 +
|
 +
|-
 +
|style="text-align:center" |16
 +
|
 +
RGB48<br>
 +
RGBP16
 +
|YUV444P16
 +
|YUV422P16
 +
|YUV420P16
 +
|
 +
|Y16
 +
|-
 +
|style="text-align:center" |14
 +
|RGBP14
 +
|YUV444P14
 +
|YUV422P14
 +
|YUV420P14
 +
|
 +
|Y14
 +
|-
 +
|style="text-align:center" |12
 +
|RGBP12
 +
|YUV444P12
 +
|YUV422P12
 +
|YUV420P12
 +
|
 +
|Y12
 +
|-
 +
|style="text-align:center" |10
 +
|RGBP10
 +
|YUV444P10
 +
|YUV422P10
 +
|YUV420P10
 +
|
 +
|Y10
 +
|-
 +
|style="text-align:center" |8
 +
|
 +
RGB24<br>
 +
RGBP<br>
 +
RGBP8
 +
|YV24
 +
|
 +
YUY2<br>
 +
YV16
 +
|
 +
|YV411
 +
|Y8
 +
|-
 +
! colspan="7" style="text-align:left; font-weight:normal" |''with alpha channel''
 +
|-
 +
|style="text-align:center" |32
 +
|RGBAPS
 +
|
 +
|
 +
|
 +
|
 +
|
 +
|-
 +
|style="text-align:center" |16
 +
|
 +
RGB64<br>
 +
RGBAP16
 +
|YUVA444P16
 +
|YUVA422P16
 +
|YUVA420P16
 +
|
 +
|
 +
|-
 +
|style="text-align:center" |14
 +
|RGBAP14
 +
|YUVA444P14
 +
|YUVA422P14
 +
|YUVA420P14
 +
|
 +
|
 +
|-
 +
|style="text-align:center" |12
 +
|RGBAP12
 +
|YUVA444P12
 +
|YUVA422P12
 +
|YUVA420P12
 +
|
 +
|
 +
|-
 +
|style="text-align:center" |10
 +
|RGBAP10
 +
|YUVA444P10
 +
|YUVA422P10
 +
|YUVA420P10
 +
|
 +
|
 +
|-
 +
|style="text-align:center" |8
 +
|style="line-height:80%" |
 +
RGB32<br>
 +
RGBAP<br>
 +
RGBAP8
 +
|
 +
|
 +
|
 +
|
 +
|
 +
|}
 +
 
 +
:{{Par2|fps|float|24}}
 +
::Frame rate of the resulting clip.
 +
 
 +
:{{Par2|fps_denominator|int|1}}
 +
::Specify frame rate in ''rational'' form (numerator/denominator). For example, <tt>fps=30000,fps_denominator=1001</tt> (approximately 29.97 fps) or <tt>fps=24000,fps_denominator=1001</tt> (approximately 23.976 fps).
 +
::''Note'' &ndash; if {{FuncArg|fps_denominator}} is given (even if it is "1"), {{FuncArg|fps}} is '''rounded to the nearest integer'''.
 +
 
 +
:{{Par2|audio_rate|int|44100}}
 +
::Sample rate of the (silent) audio.
 +
::''Note'' &ndash; <code>BlankClip(audio_rate=0)</code> produces the same result as <code>BlankClip.[[KillAudio]]</code>.
 +
 
 +
:{{Par2|channels|int|1}}
 +
::Specifies the number of channels of (silent) audio.
  
''sixteen_bit'': (boolean) true and false give both 16 bit, except when a template is used where a different bit is set. Deprecated! Use the ''sample_type'' parameter instead.
+
:{{Par2|stereo|bool|false}}
 +
::'''Deprecated:''' use {{FuncArg|channels}} instead.
 +
::If true, the (silent) audio is in stereo: {{FuncArg|channels}}=2.  
  
''color'': specifies the color of the clip, black (= $000000) by default. See [[Color_presets|color presets]] for preset colors. See [[Colors]] for more information on specifying colors.
+
:{{Par2|sample_type|string|"16bit"}}
 +
::Specifies the audio sample type. It can be ''8bit'', ''16bit'', ''24bit'', ''32bit'' or ''float''.
  
''color_yuv'': is added in v2.55, and it lets you specify the color of the clip using YUV values. It requires setting ''pixel_type'' to one of the YUV formats, otherwise it doesn't do anything.
+
:{{Par2|sixteen_bit|bool|true}}
 +
::'''Deprecated:''' use {{FuncArg|sample_type}} instead.
 +
::true and false give both 16 bit, except when a template is used where a different bit is set.
  
Blackness is an alias for BlankClip, provided for backward compatibility.  
+
:{{Par2|color|int|$000000}}
 +
::Specifies the color of the clip, black (= $000000) by default. See [[Color_presets|color presets]] for preset color. See [[Colors]] for more information on specifying colors.
  
When supplying a template you get identical clip properties to the template. If it's audio only you get a blank audio only clip, and if it's video only you get a blank video only clip. If you start to modify the parameters to force a video track (for ''width'', ''height'' or ''pixel_type'') or audio track (for ''audio_rate'', ''channels'' or ''sample_type''), the remaining parameters will be the default parameters. (added in v2.60)
+
:{{Par2|color_yuv|int|}}
 +
::Specifies the color of the clip using YUV values. It requires setting {{FuncArg|pixel_type}} to one of the YUV formats; otherwise it doesn't do anything.
  
'''Examples:'''
+
</div>
  
  # produces a black clip (3000 frames, width 720, height 576, framerate 25), with a silent audio track (16 bit 44.1 kHz stereo):
+
==Examples==
 +
<div style="max-width:62em" >
 +
<div {{BoxWidthIndent|56|1}} >
 +
  # produces a black clip (3000 frames, width 720, height 576, framerate 25),
 +
# with a silent audio track (16 bit 44.1 kHz stereo):
 
  BlankClip(length=3000, width=720, height=576, fps=25, color=$000000)
 
  BlankClip(length=3000, width=720, height=576, fps=25, color=$000000)
 +
</div>
  
  # produces a black clip (3000 frames) with the remaining clip properties of the avi:
+
<div {{BoxWidthIndent|56|1}} >
 +
  # produces a black clip (3000 frames) with the remaining clip properties of the AVI:
 
  video = [[AviSource]]("E:\pdwork\DO-Heaven.AVI")
 
  video = [[AviSource]]("E:\pdwork\DO-Heaven.AVI")
 
  BlankClip(video, length=3000, color=$000000)
 
  BlankClip(video, length=3000, color=$000000)
 +
</div>
  
 +
<div {{BoxWidthIndent|56|1}} >
 
  # adds a silent audio stream (with a samplerate of 48 kHz) to a video clip:
 
  # adds a silent audio stream (with a samplerate of 48 kHz) to a video clip:
 
  video = AviSource("E:\pdwork\DO-Heaven.AVI")
 
  video = AviSource("E:\pdwork\DO-Heaven.AVI")
 
  audio = BlankClip(video, audio_rate=48000)
 
  audio = BlankClip(video, audio_rate=48000)
 
  [[AudioDub]](video, audio)
 
  [[AudioDub]](video, audio)
 +
</div>
 +
</div>
  
'''Changes:'''
+
==Changes==
  
 
{| border="1"
 
{| border="1"
Line 65: Line 247:
  
 
[[Category:Internal filters]]
 
[[Category:Internal filters]]
 +
[[Category:Source filters]]

Latest revision as of 19:30, 16 September 2022

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

BlankClip produces a solid color video clip with silent audio. The clip passed as an argument is used as a template - for frame rate, image size, and so on, but the template is optional. You can specify as many clip properties explicitly as you wish. By default, BlankClip will produce a pitch-black 10 second clip; 24 fps, 640x480, RGB32, with 16 bit, 44100 Hz, mono, silent audio.

When supplying a template, BlankClip returns a clip with properties copied from that template. If the template is audio-only, you get a blank audio-only clip, and if it's video-only you get a blank video-only clip. If you start to add parameters that force a video track (i.e. width, height or pixel_type) or audio track (i.e. audio_rate, channels or sample_type), the remaining parameters for that track will be the defaults. (AviSynth v2.60)

Blackness is an alias for BlankClip. The parameters are the same.

[edit] Syntax and Parameters

BlankClip( [clip clip, int length, int width, int height, string pixel_type,
      float fps, int fps_denominator, int audio_rate, bool stereo, bool sixteen_bit,
      int color, int color_yuv] ) (deprecated)

BlankClip( [clip clip, int length, int width, int height, string pixel_type,
      float fps, int fps_denominator, int audio_rate, int channels, string sample_type,
      int color, int color_yuv] )

Blackness( ...same parameters as BlankClip )

clip  clip =
if supplied, the resulting clip will have the clip properties of the template, except for the properties you define explicitly.
int  length = 240
Length of the resulting clip, in frames.
int  width = 640
int  height = 480
Width and height of the resulting clip.
string  pixel_type = "RGB32"
Pixel type of the resulting clip; can be any of the following:
RGB24 RGB32 YUY2 YV12 YV16 * YV24 * YV411 * Y8 *
 * AviSynth v2.60
AVS+ these color formats are allowed:
bits RGB(A) YUV(A)444 YUV(A)422 YUV(A)420 YUV411 Y only
32 RGBPS
16

RGB48
RGBP16

YUV444P16 YUV422P16 YUV420P16 Y16
14 RGBP14 YUV444P14 YUV422P14 YUV420P14 Y14
12 RGBP12 YUV444P12 YUV422P12 YUV420P12 Y12
10 RGBP10 YUV444P10 YUV422P10 YUV420P10 Y10
8

RGB24
RGBP
RGBP8

YV24

YUY2
YV16

YV411 Y8
with alpha channel
32 RGBAPS
16

RGB64
RGBAP16

YUVA444P16 YUVA422P16 YUVA420P16
14 RGBAP14 YUVA444P14 YUVA422P14 YUVA420P14
12 RGBAP12 YUVA444P12 YUVA422P12 YUVA420P12
10 RGBAP10 YUVA444P10 YUVA422P10 YUVA420P10
8

RGB32
RGBAP
RGBAP8

float  fps = 24
Frame rate of the resulting clip.
int  fps_denominator = 1
Specify frame rate in rational form (numerator/denominator). For example, fps=30000,fps_denominator=1001 (approximately 29.97 fps) or fps=24000,fps_denominator=1001 (approximately 23.976 fps).
Note – if fps_denominator is given (even if it is "1"), fps is rounded to the nearest integer.
int  audio_rate = 44100
Sample rate of the (silent) audio.
NoteBlankClip(audio_rate=0) produces the same result as BlankClip.KillAudio.
int  channels = 1
Specifies the number of channels of (silent) audio.
bool  stereo = false
Deprecated: use channels instead.
If true, the (silent) audio is in stereo: channels=2.
string  sample_type = "16bit"
Specifies the audio sample type. It can be 8bit, 16bit, 24bit, 32bit or float.
bool  sixteen_bit = true
Deprecated: use sample_type instead.
true and false give both 16 bit, except when a template is used where a different bit is set.
int  color = $000000
Specifies the color of the clip, black (= $000000) by default. See color presets for preset color. See Colors for more information on specifying colors.
int  color_yuv =
Specifies the color of the clip using YUV values. It requires setting pixel_type to one of the YUV formats; otherwise it doesn't do anything.

[edit] Examples

# produces a black clip (3000 frames, width 720, height 576, framerate 25),
# with a silent audio track (16 bit 44.1 kHz stereo):
BlankClip(length=3000, width=720, height=576, fps=25, color=$000000)
# produces a black clip (3000 frames) with the remaining clip properties of the AVI:
video = AviSource("E:\pdwork\DO-Heaven.AVI")
BlankClip(video, length=3000, color=$000000)
# adds a silent audio stream (with a samplerate of 48 kHz) to a video clip:
video = AviSource("E:\pdwork\DO-Heaven.AVI")
audio = BlankClip(video, audio_rate=48000)
AudioDub(video, audio)

[edit] Changes

v2.55 Added color_yuv.
v2.58 Added channels and sample_type.
v2.60 Added pixel_type="YV24"/"YV16"/"YV411"/"Y8".
Supply useful defaults for new Audio/Video when using a Video/Audio only template clip.
Personal tools