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.2.tar.gz (49.8 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.2-py3-none-any.whl (9.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: subconv-1.1.2.tar.gz
  • Upload date:
  • Size: 49.8 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.2.tar.gz
Algorithm Hash digest
SHA256 77942c877a9fc5516c7d3aecdefad62b52bd00f52b566f9212437eb020c8aefa
MD5 8cca329257563ee2a0d0ab0afedf97b3
BLAKE2b-256 3f175402cf0cadf66ecd906d10238cd4f38ba20adda25545bcb3795917fdefeb

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: subconv-1.1.2-py3-none-any.whl
  • Upload date:
  • Size: 9.4 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 0c851be979b53f1491ab3a38f092d24908a79e954396b4f05dda40dd0164f3c2
MD5 f0b7adebf6bfdb10f0ef872e47d57dcf
BLAKE2b-256 22c12371b2031c5630a3f94e0b09db50073891f08601b099eb7f7c2a17b94361

See more details on using hashes here.

Provenance

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