noophq / subtitle

Convert subtitles from one format to another format. Supported formats: STL EBU, TTML SMI, VTT, SRT
GNU Lesser General Public License v3.0
100 stars 40 forks source link

Valid timecodes not parsed by VTTParser #21

Open berndmoos opened 1 year ago

berndmoos commented 1 year ago

In one of my sample files, VTT time codes look like this:

00:59.000 --> 01:23.000 VTTParser will throw an exception when reading the file. I think this is because it has not recognized this line as being a timecode line. It works fine when time code lines have hours, like so:

00:00:00.389 --> 00:00:07.910

As far as I can see from the specification, both notations should be valid.

The following lines should be changed accordingly:

https://github.com/noophq/subtitle/blob/04fdf39bb73bccab6a2a4de5de4d1fa8dd0bb202/src/main/java/fr/noop/subtitle/vtt/VttParser.java#L94

https://github.com/noophq/subtitle/blob/04fdf39bb73bccab6a2a4de5de4d1fa8dd0bb202/src/main/java/fr/noop/subtitle/vtt/VttParser.java#L109

amentan commented 1 month ago

use ffmpeg command: ffmpeg -i your_file.vtt your_file.srt