Giter Club home page Giter Club logo

subtitle's Introduction

Subtitle library

fr.noop.subtitle provides parsers and writers for different subtitle formats:

  • vtt
  • srt
  • sami (smi)
  • stl ebu
  • ttml
  • ass

VTT

Advanced features

  • voices (v tag)
  • styles
  • classes

Parser

Supported advanced features:

  • voices
  • styles
  • classes

Usage:

import fr.noop.subtitle.vtt.*;
...
VttParser parser = new VttParser("utf-8");
VttObject subtitle = parser.parse(new FileInputStream("/tmp/read/test.vtt"));

Writer

No advanced features implemented.

Usage:

import fr.noop.subtitle.vtt.*;
...
VttObject subtitle;
...
VttWriter writer = new VttWriter("utf-8");
writer.write(subtitle, new FileOutputStream("/tmp/write/test.vtt"));

SRT

Parser

Usage:

import fr.noop.subtitle.srt.*;
...
SrtParser parser = new SrtParser("utf-8");
SrtObject subtitle = parser.parse(new FileInputStream("/tmp/read/test.srt"));

Writer

Usage:

import fr.noop.subtitle.srt.*;
...
SrtObject subtitle;
...
SrtWriter writer = new SrtWriter("utf-8");
writer.write(subtitle, new FileOutputStream("/tmp/write/test.srt"));

SAMI

Parser

Usage:

import fr.noop.subtitle.sami.*;
...
SamiParser parser = new SamiParser("utf-8");
SamiObject subtitle = parser.parse(new FileInputStream("/tmp/read/test.smi"));

Writer

Usage:

import fr.noop.subtitle.sami.*;
...
SamiObject subtitle;
...
SamiWriter writer = new SamiWriter("utf-8");
writer.write(subtitle, new FileOutputStream("/tmp/write/test.smi"));

STL

The implemented STL format is the binary version of STL EBU. Currently only the reader is provided.

All the specifications described in this document https://tech.ebu.ch/docs/tech/tech3264.pdf have been implemented, so you can get data from GSI and TTI blocks.

Advanced features

  • styles
  • positioning

Parser

Usage:

import fr.noop.subtitle.stl.*;
...
StlParser parser = new StlParser();
StlObject subtitle = parser.parse(new FileInputStream("/tmp/read/test.stl"));

TTML

Currently only the writer is provided.

Advanced features

  • styles
  • regions

Parser

Usage:

import fr.noop.subtitle.ttml.*;
import fr.noop.subtitle.model.*;
...
SubtitleObject subtitle;
...
TtmlWriter writer = new TtmlWriter();
writer.write(subtitle, new FileOutputStream("/tmp/write/test.ttml"));

Jar package

To create an executable jar using maven, run the following in the directory where pom.xml is (Note: Maven must already be installed):

mvn package

This will create the executable jar under target/subtitle-*-jar-with-dependencies.jar

Convert from command line

Usage:

java -jar subtitle-*-jar-with-dependencies.jar -i input-file -o output-file

To see more options, run :

java -jar subtitle-*-jar-with-dependencies.jar -h

Analyse from command line

Parse file and report if present :

  • frame rate (numerator and denominator)
  • start timecode
  • first cue timecode

Usage :

java -cp subtitle-*-jar-with-dependencies.jar fr.noop.subtitle.Analyse -i input-file -o analysis_report.json

This will save the report to analysis_report.json

Update lib

subtitle's People

Contributors

bramart avatar clebeaupin avatar hmattner avatar oupen avatar romanelaf avatar sebcreme avatar soualid avatar warry avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

subtitle's Issues

no main manifest attribute, in subtitle-1.1.1.jar

Hello!

I created an executable jar using maven in the root directory of the repository.
Once it was created, I ran the tool to convert my SRT to STL, but I got the following error: "no main manifest attribute, in subtitle-1.1.1.jar" and didn't get any output.

I tried to convert this SRT.

Publish to central Maven repository

Hello!

This is really nice and useful project, thanks!

Have you thought of pushing the latest changes to the central Maven repository? You've done a couple of fixes recently but last version in Maven is from 2021.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.