irrwahn / svg2ass

Svg2ass - convert SVG vector graphics to ASS subtitle draw instructions.
BSD 3-Clause "New" or "Revised" License
34 stars 4 forks source link
ass c converter graphics subtitles-conversion svg

Svg2ass

Convert SVG vector graphics to ASS subtitle draw instructions.

Overview

SVG2ASS feeds on SVG files and drops ASS dialog lines, ready for pasting in e.g. Aegisub. Only a basic set of SVG funtionality is supported, whereas most of the more advanced features are simply ignored. You can work around some of these limitations by converting all objects to paths and flattening your SVG as much as feasible. The SVG/XML is not validated at all - garbage in, garbage out!

If you don't intend to build svg2ass yourself or just want to give it a quick test run, you may want to check out Gustavo Rodrigues' svg2ass-gui.

Supported SVG elements

Supported SVG attributes

Output format

The ASS dialog lines are generated according to this pattern:

    Dialogue: Layer,Start,End,Style,Name,MarginL,MarginR,MarginV,Effect,Text

Caveat:

Build

SVG2ASS should easily build on an average GNU/Linux or other POSIX compliant system by just executing make. On other systems just slab it together using compiler and linker, see Makefile - nothing fancy there. However, depending on your runtime environment, you might have provide your own getopt, strdup or strcasecmp implementations. Also, you might have to manually copy version.in to version.h

Apparently, it is advisable to change strip -s to strip -S in Makefile when building on macOS.

In case you wish to avoid the hassle of building from source altogether: As mentioned above, Gustavo Rodrigues created svg2ass-gui, a web GUI based on the svg2ass source code. You can try it live here.

Usage

Executing svg2ass -h displays a short help text. Among other general and ASS related, fairly self explaining command line options, SVG2ASS provides an option to render all shapes into a single drawing command per SVG file (which forces all shapes to use the same initial color and border width settings), or alternatively, produce a separate dialog line for each shape (which is the default).

License

Svg2ass is distributed under the Modified ("3-clause") BSD License. See LICENSE for more information.