skillfed

pysubs2

A library for editing subtitle files

pysubs2 v1.8.1 264.0K downloads/30d#8,347 on PyPI436
Permissive license MIT Active released

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 pysubs2

uv

uv add pysubs2

poetry

poetry add pysubs2

Installing 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

Development Status :: 5 - Production/StableIntended Audience :: DevelopersIntended Audience :: End Users/DesktopLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.9Topic :: Multimedia :: VideoTopic :: Software Development :: Libraries :: Python ModulesTopic :: Text Processing :: MarkupTyping :: Typed

Tags

subtitle file editorsrt ass vtt conversionbatch subtitle retimingsubtitle format convertersubtitle text manipulationsubtitle timing adjustmentmulti-format subtitle library
subtitle-editingformat-conversionvideo-processing

More Python Modules packages