SubtitleTools

1.3.1

A comprehensive toolkit for SRT and ASS/SSA subtitle files: parse, validate, repair, shift timestamps, fix encoding, convert formats, manage ASS styles, and translate using OpenAI, Anthropic, Google, or OpenRouter AI APIs.

Minimum PowerShell version

5.1

Installation Options

Copy and Paste the following command to install this package using PowerShellGet More Info

Install-Module -Name SubtitleTools -RequiredVersion 1.3.1

Copy and Paste the following command to install this package using Microsoft.PowerShell.PSResourceGet More Info

Install-PSResource -Name SubtitleTools -Version 1.3.1

You can deploy this package directly to Azure Automation. Note that deploying packages with dependencies will deploy all the dependencies to Azure Automation. Learn More

Manually download the .nupkg file to your system's default download location. Note that the file won't be unpacked, and won't include any dependencies. Learn More

Owners

Copyright

(c) 2025 Iman Edrisian. All rights reserved.

Package Details

Author(s)

  • Iman Edrisian

Tags

Subtitle SRT ASS SSA SubRip SubStation Translation Video Encoding Repair Timestamp Batch OpenAI Anthropic Gemini OpenRouter

Functions

Import-SubtitleFile Export-SubtitleFile ConvertFrom-SrtFile ConvertTo-SrtFile ConvertFrom-AssFile ConvertTo-AssFile Test-SrtFile Test-AssFile Test-SubtitleTimestamps Test-SubtitleOverlap Repair-SrtFile Repair-AssFile Repair-SubtitleEncoding Repair-SubtitleOverlap Repair-SubtitleNumbering Add-SubtitleOffset Set-SubtitleOffset Get-SubtitleDuration Set-SubtitleDuration Invoke-SubtitleStretch Merge-SubtitleFile Split-SubtitleFile Get-AssStyle Set-AssStyle New-AssStyle Remove-AssStyle Remove-AssOverrideTag Convert-AssToPlainText Convert-AssToSrt Convert-SrtToAss Invoke-SubtitleTranslation Get-TranslationProvider Set-TranslationProvider Remove-TranslationProvider New-TranslationSession Invoke-BackTranslation Get-OpenRouterModel Get-TranslationGlossary Add-TranslationGlossaryEntry Remove-TranslationGlossaryEntry Set-SubtitleLineWidth Get-SubtitleInfo Find-SubtitleFile Compare-SubtitleFile Optimize-SubtitleFile Invoke-SubtitleBatch Publish-SubtitleFile Set-SubDLCredential Get-SubDLCredential Remove-SubDLCredential

PSEditions

Desktop Core

Dependencies

This module has no dependencies.

Release Notes

Version 1.3.1

- Fixed Publish-SubtitleFile being unusable on Windows PowerShell 5.1. Both
 SubDL upload steps used Invoke-RestMethod -Form, which is PowerShell 6.1+
 and fails parameter binding on 5.1 - the edition the manifest claims to
 support. The multipart body is now built by hand and sent as bytes, on both
 editions

Version 1.3.0

- Added an end-of-run translation summary. Finishing a translation now reports
 the provider and model, how many entries were translated / served from cache
 / left unresolved, batches, API calls, retries, truncated batches, input and
 output token totals, and elapsed time. The same data is attached to the
 returned file as .TranslationSummary for scripting; -NoSummary suppresses
 only the printed block
- Added display formatting for SubtitleFile, which previously rendered by
 dumping its entire Entries array - so importing or translating a subtitle
 answered with a wall of truncated dialogue instead of a description of the
 file

Version 1.2.0

- Fixed long files being silently translated only part-way. Batches were sized
 only by character budget, so a short file went out as one call asking for
 hundreds of translated lines; the reply hit the output-token cap and stopped
 early, and because a truncated reply is an HTTP 200 with
 finish_reason=length, the missing entries quietly fell back to untranslated
 source text. Truncation is now detected on every provider, and unreturned
 entries are re-requested in smaller batches instead of being given up on
- Fixed untranslated fallback text being written to the translation cache,
 which made it a permanent cache hit that a re-run or resume could not repair
- Added streaming translation: the progress bar now advances per translated
 line with live token counts while a batch is still being written, on all
 four providers. Falls back to a buffered request automatically; -NoStream
 opts out
- Added the MaxEntriesPerBatch provider setting (default 40), capping how many
 entries go into a single API call
- Raised the default MaxOutputTokens from 8192 to 16384, since reasoning
 models spend part of that budget on thinking tokens

Version 1.1.0

- Fixed a PowerShell 5.1 parse error (the ?? operator) that broke Import-Module
 for the entire module on Windows PowerShell
- Fixed module loading on Linux/macOS, where backslash paths silently caused
 zero functions to be exported
- Fixed Invoke-BackTranslation, which was unusable because -OutputPath was
 incorrectly mandatory
- Fixed a Google provider bug that returned a raw .NET exception string as
 translated subtitle text when a prompt was safety-filtered
- Added OpenRouter as a fourth translation provider, plus Get-OpenRouterModel
 to browse its catalogue with context length, output cap, and pricing
- Added a MaxOutputTokens provider setting, separate from the client-side
 MaxTokensPerBatch batching heuristic
- Centralized HTTP request handling across all providers, fixing retry,
 header, encoding, and error-reporting bugs that previously existed in
 triplicate
- Improved translation progress reporting: priming is now a visible phase,
 token and retry counts are surfaced, nested progress bars no longer clobber
 each other, and a mid-run failure now saves the checkpoint before failing

Version 1.0.0 — Initial release

- Parse and serialize SRT and ASS/SSA files with full round-trip fidelity
- Validate: block structure, timestamps, overlapping entries
- Repair: numbering, encoding (UTF-16/Windows-1252 → UTF-8), timestamp separators, overlaps
- Timestamp manipulation: shift, stretch (two-point sync), merge, split
- ASS/SSA: style CRUD, override tag stripping, format conversion (SRT ↔ ASS)
- AI translation via OpenAI, Anthropic, and Google APIs with batching, caching, glossary,
 content-aware priming, back-translation verification, and resume from checkpoint
- Batch processing: apply any operation to an entire directory tree (PS7+ parallel support)
- Subtitle publishing to SubDL
- No external dependencies; API keys encrypted with Windows DPAPI

FileList

Version History

Version Downloads Last updated
1.3.2 5 9/7/2026
1.3.1 (current version) 4 9/7/2026
1.0.0 56 5/25/2026