pysrt
SubRip (.srt) subtitle parser and writer
What it is and what it does
pysrt is a Python library for reading, modifying, and writing SubRip subtitle files. It exposes subtitles as a list-like collection of editable items, each with text, start time, and end time properties. You can shift all subtitles forward or backward in time, rescale them to match different frame rates, slice ranges, or edit individual entries. The package also includes an srt command-line tool for common operations like time-shifting and frame-rate conversion without writing code.
The library is mature and stable but abandoned—the last release was in January 2020 and the repository shows no recent commits. It has no external runtime dependencies, making installation straightforward on systems with build tools. The GPLv3 license is copyleft, so derivative works must also be open-source. It is suitable for stable, read-only subtitle workflows but not recommended for projects requiring active maintenance or bug fixes.
Use it for:
- Batch-shift subtitle timing across a media library to correct sync issues with video files.
- Rescale subtitles from one frame rate to another (e.g., 23.9 fps to 25 fps) for format conversion.
- Programmatically edit or filter subtitle text and timing in video processing pipelines.
- Extract and manipulate subtitle metadata (start/end times, text) for analysis or re-encoding.
- Command-line subtitle adjustment without writing code (srt shift, split, rate commands).
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
pysrt parses, edits, and writes SubRip (.srt) subtitle files, offering both a Python library API and a command-line tool for shifting, splitting, and rescaling subtitles.
Yes, if your use case is stable and read-only (parsing, shifting, rescaling existing .srt files). The library is mature, dependency-free, and widely used. No, if you need active maintenance, bug fixes, or support for modern Python versions beyond what the classifiers claim. The GPLv3 license is a hard blocker for proprietary software. The high install friction (source-only) may complicate deployment on some platforms.
Install
pysrt on PyPI
pip
pip install pysrtuv
uv add pysrtpoetry
poetry add pysrtInstalling pysrt
Before you install
High install friction due to source-only distribution (pysrt-1.1.2.tar.gz). Maintenance is abandoned—last release was 2020-01-20 and last commit 2023-05-09, with no active development. Suitable only for stable, read-only subtitle workflows.
License in practice
GPLv3 copyleft license requires that any derivative work or bundled distribution also be licensed under GPLv3. Acceptable for internal tools and open-source projects, but incompatible with proprietary software that cannot adopt copyleft terms.
Quickstart
pip install pysrt
import pysrt
subs = pysrt.open('movie.srt')
subs.shift(seconds=-2)
subs.save('movie_shifted.srt')
No runtime dependencies, but source-only distribution requires a C compiler or pre-built wheel availability on your platform.
Verify before relying
- Whether the package works reliably on modern Python versions (3.10+) despite classifiers only listing up to 3.5.
- Current state of encoding handling and whether it handles modern subtitle edge cases (emoji, complex markup).
Package facts
| License | GPLv3 (copyleft) |
| Python support | not specified |
| Install friction | high — source build required |
| Runtime dependencies | none |
| Maintenance | abandoned — 2,398 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 508,478/month — #6,278 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: pysrt-1.1.2.tar.gz
Keywords: SubRip, srt, subtitle
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
pysubs2pysubs2 loads, edits, and saves subtitle files…
permissive · top 15,000 on PyPI
srtParse, modify, and compose SRT 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
python-stretchPitch-shifts and time-stretches audio using the…
permissive · top 15,000 on PyPI
subliminalSubliminal downloads subtitles for video files…
permissive · top 15,000 on PyPI
pyrubberbandProvides Python wrappers for time-stretching…
permissive · top 15,000 on PyPI
scenedetectDetects scene cuts and shot changes in videos,…
permissive · top 5,000 on PyPI
editorOpens your system's default text editor (or a…
permissive · top 5,000 on PyPI