Skip to main content

Convert ASS subtitle to SRT format

Project description

pyasstosrt

Downloads codecov

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()

CLI

pyasstosrt export /Users/user/sub/sub.ass

Optional You can specify an export folder.

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.

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.

pyasstosrt export /Users/user/sub/sub.ass --remove-duplicates

Optional You can use the flags together --remove-duplicates --remove-effects

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyasstosrt-1.4.3.tar.gz (11.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyasstosrt-1.4.3-py3-none-any.whl (11.9 kB view details)

Uploaded Python 3

File details

Details for the file pyasstosrt-1.4.3.tar.gz.

File metadata

  • Download URL: pyasstosrt-1.4.3.tar.gz
  • Upload date:
  • Size: 11.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.17

File hashes

Hashes for pyasstosrt-1.4.3.tar.gz
Algorithm Hash digest
SHA256 756167d3ff40902adedb5e311259e2fb8d8f88e3eeb619eac8beddcaf2827f77
MD5 f43216010284a5e54adecb167404888c
BLAKE2b-256 85b21661c15dd02488c8910a468b5eba8ca988ce43875b7cadb3183f76f98509

See more details on using hashes here.

File details

Details for the file pyasstosrt-1.4.3-py3-none-any.whl.

File metadata

  • Download URL: pyasstosrt-1.4.3-py3-none-any.whl
  • Upload date:
  • Size: 11.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.17

File hashes

Hashes for pyasstosrt-1.4.3-py3-none-any.whl
Algorithm Hash digest
SHA256 29f4c7b9778176a498556020e8e5f1b727355386f789338b7c42cc64a80444e0
MD5 75f92da8d8d644876f8d98004c45270d
BLAKE2b-256 1dbdd5c435dae400d7d5eeca975420edfb24906ee36bc45aa68a7f1abef6f569

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page