A command line utility for converting Blu-ray subs to SRT or ASS using AI Language Models.
Project description
pgsocr
Convert Blu-Ray SUP subtitles to SRT or ASS using AI Language Models or Tesseract.
Prerequisites
If planning on using Tesseract, see: https://tesseract-ocr.github.io/tessdoc/Installation.html
Make sure to install all the required language packs and note down the location of the 'tessdata' directory.
Make sure to set the TESSDATA_PREFIX environment variable to the location of the 'tessdata' directory from the previous step.
Installation
Download the latest .whl from the Releases tab and install using pip.
Make sure to install the [lm] extras if you want to use AI models.
Usage:
Options:
-i: Specify the path to the SUP file or (batch mode) directory.
-o: Specify the path to the output directory.
-m: Specify the OCR engine to use (florence2 or tesseract or minicpmv).
-l: (Only if using Tesseract) Specify the list of languages to use separated by spaces. Defaults to English.
-b: (Only if using Tesseract) Specify a custom character blacklist for Tesseract. Enter an empty string to turn off the default blacklist.
-f: Specify the output format (SRT or ASS). ASS output also has support for subtitle positioning.
Note: The AI models are more accurate than Tesseract but far more resource heavy. A recent GPU with a large amount of VRAM is recommended.
Examples:
# Single file
pgsocr -i /path/to/file -o path/to/outputdir -m tesseract -l eng jpn
# Multiple files in a directory
pgsocr -i /path/to/inputdir -o /path/to/outputdir -m florence2
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file pgsocr-0.1.5.tar.gz
.
File metadata
- Download URL: pgsocr-0.1.5.tar.gz
- Upload date:
- Size: 10.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: pdm/2.18.1 CPython/3.12.5 Linux/6.10.6-arch1-1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4827ce87b525728bc76d411d2e295c2417a2a5fc7dd7dbfda4f0acd122ddd1b5 |
|
MD5 | cbd46adb185dd45b911d06646c564d71 |
|
BLAKE2b-256 | 77982d5bb87a2a751bfc3a966a650e520b0408b487036e97597dc07cb124ebdf |
File details
Details for the file pgsocr-0.1.5-py3-none-any.whl
.
File metadata
- Download URL: pgsocr-0.1.5-py3-none-any.whl
- Upload date:
- Size: 12.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: pdm/2.18.1 CPython/3.12.5 Linux/6.10.6-arch1-1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d4222d34aa3e491f85b5f0b73cd30c405b4257db7f47c64195f36aae9d0a4b25 |
|
MD5 | e5479a18c2f65d843637505d66cb3d8e |
|
BLAKE2b-256 | 0f04985fcdcea8ee42f3df227621e1cc097515cbb253d9652c8efc6dde688d29 |