ShowFrameNumber
Raffriff42 (Talk | contribs) m (→ShowFrameNumber: explanatory link for 'top field first') |
Raffriff42 (Talk | contribs) m (use template Par2) |
||
Line 13: | Line 13: | ||
====Parameters==== | ====Parameters==== | ||
− | + | :{{Par2|clip|clip|}} | |
− | :Source clip. | + | ::Source clip. |
− | + | :{{Par2|scroll|bool|false}} | |
− | :If ''true'', the frame number will be drawn only once on the video and scroll from top to bottom; | + | ::If ''true'', the frame number will be drawn only once on the video and scroll from top to bottom; |
− | :If ''false'', it will be drawn on one side, stacked vertically as often as it fits. Default is ''false''. | + | ::If ''false'', it will be drawn on one side, stacked vertically as often as it fits. Default is ''false''. |
− | + | :{{Par2|offset|int|0}} | |
− | :Sets the starting frame number. | + | ::Sets the starting frame number. |
− | + | :{{Par2|x,y|int|0}} | |
− | : Text position. Their interpretation corresponds to [[Subtitle]]'s ''align=4'' and the special meaning of -1 is not available. | + | :: Text position. Their interpretation corresponds to [[Subtitle]]'s ''align=4'' and the special meaning of -1 is not available. |
− | :Note that ''x'' and ''y'' must be used together or not at all; if they are present, the ''scroll'' option is ignored. | + | ::Note that ''x'' and ''y'' must be used together or not at all; if they are present, the ''scroll'' option is ignored. |
− | + | :{{Par2|font|string|"Arial"}} | |
− | :Font name. All installed fonts on the current machine are available. Default "Arial" | + | ::Font name. All installed fonts on the current machine are available. Default "Arial" |
− | + | :{{Par2|size|int|24}} | |
− | :Height of the text in pixels. Default 24. | + | ::Height of the text in pixels. Default 24. |
− | + | :{{Par2|text_color|int|[[Color_presets|color_yellow]]}} | |
− | :Colors for font fill and outline respectively. Default yellow, black. | + | :{{Par2|halo_color|int|[[Color_presets|color_black]]}} |
+ | ::Colors for font fill and outline respectively. Default yellow, black. | ||
− | + | :{{Par2|font_width|int|0}} | |
− | :Set character width in logical units, to the nearest 0.125 unit. See [[Subtitle#Using_spc_and_font_width_arguments|Subtitle]] for an example. Default=0, use Windows' default width. | + | ::Set character width in logical units, to the nearest 0.125 unit. See [[Subtitle#Using_spc_and_font_width_arguments|Subtitle]] for an example. Default=0, use Windows' default width. |
− | + | :{{Par2|font_angle|float|0.0}} | |
− | :Adjust the baseline angle of text in degrees anti-clockwise to the nearest 0.1 degree. Default 0, no rotation. | + | ::Adjust the baseline angle of text in degrees anti-clockwise to the nearest 0.1 degree. Default 0, no rotation. |
− | ==== Examples ==== | + | ====Examples==== |
Draw the frame number on the left side of the clip, scrolling from top to bottom, starting with "00009": | Draw the frame number on the left side of the clip, scrolling from top to bottom, starting with "00009": | ||
Mpeg2Source("clip.d2v") # is always top field first, therefore numbers will be on the left | Mpeg2Source("clip.d2v") # is always top field first, therefore numbers will be on the left | ||
ShowFrameNumber(scroll=true, offset=9, text_color=$ff0000) | ShowFrameNumber(scroll=true, offset=9, text_color=$ff0000) | ||
+ | |||
== ShowSMPTE == | == ShowSMPTE == | ||
Line 52: | Line 54: | ||
{{Template:FuncDef|ShowSMPTE(clip ''clip'' [, float ''fps'', string ''offset'', int ''offset_f'', float ''x'', float ''y'', string ''font'', int ''size'', int ''text_color'', int ''halo_color'', float ''font_width'', float ''font_angle''])}} | {{Template:FuncDef|ShowSMPTE(clip ''clip'' [, float ''fps'', string ''offset'', int ''offset_f'', float ''x'', float ''y'', string ''font'', int ''size'', int ''text_color'', int ''halo_color'', float ''font_width'', float ''font_angle''])}} | ||
− | Displays SMPTE timecode | + | Displays [http://en.wikipedia.org/wiki/SMPTE_timecode SMPTE]-style timecode labels on every current frame. Format is ''HH:MM:SS:FF'' (for example "03:52:39:24" = 3 hours, 52 minutes, 39 seconds and 24 frames). |
+ | |||
+ | Frame 0 is marked "00:00:00:00", frame 1 is marked "00:00:00:01" and so on - unless an ''offset'' is applied. | ||
Due to text rendering, this filter can be slow. | Due to text rendering, this filter can be slow. | ||
====Parameters==== | ====Parameters==== | ||
− | + | :{{Par2|clip|clip|}} | |
− | :Source clip. | + | ::Source clip. |
− | + | :{{Par2|fps|float|(clip.Framerate)}} | |
− | :Not required, unless the | + | ::Not required, unless the source clip.[[Clip_properties|Framerate]] can't be used. Otherwise, the ''fps'' argument is required, and must be 24, 25, 30, or 29.97. |
− | + | :{{Par2|offset|string|}} | |
− | :Sets the start time. Format is ''HH:MM:SS:FF'' (for example "03:52:39:24" - 3 hours, 52 minutes, 39 seconds and 24 frames). | + | ::Sets the start time. Format is ''HH:MM:SS:FF'' (for example "03:52:39:24" - 3 hours, 52 minutes, 39 seconds and 24 frames). |
− | + | :{{Par2|offset_f|int|0}} | |
− | :Sets the starting frame number; ignored if ''offset'' is supplied. | + | ::Sets the starting frame number; ignored if ''offset'' is supplied. |
− | + | :{{Par2|x, y|int|0}} | |
− | : Text position. Their interpretation corresponds to [[Subtitle]]'s ''align=2''. | + | ::Text position. Their interpretation corresponds to [[Subtitle]]'s ''align=2''. |
− | + | :{{Par2|font|string|"Arial"}} | |
− | :Font name. All installed fonts on the current machine are available. Default "Arial" | + | ::Font name. All installed fonts on the current machine are available. Default "Arial" |
− | + | :{{Par2|size|int|24}} | |
− | :Height of the text in pixels. Default 24. | + | ::Height of the text in pixels. Default 24. |
− | + | :{{Par2|text_color|int|[[Color_presets|color_yellow]]}} | |
− | :Colors for font fill and outline respectively. Default yellow, black. | + | :{{Par2|halo_color|int|[[Color_presets|color_black]]}} |
+ | ::Colors for font fill and outline respectively. Default yellow, black. | ||
− | + | :{{Par2|font_width|int|0}} | |
− | :Set character width in logical units, to the nearest 0.125 unit. See [[Subtitle#Using_spc_and_font_width_arguments|Subtitle]] for an example. Default 0. | + | ::Set character width in logical units, to the nearest 0.125 unit. See [[Subtitle#Using_spc_and_font_width_arguments|Subtitle]] for an example. Default 0. |
− | + | :{{Par2|font_angle|float|0.0}} | |
− | :Adjust the baseline angle of text in degrees anti-clockwise to the nearest 0.1 degree. Default 0, no rotation. | + | ::Adjust the baseline angle of text in degrees anti-clockwise to the nearest 0.1 degree. Default 0, no rotation. |
====Drop-Frame versus Non-Drop-Frame Time Code==== | ====Drop-Frame versus Non-Drop-Frame Time Code==== | ||
Line 120: | Line 125: | ||
</div> | </div> | ||
− | ==== Examples ==== | + | ====Examples==== |
ShowSMPTE(offset="00:00:59:29", x=360, y=576, font="georgia", size=24, text_color=$ff0000) | ShowSMPTE(offset="00:00:59:29", x=360, y=576, font="georgia", size=24, text_color=$ff0000) | ||
Line 146: | Line 151: | ||
====Parameters==== | ====Parameters==== | ||
− | + | :{{Par2|clip|clip|}} | |
− | :Source clip. | + | ::Source clip. |
+ | |||
+ | :{{Par2|offset_f|int|0}} | ||
+ | ::Sets the starting frame number. Displayed time will be increased by <tt>offset_f/clip.FrameRate</tt> seconds. | ||
− | + | :{{Par2|x, y|int|0}} | |
− | + | ::Text position. Their interpretation corresponds to [[Subtitle]]'s ''align=2''. | |
− | + | :{{Par2|font|string|"Arial"}} | |
− | : | + | ::Font name. All installed fonts on the current machine are available. Default "Arial" |
− | + | :{{Par2|size|int|24}} | |
− | : | + | ::Height of the text in pixels. Default 24. |
− | + | :{{Par2|text_color|int|[[Color_presets|color_yellow]]}} | |
− | : | + | :{{Par2|halo_color|int|[[Color_presets|color_black]]}} |
+ | ::Colors for font fill and outline respectively. Default yellow, black. | ||
− | + | :{{Par2|font_width|int|0}} | |
− | : | + | ::Set character width in logical units, to the nearest 0.125 unit. See [[Subtitle#Using_spc_and_font_width_arguments|Subtitle]] for an example. Default 0. |
− | + | :{{Par2|font_angle|float|0.0}} | |
− | : | + | ::Adjust the baseline angle of text in degrees anti-clockwise to the nearest 0.1 degree. Default 0, no rotation. |
− | |||
− | |||
== Changes == | == Changes == |
Revision as of 06:05, 27 December 2015
Show frame number or time on the screen.
Contents |
ShowFrameNumber
ShowFrameNumber(clip clip [, bool scroll, int offset, float x, float y, string font, int size, int text_color, int halo_color, float font_width, float font_angle])
Draws text on every frame indicating what frame number AviSynth sees at that point in the script. This is sometimes useful when writing scripts. If you apply additional filters to the clip, they will treat the text on the frame just as they would treat an image, so the numbers may be distorted by the time you see them. Sometimes this is what you want, as it shows frame blending etc.
The frame numbers will be drawn on the left side of the clip for frame-based, top field first material; on the right side for frame-based, bottom field first material and alternating on the left side and right for field-based material, depending whether the field is top or bottom. Much more on the topic of interlaced video on this page: Interlaced Fieldbased.
Due to text rendering, this filter can be slow.
Parameters
- clip clip =
- Source clip.
- bool scroll = false
- If true, the frame number will be drawn only once on the video and scroll from top to bottom;
- If false, it will be drawn on one side, stacked vertically as often as it fits. Default is false.
- int offset = 0
- Sets the starting frame number.
- int x,y = 0
- Text position. Their interpretation corresponds to Subtitle's align=4 and the special meaning of -1 is not available.
- Note that x and y must be used together or not at all; if they are present, the scroll option is ignored.
- string font = "Arial"
- Font name. All installed fonts on the current machine are available. Default "Arial"
- int size = 24
- Height of the text in pixels. Default 24.
- int text_color = color_yellow
- int halo_color = color_black
- Colors for font fill and outline respectively. Default yellow, black.
- int font_width = 0
- Set character width in logical units, to the nearest 0.125 unit. See Subtitle for an example. Default=0, use Windows' default width.
- float font_angle = 0.0
- Adjust the baseline angle of text in degrees anti-clockwise to the nearest 0.1 degree. Default 0, no rotation.
Examples
Draw the frame number on the left side of the clip, scrolling from top to bottom, starting with "00009":
Mpeg2Source("clip.d2v") # is always top field first, therefore numbers will be on the left ShowFrameNumber(scroll=true, offset=9, text_color=$ff0000)
ShowSMPTE
ShowSMPTE(clip clip [, float fps, string offset, int offset_f, float x, float y, string font, int size, int text_color, int halo_color, float font_width, float font_angle])
Displays SMPTE-style timecode labels on every current frame. Format is HH:MM:SS:FF (for example "03:52:39:24" = 3 hours, 52 minutes, 39 seconds and 24 frames).
Frame 0 is marked "00:00:00:00", frame 1 is marked "00:00:00:01" and so on - unless an offset is applied.
Due to text rendering, this filter can be slow.
Parameters
- clip clip =
- Source clip.
- float fps = (clip.Framerate)
- Not required, unless the source clip.Framerate can't be used. Otherwise, the fps argument is required, and must be 24, 25, 30, or 29.97.
- string offset =
- Sets the start time. Format is HH:MM:SS:FF (for example "03:52:39:24" - 3 hours, 52 minutes, 39 seconds and 24 frames).
- int offset_f = 0
- Sets the starting frame number; ignored if offset is supplied.
- int x, y = 0
- Text position. Their interpretation corresponds to Subtitle's align=2.
- string font = "Arial"
- Font name. All installed fonts on the current machine are available. Default "Arial"
- int size = 24
- Height of the text in pixels. Default 24.
- int text_color = color_yellow
- int halo_color = color_black
- Colors for font fill and outline respectively. Default yellow, black.
- int font_width = 0
- Set character width in logical units, to the nearest 0.125 unit. See Subtitle for an example. Default 0.
- float font_angle = 0.0
- Adjust the baseline angle of text in degrees anti-clockwise to the nearest 0.1 degree. Default 0, no rotation.
Drop-Frame versus Non-Drop-Frame Time Code
For some frame rates, drop-frame timecode is enabled. For example it is enabled if the framerate of the clip is between 29.969 and 29.971.
Originally, when the signal of the TV was black and white, NTSC ran at 60 Hz (30 fps). When they added color, they changed it to 59.94 Hz (29.97 fps) due to technical reasons. They run 1000 frames, but count 1001 (they never actually drop a frame, just a frame number). The first two frames are dropped of every minute except the tenth, ie
00:00:00:00, 00:00:00:01, 00:00:00:02, ..., 00:00:59:29, 00:01:00:02, 00:01:00:03, 00:01:59:29, 00:02:00:02, 00:02:00:03, ..., 00:08:59:29, 00:09:00:02, 00:09:00:03, ..., 00:09:59:29, 00:10:00:00, 00:10:00:01, etc
Counting the dropped frames implies that 00:10:00:00 in drop-frame matches 00:10:00:00 in real time.
Something similar holds also for the following framerates:
framerate range | base-rate |
---|---|
29.969 – 29.971 | 30 |
47.951 – 47.953 | 48 |
59.939 – 59.941 | 60 |
119.879 – 119.881 | 120 |
Examples
ShowSMPTE(offset="00:00:59:29", x=360, y=576, font="georgia", size=24, text_color=$ff0000)
fontheight=32 ##bottom center ShowSMPTE(size=fontheight) ##top center ShowSMPTE(size=fontheight, y=(fontheight)) ##top left ShowSMPTE(size=fontheight, x=(fontheight*3), y=(fontheight)) ##top right ShowSMPTE(size=fontheight, x=(Width-fontheight*3), y=(fontheight))
ShowTime
ShowTime(clip clip [int offset_f, float x, float y, string font, int size, int text_color, int halo_color, float font_width, float font_angle])
Displays time for the current frame. Format is HH:MM:SS.DDD (for example "03:52:39.800" = 3 hours, 52 minutes, 39 seconds and 800 milliseconds).
Parameters
- clip clip =
- Source clip.
- int offset_f = 0
- Sets the starting frame number. Displayed time will be increased by offset_f/clip.FrameRate seconds.
- int x, y = 0
- Text position. Their interpretation corresponds to Subtitle's align=2.
- string font = "Arial"
- Font name. All installed fonts on the current machine are available. Default "Arial"
- int size = 24
- Height of the text in pixels. Default 24.
- int text_color = color_yellow
- int halo_color = color_black
- Colors for font fill and outline respectively. Default yellow, black.
- int font_width = 0
- Set character width in logical units, to the nearest 0.125 unit. See Subtitle for an example. Default 0.
- float font_angle = 0.0
- Adjust the baseline angle of text in degrees anti-clockwise to the nearest 0.1 degree. Default 0, no rotation.
Changes
v2.60 | All functions: position (x,y) can be float (previously int) (with 0.125 pixel granularity). ShowSMPTE: added drop-frame for other framerates (other than 30). |
v2.58 | Added ShowTime. Added font_width and font_angle. |
v2.56 | Added offset and other options. |