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. |
![]() |
#1 | Link |
Warm and fuzzy
Join Date: Apr 2010
Location: Moscow, Russia
Posts: 201
|
Another Authors2.avs script...
Another Authors2.avs script...
For your use... Any your sentences and critics are welcomed !!! . Code:
# Authors2.avs # LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\GSCRIPT_11\gscript.dll") ovText = "AviSynth Authors:"+chr(13)+ \ "----------------------------"+chr(13)+ \ "Ben Rudiak-Gould\n"+chr(13)+ \ "Klaus Post"+chr(13)+ \ "Richard Berg"+chr(13)+ \ "Dividee"+chr(13)+ \ "Ian Brabham"+chr(13)+ \ "David Pierre\n"+chr(13)+ \ "Documentation:"+chr(13)+ \ "----------------------------"+chr(13)+ \ "Wilbert Dijkhof"+chr(13)+ \ "Jonathan Ernst"+chr(13)+ \ "Ernst Peche"+chr(13)+ \ "Alexander Balakhnin"+chr(13)+ \ "Alex_e_Basta"+chr(13)+ \ "Arne Stфcker"+chr(13)+chr(13)+ \ "Contributions by:"+chr(13)+ \ "----------------------------"+chr(13)+ \ "Avery Lee, Milan, Naoki Shibata, "+chr(13)+ \ "Peter Pawlowski, Olli Parviainen,"+chr(13)+ \ "Nicolas Capens, DevIL team,"+chr(13)+ \ "Donald Graft, poptones, ARDA"+chr(13)+ \ "Kevin Atkinson, tritical, many more..."+chr(13)+chr(13)+ \ "Thanks to:"+chr(13)+ \ "----------------------------"+chr(13)+ \ "Everyone contributing to the project,"+chr(13)+ \ "Doom9 & team, kwag, stickboy,"+chr(13)+ \ "Jenyok & C°\n" # \ "Jenyok & C°" function MessageClip2(clip c, string text, int "x", int "y", int "dy", int "first_frame", int "last_frame", string "font", \ float "size", int "text_color", int "halo_color", int "align", int "spc", \ float "font_width", float "font_angle", bool "interlaced", int "back_color", string "pixel_type") { last = c dy = Default(dy, size) y = Default(y, int(size)) pixel_type = Default(pixel_type, "YUY2") text_color = Default(text_color, $FFFFFF) # White color text by default... back_color = Default(back_color, $000000) # Black color background by default... StrLen2 = StrLen(text) StrChr13 = String(Chr(13)) StrSlashN = "\n" # As C++ new line string ClipLength = 2 Str1 = "" # Temporary string Str2 = "" # Temporary string StrSum = 0 # Number of substrings in string i = 1 # Index i j = 1 # Index j k = 1 # Index k # Count SubStrings in String... # End of SubString are "\n" or/and Chr(13), see Code function... # GScript(""" while (i <= StrLen2) { Str1 = MidStr(text, i, 1) Str2 = MidStr(text, i, 2) if (Str2 == StrSlashN) { Str1 = StrChr13 i = i + 1 } # End of if () if ((Str1 == StrChr13) || (i == StrLen2)) { StrSum = StrSum + 1 } # End of if () i = i + 1 Str1 = "" Str2 = "" } # End of while () """) # End of GScript () # Calculate Height of Video Clip... # CHeight = int(StrSum * size) CHeight = CHeight + int((StrSum + 1) * dy * 0.125) # 0.125 pixel's interval, see documentation to BlankClip() function ... BlankClip(last, length=ClipLength, height=CHeight, color=back_color, pixel_type=pixel_type) # Insert SubStrings to Video with SubTitle() function... # Str1 = "" # Temporary string Str2 = "" # Temporary string i = 1 # Index i GScript(""" while (i <= StrLen2) { Str1 = MidStr(text, i, 1) Str2 = MidStr(text, i, 2) if (Str2 == StrSlashN) { Str1 = StrChr13 i = i + 1 } # End of if () if ((Str1 == StrChr13) || (i == StrLen2)) { if ((Str1 != StrChr13) && (i == StrLen2)) { k = k + 1 } # End of if () Str1 = "" Str1 = MidStr(text, j, k - 1) SubTitle(last, Str1, x=x, y=y, first_frame=first_frame, last_frame=last_frame, \ font=font, size=size, text_color=text_color, halo_color=halo_color, \ align=align, spc=spc, font_width=font_width, font_angle=font_angle, \ interlaced=interlaced) j = i + 1 k = 0 y = y + dy } # End of if () i = i + 1 k = k + 1 Str1 = "" Str2 = "" } # End of while () """) # End of GScript () return last } # Constants # W768 = 768 # Clip size Width H576 = 576 # Clip size Height FPSVideo = 25.0 FPSDenominator = 1 PixelType = "YUY2" NChannels = 2 AudioRate = 44100 LengthClip = 2048 # !!! You must "select" this value for scrolling all text in video clip from bottom to top ... BackGround = $000000 # Background color ... TextColor = $FFFFFF # White (Yellow) or other TEXT color for scrolling ... # Constants # Speed = "" # High or Low or nothing ... SpeedValue = 4 # Must be betwwen 1..20, maybe more than 20 ... # Constants # ShiftX = 8 ShiftY = 6 Speed = UCase(Speed) SpeedValue = (SpeedValue <= 1) ? 1 : (SpeedValue > 20) ? 20 : SpeedValue BlankClip(length=LengthClip, width=W768, height=H576, fps=FPSVideo, fps_denominator=FPSDenominator, \ audio_rate=AudioRate, channels=NChannels, pixel_type=PixelType, color=BackGround) # ONLY For demonstration ... # #ColorYUV(showyuv=true).Spline64Resize(W768, H576, src_width=Width(last), src_height=Height(last)) # W768 x H576 t_mask = MessageClip2(last, ovText, size=30, align=8, text_color=TextColor, \ back_color=BackGround, pixel_type=PixelType).ColorYUV(levels="tv->pc").Trim(0, 1) # See documentation to SubTitle() function ... t_blank = BlankClip(t_mask, color=TextColor) t_mask_bl = t_mask.blur(1.0).blur(1.0).blur(1.0) Overlay(last, t_mask_bl, mode="subtract") Overlay(last, t_blank, mode="blend", mask=t_mask) #FrameEvaluate("ol_x_offset = 20") # No more times needed ... (Speed == "HIGH") ? \ FrameEvaluate("ol_y_offset = H576 - ((current_frame) * SpeedValue)") : \ (Speed == "LOW") ? \ FrameEvaluate("ol_y_offset = H576 - ((current_frame) / SpeedValue)") : \ FrameEvaluate("ol_y_offset = H576 - (current_frame)") #Spline64Resize(W768-ShiftX, H576-ShiftY, src_width=Width(last), src_height=Height(last)) #BClip=BlankClip(length=LengthClip, width=W768, height=H576, fps=FPSVideo, fps_denominator=FPSDenominator, \ # audio_rate=AudioRate, channels=NChannels, pixel_type=PixelType, color=BackGround) #Overlay(BClip, last, 0, ShiftY / 2) #last = t_mask # For debuging ... #ConvertToYUY2() # For debuging ... What is needed (wanted) more ? There is needed Scrolling Text in frame window not from bottom frame edge to top frame edge, but from bottom frame edge with (+) Shift Y to top frame edge without (-) Shift Y !!! I didn't found directly decision of this problem... . See comments in Code... . #Spline64Resize(W768-ShiftX, H576-ShiftY, src_width=Width(last), src_height=Height(last)) #BClip=BlankClip(length=LengthClip, width=W768, height=H576, fps=FPSVideo, fps_denominator=FPSDenominator, \ # audio_rate=AudioRate, channels=NChannels, pixel_type=PixelType, color=BackGround) #Overlay(BClip, last, 0, ShiftY / 2) Last edited by Jenyok; 10th December 2011 at 15:17. |
![]() |
![]() |
Thread Tools | Search this Thread |
Display Modes | |
|
|