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.0.tar.gz (14.6 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.0-py3-none-any.whl (18.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: clipwright_wrap-0.3.0.tar.gz
  • Upload date:
  • Size: 14.6 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.0.tar.gz
Algorithm Hash digest
SHA256 d1bd9ce766854545b2af882568875070a5f9e4d503ad3df17012569f0232444b
MD5 68d5bd8ebd9002fe8c89e401f9e45f90
BLAKE2b-256 a12faf144bdfd15bb6bcfc1b951d159cba360d0fef27cf3fefad577622d46a7b

See more details on using hashes here.

Provenance

The following attestation bundles were made for clipwright_wrap-0.3.0.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.0-py3-none-any.whl.

File metadata

  • Download URL: clipwright_wrap-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 18.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for clipwright_wrap-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 944f967f1a93e91b9eca51b095ef4ed1637f0204a5fa7472c6d6da7df72d89c7
MD5 c89f936f51d602d0caea6476288fcffc
BLAKE2b-256 3e8312397b48acb40dcc25271d4637fa16387864b35c18e29ac6c0bf7e246438

See more details on using hashes here.

Provenance

The following attestation bundles were made for clipwright_wrap-0.3.0-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