AssRender-Vapoursynth is a Vapoursynth api3 plugin that renders ASS / SSA and SRT (without the HTML-like markup) subtitles, based on the source of pinterf’s fork. It uses libass to render the subtitles, which makes it the fastest, lower memory usage and most correct ASS renderer for Vapoursynth. Now (version >= 0.37.1) it also provides csri interface, you can use it with some support softwares, such as Aegisub.
This also means that it is much more picky about script syntax than VSFilter and friends, so keep that in mind before blaming the filter. Yes, people have reported a lot of errors that were actually the script author’s fault.
Supported video formats:
- 8-, 10-, 12-, 14- and 16-bit integer
- YUV, RGB, GRAY
assrender.TextSub(clip clip, string file, [string vfr, int hinting=0, float scale=1.0, float line_spacing=1.0, float dar, float sar, bool set_default_storage_size=True, int top=0, int bottom=0, int left=0, int right=0, string charset, int debuglevel, string fontdir="", string srt_font="sans-serif", string colorspace])
Like sub.TextFile, xyvsf.TextSub
-
clip: Input video clip. -
file: Your subtitle file. May be ASS, SSA or SRT (without the HTML-like markup). -
vfr: Specify timecodes v1 or v2 file when working with VFRaC. -
hinting: Font hinting mode. Choose between none (0, default), light (1), normal (2) and Freetype native (3) autohinting. -
scale: Font scale. Defaults to 1.0. -
line_spacing: Line spacing in pixels. Defaults to 1.0 and won’t be scaled with frame size. -
frame_width,frame_height: Actual displayed size, provide more information thandar&sar. Of course you need to set both parameters. -
dar,sar: Aspect ratio, less priority thanframe_width&frame_height. You need to set both parameters, too. -
set_default_storage_size: Whether to render ASS according to storage size, default is True. It’s behavior is consistent with the latest libass, but it maybe show some incorrect display effects, you can see Fix rendering with libass to match xy-VSFilter for details. -
top,bottom,left,right: Margins. They will be added to the frame size and may be negative. -
charset: Character set to use, in GNU iconv or enca format. Defaults to detect the BOM and fallback to UTF-8 if BOM not found. Example enca format:enca:pl:cp1250(guess the encoding for Polish, fall back oncp1250) -
debuglevel: How much crap assrender is supposed to spam to stderr. -
fontdir: Additional font directory. Useful if you are lazy but want to keep your system fonts clean. Default value:"" -
srt_font: Font to use for SRT subtitles. Defaults to whatever Fontconfig chooses for “sans-serif”. -
colorspaceselects how subtitle RGB is converted for YUV or grayscale output. RGB output uses the subtitle RGB values directly. An explicit setting overrides the script. With an empty or omitted setting, the filter uses the ASSYCbCr Matrixheader. If that header is missing or unrecognized, the filter uses the legacyVideo Colorspacehint. The default isTV.601when neither supplies a recognized value.none(includingYCbCr Matrix: None) converts subtitle RGB at the destination bit depth using each frame’s_Matrixand_ColorRange. A change in either takes effect even while the same subtitle stays on screen._Matrixaccepts BT.709 (1), FCC (4), BT.601 (5 or 6), SMPTE 240M (7), and BT.2020 non-constant luminance (9). A missing, unspecified (2), or unsupported matrix falls back to BT.709 if the width exceeds 1280 or the height exceeds 576, and to BT.601 otherwise._ColorRangeselects full (0) or limited (1) range. A missing or unrecognized range falls back to full. Each fallback applies independently.guessalways uses the resolution rule above with full range.- Fixed limited-range settings are
TV.601(Rec601,BT.601),TV.709(Rec709,BT.709),TV.fcc,TV.240m, andBT.2020(Rec2020). Fixed full-range settings arePC.601,PC.709,PC.fcc, andPC.240m.
assrender.Subtitle(clip clip, string[] text, [string style="sans-serif,20,&H00FFFFFF,&H000000FF,&H00000000,&H00000000,0,0,0,0,100,100,0,0,1,2,0,7,10,10,10,1", int[] start, int[] end, string vfr, int hinting=0, float scale=1.0, float line_spacing=1.0, float dar, float sar, bool set_default_storage_size=True, int top=0, int bottom=0, int left=0, int right=0, string charset, int debuglevel, string fontdir="", string srt_font="sans-serif", string colorspace])
Like sub.Subtitle, it can render single line or multiline subtile string instead of a subtitle file.
-
clip: Input video clip. -
text: String to be rendered, it will rendering multiline string if input a list. These can include ASS Tags. -
style:textused ASS style -
startandendare zero-based frame indices for eachtextentry. The subtitle is visible fromstartup to but excludingend.- Events and frames use the same millisecond timestamps, taken from
vfrwhen supplied. Frames that fall on the same millisecond share a subtitle sample. - In v2 timecodes, a timestamp after the last frame sets the clip end. Without it,
Subtitleuses the preceding frame duration, or the nominal duration for a one-frame clip. The minimum inferred duration is 1 ms, which also applies to a one-frame clip with an unknown frame rate. Subtitlepairs the two lists by index. It ignores unpaired values and any pairs left after the last text entry.- If there are fewer pairs than text entries, the remaining entries reuse the last complete pair. If there is no complete pair, every entry spans the whole clip.
- If you dont’t render multiline subtitles,
std.Loopmaybe faster.
- Events and frames use the same millisecond timestamps, taken from
Other parameters are same as assrender.TextSub, but not necessarily useful, such as srt_font.
assrender.FrameProp(clip clip, [string prop="ass", string style="sans-serif,20,&H00FFFFFF,&H000000FF,&H00000000,&H00000000,0,0,0,0,100,100,0,0,1,2,0,7,10,10,10,1", string vfr, int hinting=0, float scale=1.0, float line_spacing=1.0, float dar, float sar, bool set_default_storage_size=True, int top=0, int bottom=0, int left=0, int right=0, string charset, int debuglevel, string fontdir="", string srt_font="sans-serif", string colorspace])
FrameProp behaves like Subtitle, except that the ASS event for a frame comes from the given frame property prop, which defaults to "ass". As each frame specifies its own event, there is no need to provide explicit start/end times like Subtitle.
For example, the following code shows the current frame number at the top left corner of each frame for clip c:
c.akarin.Text("FrameNum {N}", prop="ass").assrender.FrameProp()It have two csri render names: assrender_textsub and assrender_ob_textsub. ob means old behavior, their differences can be referred to description of set_default_storage_size in vapoursynth usage.
see .github/workflows/build.yml
The dedicated libass Windows workflow produces a versioned libass archive with all non-system dependencies and the MSVC runtime linked statically. Its public layout is:
include/ass/ass.h
include/ass/ass_types.h
bin/ass.dll
LICENSES/ and VERSIONS.txt are included for redistribution and traceability. Dependency versions are shared by the assrender and standalone builds in .github/dependency-versions.env.
The libass Windows workflow reuses one libass-<version> prerelease tag per libass version. Each run keeps a separate asset named with its assrender commit and UTC build timestamp.
For all modules: see msvc/licenses
- Doom9 forum: https://forum.doom9.org/showthread.php?t=148926
- Avisynth wiki: http://avisynth.nl/index.php/AssRender
- libass original: https://github.com/libass/libass