Online tools to sync, fix and convert subtitle files.
The following repositories are part of Subtitle Tools:
Required php extensions:
- gd for working with images extracted from sup files
Required binaries:
- Vobsub2srt for converting sub/idx to srt
- Uchardet v0.0.6 for detecting text encoding
- Tesseract v3 for OCR'ing sup images
Installation
cp .env.example .env
# Fill in the .env file
composer install
php artisan key:generate
php artisan migrate
npm i && npm run devThe following link can be used to keep the application in sync with Laravel's master branch: compare to laravel master
- Language codes use ISO 639-2 (same as Tesseract)
Subtitle Tools runs four separate queue workers. The supervisor config that keeps these workers running is listed below. The queue workers that handle sub/idx and sup OCR jobs are nice. OCR'ing is a CPU heavy job, it will consume all available processing power of the thread it is running on. Making them nice ensures that web requests and other more important work is given priority.
Supervisor config
[program:st-worker-default]
process_name=%(program_name)s_%(process_num)02d
command=php /var/www/st/current/artisan queue:work --queue=default,A500 --sleep=2 --tries=1
numprocs=3
autorestart=true
user=www-data
[program:st-worker-broadcast]
process_name=%(program_name)s_%(process_num)02d
command=php /var/www/st/current/artisan queue:work --queue=broadcast --sleep=2 --tries=2
autorestart=true
user=www-data
[program:st-worker-1]
process_name=%(program_name)s_%(process_num)02d
command=nice php /var/www/st/current/artisan queue:work --queue=A100,A200,A300,A400,A500 --sleep=2 --tries=1
autorestart=true
user=www-data
[program:st-worker-2]
process_name=%(program_name)s_%(process_num)02d
command=nice php /var/www/st/current/artisan queue:work --queue=B200,A100,A200,A300,A400,A500 --sleep=2 --tries=1
autorestart=true
user=www-data
While debugging, you can run the following command to process all jobs:
artisan queue:work --queue=broadcast,default,B200,A100,A200,A300,A400,A500 --sleep=2 --tries=1The list below shows which queue runs which jobs. The order in which the queues are handled can be found in the supervisor config above.
Jobs per queue
- default
- All
FileJobs
- All
- broadcast
- All events
- A100
BuildSupSrtJob
- A200
ExtractSupImagesJob
- A300
OcrImageJob
- A400
OcrImageJob(when the job in queue A300 takes too long, it is re-dispatched on this lower priority queue with a higher timeout)
- A500
RecordUploadedFileMimesJoband other low priority diagnostic jobs
- A500
CollectSupMetaJobCollectStoredFileMetaJob
- B200
ExtractSubIdxLanguageJob
- Make a new controller that extends
FileJobController, add routes and views - Make a new job that extends
FileJob
- Create a
NewFormatclass that extends the abstractTextFile - Make it use either the
WithFileContenttrait or theWithFileLinestrait - If it can be converted to
Srt, implement theTransformsToGenericSubtitleinterface - Add the
NewFormatclass to the$formatsarray in\App\Subtitles\TextFileFormat
Feel free to open a pull request if you want to add a new feature, or if you want to help improve the code, design, text, seo, or any other part of the website.
If you want want to discuss an idea before implementing it, you can contact me by email, twitter, or by opening an issue.
This project is open-source software licensed under the MIT license