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.1.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.1-py3-none-any.whl (9.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: subconv-1.1.1.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.1.tar.gz
Algorithm Hash digest
SHA256 a273e2d732d2aad9f610bb31c493e97cadcc3a488a306537dc90b55cda12aa36
MD5 b9c9ec7efb22e48d988dd791f0fa89e3
BLAKE2b-256 59f332857dd905209112e8e8c7d733f0ed21734841ba7f27d7ca6f1c96f4b46e

See more details on using hashes here.

Provenance

The following attestation bundles were made for subconv-1.1.1.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.1-py3-none-any.whl.

File metadata

  • Download URL: subconv-1.1.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 99d3ea0a7bb488a48e230a2b078626eb007a120aa9219f24e32486fee48d00c8
MD5 8bc1e4a0e77f81204b6a46bbe2214b7b
BLAKE2b-256 d6f0931bebccdc482e754b7b54095d1ce4b34ffc201d20d475b19b7343de1e38

See more details on using hashes here.

Provenance

The following attestation bundles were made for subconv-1.1.1-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