View Full Version : How to display .png just for (exam 3 seconds or 100 frames) with Avisynth?


lintran
9th April 2011, 19:41
Hi all,
I use ImageSource to import png into my video, and keep transparent, here is my script

LoadPlugin("ffms2.dll")
a1=FFVideoSource("video")
a2=ImageSource("image.png")
a3=ImageSource("image.png",pixel_type="RGB32").ShowAlpha(pixel_type="RGB32")
Overlay(a1,a2,mask=a3)

Now i want this image display only from frame 300 to frame 500, how can i do that?
Anyone please tell me script.
Thank you.

Chikuzen
9th April 2011, 21:05
LoadPlugin("ffms2.dll")
a1=FFVideoSource("video")
a2=ImageSource("image.png")
a3=ImageSource("image.png",pixel_type="RGB32").ShowAlpha(pixel_type="RGB32")
ApplyRange(a1, 300, 500, "Overlay", a2, 0, 0, a3)

or

LoadPlugin("ffms2.dll")
a1=FFVideoSource("video")
a2=ImageSource("image.png")
a3=ImageSource("image.png",pixel_type="RGB32").ShowAlpha(pixel_type="RGB32")
v1 = a1.Trim(0, 299)
v2 = a1.Trim(300, 500).Overlay(a2, mask=a3)
v3 = a1.Trim(501, 0)
v1 + v2 + v3

Gavino
9th April 2011, 21:24
Also, instead of reading the image file twice:
a2=ImageSource("image.png")
a3=ImageSource("image.png",pixel_type="RGB32").ShowAlpha(pixel_type="RGB32")
do this:
a2=ImageSource("image.png",pixel_type="RGB32")
a3=a2.ShowAlpha()

lintran
10th April 2011, 03:39
Thanks all, i'll try.
And how about script if i want import 2 or more different png to video (keep transparent) at different posision?
exam 1.png at x1,y1, 2.png at x2,y2
Thank.