View Full Version : Creating and using titles in Avisynth
sundrenched
15th April 2008, 06:34
Hi Everyone,
I'm currently learning the ropes of Avisynth, and so far, it's been smooth, except for one thing.
I find it incredible that for video editing, after hunting for several days on the internet, there isn't a single tutorial on how to make titles. NOT SUBTITLES. Titles. Like when you start a video and it tells you the name of the video, the producer, director, etc.
What I've done so far is I've downloaded inkscape, made the title, exported it to png, and then attempted to import it in Avisynth with the ImageSource function. Then when I try to attach it to my clips, eg. in the front and back, I keep getting the error of how Avisynth doesn't permit a clip without audio to splice with a clip with audio.
So, my question is this. How DO you put titles into videos with Avisynth? I don't have a problem making them, the problem is getting the script to read and treat the picture file as an avi, and I understand, now, that a picture can't qualify as an avi, since it's not in a container format.
So, what do you do? Is there a function that takes a picture file, and then repeats for several frames, with a null sound so that the program can accept it? Help! I can't seem to find any decent information on this ANYWHERE.
stickboy
15th April 2008, 08:26
This is completely untested since I don't have AviSynth installed on this computer:
video = AVISource(...)
# Show some image for 5 seconds
imageClip = ImageSource(...).Loop(Int(5 * video.FrameRate()))
imageClip = imageClip.AssumeFPS(video)
imageClip = imageClip.ConvertToYUY2() # or YV12, or whatever format the video clip is in
# Add audio to imageClip using the same audio format as the video clip
imageClip = AudioDub(imageClip, video.BlankClip(length=imageClip.FrameCount()))
imageClip ++ video
Or maybe you should look at this thread (currently only a few topics below yours):
InsertImage() - Simple function to add an image to a video (http://forum.doom9.org/showthread.php?t=136842)
thetoof
15th April 2008, 16:00
Yeah, the function I posted a little while ago can be useful for you.
However, you could also use Aegisub to make those titles. It's basically a subbing program, but it has so many advanced features that you can add many things with it. Only by selecting another position and adding a little fade in + fade out to your subs, they'd look like titles. The help file included in the program is very easy to understand and you can create a LOT of effects with it (I did a karaoke where the letters transformed into petals and then flew away with this program... so titles will be very easy to do).
After that, load them in your video by adding textsub(your .ass) at the end of your script.
sundrenched
17th April 2008, 02:14
Thanks!
The code worked. I have Aegisub, and I have to use it anyway because I'm translating spanish to english.
You know, can I contribute to doom9 with a tutorial on making titles? something simple, because I KNOW that there are other people out there looking to do that with Avisynth. I'm using Avisynth and VirtualDub, actually, to put together my adventure/travel documentary. I'd like to stay away from touching Adobe premier as much as possible, mainly because I've been using GNU/Linux since 1994, and this is the first time that I've had to stick with Windows for any real work, simply because Avisynth isn't ready for linux yet, not to mention no one's made any capture software anywhere near as capable as VirtualDub for Linux.
Say, do you think it's possible to do a documentary completely in Avisynth and Virtualdub?
Anyway, here's some of my work.
This is the trailer of my adventure, that I want to redo completely in Avisynth and VirtualDub. I did it in Premier Pro, and it shows, because the encoder never seems to output at the resolution that I want.
http://www.youtube.com/watch?v=X02XsTQxIpE
And this one is in Avisynth and VirtualDub. That's me half naked teaching classes on Latin American TV.
http://www.youtube.com/watch?v=nvim9Lwpkyg
Anyway, THANK YOU VERY MUCH!
Mug Funky
21st April 2008, 13:50
function titler (clip c, string "filename", int "inframe", int "outframe", int "fade_in", int "fade_out", float "gamma", bool "filter", bool "interlaced")
{
fade_in = default(fade_in,0)
fade_out = default(fade_out,0)
gamma = default(gamma,.7)
filter = default(filter,false)
interlaced = default(interlaced,false)
fade_in= interlaced=true? fade_in*2 : fade_in
fade_out= interlaced=true? fade_out*2 : fade_out
fade_in= fade_in==0? 1 : fade_in
alphaname=string(leftstr(filename,strlen(filename)-4)+"_alpha"+rightstr(filename,4))
c = interlaced==true ? c.separatefields() : c
d=c.killaudio()
frame= filter==true? imagesource(filename).blur(0,1).converttoyv12() : imagesource(filename).converttoyv12()
alpha= filter==true? imagesource(alphaname).blur(0,1).converttoyv12(matrix="pc.601") : imagesource(alphaname).converttoyv12(matrix="pc.601")
frame= frame.selectevery(frame.framecount,0).assumefps(c.framerate)
alpha= alpha.selectevery(alpha.framecount,0).assumefps(c.framerate)
chunk= interlaced==true? frame.loop(outframe-inframe).assumefps(c.framerate()/2).separatefields() : frame.loop(outframe-inframe).assumefps(c.framerate())
chunkalpha= interlaced==true? alpha.loop(outframe-inframe).assumefps(c.framerate()/2).fadein0(fade_in-1).fadeout0(fade_out).levels(0,gamma,255,0,255,coring=false).separatefields().fity2uv() : alpha.loop(outframe-inframe).assumefps(c.framerate()).fadein0(fade_in-1).fadeout0(fade_out).levels(0,gamma,255,0,255,coring=false).fity2uv()
chunk = interlaced==true? mt_merge(d.weave().trim(inframe,outframe),chunk.weave(),chunkalpha.weave(),y=3,u=3,v=3).separatefields() : mt_merge(d.trim(inframe,outframe),chunk,chunkalpha,y=3,u=3,v=3)
interlaced==true? d.weave().trim(0,inframe-1)++chunk++d.trim(outframe+1,0).separatefields() : d.trim(0,inframe-1)++chunk++d.trim(outframe+1,0)
c.hasaudio()==true ? audiodub(last,c) : last
interlaced==true? last.weave() : last
}
this'll fade them up and down as well if you want to, either in interlace or progressive. i haven't used it for a year and a half, so you might need to figure the commands out yourself :)
there's also another one on my hard disk somewhere for making scrolling credits out of a big long image file.
Gavino
21st April 2008, 16:09
function titler (clip c, string "filename", int "inframe", int "outframe", int "fade_in", int "fade_out", float "gamma", bool "filter", bool "interlaced")
{
...
fade_in= interlaced=true? fade_in*2 : fade_in
fade_out= interlaced=true? fade_out*2 : fade_out
...
These two lines give syntax errors. Should be using double equals (interlaced==true), or simply:
fade_in= interlaced? fade_in*2 : fade_in
fade_out= interlaced? fade_out*2 : fade_out
Also, slightly nit-picking here, but filename, inframe and outframe should not be optional parameters as no defaults are provided for them in the function.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.