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.1.tar.gz (15.0 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.1-py3-none-any.whl (18.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: clipwright_wrap-0.3.1.tar.gz
  • Upload date:
  • Size: 15.0 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.1.tar.gz
Algorithm Hash digest
SHA256 4c005ead449799b465798c76d8cd8c07e763c24d93178231760a4e17dff5d949
MD5 89970b3447028599c3ac9d7ac9d632e6
BLAKE2b-256 f3597104d363495de8b2e682b82e1468b3ea0f72b94dbc9d7a5787bdff05f48b

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for clipwright_wrap-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f182e02ef8aee85a5ea77b74a4acb55307d0207a6eedda26d379c97c6a067707
MD5 b708735adb084f70e831da34173d30f8
BLAKE2b-256 1607d00243bb06d125d05f9d38e2333b407c6cd85760aa4d4aa80b07f2001166

See more details on using hashes here.

Provenance

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