https://github.com/GitBib/pyasstosrt
Convert ASS subtitle to SRT format
https://github.com/GitBib/pyasstosrt
ass ass-to-srt cli convert python srt srt-subtitles
Last synced: 11 months ago
JSON representation
Convert ASS subtitle to SRT format
- Host: GitHub
- URL: https://github.com/GitBib/pyasstosrt
- Owner: GitBib
- License: apache-2.0
- Created: 2020-04-12T19:34:49.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2025-03-23T00:02:22.000Z (about 1 year ago)
- Last Synced: 2025-07-08T23:17:46.138Z (11 months ago)
- Topics: ass, ass-to-srt, cli, convert, python, srt, srt-subtitles
- Language: Python
- Homepage: https://gitbib.github.io/pyasstosrt/
- Size: 5.55 MB
- Stars: 23
- Watchers: 1
- Forks: 4
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
pyasstosrt
=================================================================================================================================================================================
[](https://pepy.tech/project/pyasstosrt) [](https://codecov.io/gh/GitBib/pyasstosrt)
**pyasstosrt** – this tool will help you convert Advanced SubStation Alpha (ASS/SSA) subtitle files to SubRip (SRT) files.
Support for str path:
```python
from pyasstosrt import Subtitle
sub = Subtitle('sub.ass')
sub.export()
```
Support for all Path-like objects, instead of only pathlib's Path:
```python
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.
```python
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.
```python
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.
```python
from pyasstosrt import Subtitle
sub = Subtitle('sub.ass', remove_duplicates=True)
sub.export()
```
CLI
------------
```bash
pyasstosrt export /Users/user/sub/sub.ass
```
**Optional** You can specify an export folder.
```bash
pyasstosrt export /Users/user/sub/sub.ass --output-dir /Users/user/sub/srt
```
**Optional** If you want to remove effects from text, you can use the --remove-effects flag.
```bash
pyasstosrt export /Users/user/sub/sub.ass --remove-effects --output-dir /Users/user/sub/srt
```
**Optional** If you need to remove duplicates, you can use the --remove-duplicates flag.
```bash
pyasstosrt export /Users/user/sub/sub.ass --remove-duplicates
```
**Optional** You can use the flags together --remove-duplicates --remove-effects
```bash
pyasstosrt export /Users/user/sub/sub.ass --remove-duplicates --remove-effects
```
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.