Tools /

Edit cues

Change cue text or timing, delete cues, or find and replace text, then return the edited file. Cues are numbered from 1 in their current order; operations run in order, and cue numbers refer to the file as it was before any deletions in the same call.

edit_subtitles

Plan
Unlimited+
Usage
1 upload
Effect
Returns a new file

Parameters

ParameterTypeDescription
contentrequiredstringFull subtitle file contents as text (SRT, WebVTT, ASS/SSA, or the JSON produced by convert_subtitles).
filenameoptionalstringOriginal file name. The extension helps detect the format.
formatoptionalenumInput format. Detected from the file name or contents when omitted."srt" · "vtt" · "ass" · "ssa" · "json"
operationsrequiredany[]Edits to apply, in order.1–500 items
outputFormatoptionalenumOutput format. Defaults to the format of the (first) input."srt" · "vtt" · "ass" · "json"

Example

You ask your assistant:

“In ep2.srt, change "Jon" to "John" everywhere and delete cue 14.”

It calls edit_subtitles with:

arguments
{
  "filename": "ep2.srt",
  "content": "1\n00:00:01,000 --> 00:00:03,500\nHello there.\n",
  "operations": [
    {
      "op": "replace",
      "find": "Jon",
      "replace": "John"
    },
    {
      "op": "delete",
      "cue": 14
    }
  ]
}

and gets back:

result
Applied 2 edits: 6 replacements, 1 cue deleted. 311 cues as SRT.