Version

From Avisynth wiki
(Difference between revisions)
Jump to: navigation, search
m (one more touch-up)
(expand example w/ new image)
Line 9: Line 9:
  
  
The following script implements a '''Version''' filter with a ''template'' clip argument – for frame rate, image size, and so on.
+
If the '''Version''' message is presented by itself (as is the normal case, when simply checking the installed AviSynth version), you don't care about the exact size, frame rate etc; but if you want to intercut this clip with other video clips, the [[Clip_properties|properties]] must be compatible: you will need more control. The following script implements a variant of the '''Version''' filter with a clip argument {{FuncArg|bg}} which defines the resulting properties, and (if {{FuncArg|showbg}}=true) the video content in the background.
 
<div {{BoxWidthIndent|48|2}} >
 
<div {{BoxWidthIndent|48|2}} >
  function Version(clip C)
+
### 'Version' filter with background/template clip
 +
  function Version(clip bg, bool "showbg")
 
  {
 
  {
     V=Version
+
     showbg = Default(showbg, false)
     M=V.[[ConvertToRGB32]].[[ColorKeyMask]]($404040, 0).[[ShowAlpha]]
+
    bg = (showbg) ? bg : BlankClip(bg, color=$404040)
     [[Overlay]](C, V, mask=M.[[Blur]](0.2),
+
    v=Version
     \      x=(C.Width/2-V.Width/2),  
+
     m=v.ConvertToRGB32.ColorKeyMask($404040, 0).ShowAlpha
     \      y=(C.Height/2-V.Height/2))
+
     Overlay(bg, v, mask=m.Blur(0.2),
 +
     \      x=(bg.Width/2-v.Width/2),  
 +
     \      y=(bg.Height/2-v.Height/2))
 
     return Last
 
     return Last
 
  }
 
  }
 
## usage example with template clip
 
return Version([[ColorBarsHD]](width=600, height=336))
 
 
</div>
 
</div>
 +
 +
:''Example usage with template clip:''
 +
:<code>Version([[ColorBarsHD]](width=600, height=336)</code>
 +
:[[File:Avisynth-version-template-2.61.png]]
 +
 +
 +
:''Showing the argument clip behind the Version message:''
 +
:<code>Version([[ColorBarsHD]](width=600, height=336), '''showbg=true''')</code>
 
:[[File:Avisynth-version-overlay-2.61.png]]
 
:[[File:Avisynth-version-overlay-2.61.png]]
  

Revision as of 18:33, 20 August 2016

Version()

Generates a 24fps, 10-second, RGB24-format video clip with a version, build time, copyright statement, and homepage information in 24-point, Arial, light yellow ($ECF2BF) text on a 25% grey ($404040) background. Width and height are chosen to fit the message, so clip size varies by version.


Avisynth-version-2.6.png


If the Version message is presented by itself (as is the normal case, when simply checking the installed AviSynth version), you don't care about the exact size, frame rate etc; but if you want to intercut this clip with other video clips, the properties must be compatible: you will need more control. The following script implements a variant of the Version filter with a clip argument bg which defines the resulting properties, and (if showbg=true) the video content in the background.

### 'Version' filter with background/template clip 
function Version(clip bg, bool "showbg")
{
    showbg = Default(showbg, false)
    bg = (showbg) ? bg : BlankClip(bg, color=$404040)
    v=Version
    m=v.ConvertToRGB32.ColorKeyMask($404040, 0).ShowAlpha
    Overlay(bg, v, mask=m.Blur(0.2),
    \       x=(bg.Width/2-v.Width/2), 
    \       y=(bg.Height/2-v.Height/2))
    return Last
}
Example usage with template clip:
Version(ColorBarsHD(width=600, height=336)
Avisynth-version-template-2.61.png


Showing the argument clip behind the Version message:
Version(ColorBarsHD(width=600, height=336), showbg=true)
Avisynth-version-overlay-2.61.png
Personal tools