srt
A tiny library for parsing, modifying, and composing SRT files.
What it is and what it does
srt is a minimal Python library for working with SubRip subtitle files. It provides parsing, modification, and composition of SRT files through a simple object-oriented API, converting raw SRT text into Subtitle objects you can inspect and edit, then serialize back to SRT format. The library is designed to handle real-world SRT files that may be malformed or use non-standard formats, including Asian-style (fullwidth) variants.
The package includes both a library API and command-line tools for common subtitle tasks like filtering, time-shifting, and multiplexing. It has no external dependencies beyond the Python standard library, making it lightweight and portable across Linux, macOS, and Windows. The codebase is small (~200 lines excluding docstrings) with high test coverage, and it has been used in production by projects like subsync, NVIDIA RAD-TTS, and manim.
Use it for:
- Parse and extract subtitle timing and content from SRT files for video processing pipelines.
- Repair or normalize malformed SRT files that other parsers reject, then re-export them.
- Adjust subtitle timing (shift, scale) programmatically before re-encoding or remuxing.
- Filter or transform subtitle lines based on language or content criteria using the included CLI tools.
- Build subtitle manipulation features into video editing or transcription applications.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Parse, modify, and compose SRT subtitle files with support for broken or malformed files and Asian-style formats.
Yes, if you need to work with SRT files. The library is stable, well-tested, and has no dependencies. High install friction (source distribution) is a minor drawback, but the package is lightweight and dormant maintenance is acceptable for a mature, focused tool. No security vulnerabilities and permissive licensing make it a low-risk choice.
Install
srt on PyPI
pip
pip install srtuv
uv add srtpoetry
poetry add srtInstalling srt
Before you install
High install friction due to source distribution; however, the package has no runtime dependencies and is extremely lightweight. Maintenance is dormant (last release 2023-03-28, last commit 2024-03-19), but the library is stable and has been in production use since its early releases.
License in practice
Released under MIT, a permissive license allowing commercial and private use with minimal restrictions—no licensing concerns for most projects.
Quickstart
pip install srt
import srt
data = """1
00:00:33,843 --> 00:00:38,097
Subtitle text"""
for sub in srt.parse(data):
print(sub.content)
output = srt.compose(srt_objects)
Verify before relying
- Whether the source distribution (tar.gz) requires compilation or has platform-specific build requirements beyond standard Python tooling.
- Current compatibility with Python versions beyond 3.11, given the dormant maintenance status.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=2.7) |
| Install friction | high — source build required |
| Runtime dependencies | none |
| Maintenance | dormant — 1,235 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 689,259/month — #5,337 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: srt-3.5.3.tar.gz
Keywords: srt
Tags
More Libraries packages
urllib3 is an HTTP client library that provides…
permissive · top 100 on PyPI
requestsRequests is a Python HTTP library that…
permissive · top 100 on PyPI
pluggyPluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
python-dateutilProvides parsing, arithmetic, and recurrence…
permissive · top 100 on PyPI
sixSix provides utility functions to write Python…
permissive · top 100 on PyPI
pytestpytest is a testing framework that lets you…
permissive · top 100 on PyPI
pysrtpysrt parses, edits, and writes SubRip (.srt)…
copyleft · top 15,000 on PyPI
pysubs2pysubs2 loads, edits, and saves subtitle files…
permissive · top 15,000 on PyPI
aeidonaeidon reads, writes, and manipulates…
copyleft · top 15,000 on PyPI
trakitParses track names and filenames to extract…
permissive · top 15,000 on PyPI
webvtt-pyReads, writes, and segments WebVTT caption…
permissive · top 5,000 on PyPI
human-readableConverts numbers, dates, times, file sizes, and…
permissive · top 15,000 on PyPI
humanizeConverts numbers, dates, times, and file sizes…
permissive · top 1,000 on PyPI
agoConverts datetime, timedelta, and timestamp…
permissive · top 15,000 on PyPI
subliminalSubliminal downloads subtitles for video files…
permissive · top 15,000 on PyPI
metomi-isodatetimeParses and manipulates ISO 8601 date-time…
copyleft · top 15,000 on PyPI