Animate のバックアップの現在との差分(No.2)


  • 追加された行はこの色です。
  • 削除された行はこの色です。
 Animate(clip clip, int start_frame, int end_frame, string filtername, start_args, end_args)
#pre{{
Animate (clip, int start_frame, int end_frame, string filtername, start_args, end_args)
ApplyRange (clip, int start_frame, int end_frame, string filtername, args)
}}

 ApplyRange(clip clip, int start_frame, int end_frame, string filtername, args)
Animate は、連続的に変化する実引数を伴った '''filtername''' パラメータを評価するメタフィルタです。'''filtername''' は、'''start-frame''' 以前のフレームでは、'''start-args''' によって与えられた実引数を使って評価されます。'''end-frame''' 以降のフレームでは、'''end-args''' によって与えられた引数を用いて評価されます。それらに挟まれた範囲では、実引数は、スムーズに変化するように線形補間されます。

Animateは、連続的に変化する引数を伴ったパラメータフィルタを評価する、メタフィルタです。start-frame以前のフレームでは、フィルタは、start-argsによって与えられた引数で評価されます。end-frame以降のフレームでは、end-argsによって与えられた引数で評価されます。その中間では、引数は、スムーズな変化(transition)のために、直線的に補間されます。
ApplyRange は、'''start_args''' が '''end_args''' と等しいという特別な場合の Animate フィルタで、v2.51 から内蔵されています。あるフィルタをクリップのある範囲のフレームに適用したいときに使用することができます。Animate とのもうひとつの違いは、'''args''' が '''clip''' を含むことができないということです。v2.53 からは音声をサポートしており、'''start_frame''' と '''end_frame''' を同じ値にすることもできます(1 フレームだけが処理されるような場合)。

ApplyRangeは、start_argsがend_argsと等しいという、特殊なケースのAnimateフィルタです。あるフィルタを、クリップの、ある範囲のフレームに適用したいときに使用することができます。Animateとの、もうひとつの違いは、argsがclipを含むことができないということです。v2.53から音声をサポートしています。しかも、start_frameとend_frameを同じ値にすることもできます(1フレームだけが処理されるような場合)。
たくさんの範囲が同様の処理を必要とする場合、数多くの ApplyRange を呼び出すことは、リソース問題を引き起こすかもしれません。代替案としては、未処理のバージョンのソースと処理されたバージョンのソースとの間で選択するために、[[ConditionalFilter]] と一緒に [[ConditionalReader]] を使うことが考えられます。

Filter must be enclosed in quotation marks, and the two nested argument lists are not parenthesized. Strings and video clips can't be interpolated, and therefore must be identical in the two argument lists. You can't use OOP notation or implicit last with this filter, even if the filter in the filter argument normally allows them.
'''filtername''' は、(string 型なので)二重引用符で囲まなければなりません。そして、2 つの入れ子になった実引数リストは、丸括弧には入れません。文字列とビデオクリップは補間できないため、それらは、2 つの実引数リストにおいて、まったく同一でなければなりません。ただし重要な警告: もし 1 つ目の実引数としてクリップを使用するなら、同じクリップは '''start_args''' と  '''end_args''' に含まれるべきではありません。例えば、次のスクリプト

This filter will not correctly handle a changing sound track, so I don't recommend its use with filters which modify the sound track. And for heaven's sake don't make the initial and final parameters yield a different output frame size.
#pre{{
v = Version()
Animate(v,0,149,"Crop", v,0,0,64,32, v,316,0,64,32)
}}

The filter argument can even be Animate if you want quadratic rather than linear interpolation, but I'm not going to think about this too much because my head might explode.
は、最初のフレームが Crop(v, v, 0, 0, 64, 32) という間違ったシンタックスになるため、エラーを引き起こしてしまいます。

例: 
このフィルタは変化する音声トラックを正確に取り扱うことができないため、音声トラックを修正するフィルタとの併用は推奨されません。そしてお願いですから、最初と最後のパラメータが異なる出力フレームサイズをもたらさないようにしてください。

 # Make a scrolling version of the "Version" video
 ver = Version
 return Animate(0, 149, "Crop", ver, 0, 0, 64, 32, ver, 448, 0, 64, 32)
線形補間よりも 2 次補間を望むなら、'''filtername''' の実引数を Animate にすることもできます。

 # or what is the same:
 ver = Version()
 return Animate(ver,0,149,"Crop", 0,0,64,32, 316,0,64,32)
''使用例:''

 # Fade to white
 Animate(100, 200, "Levels", last, 0, 1, 255, 0, 255, last, 0, 1, 255, 255, 255)
#pre{{
# 「Version」ビデオのスクロール版をつくる:
ver = Version
Animate(0,149,"Crop", ver,0,0,64,32, ver,316,0,64,32)

 # Do a gradual zoom into the center of a 320x240 video, starting at
 # 1:1 magnification in frame 100 and ending with 4:1 magnification
 # in frame 200
 
 #31-03-04 This wont work - Bicubic needs extra parameters!
 #maybe try BilinearResize instead
 Animate(100, 200, "!BicubicResize",last, 0, 0, 320, 240, 320, 240, last, 120, 90, 80, 60, 320, 240)
# 上の使用例と同じ:
ver = Version()
Animate(ver,0,149,"Crop", 0,0,64,32, 316,0,64,32)
}}

 # Make the text "Hello, World!" zoom out from the center of a 320x240 video
 Animate(0, 48, "Subtitle", last, "Hello, World!", 160, 120, 0, 99999, "Arial", 0, last, "Hello, World!", 25, 130, 0, 99999, "Arial", 48)
#pre{{
# 白色にフェードアウトする
AviSource("E:\pdwork\DO-Heaven.AVI")
Animate(100,200,"Levels", 0,1,255,0,255, 0,1,255,255,255)
}}

 ver = Version()
 return ver.ApplyRange(0,149,"Crop", 158,0,64,32)
#pre{{
# フレーム 100 が 1:1 の倍率で始まり、
# フレーム 200 が 4:1 の倍率で終わるように、
# 320x240 のビデオの中心へ次第にズームする:
clip = AviSource("E:\pdwork\DO-Heaven.avi")
Animate(100,200,"BicubicResize",
\ clip,320,240,0,0,320,240,
\ clip,320,240,120,90,80,60)
# Animate(clip, 100,200,"BicubicResize",
#\ 320,240,0,0,320,240,
#\ 320,240,120,90,80,60) # これも動作する。
}}

 AviSource("E:\pdwork\DO-Heaven.AVI").BicubicResize(320,240)
 ApplyRange(0,48,"Subtitle", "Hello, World!",25,130,0,99999,"Arial",48)
#pre{{
# 「Hello, World!」というテキストを 320x240 のビデオの中心からズームアウトさせる: 
BlankClip(width=320, height=240)
Animate(0,48,"Subtitle", "Hello, World!",160,120,0,99999,"Arial",0,
  \  "Hello, World!",25,130,0,99999,"Arial",48)
}}

 # 上の例と同じもの:
 clip = AviSource("E:\pdwork\DO-Heaven.AVI").BicubicResize(320,240)
 ApplyRange(clip, 0,48,"Subtitle", "Hello, World!",25,130,0,99999,"Arial",48)
#pre{{
# クリップ c2 を c1 の上にオーバーレイさせながらズームする:
Function myfunc(clip c1, clip c2, int x, int y, int w, int h)
{
  w = w - w%2
  h = h - h%2
  my_c2 = BicubicResize(c2,w,h)
  Overlay(c1,my_c2,x,y)
}

c1 = AviSource("D:\Captures\jewel.avi") # c1 は c2 より大きい
c2 = AviSource("D:\Captures\atomic.avi").BicubicResize(320,240)
Animate(0,1000,"myfunc",c1,c2,10,10,10,10,c1,c2,300,300,360,288)
# もしくは
# Animate(c1,0,1000,"myfunc", c2,10,10,10,10, c2,300,300,360,288)

# しかし下記のスクリプトは、myfunc に 3 つのクリップ(c1、c1、および c2)が渡されるが、
# 実際に許可されるのは 2 つのみなので動かない:
# Animate(c1,0,1000,"myfunc",c1,c2,10,10,10,10,c1,c2,300,300,360,288)
}}

#pre{{
# メインのクリップに取って代わるまで、小さな写真が黒色のクリップの上で拡大する:
function res(clip clip, clip "LClip",
\ int "width", int "height",
\ int "centerX", int "centerY") {
  LClip = BicubicResize(LClip, width, height)
  Overlay(clip, LClip, centerX-LClip.width/2, centerY-LClip.height/2)
}

function resize(clip clip, clip "LClip",
\ int "start_frame", int "start_width", int "start_height",
\ int "end_frame", int "end_width", int "end_height",
\ int "centerX", int "centerY")
{
  return Animate(start_frame, end_frame, "res",
\   clip, LClip, start_width, start_height, centerX, centerY,
\   clip, LClip, end_width, end_height, centerX, centerY)
}

clip = AviSource("D:\captures\jewel.avi")
clip = clip.BicubicResize(640,480)
clip = clip.ConvertToRGB()
black = BlankClip(clip)

resize(black, clip,
\     0, 120, 120*clip.height/clip.width,
\   500, 640, 480,
\   clip.width/2, clip.height/2)
}}

#pre{{
ver = Version()
return ver.ApplyRange(0,149,"Crop", 158,0,64,32)

AviSource("E:\pdwork\DO-Heaven.avi").BicubicResize(320,240)
ApplyRange(0,48,"Subtitle", "Hello, World!",25,130,0,99999,"Arial",48)

# 上の使用例と同じ:
clip = AviSource("E:\pdwork\DO-Heaven.avi").BicubicResize(320,240)
ApplyRange(clip,0,48,"Subtitle","Hello World!",25,130,0,99999,"Arial",48)
}}

#hr
註: このページは、http://www.avisynth.org/Animateの日本語訳です。

註: このページは、AviSynth 2.5.8 RC1 に同梱されている英語版ヘルプの日本語訳です。原文は、AviSynth をインストールしたフォルダ内の Docs/english/corefilters/animate.htm にあります。なお、このページのテキストおよび画像のライセンスは、オリジナルのそれに準じます。詳しくは、[[AboutLicense]] を参照してください。