Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. |
7th July 2008, 07:36 | #1 | Link |
Antronio's DV ambassador
Join Date: Mar 2006
Location: Santiago, Chile
Posts: 115
|
Animated overlay with transparency
Hi everybody.
I've always visited this forum as a knowledge source in every video job i've done. Now it's time to make a question because I still haven't found what I'm looking for (yes, i like U2 ). I started a week ago editing some baby fútbol (smallest field with five players) material I've filmed. Every goal scored must have an animated overlay (similar to euro 2008) showing name of the player and time of scoring everytime a goal has occured. The overlay is a sequence of PNG images with transparency enabled (with fade in and out)and the text is shown through subtitles (fading out together with overlay). The script I'm using is as follows: Code:
testcard = avisource("petazetas_vs_mamaestapresa.avi").ConvertToRGB32() tcard01 = testcard.trim(8587,8757) subs = ImmaRead("gol%02d.png", start=1, end=45) logo = Overlay(tcard01, subs, 165, 280, ShowAlpha(subs), 255, "blend") dissolve(trim(testcard, 0, 8586),logo,trim(testcard,8758,24546),5) subtitle("JUAN CASTILLO", 230, 287, 8622, 8752, "Arial Narrow Cursiva", 16, $00ffffff, $ff000000, 7) subtitle("MIN. 51", 248, 307, 8622, 8752, "Arial Narrow Cursiva", 14, $00ffffff, $ff000000, 7) converttoyv12()
Thanks in advance. Saludos By ALEX-KID |
7th July 2008, 09:00 | #2 | Link |
Avisynth Developer
Join Date: Jan 2003
Location: Melbourne, Australia
Posts: 3,167
|
Code:
testcard = avisource("petazetas_vs_mamaestapresa.avi") subs = ImmaRead("gol%02d.png", start=1, end=45) Goal(testcard, subs, 8587, "JUAN CASTILLO", "MIN. 51") Goal(testcard, subs, 17007, "JOSE FANGIO", "MIN. 101") ... Function Goal(clip src, clip sub, int start, string text1, string text2) { ol = 5 # Dissolve duration fc = FrameCount(sub) # Animation duration tl = 130 # Text duration v1 = src.trim(0, -start-ol) tc = src.trim(start, -fc-ol) tx = src.trim(start+fc, -tl) v2 = src.trim(start+fc+tl-ol, 0) tc = tc.Overlay(sub, 165, 280, ShowAlpha(sub), 1.0, "blend") tx = tx.subtitle(text1, 230, 287, 0, tl, "Arial Narrow Cursiva", 16, $00ffffff, $ff000000, 7) tx = tx.subtitle(text2, 248, 307, 0, tl, "Arial Narrow Cursiva", 14, $00ffffff, $ff000000, 7) return dissolve(v1, tc, tx, v2, ol) } |
9th July 2008, 21:06 | #3 | Link |
Antronio's DV ambassador
Join Date: Mar 2006
Location: Santiago, Chile
Posts: 115
|
After a lot of thinking about what the script does, I finally can write reply ...
I had some issues with sub/subs variable, but were easy to solve. The video was split in four parts, where the second one and third one contain the overlay and the subtitles repectively. Then the video is rejoined through Dissolve filter, but when showing subtitles, the overlay is gone and it's needed as a background for the subtitles. So my attempt is to add another image, make the overlay and add the text. Like this: Code:
testcard = avisource("petazetas_vs_mamaestapresa.avi") sub = ImmaRead("gol%02d.png", start=1, end=45) sub0 = ImmaRead("gol45.png") Goal(testcard, sub, 8587, "JUAN CASTILLO", "MIN. 51") Goal(testcard, sub, 17007, "JOSE FANGIO", "MIN. 101") ... Function Goal(clip src, clip sub, int start, string text1, string text2) { ol = 5 # Dissolve duration fc = FrameCount(sub) # Animation duration tl = 130 # Text duration v1 = src.trim(0, -start-ol) tc = src.trim(start, -fc-ol) tx = src.trim(start+fc, -tl) v2 = src.trim(start+fc+tl-ol, 0) tc = tc.Overlay(sub, 165, 280, ShowAlpha(sub), 1.0, "blend") tx = tx.Overlay(sub0, 165, 280, ShowAlpha(sub), 1.0, "blend") tx = tx.subtitle(text1, 230, 287, 0, tl, "Arial Narrow Cursiva", 16, $00ffffff, $ff000000, 7) tx = tx.subtitle(text2, 248, 307, 0, tl, "Arial Narrow Cursiva", 14, $00ffffff, $ff000000, 7) return dissolve(v1, tc, tx, v2, ol) } But this script only works for the last Goal function specified, I don't know how to make it work for each goal scored. Help is needed again. Saludos By ALEX-KID |
9th July 2008, 23:13 | #4 | Link | |
Avisynth language lover
Join Date: Dec 2007
Location: Spain
Posts: 3,433
|
Ah, so IanB's earlier assumption was mistaken.
Quote:
Code:
Function Goal(clip src, clip sub, int start, string text1, string text2) { ol = 5 # Dissolve duration tl = 130 # Text duration ts = 30 # Text start relative to animation fc = tl+ts # Total animation duration v1 = src.trim(0, -start-ol) tc = src.trim(start, -fc-ol) v2 = src.trim(start+fc, 0) tc = tc.Overlay(sub, 165, 280, ShowAlpha(sub), 1.0, "blend") tc = tc.subtitle(text1, 230, 287, ts, fc-1, "Arial Narrow Cursiva", 16, $00ffffff, $ff000000, 7) tc = tc.subtitle(text2, 248, 307, ts, fc-1, "Arial Narrow Cursiva", 14, $00ffffff, $ff000000, 7) return dissolve(v1, tc, v2, ol) } |
|
9th July 2008, 23:49 | #5 | Link |
Avisynth Developer
Join Date: Jan 2003
Location: Melbourne, Australia
Posts: 3,167
|
Right I misunderstood what you wanted. You want the last frame of the .PNG's repeated thru the text. And oops forgot to remove the "testcard="
Code:
Function Goal(clip src, clip sub, int start, string text1, string text2) { ol = 5 # Dissolve duration fc = FrameCount(sub) # Animation duration tl = 130 # Text duration v1 = src.trim(0, -start-ol) tc = src.trim(start, -fc-tl-ol) v2 = src.trim(start+fc+tl, 0) tc = tc.Overlay(sub, 165, 280, ShowAlpha(sub), 1.0, "blend") t1 = tc.trim(0, -fc-ol) t2 = tc.trim(fc, 0) t2 = t2.subtitle(text1, 230, 287, 0, tl, "Arial Narrow Cursiva", 16, $00ffffff, $ff000000, 7) t2 = t2.subtitle(text2, 248, 307, 0, tl, "Arial Narrow Cursiva", 14, $00ffffff, $ff000000, 7) return dissolve(v1, t1, t2, v2, ol) } subs = ImmaRead("gol%02d.png", start=1, end=45) avisource("petazetas_vs_mamaestapresa.avi") Goal(subs, 8587, "JUAN CASTILLO", "MIN. 51") Goal(subs, 17007, "JOSE FANGIO", "MIN. 101") ... |
Tags |
animated, logo, overlay, transparency |
Thread Tools | Search this Thread |
Display Modes | |
|
|