Skip to main content

Convert Blu-Ray PGS (.sup) subtitles to SRT via OCR

Project description

Prerequisites

Before installing sup2srt, install Tesseract OCR on your machine:

Github Repo: tesseract-ocr

You will need the Tesseract engine and the specific language packs that you want to use.

For example on an Arch Linux machine:

Arch Linux

sudo pacman -S tesseract tesseract-data-eng tesseract-data-deu 

If you're using a different Linux distribution or operating system, check your distribution's documentation.

Installation

The best approach is to install it globally via pipx:

pipx install sup2srt

Alternatively you can install it in a Python environment:

python -m venv .venv

Enable the environment:

source .venv/bin/activate

Install the package using pip:

pip install sup2srt

Compiling from Source Code

If you want to "compile" the tool from the source code/ build a package:

# Create a new folder and clone the repository;
git clone "https://github.com/Frank-Hoffmann-Dev/sup2srt.git"

# Change directory;
cd sup2srt

# Build the package;
python -m build

The packages are now in the dist directory and can be installed using pip/pipx:

# Version number may vary;
pipx install dist/sup2srt-0.1.1-py3-none-any.whl  

Running sup2srt

Check the basic commands with:

sup2srt --help

Convert a .SUP file (Tesseract OCR with English language):

sup2srt movie_subtitles.sup --lang eng

Here are a few different options:

# With multiple threads;
# The number of threads is automatically determined by the number of CPU cores;
# Alternatively you can specify a number of threads;
sup2srt movie_subtitles.sup -w 0

# With two different languages;
sup2srt movie_subtitles.sup -w 0 --lang "eng+deu"

# Provides additional information, such as statistics on processing time;
sup2srt movie_subtitles.sup -w 0 --lang eng --debug

Using batch mode, you can convert multiple .SUP files all at once:

sup2srt --batch /path/to/directory

# You can use the '-O' option to specify the output directory;
sup2srt --batch /path/to/directory -O /home/user/abc/output/srt -l eng -w 0

Batch mode attempts to determine the languages for OCR based on the filename. The '-l' flag can be used to specify fallback languages if the filename does not contain any language information. If no fallback language is specified, 'eng' is used by default.

# Examples for .SUP files;
watchmen_eng.sup
dune_ger.sup

OCR

This tool uses Tesseract OCR.

Subtitles typically consist of white text on a transparent background. However, OCR works best with black text on a white background.

The images extracted from the .SUP files are preprocessed to achieve the best possible results from the OCR engine, but errors in character recognition still occur. Based on my tests, the subtitles are readable and understandable, but they are not perfect.

Tesseract OCR can be configured, and it is quite possible that the results can be further optimized.

The settings are located in the ocr.py module and can be modified as needed.

In general, all modules can be used independently, as they contain self-tests (see the source code).

License

MIT License

Copyright 2026 Frank Hoffmann

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

About

I developed this tool primarily for my own use. As a Linux user, I couldn’t find a satisfying solution for converting SUP files to SRT files.

While there are tools available for Windows, (and these can likely be run on Linux using Wine) I wanted a native solution.

Since I couldn’t find a PIP package for this (maybe there is one after all??), I decided to create one myself.

Thanks

Many thanks to all the developers of the libraries used and to the community for creating so many incredibly useful tools.

AI Usage

I used the AI assistant Anthropic Claude AI - Sonnet 4.6 to create this tool.

As a computer scientist, I have reviewed and approved every single line of code, and I understand the tool’s internal processes and how it works. I didn’t just copy and paste the code from the AI. Instead, I wrote it by hand, line by line, making changes whenever I deemed it necessary.

Nevertheless, there may still be errors or poor design choices. Everyone is free to examine, modify, improve, fork the code or call it AI slop :D

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sup2srt-0.1.2.tar.gz (22.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sup2srt-0.1.2-py3-none-any.whl (27.7 kB view details)

Uploaded Python 3

File details

Details for the file sup2srt-0.1.2.tar.gz.

File metadata

  • Download URL: sup2srt-0.1.2.tar.gz
  • Upload date:
  • Size: 22.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for sup2srt-0.1.2.tar.gz
Algorithm Hash digest
SHA256 f3d36e74a86bddafca7435fa548d4c393fc8bf3f5cefed5efbddad6ec36de357
MD5 06bc2d5ba7452e82e14826cf03f1b10c
BLAKE2b-256 8651368921b0306ce48519f19538a1ff822334d83882e9e58f74ba706725c41b

See more details on using hashes here.

File details

Details for the file sup2srt-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: sup2srt-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 27.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for sup2srt-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 11611a11d6cd784d1941bb0abd01877efd651b9e7897d5f4ebedc277bfd431d6
MD5 b1d42e582f1b358d427beadeaeac383c
BLAKE2b-256 5d97bfc01a62e7d62b58fb4f3e6bce8dca7844abf56c39ab2fea6c1cfdbf34e6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page