/sanverter

SRT⟷ASS Converter

Primary LanguageCommon LispBSD 2-Clause "Simplified" LicenseBSD-2-Clause

LOGO

SANVERTER

SRT⟷ASS Converter

Convert SRT file to ASS file and vise versa.

Author: Panji Kusuma (epanji@gmail.com)

Drawbacks

  • Detail timing will change due to milliseconds and centiseconds different.
  • Information such as title, style and some modifiers will loss due to conversion.
  • Only bold, italic, underline, strikeout and colors will be preserve.
  • Global styles did not preserve like local modifiers.

Dependencies

Primary Features

Converting

Convert file.srt to file.ass with adjustment options:

SANVERTER> (convert-srt-to-ass #p"bad-source.srt" :output #p"tmp.ass" :title "Temporary" :primary-colour "blue violet")
#P"tmp.ass"

Convert file.ass to file.srt with optional output:

SANVERTER> (convert-ass-to-srt #p"bad-source.ass" :output #p"tmp.srt")
#P"tmp.srt"

Secondary Features

Parsing

Parsing SRT format:

SANVERTER> (parse-subrip #p"bad-source.srt")

Parsing VTT format:

SANVERTER> (parse-subrip #p"bad-source.vtt")

Parsing ASS format:

SANVERTER> (parse-subass #p"bad-source.ass")

Printing

Printing SRT format:

SANVERTER> (print-subrip #p"bad-source.srt")

Printing VTT format:

SANVERTER> (print-subrip #p"bad-source.vtt" "en")

Printing ASS format:

SANVERTER> (print-subass #p"bad-source.ass")

Cross Printing

Printing SRT format:

SANVERTER> (print-subrip #p"bad-source.ass")
SANVERTER> (print-subrip #p"bad-source.vtt")

Printing VTT format:

SANVERTER> (print-subrip #p"bad-source.ass" "en")
SANVERTER> (print-subrip #p"bad-source.srt" "en")

Printing ASS format:

SANVERTER> (print-subass #p"bad-source.srt")
SANVERTER> (print-subass #p"bad-source.vtt")

Auto Corrections

Printing from bad source will be corrected.

Before After
1
00:00:00,000 --> 00:01:20,000
Hello world!

00:01:20,000-->  00:02:40,000
<font color=#1A2B3C>Hello <b>world</b>!</font>

3
00:02:40,000 --> 00:01:20,000
<font color="#ABC">Hello <b>world!
Hello world!

1
00:00:00,000 --> 00:01:20,000
Hello world!

2
00:01:20,000 --> 00:02:40,000
<font color="#1A2B3C">Hello <b>world</b>!</font>

3
00:02:40,000 --> 00:04:00,000
<font color="#AABBCC">Hello <b>world!
Hello world!</b></font>

WEBVTT

STYLE
::cue(.aa) {
           color: red;
}
::cue(.bb) {
           color: #1a2b3d;
}

00:00:00.000 --> 00:01:20.000
Hello world!

00:01:20.000 --> 00:02:40.000
<c.aa>Hello <b>world</b>!</c>

00:02:40.000 --> 00:01:20.000
<c.magenta>Hello <b>world!
Hello world!</b></c>

WEBVTT
Kind: captions
Language: en

STYLE
::cue(.ff0000) { color: #ff0000; }
::cue(.ff00ff) { color: #ff00ff; }

00:00:00.000 --> 00:01:20.000
Hello world!

00:01:20.000 --> 00:02:40.000
<c.ff0000>Hello <b>world</b>!</c>

00:02:40.000 --> 00:04:00.000
<c.ff00ff>Hello <b>world!
Hello world!</b></c>

Swing GUI

This is SANVERTER when running with ABCL (Armed Bear Common Lisp) in JVM (Java Virtual Machine)

SWING

Command Line Interface

This is command line interface build with ECL (Embeddable Common Lisp).

Conversions

$ ./sanverter -f vtt ../bad-source.srt

Success converting ../bad-source.srt to ../bad-source.vtt.

$ ./sanverter -f srt ../bad-source.vtt

File ../bad-source.srt already exists.

$ ./sanverter -e nil -f srt ../bad-source.vtt
1
00:00:00,000 --> 00:01:20,000
Hello world!

2
00:01:20,000 --> 00:02:40,000
<font color="#1A2B3C">Hello <b>world</b>!</font>

3
00:02:40,000 --> 00:04:00,000
<font color="#AABBCC">Hello <b>world!
Hello world!</b></font>

Corrections

$ ./sanverter -f srt ../bad-source.srt

Convert nothing for ../bad-source.srt with option '-f srt' or '--format srt'.
If you are sure about this, add option '-c' or '--corrections'.

$ ./sanverter -c -f srt ../bad-source.srt

Success converting ../bad-source.srt to ../bad-source-rev.srt.

For more options:

$ ./sanverter --help

License

BSD 2-Clause License