Skip to content

Instantly share code, notes, and snippets.

@flavioribeiro
Created August 29, 2022 16:14
Show Gist options
  • Save flavioribeiro/7fd94dd71fabf6c7cd01aa60a5519b77 to your computer and use it in GitHub Desktop.
Save flavioribeiro/7fd94dd71fabf6c7cd01aa60a5519b77 to your computer and use it in GitHub Desktop.
import fr.noop.subtitle.vtt.*;
import fr.noop.subtitle.model.SubtitleParsingException;
import fr.noop.subtitle.ttml.*;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
public class Hello {
public static void main (String[] args) throws IOException, SubtitleParsingException {
System.out.println("converting");
VttParser parser = new VttParser("utf-8");
TtmlWriter writer = new TtmlWriter();
FileInputStream vtt = new FileInputStream("/Users/flavior/Development/subtitles/example2.vtt");
VttObject subtitle = parser.parse(vtt);
writer.write(subtitle, new FileOutputStream("/tmp/output.ttml"));
vtt.close();
System.out.println("done");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment