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
- Vobsub2srt for converting sub/idx to srt
- Uchardet for detecting text encoding
- Tesseract v3 for OCR'ing sup images
Optional PECL extension:
- rar for extracting rar archives uploaded by users
cp .env.example .env # Fill in the .env file composer install php artisan key:generate php artisan migrate npm i && npm run dev
The 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.
[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
Processing all jobs
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=1
Jobs per queue
The 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
- All events
OcrImageJob(when the job in queue A300 takes too long, it is re-dispatched on this lower priority queue with a higher timeout)
Adding a FileGroup + FileJob tool
- Make a new controller that extends
FileJobController, add routes and views
- Make a new job that extends
Adding a new plain-text format
- Create a
NewFormatclass that extends the abstract
- Make it use either the
WithFileContenttrait or the
- If it can be converted to
Srt, implement the
- Add the
NewFormatclass to the
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