PDA

View Full Version : Another Annoying Logo Question


Zephie-chan
17th March 2007, 08:51
Warning: I'm very much a newbie, so this question is probably addressed somewhere already, and I apologize ahead of time.

It's a question about using images in AVISynth, or a logo if you prefer. I have searched this forum and have been successful in finding what I've needed up to 'till now, but I'm kinda stumped as to how to find/figure out this particular bit:

I want to display the logo only for specific frames (like only for frames 480 through 1002). This is what I've gathered so far with help from various places:

logoImage = ImageReader("C:\Video\image_logo.bmp")
logoMask = ImageReader("C:\Video\image_mask.bmp")

AVISource("C:\Video\video.avi")
ChangeFPS(23.976)

Overlay(logoImage, x=(Width() - logoImage.Width()), y=(Height() - logoImage.Height()), mask=logoMask)

This works and displays exactly the image I want, but for the entire video, from frame zero to end. How can I modify the above to only display on the frames that I want?

And while I'm asking this question, just so I don't have to post again if I can't figure out how to implement it myself: I want said logo to fade in, but not fade out. I assume I'd only have to use the FadeIn() function? Where and how would I format that fade into the script?

Any help would be appreciated. Thank you.

gzarkadas
17th March 2007, 10:56
Use the Loop (or maybe the FreezeFrame) filter to make your logo (and mask) as long as the range you want to apply it (1002 - 480 + 1 = 523 frames in your example).

To make the fadein effect use this (after applying Loop):

logoimage = logoimage.Trim(0, -frames_that_you_want) + logoimage
padleft = logomask.BlankClip.Trim(0, -frames_that_you_want)
logomask = Dissolve(padleft, logomask, frames_that_you_want)


Then Overlay just as you did but only on the range of the clip that you want the logo to appear, such as below:


last.Trim(0, 479-frames_that_you_want) + last.Trim(480-frames_that_you_want, 1002).Overlay(...your previous settings...) + last.Trim(1003, 0)


I have not tested it, but I believe it will do the job. Experiment and you' ll succeed :).

Zephie-chan
18th March 2007, 01:43
Thanks! I've been working on it with all my free time today; I sacrificed the comfort of reading a book on my break time -- which is major for me. After some tweaking and hair tugging trial and error work on the Trim options, I've been able to specify the logo for specific frames using the final example you gave me.

I couldn't get FreezeFrame to work, so then I moved on to try Loop, and I couldn't see it make any difference -- if anything it gave me more headaches and errors than help. :P

For those interested in this post, and for you (gzarkadas) to look at, this is what I've ended up with so far:

# First Frame : 485
# Last Frame : 699
# Total Frames: 214

logoImage = ImageReader("C:\Video\image_logo.bmp")
logoMask = ImageReader("C:\Video\image_mask.bmp")

AVISource("C:\Video\video.avi")
ChangeFPS(23.976)

last.Trim(0, 698-214) + last.Trim(699-215, 699).Overlay(logoImage, x=(Width() - logoImage.Width()), y=(Height() - logoImage.Height()), mask=logoMask) + last.Trim(700, 0)

It may be slightly, or completely, crude without the Loop or FreezeFrame function, but this works perfectly thus far by itself, and now all I have to do is figure out your fade code and find a way to put that in. :)

Thank you so much for your help.

Zephie-chan
18th March 2007, 05:44
Ah, never mind. I got it! This is my final version, which works absolutely perfectly. It was so simple that I nearly died when I tried it and it actually worked!

# First Frame : 485
# Last Frame : 699
# Total Frames: 214

logoImage = FadeIn(ImageReader("C:\Video\image_logo.bmp"), 12, $FFFFFF)
logoMask = FadeIn(ImageReader("C:\Video\image_mask.bmp"), 12, $FFFFFF)

AVISource("C:\Video\video.avi")
ChangeFPS(23.976)

last.Trim(0, 698-214) + last.Trim(699-215, 699).Overlay(logoImage, x=(Width() - logoImage.Width()), y=(Height() - logoImage.Height()), mask=logoMask) + last.Trim(700, 0)

Thank you so very much, gzarkadas. This couldn't have been possible without your help; I would have still been bleary-eyed and frustrated otherwise!

gzarkadas
18th March 2007, 17:57
Glad that things work :) and also for helping me update my knowledge on ImageReader/Source (this Loop / FreezeFrame stuff I mentioned in my fisrt post was a hack to overcome getting flipped images after the 1st frame when I was using v2.55 which I didn't noticed it was fixed meanwhile; :( shame on me).