BlankClip

From Avisynth wiki
(Difference between revisions)
Jump to: navigation, search
m (category source filters)
(formatting, links, phrasing)
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()}}
+
'''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.
  
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.  
+
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)
  
;clip
+
'''Blackness''' is an ''alias'' for '''BlankClip'''. The parameters are the same.
: if present, the resulting clip will have the clip-properties of the template, except for the properties you define explicitly.  
+
  
;length
+
== Syntax and Parameters ==
: length of the resulting clip (in frames).
+
'''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)''
  
;width, height
+
{{Template:FuncDef
: width and height of the resulting clip.
+
|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''] )}}
  
;pixel_type
+
{{Template:FuncDef|Blackness( ...''same parameters as'' BlankClip )}}
: 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).
+
  
;fps
+
:{{Par2|clip|clip|}}
: the framerate of the resulting clip.  
+
::if supplied, the resulting clip will have the clip properties of the template, except for the properties you define explicitly.  
  
;fps_denominator
+
:{{Par2|length|int|240}}
: 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.  
+
::Length of the resulting clip, in frames.  
  
;audio_rate
+
:{{Par2|width|int|640}}
: samplerate of the silent audio of the clip.  
+
:{{Par2|height|int|480}}
 +
::Width and height of the resulting clip.  
  
;channels
+
:{{Par2|pixel_type|string|"RGB32"}}
: specifies the number of audio channels of silent audio added to the blank clip (added in v2.58).
+
::Pixel type of the resulting clip; it can be any of the following:
 +
:::{|class="wikitable"
 +
|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''
 +
|}
  
;stereo
+
:{{Par2|fps|float|24}}
: (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.
+
::Frame rate of the resulting clip.  
  
;sample_type
+
:{{Par2|fps_denominator|int|1}}
: specifies the audio sample type of the resulting clip. It can be "8bit", "16bit", "24bit", "32bit" or "float" (added in v2.58).
+
::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:''' if {{FuncArg|fps_denominator}} is given (even if it is "1"), {{FuncArg|fps}} is '''rounded to the nearest integer'''.
  
;sixteen_bit
+
:{{Par2|audio_rate|int|44100}}
: (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.
+
::Sample rate of the (silent) audio.  
  
;color
+
:{{Par2|channels|int|1}}
: 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.
+
::Specifies the number of channels of (silent) audio.
  
;color_yuv
+
:{{Par2|stereo|bool|false}}
: 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.
+
::'''Deprecated:''' use {{FuncArg|channels}} instead.
 +
::If true, the (silent) audio is in stereo: {{FuncArg|channels}}=2.  
  
'''Blackness''' is an alias for BlankClip, provided for backward compatibility.  
+
:{{Par2|sample_type|string|"16bit"}}
 +
::Specifies the audio sample type. It can be "8bit", "16bit", "24bit", "32bit" or "float".
  
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|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.
  
====Examples:====
+
:{{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.
  
  # produces a black clip (3000 frames, width 720, height 576, framerate 25), with a silent audio track (16 bit 44.1 kHz stereo):
+
:{{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==
 +
 
 +
  # 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)
  
  # produces a black clip (3000 frames) with the remaining clip properties of the avi:
+
  # 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)
Line 60: Line 88:
 
  [[AudioDub]](video, audio)
 
  [[AudioDub]](video, audio)
  
====Changes:====
+
 
 +
==Changes==
  
 
{| border="1"
 
{| border="1"

Revision as of 09:04, 9 January 2016

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.

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; it can be any of the following:
RGB24 RGB32 YUY2 YV12 YV16 * YV24 * YV411 * Y8 *
 * AviSynth v2.60
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.
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.


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)


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