Hi, I am trying to do this in AviSynth: static background + title zooming in.
I tried using "animate()" (as the wiki says) but the result of this is a really choppy zoom (I guess it is because of font sizes getting "snapped" to some values).
So then I searched and found a script called "KenBurnsEffect", which works nice. The problem is that I need to render the subtitle into a temporary surface (otherwise I get the effect in the background too), and subtitle() doesn't modify the alpha value of the pixels, so to blend it into the background, I need to create a mask.Code:BlankClip(width=320, height=240) return Animate(0,48,"Subtitle", "Hello, World!",160,120,0,99999,"Arial",0, \ "Hello, World!",25,130,0,99999,"Arial",48)
The problem is that Overlay does "non pre-multiplied alpha" (aka Flat matte) blending, so the subtitles appear with a black outline (undesired):Code:bg = ImageSource("test.png", end=100, fps=30).convertToRGB32() blank = BlankClip(length=100, width=640, height=360, pixel_type="RGB32", color=$000000, fps=30) white = blank.Subtitle("Test Subtitle", x=320, y=180, size=40, text_color=$00FF00, halo_color=$000000, align=5) alpha = blank.Subtitle("Test Subtitle", x=320, y=180, size=40, text_color=$FFFFFF, halo_color=$000000, align=5) return Overlay(bg, white, mask=alpha)
My solution is to manually do the premultiplied alpha blending (using a multiply of the background with the inverse of the alpha and then an addition to the foreground):
Code:bg = ImageSource("test.png", end=100, fps=30).convertToRGB32() blank = BlankClip(length=100, width=640, height=360, pixel_type="RGB32", color=$000000, fps=30) white = blank.Subtitle("Test Subtitle", x=320, y=180, size=40, text_color=$00FF00, halo_color=$000000, align=5) alpha = blank.Subtitle("Test Subtitle", x=320, y=180, size=40, text_color=$FFFFFF, halo_color=$000000, align=5).invert("RGB") return Overlay(Overlay(bg,alpha,mode="multiply"), white, mode="add")
This works perfectly, but I'm guessing there has to be a simpler way to perform that...
Thanks,
Gzaloprgm
Try StreamFab Downloader and download from Netflix, Amazon, Youtube! Or Try DVDFab and copy Blu-rays!
+ Reply to Thread
Results 1 to 3 of 3
Thread
-
-
A workaround for jerkiness/positioning might be to uprez+uprateconvert the footage prior to adding the text/subs being animated, then downrezzing+downrateconverting after. Yes it is a quality compromise, but it will get you smooth sub-pixel positioning.
There are probably other workarounds as well...Gavino? jagabo?...
Scott -
The problem is actually due to the way the halo_color interacts with the anti-aliasing performed by Subtitle().
The solution is to set the halo_color to the same as the text_color in the first Subtitle call.
Code:bg = ImageSource("test.png", end=100, fps=30).convertToRGB32() blank = BlankClip(length=100, width=640, height=360, pixel_type="RGB32", color=$000000, fps=30) white = blank.Subtitle("Test Subtitle", x=320, y=180, size=40, text_color=$00FF00, halo_color=$00FF00, align=5) alpha = blank.Subtitle("Test Subtitle", x=320, y=180, size=40, text_color=$FFFFFF, halo_color=$000000, align=5) return Overlay(bg, white, mask=alpha)
return Layer(bg, white.Mask(alpha))
Regarding the jerky zooming, use floating point instead of integer for the positions to allow the animation to perform a smooth interpolation and allow Subtitle to use sub-pixel positioning.
Code:BlankClip(width=320, height=240) return Animate(0,48,"Subtitle", "Hello, World!",160.0,120.0,0,99999,"Arial",0, \ "Hello, World!",25.0,130.0,0,99999,"Arial",48)
Similar Threads
-
AVISynth Overlay Image Help
By smike in forum EditingReplies: 11Last Post: 17th Sep 2012, 11:04 -
AviSynth Overlay and Trim Help
By NMeade in forum Newbie / General discussionsReplies: 20Last Post: 1st Apr 2012, 07:53 -
AviSynth Audio Overlay
By legocrazy1 in forum EditingReplies: 7Last Post: 14th Jul 2010, 10:01 -
Help with Avisynth overlay
By WAKA in forum Newbie / General discussionsReplies: 12Last Post: 14th Jul 2009, 12:37 -
Overlay text at various positions via avisynth subtitle() function ?
By vhelp in forum EditingReplies: 3Last Post: 11th Jul 2009, 03:29