A linter for the WebVTT specification with hinting based on common closed captioning standards.
- Clone or download to local directory:
$ git clone https://github.com/mafachu/vttlint.git
- Install dependencies:
$ npm install
vttlint
is a function that takes a file and returns an array of errors.
var vttlint = require('vttlint'),
errors = vttlint('file.vtt');
// errors:
//
// [{ reason: 'Captions should have a minimum duration of 1.333 seconds.',
// cue:
// { identifier: '',
// start: 32.5,
// end: 33.5,
// text: '<v Neil deGrasse Tyson><i>Laughs</i>',
// styles: 'align:left size:50%',
// index: 12 } }]
vttlint
takes an optional second argument that allows you to disable or override certain checks.
You can disable checking for minimum duration like this:
var errors = vttlint('file.vtt', { mindur: false });
You can use vttlint
as a command-line tool by installing it globally:
$ npm install -g
vttlint
takes a file and prints errors to stdout:
$ vttlint file.vtt
cue 12: Captions should have a minimum duration of 1.333 seconds.
1 error
You can override specific checks like this:
$ vttlint file.vtt --mindur 1
Or exclude checks like this:
$ vttlint file.vtt --mindur false
Captions should have a minimum duration of X
seconds. Default is 1.333
.
Captions should have a maximum duration of X
seconds. Default is 6
.
See Issue #8. It is preferred that there are no more than X
lines per caption. Default is 2
.
See Issue #17. Presentation rate should not to exceed X
words per minute (wpm). Accepts any positive integer
. Default is 140
. Also accepts:
"lower"
: 130 wpm"middle"
: 140 wpm"upper"
: 160 wpm
See Issue #50. Simultaneous captions should be synchronized.
See Issue #51. Captions should start at least 0.001 seconds after preceding caption.
See Issue #52. Captions should have no more than X
words before manual line break. Default TBD.
- Captioning Key
- CBC Captioning Style Guide
- WGBH Captioning FAQ
- 3PlayMedia Transcription, Captioning, and Subtitling Standards
MIT