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.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Usage

Reply
 
Thread Tools Search this Thread Display Modes
Old 2nd May 2005, 23:35   #1  |  Link
Anacondo
I know nothing
 
Anacondo's Avatar
 
Join Date: Jul 2002
Posts: 45
Scrolling credits

Hi. I have a huge bitmap file (720x4500) with text and I would like to make a scrolling video out of it, just like end movie credits. I have made this with Premiere in the past, but using several 720x576 pics instead. I was wondering if there is a simple and straight way of doing this with Avisynth, and found this, but I'd have to write all the text again.

Any ideas? Thanks in advance!

Edit: forgot to say, final video res for this project is 720x576...
Anacondo is offline   Reply With Quote
Old 3rd May 2005, 01:11   #2  |  Link
matrix
Registered User
 
Join Date: Jan 2002
Location: ..north of Great Lakes
Posts: 263
Take a look at this post
__________________
Welcome....to the real world.
matrix is offline   Reply With Quote
Old 3rd May 2005, 09:26   #3  |  Link
Anacondo
I know nothing
 
Anacondo's Avatar
 
Join Date: Jul 2002
Posts: 45
Thanks a lot! I managed to do it tweaking the horizontal scroll example, this is my script:

creds = imagereader("creditos.png").assumefps(25)
return Animate(0, 3000, "Crop", creds, 0, 0, 720, 576, creds, 0, 4424, 720, 576)

But the scripts returns 1001 frames only. How do I change this? I want it to last 2 minutes (3000 frames).

Cheers.
Anacondo is offline   Reply With Quote
Old 3rd May 2005, 10:21   #4  |  Link
Didée
Registered User
 
Join Date: Apr 2002
Location: Germany
Posts: 5,390
To get 3000 frames, just insert a "loop().trim(0,3000)" in the middle of your script.

An improvement could be to make the scrolling more smooth. As it is now, the delta in vertical position is 4424 pixels, which you're going to spread over 3000 frames. Since crop() supports only integer values, as a result many frames will have the image shifted by 1 pixel from the previous frame, and some frames will have a shift of 2 pixels, making the scrolling somewhat "nerveous".
This can be changed by using the cropping routines that are integrated in the resizers, since these support float arguments for the cropping coordinates.

Try this:

Code:
creds = imagereader("creditos.png").assumefps(25)
loop().trim(0,3000)
return Animate(0, 3000, "LanczosResize", creds, 720,576, 0.0, 0.0, 720, 576, creds, 720,576, 0.0,4424.0, 720,576)
__________________
- We´re at the beginning of the end of mankind´s childhood -

My little flickr gallery. (Yes indeed, I do have hobbies other than digital video!)
Didée is offline   Reply With Quote
Old 3rd May 2005, 12:33   #5  |  Link
Anacondo
I know nothing
 
Anacondo's Avatar
 
Join Date: Jul 2002
Posts: 45
Thank you very much! It worked beautifully.

Cheers.
Anacondo is offline   Reply With Quote
Old 15th March 2009, 19:55   #6  |  Link
mel2000
Registered User
 
Join Date: Jun 2007
Posts: 52
I've been looking over credits scripts and can't seem to get any to work. However, I feel the script on this page is worth pursuing so I'd like to get some help with analyzing this one. My problem is that the number of frames continues = 1001 even though I modified the script to last a specified number of frames:

imgCredits = "K:\AppData\Avisynth\credits2.png"

DirectShowSource("K:\AppData\Virtualdub\Class99_short.avi", fps=25.00)

Normalize(0.95)
Levels(0, 1.2, 255, 0, 255, coring=true)
Tweak (hue=0, sat=1.3, bright=0.0, cont=1.0, coring=true, sse=false)
DelayAudio (0.18)

video = last

vidWidth = 720
vidHeight = 576

# make credits last 10 seconds
numSecs = 10
numFrames = Int(numSecs*video.FrameRate())

creds = imagereader(imgCredits).assumefps(video.FrameRate())
loop().trim(0,numFrames)
return Animate(0, numFrames, "LanczosResize", creds, vidWidth,vidHeight, 0.0, 0.0, vidWidth, vidHeight, creds, vidWidth,vidHeight, 0.0,4424.0, vidWidth,vidHeight)

Can someone tell me where I'm going wrong here?
mel2000 is offline   Reply With Quote
Old 16th March 2009, 21:36   #7  |  Link
Gavino
Avisynth language lover
 
Join Date: Dec 2007
Location: Spain
Posts: 3,375
Quote:
Originally Posted by mel2000 View Post
My problem is that the number of frames continues = 1001 even though I modified the script to last a specified number of frames
That's because you are applying loop.trim(0, numFrames) to the video (which incidentally is never used) instead of to the credits.
Do this instead:
Code:
creds = imagereader(imgCredits).assumefps(video.FrameRate()).loop().trim(0,numFrames-1)
or more simply
Code:
creds = imagereader(imgCredits, end=numFrames-1, fps=video.FrameRate())
[Note that Trim(0, 3000) actually gives 3001 frames, a rare slip by Didée (well, it was almost 4 years ago ]
Gavino is offline   Reply With Quote
Old 17th March 2009, 05:41   #8  |  Link
mel2000
Registered User
 
Join Date: Jun 2007
Posts: 52
Thanks for your prompt reply Gavino. However, it looks like I'm still missing something. VirtualDub shows the png credits scroll up quickly, followed by a white background for the rest of the 10 seconds. The one minute DirectShowSource movie is never displayed.

I've listed my modified script below:

**************************************
imgCredits = "K:\AppData\Avisynth\credits2.png"

DirectShowSource("K:\AppData\Virtualdub\Class99_short.avi", fps=25.00)

Normalize(0.95)
Levels(0, 1.2, 255, 0, 255, coring=true)
Tweak (hue=0, sat=1.3, bright=0.0, cont=1.0, coring=true, sse=false)
DelayAudio (0.18)

video = last

vidWidth = 720
vidHeight = 576

# make credits last 10 seconds
numSecs = 10
numFrames = Int(numSecs*video.FrameRate())

creds = imagereader(imgCredits, end=numFrames-1, fps=video.FrameRate())

return Animate(0, numFrames, "LanczosResize", creds, vidWidth,vidHeight, 0.0, 0.0, vidWidth, vidHeight, creds, vidWidth,vidHeight, 0.0,4424.0, vidWidth,vidHeight)
mel2000 is offline   Reply With Quote
Old 17th March 2009, 06:37   #9  |  Link
Sagekilla
x264aholic
 
Join Date: Jul 2007
Location: New York
Posts: 1,752
that's because you're adding it back in.

If we turn the scrolling credits into a function:

Code:
function CreditScroll(clip src, string file, int "numSecs", int "vidWidth", int "vidHeight")
{
fps = src.FrameRate()
numSecs = default(numSecs, 10)
numFrames = int(numSecs * fps)

vidWidth = default(vidWidth, src.Width())
vidHeight = default(vidHeight, src.Height())

credits = ImageReader(file, end=numFrames-1, fps=fps)

return Animate(0, numFrames, "LanczosResize", credits, vidWidth, vidHeight, 0.0, 0.0, vidWidth, vidHeight, credits, vidWidth, vidHeight, 0.0, 4424.0, vidWidth, vidHeight)
}
Now let's think of this in terms of your goal. You want to give the credits after the movie:
Code:
image = "K:\AppData\Avisynth\credits2.png"

DirectShowSource("k:\AppData\VirtualDub\Class99_short.avi", fps=25.00)
Normalize(0.95)
Levels(0, 1.2, 255, 0, 255, coring=true)
Tweak(hue=0, sat=1.3, bright=0.0, cont=1.0, coring=true, sse=false)
DelayAudio(0.18)

video = last

return CreditsScroll(Video, image)
Anything seem wrong here? You're creating a clip of the scrolling credits. But that's it. You're not actually -adding- it to the original movie. To do that, you would do:
Code:
video = last
credits = ScrollCredits(video, image)
# Splicing of video and audio
return video + credits
__________________
You can't call your encoding speed slow until you start measuring in seconds per frame.
Sagekilla is offline   Reply With Quote
Old 18th March 2009, 01:04   #10  |  Link
Gavino
Avisynth language lover
 
Join Date: Dec 2007
Location: Spain
Posts: 3,375
Quote:
Originally Posted by mel2000 View Post
Thanks for your prompt reply Gavino. However, it looks like I'm still missing something. VirtualDub shows the png credits scroll up quickly, followed by a white background for the rest of the 10 seconds.
Is it scrolling up more quickly than you wanted?
You may need to adjust the vertical scroll distance (4424.0) to something nearer the height of your png.
Quote:
The one minute DirectShowSource movie is never displayed.
That's what I meant when I said it was never used. Sagekilla has now explained this very well.
Gavino is offline   Reply With Quote
Old 22nd March 2009, 13:17   #11  |  Link
mel2000
Registered User
 
Join Date: Jun 2007
Posts: 52
Thank you so much for your reply Sagekilla. I can't get over the clarity, elegance and conciseness of your script modifications. Your advice worked perfectly.

image = "K:\AppData\Avisynth\credits2.png"

DirectShowSource("K:\AppData\Virtualdub\Class99_short.avi", fps=25.00)

Normalize(0.95)
Levels(0, 1.2, 255, 0, 255, coring=true)
Tweak (hue=0, sat=1.3, bright=0.0, cont=1.0, coring=true, sse=false)
DelayAudio (0.18)

video = last

# make credits last 10 seconds
credits = CreditScroll(video, image, numSecs=10, vidWidth=720, vidHeight=576)
credits = credits.ConvertToYV12()

# Splicing of video and audio
# Add audio to credits using the same audio format as the video clip
credits = AudioDub(credits, video.BlankClip(length=credits.FrameCount()))

return credits + video

function CreditScroll(clip src, string file, int "numSecs", int "vidWidth", int "vidHeight")
{
fps = src.FrameRate()
numSecs = default(numSecs, 10)
numFrames = int(numSecs * fps)

vidWidth = default(vidWidth, src.Width())
vidHeight = default(vidHeight, src.Height())

credits = ImageReader(file, end=numFrames-1, fps=fps)

return Animate(0, numFrames, "LanczosResize", credits, vidWidth, vidHeight, 0.0, 0.0, vidWidth, vidHeight, credits, vidWidth, vidHeight, 0.0, 576.0, vidWidth, vidHeight)
}

Having said that, I created my transparent png intending to *overlay* my credits on the video. How can this script be modified to overlay the credits instead of putting them at the beginning? Thanks.
mel2000 is offline   Reply With Quote
Old 22nd March 2009, 13:18   #12  |  Link
mel2000
Registered User
 
Join Date: Jun 2007
Posts: 52
Thanks for your helpful reply too, Gavino. Setting the vertical scroll distance to the height of the png graphic was the perfect solution. This scrolling method is much easier to understand, modify and maintain than the one that uses TextSub with an ssa file.
mel2000 is offline   Reply With Quote
Old 22nd March 2009, 16:43   #13  |  Link
Gavino
Avisynth language lover
 
Join Date: Dec 2007
Location: Spain
Posts: 3,375
Quote:
Originally Posted by mel2000 View Post
I created my transparent png intending to *overlay* my credits on the video. How can this script be modified to overlay the credits instead of putting them at the beginning?
Change your script to return, instead of credits + video,
Overlay(video, credits, mask=ShowAlpha(credits))

You will also have to add pixel_type="RGB32" to ImageReader to make it use the transparency. And remove the ConvertToYV12() and AudioDub.
Gavino is offline   Reply With Quote
Old 23rd March 2009, 01:36   #14  |  Link
mel2000
Registered User
 
Join Date: Jun 2007
Posts: 52
Gavino I want to thank you once again for your expert advice. Your instructions worked perfectly. The only issue I have left is that the credits start at the top of the screen and scroll upward, as expected. Is there a way I can get the credits to start scrolling from the bottom of the screen?
mel2000 is offline   Reply With Quote
Old 23rd March 2009, 11:18   #15  |  Link
Gavino
Avisynth language lover
 
Join Date: Dec 2007
Location: Spain
Posts: 3,375
Quote:
Originally Posted by mel2000 View Post
the credits start at the top of the screen and scroll upward, as expected. Is there a way I can get the credits to start scrolling from the bottom of the screen?
The starting and finishing scroll positions are controlled by the numbers shown in blue in the Animate call:
Code:
return Animate(0, numFrames, "LanczosResize", \
    credits, vidWidth, vidHeight, 0.0, 0.0, vidWidth, vidHeight, \
    credits, vidWidth, vidHeight, 0.0, 576.0, vidWidth, vidHeight)
(as seen earlier when changing 4424 to 576).
So you can change the 0.0 to -576.0 to start scrolling from the bottom.
You should study the documentation for Animate and the resizers to understand how this works.

To fit in with the approach of using a generalised function, I would change it to:
Code:
return Animate(0, numFrames-1, "LanczosResize",  \
    credits, vidWidth, vidHeight, 0.0, -vidHeight, vidWidth, vidHeight, \
    credits, vidWidth, vidHeight, 0.0, credits.height, vidWidth, vidHeight)
(where I have also corrected numFrames to numFrames-1).
Gavino is offline   Reply With Quote
Old 23rd March 2009, 15:35   #16  |  Link
mel2000
Registered User
 
Join Date: Jun 2007
Posts: 52
This is my final thanks to you for giving me an understanding of using Avisynth for scrolling credits. As before, your advice was understandable and worked perfectly.

I want you to know that I did a lot of research and used a lot of trial and error scripts before resorting to this forum for help. I had already looked at the Animate filter definition but found it difficult to parse when comparing its Avisynth documentation definition to the multitude of parameters used in the script. I now understand why there are 14 parameters after the "LanczosResize" parameter, and it all makes sense. However, I'm not sure it would all have come together so easily without your script example. I especially appreciate that you placed the start and end frame parameter sets on separate lines for clarity.
mel2000 is offline   Reply With Quote
Old 23rd March 2009, 15:50   #17  |  Link
mel2000
Registered User
 
Join Date: Jun 2007
Posts: 52
For archival purposes I'm posting the final working script:

********************************
image = "K:\AppData\Avisynth\credits2.png"

DirectShowSource("K:\AppData\Virtualdub\Class99_short.avi", fps=25.00)

video = last

# make credits last 10 seconds
credits = CreditScroll(video, image, numSecs=10, vidWidth=720, vidHeight=576)

return overlay(video, credits, mask=ShowAlpha(credits))

function CreditScroll(clip src, string file, int "numSecs", int "vidWidth", int "vidHeight")
{
fps = src.FrameRate()
numSecs = default(numSecs, 10)
numFrames = int(numSecs * fps)

vidWidth = default(vidWidth, src.Width())
vidHeight = default(vidHeight, src.Height())

credits = ImageSource(file, end=numFrames-1, fps=fps, pixel_type="RGB32")

return Animate(0, numFrames-1, "LanczosResize", credits, vidWidth, vidHeight, 0.0, -vidHeight, vidWidth, vidHeight, credits, vidWidth, vidHeight, 0.0, credits.height, vidWidth, vidHeight)
}
********************************

Using a png image for my credits lets me go as wild as I want with the fonts, font colors and sizes, as well as the kerning and line spacing. Thanks to all for their assistance.
mel2000 is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 19:47.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2017, vBulletin Solutions Inc.