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. |
2nd May 2005, 23:35 | #1 | Link |
I know nothing
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... |
3rd May 2005, 09:26 | #3 | Link |
I know nothing
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. |
3rd May 2005, 10:21 | #4 | Link |
Registered User
Join Date: Apr 2002
Location: Germany
Posts: 5,389
|
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!) |
15th March 2009, 19:55 | #6 | Link |
Registered User
Join Date: Jun 2007
Posts: 54
|
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? |
16th March 2009, 21:36 | #7 | Link | |
Avisynth language lover
Join Date: Dec 2007
Location: Spain
Posts: 3,431
|
Quote:
Do this instead: Code:
creds = imagereader(imgCredits).assumefps(video.FrameRate()).loop().trim(0,numFrames-1) Code:
creds = imagereader(imgCredits, end=numFrames-1, fps=video.FrameRate()) |
|
17th March 2009, 05:41 | #8 | Link |
Registered User
Join Date: Jun 2007
Posts: 54
|
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) |
17th March 2009, 06:37 | #9 | Link |
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) } 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) 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. |
18th March 2009, 01:04 | #10 | Link | ||
Avisynth language lover
Join Date: Dec 2007
Location: Spain
Posts: 3,431
|
Quote:
You may need to adjust the vertical scroll distance (4424.0) to something nearer the height of your png. Quote:
|
||
22nd March 2009, 13:17 | #11 | Link |
Registered User
Join Date: Jun 2007
Posts: 54
|
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. |
22nd March 2009, 13:18 | #12 | Link |
Registered User
Join Date: Jun 2007
Posts: 54
|
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.
|
22nd March 2009, 16:43 | #13 | Link | |
Avisynth language lover
Join Date: Dec 2007
Location: Spain
Posts: 3,431
|
Quote:
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. |
|
23rd March 2009, 01:36 | #14 | Link |
Registered User
Join Date: Jun 2007
Posts: 54
|
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?
|
23rd March 2009, 11:18 | #15 | Link | |
Avisynth language lover
Join Date: Dec 2007
Location: Spain
Posts: 3,431
|
Quote:
Code:
return Animate(0, numFrames, "LanczosResize", \ credits, vidWidth, vidHeight, 0.0, 0.0, vidWidth, vidHeight, \ credits, vidWidth, vidHeight, 0.0, 576.0, vidWidth, vidHeight) 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) |
|
23rd March 2009, 15:35 | #16 | Link |
Registered User
Join Date: Jun 2007
Posts: 54
|
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. |
23rd March 2009, 15:50 | #17 | Link |
Registered User
Join Date: Jun 2007
Posts: 54
|
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. |
Thread Tools | Search this Thread |
Display Modes | |
|
|