2017 © Pedro Peláez
 

library vtt2srt

A php command-line utility that converts Web Video Text Tracks files (.vtt) to SubRip Subtitle File (.srt)

image

ledat/vtt2srt

A php command-line utility that converts Web Video Text Tracks files (.vtt) to SubRip Subtitle File (.srt)

  • Wednesday, May 4, 2016
  • by lferaml
  • Repository
  • 3 Watchers
  • 11 Stars
  • 7 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 6 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

vtt2srt

A php command-line utility that converts Web Video Text Tracks files (.vtt) to SubRip Subtitle File (.srt), (*1)

So, one of these days I was ready to watch some movie, without realizing that its subtitles were on Web Video Text Tracks (.vtt) format, and my player of choice wouldn't read there files. Then, I did what most people would do: googled "vtt 2 srt", "how to convert vtt files to srt files", and so on., (*2)

To my surprise, utilities that convert vtt files to srt are scarce. The one that I found was a nodejs class that does not work at all. But, after looking at its source and figuring out the logic, I wrote a simple PHP script that did the job. Eventually, I rewrote it into a class., (*3)

The executables are at bin/ folder. To use it PHP command line executable is needed. Example of usage:, (*4)

cd bin
php vtt2srt.php "Dawn.of.the.Planet.of.the.Apes.2014.vtt" "Dawn.of.the.Planet.of.the.Apes.2014.srt"

For Windows users' convenience, a executable batch file is provided., (*5)

cd bin
vtt2srt "Dawn.of.the.Planet.of.the.Apes.2014.vtt" "Dawn.of.the.Planet.of.the.Apes.2014.srt"

and if you wanna use in .php, (*6)

define('__ROOT__', dirname(dirname(__FILE__)));
require_once(__ROOT__.'/projectname/Vtt2Srt.php');
$convert = new \ledat\Vtt2Srt("Dawn.of.the.Planet.of.the.Apes.2014.vtt","Dawn.of.the.Planet.of.the.Apes.2014.srt");
$convert->run();

Hope it can be usefull to you. Have a nice day., (*7)

The Versions

04/05 2016

dev-master

9999999-dev https://github.com/ledazinha/vtt2srt

A php command-line utility that converts Web Video Text Tracks files (.vtt) to SubRip Subtitle File (.srt)

  Sources   Download

GPL-2.0

The Requires

  • php >=5.3.0

 

by Leda Ferreira

vtt srt webvtt subrip