pysubs2
A library for editing subtitle files
What it is and what it does
pysubs2 is a Python library for reading, editing, and writing subtitle files across multiple formats. It centers on SubStation Alpha (the native format of Aegisub) but also handles SubRip, MicroDVD, MPL2, TMP, WebVTT, TTML, SAMI, and OpenAI Whisper captions. The library provides both a programmatic API for subtitle manipulation—loading files, shifting timings, modifying text and styling—and a command-line tool for batch conversion and retiming tasks.
The package has no external runtime dependencies, making installation straightforward. It is actively maintained, production-stable, and supports current Python versions. The MIT license places no restrictions on use, modification, or distribution. It is well-suited for developers building video processing pipelines, subtitle editors, or tools that need to work with captions in multiple formats.
Use it for:
- Batch convert subtitle files between formats (e.g., SRT to ASS) across a directory.
- Programmatically adjust subtitle timings in response to video edits or synchronization issues.
- Parse and modify subtitle text, styling, or metadata within a video processing workflow.
- Integrate subtitle handling into a video editor or caption management application.
- Process OpenAI Whisper-generated captions and convert them to standard subtitle formats.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
pysubs2 loads, edits, and saves subtitle files in multiple formats including SubStation Alpha, SubRip, MicroDVD, MPL2, TMP, WebVTT, TTML, SAMI, and OpenAI Whisper captions, with a CLI tool for batch conversion and retiming.
Yes. pysubs2 is a stable, actively maintained library with zero dependencies, broad format support, and a permissive license. Install it if you need to programmatically work with subtitles or build subtitle conversion and retiming tools. The low friction and production-ready status make it a straightforward choice for subtitle-related tasks.
Install
pysubs2 on PyPI
pip
pip install pysubs2uv
uv add pysubs2poetry
poetry add pysubs2Installing pysubs2
Before you install
Low install friction with no runtime dependencies. Actively maintained with a recent release and ongoing commits; classifiers indicate production-stable status and support for current Python versions.
License in practice
MIT license permits commercial and private use with minimal restrictions; you may use, modify, and distribute pysubs2 freely provided you include the license notice.
Quickstart
pip install pysubs2
import pysubs2
subs = pysubs2.load("my_subtitles.ass", encoding="utf-8")
subs.shift(s=2.5)
subs.save("my_subtitles_edited.ass")
Requires Python 3.9 or later.
Verify before relying
- Whether the library handles edge cases in format conversion (e.g., unsupported tags or malformed input) gracefully.
- Performance characteristics when processing large subtitle files or batch operations.
- Completeness of support for advanced SubStation Alpha features beyond basic text and timing.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.9) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | actively maintained — 148 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 263,983/month — #8,347 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: pysubs2-1.8.1-py3-none-any.whl
Keywords: MPL2, MicroDVD, SubRip, SubStation, WebVTT, ass, captions, srt, sub, subtitles, vtt
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
aeidonaeidon reads, writes, and manipulates…
copyleft · top 15,000 on PyPI
pysrtpysrt parses, edits, and writes SubRip (.srt)…
copyleft · top 15,000 on PyPI
webvtt-pyReads, writes, and segments WebVTT caption…
permissive · top 5,000 on PyPI
subliminalSubliminal downloads subtitles for video files…
permissive · top 15,000 on PyPI
srtParse, modify, and compose SRT subtitle files…
permissive · top 15,000 on PyPI
trakitParses track names and filenames to extract…
permissive · top 15,000 on PyPI
pydubPydub provides a high-level Python interface…
permissive · top 5,000 on PyPI
pyaaf2Read, write, and modify Advanced Authoring…
permissive · top 15,000 on PyPI
pywhispercpppywhispercpp provides Python bindings for…
permissive · top 15,000 on PyPI
moviepyMoviePy is a Python library for video editing…
permissive · top 5,000 on PyPI