Last Updated | | Ratings | | Unique User Downloads | | Download Rankings |
2017-01-16 (12 hours ago) | | Not enough user ratings | | Total: 57 This week: 57 | | All time: 8,678 This week: 12 |
|
Description | | Author |
This class can edit video subtitles in SRT and VTT format.
It can create a new video subtitles file or read an existing file in SRT and VTT format.
The class can also add, change and delete subtitles text at a given time.
The generated subtitles may be saved to a SRT or VTT file or returned as an array.
You can also convert formats from SRT to VTT or VTT to SRT. | |
|
|
Innovation award
Nominee: 6x |
|
Details
lutian/phpEditSubtitles
> text processing
Edit files of video subtitles. You can add, edit or delete subtitles and save into new file in .srt or .vtt format
New: you can convert from SRT to VTT format
Version
1.1
Authors
- [Luciano Salvino] - <lsalvino@hotmail.com>
Installation
To use the tools of this repo only has to be required in your composer.json:
{
"require":{
"lutian/phpEditSubtitles": "dev-master"
}
}
Use
include('phpEditSubtitles.php');
$st = new phpEditSubtitles();
$st->setFile('test.srt');
// set output type to vtt (it will convert from srt to vtt type)
$st->setType('vtt');
$st->readFile();
// Edit the first subtitle
// IMPORTANT: it will reordenate the time. If the amount of time is smaller than $timeIni or bigger than $timeEnd the request will not be processed
$order = 1;
$timeIni = '00:00:00,090';
$timeEnd = '00:00:01,830';
$subtitle = 'Replace the first subtitle';
$st->editSubtitle($order,$timeIni,$timeEnd,$subtitle);
// remove subtitle in position 25
$st->deleteSubtitle(25);
// add subtitle on position 145
// IMPORTANT: it will reordenate the time. If the amount of time is smaller than $timeIni or bigger than $timeEnd the request will not be processed
$order = 145;
$timeIni = '00:05:05,050';
$timeEnd = '00:08:05,130';
$subtitle = 'New subtitle';
$st->addSubtitle($order,$timeIni,$timeEnd,$subtitle);
// save subtitles in a new file
$st->saveFile('newfile.srt');
// get array of subtitles
$subtitles = $st->getSubtitles();
echo '<pre>';
print_r($subtitles);
echo '</pre>';
License
MIT
[Luciano Salvino]:http://mueveloz.com/
|
Applications that use this package |
|
No pages of applications that use this class were specified.
If you know an application of this package, send a message to the author to add a link here.