Skip to main content

Async SRT subtitle translator using OpenAI

Project description

SRT Translator

A tool that translates SRT subtitle files to any language using OpenAI's API. It processes subtitles asynchronously in batches for efficient translation while preserving timing and formatting.

CLI

subconv input.srt output.srt

Examples

subconv input.srt output.srt -t "Spanish"
subconv input.srt output.srt -s "English" -t "Japanese"
subconv input.srt output.srt --target-language "French" --source-language "German"

Options

Option Description Default
-t, --target-language Target language for translation Brazilian Portuguese
-s, --source-language Source language (optional) Auto-detected
-m, --model OpenAI model gpt-4o-mini
-c, --concurrent Max concurrent requests 5
-b, --batch-size Subtitles per batch 15

Library

import asyncio
from pathlib import Path
from subconv import TranslationConfig, TranslationService

config = TranslationConfig(
    input_path=Path("input.srt"),
    output_path=Path("output.srt"),
    target_language="Spanish",
    source_language="English",
)

asyncio.run(TranslationService(config).run())

Environment

export OPENAI_API_KEY=your-key

License

MIT


Tests and documentation generated by Claude xD

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

subconv-1.1.0.tar.gz (49.7 kB view details)

Uploaded Source

Built Distribution

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

subconv-1.1.0-py3-none-any.whl (9.3 kB view details)

Uploaded Python 3

File details

Details for the file subconv-1.1.0.tar.gz.

File metadata

  • Download URL: subconv-1.1.0.tar.gz
  • Upload date:
  • Size: 49.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for subconv-1.1.0.tar.gz
Algorithm Hash digest
SHA256 61156f7330c8a73e608f656c76a5963f0486411b78ab18a04842f4086f3976f7
MD5 01bbdde016092d25a4ec220eae190661
BLAKE2b-256 a7f634241fb3d85b7d57c34eb570ccf9d616f808af239d5a398c63287335c7fc

See more details on using hashes here.

Provenance

The following attestation bundles were made for subconv-1.1.0.tar.gz:

Publisher: publish.yml on vnniciusg/subconv

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file subconv-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: subconv-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 9.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for subconv-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6116df25502a581cce6bfca43d0f27828fe66bfb568fd42c9b8cad52bf455a3f
MD5 692bea195669cf8ec895b93a3521311e
BLAKE2b-256 4f8de9bda681ceea6097ac4170cd9f84eecc04c47fc4cf6ad2ecdf45f337f06e

See more details on using hashes here.

Provenance

The following attestation bundles were made for subconv-1.1.0-py3-none-any.whl:

Publisher: publish.yml on vnniciusg/subconv

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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