Watch movies with 2 subtitles at the same time
Java HTML CSS JavaScript
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
submerge-api
submerge-cli
submerge-web
.gitignore
LICENSE.txt
README.md
pom.xml

README.md

submerge

Submerge is a tool that aims to merge two subtitles into one ASS displaying both: one at the top of the screen, the other at the bottom. It can also be used to convert SRT to ASS or ASS to SRT, or to change the encoding of a file.

The project is made up of three sub-project :

  • submerge-api : a library to manage SRT and ASS subtitles
  • submerge-web : the website available at www.submerge.ovh
  • submerge-cli : a command line application with the exact same features as the website, see how to use it here

Basic use of submerge-api

<dependency>
  <groupId>com.github.dnbn.submerge</groupId>
  <artifactId>submerge-api</artifactId>
  <version>1.9.2</version>
</dependency>

Parsing ASS subtitles:

File file = new File("subtitle.ass");

ASSParser parser = new ASSParser();
ASSSub subtitle = parser.parse(file);

System.out.println(subtitle.toString());

Parsing SRT subtitles:

File file = new File("subtitle.srt");
SRTParser parser = new SRTParser();

SRTSub subtitle = parser.parse(file);

System.out.println(subtitle.toString());

Using interfaces:

File file = new File("subtitle.srt");
String extension = FilenameUtils.getExtension(file.getName());

SubtitleParser parser = ParserFactory.getParser(extension);
TimedTextFile subtitle = parser.parse(file);

System.out.println(subtitle.toString());

ASS to SRT:

File file = new File("subtitle.ass");

ASSParser parser = new ASSParser();
ASSSub ass = parser.parse(file);

SubmergeAPI api= new SubmergeAPI();
SRTSub srt = convert.toSRT(ass);

System.out.println(srt.toString());

SRT (or ASS) to ASS:

File file = new File("subtitle.srt");
String extension = FilenameUtils.getExtension(file.getName());

SubtitleParser parser = ParserFactory.getParser(extension);
TimedTextFile subtitle = parser.parse(file);

SimpleSubConfig config = new SimpleSubConfig();
config.setSub(subtitle);

ASSSub ass = new SubmergeAPI().toASS(config);

System.out.println(ass.toString());