Log in

View Full Version : Trying to overlay an image logo zooming in while retaining transparency.


The T
10th December 2017, 17:39
I have no idea how I'm having so much trouble with this.

What I'm trying to do is, have a video, have a logo appear in the center super small, then slowly zoom in to fill up the screen, all the while leaving the original video in the background, and keep transparency intact.

I'm trying to use the sample on the Animate page, "Zoom overlay 2". But when I do it, the closest I get is, the first frame of the video has the final frame of the zoom's transparency present, like a mask, and the image zooms in to fill in that space, only showing up where the black mask is.

The weird thing is, if I jump around in the video, it disappears altogether. If I then run through it, flickers between the underlay video and the zooming image on a pure black background.

What the heck is going on?

Here's the entire script:

a=FFVideoSource("video.mp4").converttorgb32

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 = ImageSource("title.png",pixel_type="RGB32")
black=BlankClip(clip)
clip=resize(black, clip,
\ 0, 5, 5,
\ 300, 1280, 720,
\ clip.Width/2, clip.Height/2)

Layer(a,clip)

trim(0,500)

poisondeathray
11th December 2017, 16:25
It's because the alpha channel is not resized in the same manner. If you view the alpha separately, you will see the problem

not a very smooth zoom either ; I think someone made a smoother zoom function here, maybe riffraff42 or gavino ? Eitherway it's a lot smoother in a NLE or compositing tool
https://forum.doom9.org/showthread.php?t=168266




a=FFVideoSource("video.mp4").converttorgb32

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)
}

b = ImageSource("title.png",pixel_type="RGB32").assumefps(framerate(a))
black=BlankClip(b)
b2=resize(black, b,
\ 0, 5, 5,
\ 300, 1280, 720,
\ b.Width/2, b.Height/2)

b3=resize(black, b.showalpha,
\ 0, 5, 5,
\ 300, 1280, 720,
\ b.Width/2, b.Height/2)

overlay(a, b2, mask=b3)


trim(0,500)

StainlessS
11th December 2017, 16:58
Perhaps something of interest here:- https://forum.doom9.org/showthread.php?t=174127