Download the PHP package ymakhloufi/subtitle-toolbox without Composer
On this page you can find all versions of the php package ymakhloufi/subtitle-toolbox. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download ymakhloufi/subtitle-toolbox
More information about ymakhloufi/subtitle-toolbox
Files in ymakhloufi/subtitle-toolbox
Package subtitle-toolbox
Short Description A PHP library and command line tool that reads, edits and writes subtitles, transcripts and chapter lists in more than 30 formats.
License MIT
Homepage https://github.com/yama6a/subtitle-toolbox
Informations about the package subtitle-toolbox
[!CAUTION]
This package is abandoned
ymakhloufi/subtitle-toolboxgets no more releases. This repository is a read-only archive of its 1.x and 2.x versions.The project continues as
yama6a/subtitle-toolbox-php:
- Code and issues: https://github.com/yama6a/subtitle-toolbox-php
- Packagist: https://packagist.org/packages/yama6a/subtitle-toolbox-php
- Upgrade from 2.x: docs/upgrade-3.0.md
Never install both packages together. They share the
SubtitleToolbox\namespace.
Subtitle Toolbox
A PHP library and command line tool that reads, edits and writes subtitles, transcripts and chapter lists in more than 30 formats.
Upgrading from 1.x? See the upgrade guide.
Install
From 3.0, the package continues as yama6a/subtitle-toolbox-php. Never install both packages together.
The core package needs neither OCR engine. See ocr.md for the install commands of other systems and languages.
The library needs PHP 8.2 or later with ext-dom and ext-iconv. These extensions are optional:
ext-mbstringfor Unicode upper and lower caseext-zlibfor PGS output and compressed MKV tracksext-curlfor the DeepL and Google translation engines
The command line tool also comes as a PHAR file and as two container images. The -tesseract image includes Tesseract for OCR. See Install without Composer for the commands.
Supported formats
| Format | Case | Name | Extensions | Read | Write | Notes |
|---|---|---|---|---|---|---|
| ASS, SSA | Ass |
ass |
.ass, .ssa |
yes | yes | |
| CSV, TSV | Csv, Tsv |
csv, tsv |
.csv, .tsv |
yes | yes | not detected from the content |
| EBU STL | EbuStl |
stl |
.stl |
yes | yes | binary, 25 or 30 fps |
| iTunes Timed Text | Itt |
itt |
.itt |
yes | yes | needs a frame rate to write |
| LRC | Lyrics |
lrc |
.lrc |
yes | yes | with enhanced LRC word times |
| MicroDVD | MicroDvd |
microdvd |
.sub |
yes | yes | needs the frame rate of the video |
| MPL2 | Mpl2 |
mpl2 |
.txt |
yes | yes | |
| MPSub | MpSub |
mpsub |
.mpsub |
yes | yes | |
| SAMI | Sami |
sami |
.smi, .sami |
yes | yes | one language class per parse |
| SBV | Sbv |
sbv |
.sbv |
yes | yes | |
| SCC | Scc |
scc |
.scc |
yes | yes | CEA-608 closed captions |
| SubRip | SubRip |
srt |
.srt |
yes | yes | |
| SubViewer 1 and 2 | SubViewer |
subviewer |
.sub |
yes | yes | |
| TMPlayer | TmPlayer |
tmplayer |
.txt |
yes | yes | |
| TTML, IMSC, DFXP | Ttml |
ttml |
.ttml, .dfxp, .xml |
yes | yes | |
| WebVTT | WebVtt |
vtt |
.vtt |
yes | yes | also chapters |
| PGS | Pgs |
pgs |
.sup |
yes | yes | Blu-ray bitmaps as image cues |
| VobSub | VobSub |
vobsub |
.idx with .sub |
yes | no | DVD bitmaps as image cues |
| JSON of this library | Json |
json |
.json |
yes | yes | |
| Plain text | PlainText |
txt |
.txt |
no | yes | transcript |
| Whisper JSON | Whisper |
whisper |
.json |
yes | no | OpenAI API, openai-whisper, faster-whisper, WhisperX, whisper.cpp |
| Cloud speech-to-text JSON | AwsTranscribe, Deepgram, AssemblyAi, GoogleSpeech |
aws-transcribe, deepgram, assemblyai, google-speech |
.json |
yes | no | not detected from the content |
| YouTube timed text | YouTubeTimedText |
youtube |
.json3, .srv3, .srv1 |
yes | no | json3, srv1, srv2, srv3 and transcript XML |
| Podcasting 2.0 transcript JSON | PodcastTranscript |
podcast-transcript |
.json |
yes | yes | |
| HTML transcript | HtmlTranscript |
html |
.html, .htm |
yes | yes | the Podcasting 2.0 HTML format |
| YouTube chapters | YouTubeChapters |
youtube-chapters |
.txt |
yes | yes | not detected from the content |
| Podcasting 2.0 chapters | PodcastChapters |
podcast-chapters |
.json |
yes | yes | not detected from the content |
| FFmpeg metadata chapters | FfMetadataChapters |
ffmeta-chapters |
.ffmeta |
yes | yes | not detected from the content |
| OGM chapters | OgmChapters |
ogm-chapters |
.txt |
yes | yes | not detected from the content |
| MKV and WebM tracks | .mkv, .webm |
yes | no | text, ASS, SSA, WebVTT and PGS tracks |
Case is the case of the enum Format, for example Format::SubRip. Name is the format name for --from and --to. An image cue holds a bitmap in place of text.
Command line tool
Composer installs vendor/bin/subtitle-toolbox. Optional parts are in brackets.
- Without
-o, the output goes to standard output. - Several inputs need
--output-dir, for exampleretime season1/ --shift 2 --output-dir fixed/. - No command overwrites a file.
- When detection fails, pass
--from.
subtitle-toolbox convert --help lists the option groups of convert. See cli.md for all commands and options.
Library
Load and write
Read options
See read-options.md for the options of each format.
Edit
A service such as HearingImpairedRemover changes the subtitle in place and returns a report.
Validate and count
MKV and WebM tracks
OCR
create() takes the Tesseract language as its second argument, for example 'deu+eng'. For engine settings, pass TesseractOcrOptions to new TesseractOcrEngine() or GlyphOcrOptions to new GlyphOcrEngine().
Translate
GoogleTranslateEngine works the same way. See translation.md.
Sync to a reference
Every exception implements SubtitleToolboxException. See errors.md.
OCR
OCR turns the bitmaps of PGS and VobSub subtitles into text. The library uses Tesseract when it is installed. Otherwise it uses php-glyph-ocr. When neither engine is installed, the call throws InvalidArgumentException that names both engines. Tesseract reads more than 100 languages. php-glyph-ocr reads only Latin-script fonts. See ocr.md for the install commands and a comparison of the engines.
Compatibility
See compatibility.md for the parts that semantic versioning covers and for what a minor or patch release can change.
Documentation
docs/README.md lists every page. The most used pages:
- cli.md: all commands and options
- formats.md: what each parser reads and each formatter writes
- editing.md: retiming, cutting, joining and splitting cues
- text.md: text changes, hearing-impaired removal, common error fixes
- validation.md: rules and presets
- sync.md: sync to a reference or to the speech
- subtitle.md: metadata, comments, cue lookup, statistics
Contributing
Pull requests are welcome. Run the tests with composer test. Each pull request carries one label that sets the version bump: major, minor, patch or skip-release. Every merge to master publishes a release.
License
MIT, see LICENSE.
All versions of subtitle-toolbox with dependencies
ext-dom Version *
ext-iconv Version *