subtitle-translator
Translate SRT subtitle files using LLM APIs with OpenAI-compatible format. Supports both single-language and bilingual output. Use when you need to translate subtitle files (.srt) from one language to another while preserving timestamps. Processes in batches of 50 sentences with progress logging.
- License 许可
- MIT
- 最近更新
- 2026-06-07
- Stars
- ★ 0
- Forks
- 1
01 前言 Front Matter
- name
- subtitle-translator
- description
- Translate SRT subtitle files using LLM APIs with OpenAI-compatible format. Supports both single-language and bilingual output. Use when you need to translate subtitle files (.srt) from one language to another while preserving timestamps. Processes in batches of 50 sentences with progress logging.
03 SKILL.md 正文
Subtitle Translator
Overview
Translate SRT subtitle files using LLM APIs. Supports OpenAI-compatible API format with customizable URL, API key, and model selection. Outputs single-language or bilingual subtitles with original timestamps preserved.
Features
- Format Support: SRT subtitles
- API Compatibility: OpenAI-compatible endpoints
- Output Modes: Single-language or bilingual (translation above original)
- Batch Processing: 50 sentences per batch (configurable) with 1-second intervals
- Progress Tracking: Detailed logging of task progress and execution
- Validation: Ensures sentence count consistency and timestamp preservation
Quick Start
Basic Translation
python3 scripts/translate_srt.py \
--input video.srt \
--output video_zh.srt \
--source-lang en \
--target-lang zh \
--api-url https://api.openai.com/v1 \
--api-key sk-... \
--model gpt-4
Bilingual Output
python3 scripts/translate_srt.py \
--input video.srt \
--output video_bilingual.srt \
--source-lang en \
--target-lang zh \
--bilingual \
--api-url https://api.openai.com/v1 \
--api-key sk-...
Validate SRT File
python3 scripts/validate_srt.py input.srt
List Available Models
python3 scripts/list_models.py \
--api-url https://api.openai.com/v1 \
--api-key sk-...
Configuration
Option 1: Environment Variables (Recommended)
export SUBTITLE_API_URL="https://api.openai.com/v1"
export SUBTITLE_API_KEY="sk-your-api-key"
export SUBTITLE_MODEL="gpt-4"
python3 scripts/translate_srt.py -i input.srt -o output.srt
Option 2: Command Line Arguments
python3 scripts/translate_srt.py \
-i input.srt \
-o output.srt \
-u https://api.openai.com/v1 \
-k sk-your-api-key \
-m gpt-4
Option 3: Config File (Less Secure)
Create ~/.openclaw/skills/subtitle-translator/config.json:
{
"api_url": "https://api.openai.com/v1",
"api_key": "sk-your-api-key",
"model": "gpt-4",
"batch_size": 50,
"batch_interval_ms": 1000,
"output_mode": "single",
"log_level": "info"
}
⚠️ Security Warning: Storing API keys in plaintext config files increases risk. Prefer environment variables or command line arguments.
Security Considerations
- API Key Storage: Use environment variables or secure secret managers instead of plaintext config files
- API Endpoint: Ensure you trust the API URL you provide
- Proxy Environment: The scripts honor
http_proxy/https_proxyenvironment variables. If your environment uses untrusted proxies, API keys could be captured - Network Traffic: All subtitle content is sent to the API endpoint. Do not use with sensitive/confidential content unless you control the API
Workflow
- Parse SRT: Extract index, timecodes, and text
- Validate: Optional validation of input format
- Batch Translation: Send 50 sentences per request (configurable)
- Validate: Ensure output count matches input
- Reconstruct: Combine original timecodes with translations
- Output: Generate SRT file
Resources
scripts/
translate_srt.py- Main translation scriptlist_models.py- List available models from APIvalidate_srt.py- Validate SRT file format
references/
srt_format.md- SRT file format specification
04 同仓库更多 Skills
crowd-prompting
A marketplace where AI agents improve prompts, system instructions, tool descriptions, and other text-based content with domain expertise from real-world operations — and earn tokens for valuable contributions.
ceaser
Interact with the Ceaser privacy protocol on Base L2 using the ceaser-mcp MCP tools. This skill uses the ceaser-mcp npm package for ALL operations -- shield, unshield, note management, and protocol queries. All ceaser tool calls use CLI subcommands (npx -y ceaser-mcp <subcommand>). Ceaser is a privacy-preserving ETH wrapper using Noir/UltraHonk zero-knowledge proofs on Base L2 (chain ID 8453).
ceaser-send
Fully automated private ETH transfer via Ceaser Protocol on Base L2 using the ceaser-mcp MCP tools. This skill uses the ceaser-mcp npm package for ALL operations -- all ceaser tool calls use CLI subcommands (npx -y ceaser-mcp <subcommand>). WARNING -- creates observable on-chain links between user wallet and hot wallet (see Privacy Warning). Generates an ephemeral hot wallet with BIP-39 mnemonic recovery, user funds it, agent signs and broadcasts the Shield TX automatically. Exactly one manual step required (funding the hot wallet with ETH). Uses Noir/UltraHonk zero-knowledge proofs.
dilemm-ai
Compete in DilemmAI, the prisoner's dilemma AI arena at dilemm.ai. Use when an OpenClaw agent wants to create an account, design and submit strategy prompts for their bot, enter matchmaking, analyze historical matches and leaderboards, and iterate on bot strategy. Requires headless browser automation (no API available yet).
moldium
Post and manage content on the Moldium blog platform. Triggered by "post to Moldium", "write a blog post", "publish an article", etc.
arxiv-paper-reviews
Interact with arXiv Crawler API to fetch papers, read reviews, submit comments, search papers, and import papers. Use when working with arXiv papers, fetching paper lists by date/category/interest, viewing paper details with comments, submitting paper reviews, searching papers by title, or importing papers from arXiv URLs via API at http://weakaccept.top:8000/.