XML to VTT subtitles Converter
A dart console application to convert and generate vtt
files from a specific xml
subtitle files.
Usage
The example files are located in the data
folder, used also for testings.
This command will genarate vtt
files from all xml
files located in the specified folder, the current folder by default.
- The command:
xmltovtt -d <folder path>
. - Ex:
xmltovtt
: Executed in the current folder.xmltovtt -d data
: Executed in thedata
folder.
How it works
The xml
files format:
<xml>
<dia>
<st>15330</st>
<et>15870</et>
<sub><![CDATA[The 1st subtitle.]]></sub>
<style name="style" version="2">
<position alignment="BottomCenter" horizontal-margin="50%" vertical-margin="86%" />
</style>
</dia>
<dia>
<st>49250</st>
<et>51250</et>
<sub><![CDATA[The second subtitle.]]></sub>
<style name="style" version="2">
<position alignment="BottomCenter" horizontal-margin="50%" vertical-margin="86%" />
</style>
</dia>
</xml>
Time | xml ms | vtt | Description |
---|---|---|---|
st: start time | 15330 | 00:00:15.330 | Converted from ms to hh:mm:ss.xxx (xxx: milliseconds) |
et: end time | 15870 | 00:00:15.870 | Converted from ms to hh:mm:ss.xxx (xxx: milliseconds) |
- sub: the subtitle is marked as
<sub><![CDATA[
The sub title]]></sub>
.
The converted vtt
files format:
WEBVTT
00:00:15.330 --> 00:00:15.870
Look at Sword Point.
00:00:49.250 --> 00:00:51.250
to protect you.