ass is the format of the subtitle file. The full name of ASS is "Advanced SubStation Alpha". It is an advanced subtitle format based on SSA 4.00 encoding. It adds more special effects and instructions based on the SSA writing style; the plug-in file for subtitles in this format starts with "*.ass" as a suffix. ASS subtitles are plain text files, which means they can be edited manually with any text editor.
The operating environment of this tutorial: Windows 7 system, Dell G3 computer.
ASS is a subtitle format recognized and frequently used by most subtitlers.
SubStation Alpha (Sub Station Alpha), referred to as SSA, is a subtitle file format created by CS Low (also known as Kotus) and has more advanced functions than traditional subtitle formats (such as SRT). Plug-in files for subtitles in this format have the suffix *.ssa.
Advanced SubStation Alpha (ASS) is a subtitle format more advanced than SSA, and its actual version is SSA v4.00. It is built on SSA 4.00 encoding. The main change of ASS is to add more special effects and instructions based on the SSA writing style. Plug-in files for subtitles in this format have the suffix *.ass.
Currently, many players support rendering SSA and ASS subtitles.
ASS is compatible with SSA format.
SSA/ASS subtitles are plain text files, which means they can be used in any Edit manually with a text editor, but be careful: the parser assumes that this script follows the rules defined in the SSA standard, and any errors during parsing may lead to unpredictable results.
The SSA/ASS script is divided into multiple sections in an ini file style. But it is not a standard ini file.
The script contains up to five sections:[Script Info]
,[v4 Styles]
,[Events]
,[Fonts]
,[Graphics]
.
[Script Info]
must be the first line of the entire file.[Fonts]
and[Graphics]
.[Script 15 line types in the Info]
section; style lines in the[v4 Styles]
section;[Events]
section of 6 row types. (Row types are covered separately in each subsequent section).[Events]
section can be scrambled and still be played correctly. We cannot assume that each line of dialogue is arranged in chronological order in the script file.Arial/宋体
will be used.The following is a brief summary of the five main sections in the SSA/ASS file:
This section contains the header and overall body of the script information. [Script Info] must be the first line of a v4 script.
This section contains the definitions of all styles. Every style used by the script should be defined here. ASS uses [v4 Styles].
This part contains all script events, including subtitles, comments, pictures, sounds, images and commands. Basically, everything you see on the screen is in this section.
This section contains information about fonts embedded in the script.
This part contains information about the images embedded in the script.
A typical [Script Info] section is like this:
[Script Info] ; This is a Sub Station Alpha v4 script. ; For Sub Station Alpha info and downloads, ; go to http://www.eswat.demon.co.uk/ Title: Neon Genesis Evangelion - Episode 26 (neutral Spanish) Original Script: RoRo Script Updated By: version 2.8.01 ScriptType: v4.00 Collisions: Normal PlayResY: 600 PlayDepth: 0 Timer: 100,0000
This section defines multiple Row type, its corresponding meaning is as follows:
在实际应用中可能用到的是Title、PlayResX、PlayResY、WrapStyle等。
这一部分包含了所有样式的定义。每一个被脚本使用的样式都应该在这里定义。区别于SSA,ASS 使用[v4+ Styles]
关键字。
典型的字段如下:
[V4 Styles] Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, TertiaryColour, BackColour, Bold, Italic, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, AlphaLevel, Encoding Style: DefaultVCD, Arial,28,11861244,11861244,11861244,-2147483640,-1,0,1,1,2,2,30,30,30,0,0
这一部分用来定义字幕的外观和位置,以便[Events]部分直接引用。此部分由格式行(Format:)和样式行(Style:)组成。除边框样式外,所有样式都可以在[Events]部分使用代码重设。
格式行和样式行的内容一一对应。格式行定义了如何解释样式中的每个字段,因此格式行必须出现在所有的样式之前,且格式行中列出的字段名必须拼写正确!格式行允许在未来将新字段添加到脚本格式中,并且允许旧版本的软件读取它所识别的字段——即使字段顺序已经更改。包括如下23个字段:
Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding
各字段含义如下:
Script line | Remarks |
---|---|
semicolon, after Can be followed by any content. Only used as comments in scripts. Not visible when loading script. The semicolon must be the first character on the line. In older versions, | !:comments |
title is a description of the script. If not specified, automatically set to | untitled
|
The author who originally created the script. If not specified, automatically set to | unknown
|
(Optional) The person who originally translated the conversation. If not specified, this field does not show | |
(optional) The editor of the original script, usually the person who polished and proofread the translation. If not specified, this item does not display | |
(optional) The original timeline person. If not specified, this item is not displayed | |
(optional) Indicates when the script should start playing. If not specified, this item does not show | |
(optional) People from other subtitle groups who updated the original script. If not specified, this item does not display | |
(Optional) Details of updates to the original script by other subtitle groups. If not specified, this entry does not display the | |
version of the SSA script format. For example V4.00. If the version of the SSA program currently in use is older than the version of the script, a warning will be given | |
This determines how the subtitles are moved in order to prevent them from overlapping. | If set to Normal , SSA will attempt to position the subtitles using the positions specified by "Margins". At the same time, subtitles are moved vertically to prevent overlapping. In Normal's anti-overlap mode, new subtitles will appear on top of existing subtitles, but it will look for the lowest non-overlapping position to fill the "gaps" created by other subtitles. If set toReverse , existing subtitles will be moved to make room for new subtitles. This means that subtitles can always be read from top to bottom, but it also means that existing subtitles may appear in the middle of the screen before new subtitles appear. It takes up a lot of screen area. |
The height of the rendering range when rendering subtitles. If playing with Directdraw, SSA v4 will automatically choose the closest enabled setting to the width of the rendering range when rendering subtitles | |
. If playing with Directdraw, SSA v4 will automatically choose the closest enabled setting | |
to the color depth when rendering subtitles. If playing with Directdraw, SSA v4 will automatically choose the closest enabled setting to the | |
script's timer speed, using floating point percentages. For example, | 100.0000represents 100% to four decimal places. Timer speed is a time multiplier applied to the SSA clock to provide ramp times to expand or compress the total time of the script. A speed greater than100% will reduce the total script time, meaning that subtitles will gradually appear earlier and earlier; a speed less than 100%will increase the total script time, meaning that subtitles will gradually appear earlier and earlier. Land appears later and later (like a positive ramp time). Expansion and compression only occur when the script is played, this value does not change the actual time of the script event part. |
defines the default line wrapping method. | 0: Intelligent line wrapping, the division is relatively even, and the upper line is longer. 1: Wrap from the word at the end of the line. Only \N can force a line break. 2: No line breaks, \n and \N force line breaks. 3: Smart line wrapping like 0, the following line is longer. |
Specifies whether the border width and shadow depth scale proportionally with the video resolution. The default is No. | |
格式名 | 备注 |
---|---|
Name | 样式名称(用于[Events]部分引用,区分大小写,不能包含逗号) |
Fontname | 字体名称( Windows所使用的字体名称,区分大小写) |
Fontsize | 字体大小(字号) |
PrimaryColour | 主体颜色(一般情况下文字的颜色) |
SecondaryColour | 次要颜色(在卡拉OK效果中字幕由次要颜色变为主体颜色) |
OutlineColor | 边框颜色 |
BackColour | 阴影颜色 |
Bold | 粗体(-1=开启,0=关闭) |
Italic | 斜体(-1=开启,0=关闭) |
Underline | 下划线( -1=开启,0=关闭) |
Strikeout | 删除线( -1=开启,0=关闭) |
ScaleX | 横向缩放(单位% ,100即正常宽度) |
ScaleY | 纵向缩放(单位% ,100即正常高度) |
Spacing | 字间距(单位像素 ,支持小数) |
Angle | 旋转角度(绕z轴逆时针旋转\frz,负数=顺时针旋转。单位度 ,支持小数) |
BorderStyle | 边框样式(1=边框+阴影,3=不透明底框) |
Outline | 边框宽度(单位像素 ,可用小数) |
Shadow | 阴影深度(单位像素 ,可用小数,右下偏移) |
Alignment | 对齐方式(同小键盘布局,决定了旋转/定位/缩放的参考点) |
MarginL | 左边距(字幕距左边缘的距离,单位像素 ,右对齐和中对齐时无效) |
MarginR | 右边距(字幕距右边缘的距离,单位像素 ,左对齐和中对齐时无效) |
MarginV | 垂直边距(字幕距垂直边缘的距离,单位像素 ,下对齐时表示到底部的距离;上对齐时表示到顶部的距离;中对齐时无效,文本位于垂直中心) |
Encoding | 编码( 0=ANSI,1=默认,128=日文,134=简中,136=繁中,一般用默认1即可 ) |
其中脚本支持的颜色格式是:&Haabbggrr,均为十六进制,取值0-9,A-F。
前2位(alpha)为透明度,00=不透明,FF=DEC255=全透明;
后6是BGR蓝绿红颜色。 排在最前的00可以忽略不写, 如:{\c&HFF&}={\c&H0000FF&}为纯红色、&HFFFFFF=纯白色、&HC8000000=透明度为200的黑色。
该部分的一个典型示例是:
[Events] Format: Marked, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text Dialogue: Marked=0,0:00:01.18,0:00:06.85,DefaultVCD, NTP,0000,0000,0000,,{\pos(400,570)}Like an angel with pity on nobody
[Event]部分由格式行(Format:)和多个事件行组成。格式航定义了事件行中各种字段的具体含义,因此格式行必须出现在所有事件前。事件行包括:
注意后面三个使用频率及兼容性过低,这里不作深入分析。
Format:
Format 行必须出现在所有事件行之前,因为它决定了SSA如何来解析下面的事件行。其所列出的字段必须正确拼写。字段名如下:
Marked, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text
最后的字段总是 Text,以便其可以包含逗号。
格式行支持在未来的脚本格式中添加新的字段,也支持旧版本的软件读出它所能识别的字段,即便字段的顺序发生了变化。其中各字段含义如下:
Number | Field name | Remark |
---|---|---|
1 | Marked | Marked=0 means that the row is not displayed as marked in SSA. Marked=1, indicating that the row is displayed as marked in SSA. Usually set Marked to 0 |
2 | Layer | Any integer. Subtitles with different layer values will be ignored in overlap detection. Large value layers will be overlaid on small value layers. |
3 | Start | The start time of the event, the format is0:00:00:00 (hour:minute :second:millisecond), the minimum unit is 0.01s. It is the amount of time that elapses in script playback while the subtitles are displayed on the screen. Note that there is only one hour. |
4 | End | The end time of the event, the format is0:00:00:00 (hour:minute :seconds:milliseconds). It is the amount of time that elapses in script playback before the subtitles disappear from the screen. Note that there is only one hour. |
5 | Style | Style name. If Default, your own *Default style will replace it. However, if the Default style that the script author wants to use is already stored in the script but is ignored by SSA, if you want to use it, you can modify the name in the style definition line so that it appears in the script's style list. In actual applications, if the Default style is defined in [v4 Styles], and if an undefined style name is used later, the Default style will be used. If the Default style is not defined, then the renderer's own style will be used. |
6 | Name | Character name. Say the character's name for this line of dialogue. Just for easy identification when editing and setting up the timeline. |
7 | MarginL | 4-digit left margin override value (in pixels). 0000 means using the value defined in the Style line. |
8 | MarginR | 4-bit right margin override value (in pixels). 0000 means using the value defined in the Style line. |
9 | MarginV | 4-bit vertical margin override value (in pixels). 0000 means using the value defined in the Style line. |
10 | Effect | Transition effect. Can be a null value, or one of the three transition effects implemented in SSA v4.x. Effect names are case-sensitive and must be spelled correctly without quotation marks. Karaoke , indicates the karaoke effect, highlighting each word in turn. Deprecated as an effect type.Scroll up;y1;y2;delay[;fadeawayheight] , means that the text or image will scroll up on the screen.The parameter fields after Scroll up are separated by semicolons. The y1 and y2 values (in pixels) define the vertical area on the screen where the text will scroll. The two value positions are interchangeable. If both values are 0, the text will scroll up the full height of the screen. The delay value can range from 1 to 100 to reduce the scrolling speed. 0 means scrolling at the original speed without delay. When the delay value is greater than 1, it takes (1000/delay) seconds to move 1 pixel. The fadeawayheigh value is optional and can cause the text to fade out when it scrolls to the edge of its range. Scroll down;y1;y2;delay[;fadeawayheight] , same as above, for scrolling down.Banner;delay[;lefttoright;fadeawaywidth] , indicating that all text is ignored and lengthened to one line, and scrolls across the screen from right to left.The delay value is the same as above. The lefttoright value is optional and takes the value 0 or 1. The default is 0, which means scrolling from right to left. fadeawaywidth value is the same as above. |
11 | Text | Subtitle text. It is the text that actually appears on the screen as subtitles. Any text after the 9th comma is considered subtitle text, so it can contain commas. The text can contain the \n code that represents a line break, or it cancontain the style override control codethat appears between curly braces {}. |
The Dialog event gives the corresponding number according to the field sequence given in the above format line.
Comment, Picture, Sound, Movie, and Command event lines only replace the Text field with the corresponding parameter information. For example, the comment information of Comment, the full command path of Command, the picture path of Picture, etc.
The above four parts are the basic SSA/ASS format. In order to achieve various special effects, it is actually necessary to embed various style control override codes in the Text of the Dialog. The following is a brief summary:
\h
,\n
and\N
, all override codes are written in capital letters within brackets {}.\
.{}
.Alignment
codes, and more may be added later (for example, overrides for shadow and border depth).\pos
and\move
will also act on the entire line of text, as will be mentioned in the specific instructions below.In the following writing,means parameters,
[]
means optional,<..>
Select one.There is no similar symbol in the actual code.
Overwrite code | Explanation and remarks |
---|---|
\n | Line break. If smart line wrapping is enabled,\n will be ignored.Writing example: This is the first line\nThis is the second line. \n will only wrap whenWrapStyle:2 or\q2 . In other modes, it is equivalent to a space. |
\N | Force newline. When smart line wrapping is enabled, it is used instead of\n to implement line wrapping.Line breaks will be forced in any mode. In xy-VSFilter ,\N will also wrap in the transition effect Banner; inlibass ,\N will be in the Banner No line breaks, equivalent to spaces. |
\h | Hard spaces. Without line breaks, this ensures that the subtitles will not break on this space when displaying them (to ensure that the left and right words are on the same line). |
\b | \b1 Make text bold,\b0 Cancel bold.When this parameter is greater than 1, it will be used as the weight value of the font (400 = normal, 700 = bold, note: the thickness of most fonts can be quantized into 2-3 levels). |
\i | \i1 Italicize the text,\i0 Cancel italics. |
\u1Underline the text, \u0Cancel the underlining of the text. |
|
\s1Add strikethrough to text, \s0Cancel text deletion Wire. |
|
\xbord
\ybord | Border width, unit is pixel, OK It's a decimal. When there is x or y, the border width along the X-axis or Y-axis can be set independently.
Writing examples: \bord1 , \xbord2, \ybord3. |
\xshad
\yshad | Shadow depth, unit is pixel, can It's a decimal. When there is x or y, the shadow depth along the X or Y axis can be set independently.
Writing examples: \shad1, \xshad2, \yshad3. |
Specify a font that is installed in the system. case sensitive. If the specified font is not installed, | Arial fontwill be used. Writing example:\fnMicrosoft Yahei . |
Note that the font size here is not the font size. \fs20 It does not mean that the font size (font-size) is 20px, but that the line-height (line-height) is 20px. Mainly It's because VSFilter uses the Windows GDI font interface. |
|
\fs-
| Multiply the font size of the current text by a certain multiple. For example,
\fs 2means multiplying the font size of the current text by 1.2, and \fs-3means multiplying the font size of the current text by 0.7. The calculation method is (10 ± |
\fscy
| Scale text size.
\fscx
is horizontal scaling, \fscy
is vertical scaling. Writing examples:
\fscx233.33 , \fscy50
. Can be used for vector graphics.
|
It changes the distance between characters, default is 0. Writing example: | \fsp3. |
\frx
\fry \frz | represents a certain degree of rotation along the X/Y/Z axis.
\fr
means rotation along the Z axis. Writing examples:
\fr30 , \frx-30
, \fry-233.33
, \frz480
. The origin of its rotation is determined by
\org . If \org
is not specified, then the rotation will be based on the "default anchor point".
|
\fay
| Incline the text lines along the X-axis and Y-axis respectively. For example,
\fax-0.5is equivalent to italics. In general, the absolute value of the factor should not exceed 2. |
Specifies the character set (font encoding) of the text. Usually 0 is English, 1 is system default, 134 is Simplified Chinese, and 136 is Traditional Chinese. | When general subtitle files are saved in Unicode encoding such as UTF-8, this setting can be ignored. |
[&]
| ##
is a hexadecimal RGB value, but the color order is reversed, and the leading 0 can be omitted.
|
\[
|
When c is not followed by other characters, it will be set to the corresponding value defined in the currently used Style . |
|
Writing examples: \1a&H80& ,
\2a&H80 ,
\3a80 ,
\4a&H80& .
The & and H should be present according to the specification, but if not, it can be parsed normally. |
\alpha[&][H]
|
\1a&H .
Writing example: \alpha80 .
|
1, 2, and 3 are left, center, and right at the bottom respectively; 5, 6, and 7 are left, center, and right at the top respectively; 9, 10, and 11 are in the middle respectively Left, center, right. If it is 0 or none, set it to the default location. If multiple \a or \an appear, the first one that appears takes precedence. |
|
Same as the keypad layout. If multiple \a or \an appear, the first one that appears takes precedence. | |
WrapStyle. 0: Intelligent line wrapping, the division is relatively even, and the upper line is longer.1: Wrap from the word at the end of the line. Only \N can force a line break. 2: No line breaks, \n and \N force line breaks. 3: Same as 0, smart line wrapping, the following line is longer. |
|
Provides moving effects for subtitles. | , are the starting point coordinates, are the milliseconds of the start movement and end movement relative to the subtitle display time. , , the subtitles move from , are not written or both are 0, the subtitles will move at an even speed during the entire period. When a line contains \move, the detection of subtitle overlap conflicts will be ignored. | ##\pos(
Position the subtitles At coordinate points , . The top left corner of the screen is 0,0. The "anchoring point" of the subtitle is determined by | \a, Alignment . For example: The anchor point of \an1 is in the lower left corner of the subtitle. The positioning point of \an2 is in the middle of the bottom edge of the subtitle. The anchor point of \an3 is in the lower right corner of the subtitle. The positioning point of \an4 is in the middle of the left line of the subtitle. The positioning point of \an5 is in the middle of the vertical and horizontal subtitles. The positioning point of \an6 is in the middle of the right line of the subtitle. The anchor point of \an7 is in the upper left corner of the subtitle. The positioning point of \an8 is in the middle of the top edge of the subtitle. The anchor point of \an9 is in the upper right corner of the subtitle. When there are multiple \pos and \movein a line, the first one shall prevail. In fact \pos( is equivalent to \move( . 当一行中含有 \pos 时会忽略字幕重叠冲突的检测。 |
\org\( |
设置字幕的原点为 当一行中有多个 \org 时,以第一个为准。原点就是定位点,定位点就是原点。 |
\fad( |
提供简单的淡入淡出效果。t1为淡入时间长度,t2为淡出时间长度。单位为毫秒。 当一行中有多个 \fad 或 \fade 时,以第一个为准。 |
\fade( |
提供复杂的淡入淡出效果。单位为毫秒。 在 在 在 在 在 当 \fade 只有两个参数时,其效果与 \fad 一致。 当一行中有多个 \fad 或 \fade 时,以第一个为准。 |
\[i]clip( |
定义一个矩形,只有在该矩形范围内的内容可见或不可见。 当一行中有多个 \[i]clip 出现时,以最后一个为准。 |
\[i]clip([,]) |
定义一个绘画图形,只有在该绘画图形范围内的内容可见或不可见。 和 的含义与 \p 相同。 |
这里举一个我实际中使用过的示例:
需要控制字幕显示的行间距,需要怎么做呢?
假设字幕预设字体大小为16,下面文本如何控制行间距?
…很长的字幕…\N…下一行字幕…
虽然这里有\N换行符了,但显示出来还是两行紧挨在一起,没有行距。
那么参考上面的覆盖代码,可以通过下面命令调整行间距:
…很长的字幕…\N{\fs12}\N{\fs16}…下一行字幕…
当然最终行间距数值按照需求更改就行了。
SSA/ASS是相对复杂的字幕格式,但其也具有丰富的功能集及可扩展性。本文简要概述了SSA/ASS字幕文件的主要构成及基本样式覆盖代码。
更多相关知识,请访问常见问题栏目!
The above is the detailed content of What is the file format of ass?. For more information, please follow other related articles on the PHP Chinese website!