This Python script translates SRT subtitle files using the free Pollinations AI API. It:
- ✅ Preserves all timing information exactly as it is
- ✅ Only sends the subtitle text for translation
- ✅ Works without an API key (completely free!)
- ✅ Supports batch processing for efficiency
You have: One.Battle.After.Another.2025.1080p.AMZN.WEB-DL.DDP5.1.H.264-KyoGo.srt
- Contains: 2,245 subtitle entries
- Status: ✅ Successfully parsed and ready for translation
# Install the required Python package
pip install requests
# or use the requirements file:
pip install -r requirements.txtThat's it! No API key setup needed.
python translate_srt.py "One.Battle.After.Another.2025.1080p.AMZN.WEB-DL.DDP5.1.H.264-KyoGo.srt" -t esOutput: One.Battle.After.Another.2025.1080p.AMZN.WEB-DL.DDP5.1.H.264-KyoGo_translated.srt
python translate_srt.py "One.Battle.After.Another.2025.1080p.AMZN.WEB-DL.DDP5.1.H.264-KyoGo.srt" \
-t es \
-o "One.Battle.Spanish.srt"python translate_srt.py "One.Battle.After.Another.2025.1080p.AMZN.WEB-DL.DDP5.1.H.264-KyoGo.srt" -t frpython translate_srt.py "One.Battle.After.Another.2025.1080p.AMZN.WEB-DL.DDP5.1.H.264-KyoGo.srt" \
-t es \
--batch-size 10| Code | Language | Code | Language |
|---|---|---|---|
en |
English | ja |
Japanese |
es |
Spanish | ko |
Korean |
fr |
French | zh |
Chinese |
de |
German | pt |
Portuguese |
it |
Italian | auto |
Auto-detect |
-
Parsing - The script reads your SRT file and extracts:
1 00:01:33,135 --> 00:01:34,303 Welcome.- Index: 1
- Timestamp:
00:01:33,135 --> 00:01:34,303(kept as-is) - Text: "Welcome." (sent for translation)
-
Translation - The text is sent to Pollinations AI:
- Processed in batches (default: 50 subtitles at a time)
- Shows progress: "Translated 50/2245 subtitles..."
-
Reconstruction - Creates new SRT file:
1 00:01:33,135 --> 00:01:34,303 Bienvenido.- Same index
- Same timestamp (unchanged!)
- Translated text
We've included a test script to verify everything works:
python test_parser.pyThis tests the SRT parser without making any API calls.
translate_srt.py- Main translation scriptrequirements.txt- Python dependenciestest_parser.py- Test script to verify SRT parsingexample_usage.sh- Interactive example scriptREADME.md- Full documentationGETTING_STARTED.md- This file!
pip install requests- This is normal! Translating 2,245 subtitles takes time
- Default batch size is 50 (processes 50 at a time)
- You can increase it:
--batch-size 100(faster but might hit rate limits)
- Decrease batch size:
--batch-size 10 - The free tier has a concurrency limit of 1
- Consider getting an API key for higher limits (still free for higher tiers)
- Specify source language explicitly:
-s en -t es - Try a different model:
--model openai
Pollinations AI offers free tiers:
| Tier | Key Required? | Concurrency | Access |
|---|---|---|---|
| Anonymous (🌱) | No | 1 | Basic models |
| Seed (🌱) | Yes | 3 | Standard models |
| Flower (🌸) | Yes | 7 | Advanced models |
| Nectar (🍯) | Yes | 50 | All models + priority |
To get an API key (optional, for faster processing):
- Visit https://pollinations.ai/
- Sign up for a free tier
- Use it:
--api-key YOUR_KEY
-
Install dependencies:
pip install -r requirements.txt
-
Try a translation:
python translate_srt.py "One.Battle.After.Another.2025.1080p.AMZN.WEB-DL.DDP5.1.H.264-KyoGo.srt" -t es -
Check the output:
- Look for the
_translated.srtfile - Open it in a text editor or subtitle software
- Verify timing is preserved
- Look for the
-
Use with your videos!
For more details, see:
- Full documentation: README.md
- Pollinations AI docs: https://pollinations.ai/
Happy Translating! 🎬🌍