11-25-2002, 06:06 PM
|
Free Member
|
|
Join Date: Jun 2002
Location: São Paulo - Brasil
Posts: 879
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hi all!
I need some help with a simple task...
Is there a way to fade in a line of text into a movie, make it stay for a couple of seconds the fade it out?
I'm using the avs native subtitle() function, but it doesn’t fade in/out.
Any ideas?
Thanks,
|
Someday, 12:01 PM
|
|
Site Staff / Ad Manager
|
|
Join Date: Dec 2002
Posts: 42
Thanks: ∞
Thanked 42 Times in 42 Posts
|
|
|
11-28-2002, 01:31 AM
|
Free Member
|
|
Join Date: Jun 2002
Location: São Paulo - Brasil
Posts: 879
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Well... I think I got it. Here is the script:
Quote:
source1 = mpeg2source("C:\Temp\cassia_eller\malandragem.d2v" )
subtitle1 = Subtitle(source1, "Malandragem", 465,390, 70,280, "arial",33,$FFFFFF,$000000)
subtitle2 = Subtitle(subtitle1, "(Cazuza/Frejat)", 465,414, 70,280, "arial",21,$FFFFFF,$000000)
sub_fadein = Dissolve(trim(source1,70,100), trim(subtitle2,70,280), 30)
sub_fadeout = Dissolve(sub_fadein, trim(source1,250,0), 30)
trim(source1,0,69) + sub_fadeout
|
This script FadeIn 2 text lines (1 sec fadein), show it for 5sec, then FadeOut (1sec fadeout).
I would like to make a function with it. The function should have the same arguments that the "subtitle" has, plus the fadein/out time and stay time.
But I never did any function with avs... can someone help me?
|
11-28-2002, 04:16 AM
|
Free Member
|
|
Join Date: Jun 2002
Location: Paris, France
Posts: 54
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hi!
Sorry I cannot help you. However, checking the script at http://www.avisynth.org/index.php?page=VirtualDub_II might help you to get an idea about functions.
Cheers,
|
11-29-2002, 01:08 AM
|
Free Member
|
|
Join Date: Jun 2002
Location: São Paulo - Brasil
Posts: 879
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Quote:
Originally Posted by Graal_CPM
|
Hi Graal_CPM!
Thanks for the link!
I made a function, and it works!
Here is the script:
Quote:
LoadPlugin("D:\DVD Rip Tools\AviSynth2\filters\mpeg2dec.dll")
mpeg2source("C:\Temp\cassia_eller\malandragem.d2v" )
FadeSub("Malandragem", 465,390, "arial",33,$FFFFFF,$000000, 3, 7, 1)
FadeSub("(Cazuza/Frejat)", 465,414, "arial",21,$FFFFFF,$000000, 3, 7, 1)
BilinearResize(448,448,24,16,672,44
clip3=AddBorders(16,16,16,16)
clip4=Dissolve(Blackness(clip3,60),clip3,60)
Dissolve(trim(clip4,0,7202),Blackness(clip3,250),1 50)
#----------------------#
# FadeSub Function #
#----------------------#
function FadeSub(clip clip, string "text", int "x", int "y", string "font", int "size",
\ int "text_color", int "halo_color", int "start", int "stay", int "fade")
{
framerate = 29.976
first_frame = round(framerate * start)
last_frame = round((framerate * stay) + first_frame)
fade_frames = round(framerate * fade)
fin_frame = fade_frames + first_frame
fout_frame = last_frame - fade_frames
solid_sub = Subtitle(clip, text, x, y, first_frame, last_frame, font, size, text_color, halo_color)
sub_fin = Dissolve(trim(clip, first_frame, fin_frame), trim(solid_sub, first_frame, last_frame), fade_frames)
sub_fout = Dissolve(sub_fin, trim(clip, fout_frame, 0), fade_frames)
return (trim(clip, 0, first_frame-1) + sub_fout)
}
|
But I have one problem. See the line that says "framerate = 29.976"? That line should not exist... cause framerate is a function that should return the framerate of the clip. Well, if I erase that line, AVS give me the message: I don't know what "framerate" means
Anyone know what I'm doing wrong?
|
11-29-2002, 06:05 AM
|
Free Member
|
|
Join Date: Jun 2002
Location: Paris, France
Posts: 54
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Well, reading doc at http://www.avisynth.org I understand that synthax is "FRAMERATE(clip)", not FRAMERATE alone.
Very nice script indeed.
Cheers,
|
11-29-2002, 12:34 PM
|
Free Member
|
|
Join Date: Jun 2002
Location: São Paulo - Brasil
Posts: 879
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hey! Thanks again, Graal_CPM!
Now it's working.
I just changed the start, stay and fade variables to float, so you can use fraction of seconds.
I'm using this script to show the name of the music (and composer) of music-videos that are missing that information.
Quote:
#----------------------#
# FadeSub Function #
#----------------------#
function FadeSub(clip clip, string "text", int "x", int "y", string "font", int "size",
\ int "text_color", int "halo_color", float "start", float "stay", float "fade")
{
frame_rate = framerate(clip)
first_frame = round(frame_rate * start)
last_frame = round(first_frame + (frame_rate * stay))
fade_frames = round(frame_rate * fade)
fin_frame = fade_frames + first_frame
fout_frame = last_frame - fade_frames
solid_sub = Subtitle(clip, text, x, y, first_frame, last_frame, font, size, text_color, halo_color)
sub_fin = Dissolve(trim(clip, first_frame, fin_frame), trim(solid_sub, first_frame, last_frame), fade_frames)
sub_fout = Dissolve(sub_fin, trim(clip, fout_frame, 0), fade_frames)
return (trim(clip, 0, first_frame-1) + sub_fout)
}
|
|
All times are GMT -5. The time now is 08:13 AM — vBulletin © Jelsoft Enterprises Ltd
|