Skip to main content

MCP tool to insert subtitle (SRT/VTT) line breaks: phrase-boundary wrapping for CJK/Thai (BudouX) and word wrapping for space-delimited (Latin) languages.

Project description

clipwright-wrap

MCP tool to format subtitle file text (SRT/VTT) at phrase boundaries using BudouX with line wrapping.

Overview

clipwright-wrap takes SRT/VTT subtitle files as input, splits each cue text into phrase units by BudouX, inserts line breaks to fit within specified character count and line count, and outputs the subtitle file in the same format. A pure text formatting tool with no FFmpeg / Whisper dependencies.

Input/Output

  • Input: SRT file (.srt) or VTT file (.vtt)
  • Output: Subtitle file in same format as input (with phrase boundary line breaks inserted)
  • Timecodes: Unchanged (no retiming)

MCP Tool

clipwright_wrap_captions

Parameters

Name Type Default Description
input string required Input subtitle file path (.srt / .vtt)
output string required Output subtitle file path (same extension as input)
language string "ja" Phrase splitting language (ja / zh-hans / zh-hant / th)
max_chars int 16 Max characters per line (full-width and half-width both count as 1 character). Positive integer.
max_lines int 2 Max lines per cue. Over-limit cues recorded in warnings (not truncated). Positive integer.

Character Count Specification

max_chars is counted uniformly as 1 character each (both full-width and half-width as one len() character). Full-width normalization is a future extension (requirement §8).

Phrase Wrapping Mechanism

  1. Each cue text (if multiple lines, remove line breaks and concatenate) is split into phrases by BudouX
  2. Phrase token sequence is greedily packed into one line within max_chars
  3. Formatted text (multiple lines separated by \n) is written back to cue

If a single phrase exceeds max_chars alone, place that phrase on one line (no splitting mid-phrase).

Supported Languages

Supports the following languages for which BudouX provides phrase splitting:

language Value Language
ja Japanese
zh-hans Chinese (Simplified)
zh-hant Chinese (Traditional)
th Thai

Dependencies

Package Purpose
budoux Phrase boundary splitting (standard dependency, lightweight model bundled)
clipwright Shared types, envelope, errors
mcp[cli] MCP server
pydantic Parameter validation

No FFmpeg / Whisper dependencies (pure text formatting). budoux is a standard dependency bundled with the package, so e2e tests can run continuously without environment variable gating.

Installation and Startup

uv add clipwright-wrap
clipwright-wrap

Or within a uv workspace:

uv run --package clipwright-wrap clipwright-wrap

Prerequisites

  • Python 3.11 or later
  • FFmpeg not required (text formatting only)

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

clipwright_wrap-0.3.2.tar.gz (14.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

clipwright_wrap-0.3.2-py3-none-any.whl (18.5 kB view details)

Uploaded Python 3

File details

Details for the file clipwright_wrap-0.3.2.tar.gz.

File metadata

  • Download URL: clipwright_wrap-0.3.2.tar.gz
  • Upload date:
  • Size: 14.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for clipwright_wrap-0.3.2.tar.gz
Algorithm Hash digest
SHA256 6c245fe151143fb0f0610b558ae3e55836035ea1850d9b84461e5a2b47be41a9
MD5 9febc0563f7f78937fd46eb3480f27b7
BLAKE2b-256 e79a759574846d39241f8bb5f5f4a73922a9816fe80863efb58e4fec9a86a52f

See more details on using hashes here.

Provenance

The following attestation bundles were made for clipwright_wrap-0.3.2.tar.gz:

Publisher: publish.yml on satoh-y-0323/clipwright

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file clipwright_wrap-0.3.2-py3-none-any.whl.

File metadata

File hashes

Hashes for clipwright_wrap-0.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 04433ea2dfd28bc978729cf83dda5b27b73b865a38e9a249b94e8fef7f9805d5
MD5 aa7bb16af58c9b9c2daaf42c4b96956f
BLAKE2b-256 187a1fec709d6f15bd613b7a6bf8199da1106fea58a93a0d31d8e3c2102e62f4

See more details on using hashes here.

Provenance

The following attestation bundles were made for clipwright_wrap-0.3.2-py3-none-any.whl:

Publisher: publish.yml on satoh-y-0323/clipwright

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