Letterbox

From Avisynth wiki
(Difference between revisions)
Jump to: navigation, search
m (added category)
(formatting, links, phrasing)
Line 1: Line 1:
{{Template:FuncDef|Letterbox(clip ''clip'', int ''top'', int ''bottom'' [, int ''x1''] [, int ''x2''] [, int ''color''])}}
+
<div style="max-width:54em" >
 +
Fills the top and bottom ''rows'' of each frame, and optionally the left and right ''columns'', with black or color. This has several common uses:
 +
* Adjust the [[Aspect_ratios|aspect ratio]] ([[Wikipedia:Letterboxing_(filming)|letterboxing's]] traditional purpose)
 +
* [[Splice]] a smaller resolution clip to a larger one without resizing
 +
* Black out video noise from the existing black bands in an image that's already letterboxed
 +
* Black out the video noise at the bottom of the frame in [[Wikipedia:VHS|VHS]] tape sources.
 +
* Black out [[Wikipedia:Overscan#Overscan_amounts|overscan]] areas in [[Wikipedia:Video_CD|VCD]] or [[Wikipedia:Super_Video_CD|SVCD]] sources.
 +
* Create a quick rectangular [[Mask|mask]] for other filters &ndash; a so-called "[[Wikipedia:Matte_(filmmaking)#Garbage_matte|garbage matte]]"
  
Letterbox simply blocks out the upper ''top'' and lower ''bottom'' scanlines of each frame, and / or optionally blocking out the left (x1) and right (x2) portions for HDTV letterboxing, and using black by default or specifying an optional color. This has a couple of uses: one, it can eliminate stray video noise from the existing black bands in an image that's already letterboxed; two, it can eliminate the garbage lines that often appear at the bottom of the frame in captures from VHS tape.  
+
The functionality of '''Letterbox''' can be duplicated with a combination of [[Crop]] and [[AddBorders]], but '''Letterbox''' is faster and easier.  
  
The functionality of Letterbox can be duplicated with a combination of [[Crop]] and [[AddBorders]], but Letterbox is faster and easier.  
+
Generally, it's better to '''Crop''' video noise off than to black it out; many older lossy compression algorithms don't deal well with solid-color borders, unless the border happens to fall on a [[Wikipedia:Macroblock|macroblock]] boundary (16 pixels for MPEG). However, in some cases, particularly for certain hardware players, it's better to use '''Letterbox''' because it lets you keep a standard frame size.
 +
</div>
  
Generally, it's better to crop this stuff off using Crop or [[CropBottom]] than to hide it with Letterbox. However, in some cases, particularly if you're compressing to MPEG, it's better to use Letterbox because it lets you keep a standard frame size like 352x288 or 320x240. Some MPEG players get confused when the source video has a strange frame size.
 
  
The color parameter is optional, default=0 <black>, and is specified as an RGB value regardless of whether the clip format is RGB or YUV based. See [[Colors]] for more information on specifying colors.
+
== Syntax and Parameters ==
 +
{{FuncDef
 +
|Letterbox(clip ''clip'', int ''top'', int ''bottom'' [, int ''x1'' , int ''x2'' , int ''color'' ] )
 +
}}
  
Another use could also be to clear out overscan areas in VCD or SVCD encodings.  
+
:{{Par2|top, bottom|int|(required)}}
 +
::Number of {{FuncArg|top}} and {{FuncArg|bottom}} rows to blank out.
  
'''Changes:'''
+
:{{Par2|x1, x2|int|0}}
 +
::Number of ''left'' ({{FuncArg|x1}}) and ''right'' ({{FuncArg|x2}}) columns to blank out.
 +
 
 +
:{{Par2|color|int|(black)}}
 +
::Fill color; specified as an RGB value. See [[Colors|this page]] for more information on specifying colors.
 +
::*For YUV clips, colors are converted from full-range (0&ndash;255) to tv-range (16&ndash;235).
 +
 
 +
 
 +
== Changes ==
 
{| border="1"
 
{| border="1"
 
|-  
 
|-  
Line 18: Line 37:
 
|-  
 
|-  
 
| v2.06
 
| v2.06
| Added optional left and right parameters (x1 and x2).
+
| Added optional left and right parameters (''x1'' and ''x2'').
 
|}
 
|}
  

Revision as of 15:28, 30 January 2016

Fills the top and bottom rows of each frame, and optionally the left and right columns, with black or color. This has several common uses:

  • Adjust the aspect ratio (letterboxing's traditional purpose)
  • Splice a smaller resolution clip to a larger one without resizing
  • Black out video noise from the existing black bands in an image that's already letterboxed
  • Black out the video noise at the bottom of the frame in VHS tape sources.
  • Black out overscan areas in VCD or SVCD sources.
  • Create a quick rectangular mask for other filters – a so-called "garbage matte"

The functionality of Letterbox can be duplicated with a combination of Crop and AddBorders, but Letterbox is faster and easier.

Generally, it's better to Crop video noise off than to black it out; many older lossy compression algorithms don't deal well with solid-color borders, unless the border happens to fall on a macroblock boundary (16 pixels for MPEG). However, in some cases, particularly for certain hardware players, it's better to use Letterbox because it lets you keep a standard frame size.


Syntax and Parameters

Letterbox(clip clip, int top, int bottom [, int x1 , int x2 , int color ] )

int  top, bottom = (required)
Number of top and bottom rows to blank out.
int  x1, x2 = 0
Number of left (x1) and right (x2) columns to blank out.
int  color = (black)
Fill color; specified as an RGB value. See this page for more information on specifying colors.
  • For YUV clips, colors are converted from full-range (0–255) to tv-range (16–235).


Changes

v2.07 Added color option.
v2.06 Added optional left and right parameters (x1 and x2).
Personal tools