pyasstosrt
pyasstosrt – this tool will help you convert Advanced SubStation Alpha (ASS/SSA) subtitle files to SubRip (SRT) files.
Support for str path:
from pyasstosrt import Subtitle
sub = Subtitle('sub.ass')
sub.export()
Support for all Path-like objects, instead of only pathlib's Path:
from pathlib import Path
from pyasstosrt import Subtitle
path = Path('sub.ass')
sub = Subtitle(path)
sub.export()
You can get a sheet with dialogue by specifying output_dialogues.
from pathlib import Path
from pyasstosrt import Subtitle
path = Path('sub.ass')
sub = Subtitle(path)
sub.export(output_dialogues=True)
If you want to remove effects from text, you can use the removing_effects.
from pyasstosrt import Subtitle
sub = Subtitle('sub.ass', removing_effects=True)
sub.export()
You can enable the deletion of duplicate lines with the rearrangement of start and end times.
from pyasstosrt import Subtitle
sub = Subtitle('sub.ass', remove_duplicates=True)
sub.export()
You can get a list of all styles in the file and filter subtitles by style names.
from pyasstosrt import Subtitle
# Get list of all styles in the file
sub = Subtitle('sub.ass')
styles = sub.get_styles()
print(styles) # ['Default', 'Alt', 'Signs', 'Credits']
# Export only styles with "Default" in name (e.g., Default, Default_dvd)
sub = Subtitle('sub.ass', only_default_style=True)
sub.export()
# Export only Default style
sub = Subtitle('sub.ass', include_styles=['Default'])
sub.export()
# Export only Default and Alt styles
sub = Subtitle('sub.ass', include_styles=['Default', 'Alt'])
sub.export()
# Exclude Signs and Credits styles
sub = Subtitle('sub.ass', exclude_styles=['Signs', 'Credits'])
sub.export()
CLI
🎬 Export Command
Convert ASS/SSA subtitle files to SRT format with various options.
Basic usage:
pyasstosrt export subtitle.ass
Specify output directory:
pyasstosrt export subtitle.ass --output-dir /path/to/output
# or use short form
pyasstosrt export subtitle.ass -o /path/to/output
Remove effects and duplicates:
pyasstosrt export subtitle.ass --remove-effects --remove-duplicates
# or use short form
pyasstosrt export subtitle.ass -r -d
Process multiple files at once:
pyasstosrt export subtitle1.ass subtitle2.ass subtitle3.ass
Style filtering options:
# Export only styles with "Default" in name (e.g., Default, Default_dvd)
pyasstosrt export subtitle.ass --only-default
# Export only specific styles
pyasstosrt export subtitle.ass --include-styles "Default,Signs"
# Exclude specific styles
pyasstosrt export subtitle.ass --exclude-styles "Signs,Credits"
Custom encoding:
pyasstosrt export subtitle.ass --encoding utf-16
Print dialogues to console:
pyasstosrt export subtitle.ass --output-dialogues
🎨 Styles Command
List all unique styles found in an ASS subtitle file.
Basic usage:
pyasstosrt styles subtitle.ass
Display in table format:
pyasstosrt styles subtitle.ass --table
# or use short form
pyasstosrt styles subtitle.ass -t
🔧 General Options
Show version:
pyasstosrt --version
# or
pyasstosrt -v
Show help:
pyasstosrt --help
pyasstosrt export --help
pyasstosrt styles --help
Enable shell completion:
# For bash
pyasstosrt --install-completion bash
# For zsh
pyasstosrt --install-completion zsh
# For fish
pyasstosrt --install-completion fish
Installation
Most users will want to simply install the latest version, hosted on PyPI:
$ pip install 'pyasstosrt[cli]'
If you just want to use it as a library and don't need the CLI, you can omit the [cli] extra.
Metadata
Release files for pyasstosrt 1.5.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pyasstosrt-1.5.0.tar.gz | 15.6 kB | Without provenance | Details for pyasstosrt-1.5.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pyasstosrt-1.5.0-py3-none-any.whl | Python 3 | none | any | Details for pyasstosrt-1.5.0-py3-none-any.whl |
Total release size: 31.5 kB
Release files / pyasstosrt-1.5.0.tar.gz
| Download URL | pyasstosrt-1.5.0.tar.gz |
|---|---|
| Size | 15.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
122f676a185c3951ff89a165f2ad402f9f1ffa6fd53474a65496bdb83b6198dd
|
|
BLAKE2b-256 checksum How to use checksums |
108d9936fba19366c3a9274f7c1f1092d4d04312cf475505e9b5c91316032442
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.9 {"installer":{"name":"uv","version":"0.9.9"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / pyasstosrt-1.5.0-py3-none-any.whl
| Download URL | pyasstosrt-1.5.0-py3-none-any.whl |
|---|---|
| Size | 16.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d178f9ceb269fb329ad3b1973bad5abf68dd5141e88282a44257ddf3e0ce115e
|
|
BLAKE2b-256 checksum How to use checksums |
d726f6a618fe8cd5da96399b9ad598dbad8f95a537b054162cd1cc969d5bde12
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.9 {"installer":{"name":"uv","version":"0.9.9"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for pyasstosrt 1.5.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.