Log in

View Full Version : How to display logo, .ass subtitle, and sequence png in some frames with avisynth?


lintran
9th May 2011, 14:01
I tried more and more times (before post this question) but failed (i followed this thread http://forum.doom9.org/showthread.php?t=160511). So anyhelp would be grateful and appreciated.
Here is exactly that i want to do:
* I have one videoclip called: video.mkv (fps=23.976 constant), one logo called: logo.png, and some png sequences: A 01...A 100.png (from A 01.png to A 100.png) B 01...B 50.png (from B 01.png to B 50.png), and one ass subtitle file called: sub.ass
Now I want to do all of steps below in one avs script: (all .png file must be keep transparent)
- Display logo.png and sub.ass at all frames of video.mkv

- Display A 01.png...A 100.png at frame 01 to frame 100 of video.mkv, one png per frame (mean A 01.png display at frame 01, A 02.png at frame 02... A 100.png at frame 100)

- Same as above, display B 01.png...B50.png at frame 201 to frame 250 of video.mkv

The images display priotity is: logo.png > sub.ass > all png sequences (A 01, B 01...)
And please remember all images must be keep transparent.
How i can do this in avisynth?
-----------------------
Then finally i got one video return with logo,subtitle display at all frames, A 01... A100 display at frame 01 to 100, B 01...B 50 display at frame 201 to 250 (Yeah! Exactly that I want :D)

I will use ffms2.dll (index video), vsfilter.dll (display .ass), imagesource (display images) in this avs, and ofcourse, i know how to load them into avs :D

Thank you and love you all and so sorry about my bad English ^^

Sir BlunderBrain
9th May 2011, 19:21
ImageSource can load a sequence of images as a clip - you should be able to use that. Something like this (untested):


video=FFVideoSource("video.mkv")

A1=ImageSource("A%02d.png",pixel_type="RGB32", start=1, end=99, fps=23.976)
A2=ImageSource("A100.png",pixel_type="RGB32", fps=23.976)
A=A1+A2

B=ImageSource("B%02d.png",pixel_type="RGB32", start=1, end=50, fps=23.976)

Logo=ImageSource("Logo.png",pixel_type="RGB32", fps=23.976)

video.Trim(0,99).overlay(A,mask=A.ShowAlpha()) + video.Trim(100,199) + video.Trim(200,249).Overlay(B,mask=B.ShowAlpha()) + video.Trim(250,0)

#add subs here

overlay(Logo, mask=Logo.ShowAlpha())



You can get rid of the ugly special case handling for A100.png if you rename your files like A001 - A100 and load them with "A%03d.png" in ImageSource instead.

Gavino
9th May 2011, 19:35
A2=ImageSource("A100.png",pixel_type="RGB32", fps=23.976)
You need to add end=0 to this call, as the default will give you 1001 frames instead.

Sir BlunderBrain
9th May 2011, 21:11
True - I always tend to forget about that detail when using ImageSource :)

The logo clip should probably also be modified to equal the number of frames of the sourceclip.

lintran
10th May 2011, 00:45
Oh, i've got it and try now.
Thank you guys

lintran
10th May 2011, 00:56
video.Trim(0,99).overlay(A,mask=A.ShowAlpha()) + video.Trim(100,199) + video.Trim(200,249).Overlay(B,mask=B.ShowAlpha()) + video.Trim(250,0)



video.Trim(0,99).overlay(A,mask=A.ShowAlpha()) -> make A will display at frame 0 to frame 99, right?
video.Trim(200,249).Overlay(B,mask=B.ShowAlpha()) -> make B will display at frame 200 to frame 249, right?

Thank.

lintran
10th May 2011, 02:40
I dont know if it has bugs or not but I recently made a function for that here (http://forum.doom9.org/showthread.php?p=1487905#post1487905). Maybe its useful to you.

Thank you but your funtion is too much complicated for me, i need to train myseff much more to handle your script :D

Sir BlunderBrain
10th May 2011, 14:05
video.Trim(0,99).overlay(A,mask=A.ShowAlpha()) -> make A will display at frame 0 to frame 99, right?
video.Trim(200,249).Overlay(B,mask=B.ShowAlpha()) -> make B will display at frame 200 to frame 249, right?

Yes, that's correct