# clip.set_speed

> Changes a clip or audio item's speed: constant, curved or reversed.

Source: https://stuarty.com/docs/mcp/tools/edit/clip.set_speed/

Sets either speed, from 0.25x to 4x, or curve, 2 to 8 points \{t, speed\} (speed is text like "0.5x") with t the fraction of the item from 0 to 1 (first 0, last 1) and a linear ramp between points; a speed clears the curve. Rescales the duration, the fades, the transitions and the keyframes by the ratio of the old to the new mean speed. With ripple track the later items of the track follow the change in length. Captions linked to the clip are listed, not changed. reverse true plays the same source range backwards (false restores it), alone or with a speed or a curve. A composition item takes a constant speed only: a curve or a reverse on it is refused.

## Arguments

| Argument | Type | Required | Notes |
| --- | --- | --- | --- |
| `curve` | array of `object` | no | Speed ramp: 2 to 8 points, linear between them, first t 0 and last t 1. Not with speed. |
| `item_id` | `string` | yes | A clip of a video asset, an audio item, or a composition item.; pattern `^itm_[0123456789abcdefghjkmnpqrstvwxyz]{10}$` |
| `reverse` | `boolean` | no | True plays the source range backwards; false plays it forwards. |
| `ripple` | `none`, `track` | no | None (default) or track: shift the later items of the track. |
| `speed` | `any` | no | "1.5x" (up to 3 decimals) or \{"num": 3, "den": 2\}; 1/4 to 4. Not with curve. |

## Errors

- [`E_VALIDATION`](/docs/reference/error-codes#e_validation)
- [`E_NOT_FOUND`](/docs/reference/error-codes#e_not_found)
- [`E_TYPE_MISMATCH`](/docs/reference/error-codes#e_type_mismatch)
- [`E_OUT_OF_SOURCE`](/docs/reference/error-codes#e_out_of_source)
- [`E_INVALID_TIME`](/docs/reference/error-codes#e_invalid_time)
- [`E_OVERLAP`](/docs/reference/error-codes#e_overlap)

## Scope

Scope `edit`. The scope is the one an API key needs in network mode. Run `stuarty command:help clip.set_speed` for the same description from the binary, or call the [`command_help`](/docs/mcp/tools/command_help) tool.

## Next steps

- [The edit tool](/docs/mcp/tools/edit)
- [Batches, revisions and idempotency](/docs/agents/batches)

**As an MCP call**

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "edit",
    "arguments": {
      "project_id": "prj_7k2m9x4q1b",
      "base_revision": 12,
      "operations": [
        {
          "op": "clip.set_speed",
          "args": {
            "curve": [
              {
                "speed": "1x",
                "t": 0
              },
              {
                "speed": "3x",
                "t": 0.5
              },
              {
                "speed": "1x",
                "t": 1
              }
            ],
            "item_id": "itm_m1n2p3q4r5"
          }
        }
      ]
    }
  }
}
```

**As a batch file for the CLI**

```json
[
  {
    "op": "clip.set_speed",
    "args": {
      "curve": [
        {
          "speed": "1x",
          "t": 0
        },
        {
          "speed": "3x",
          "t": 0.5
        },
        {
          "speed": "1x",
          "t": 1
        }
      ],
      "item_id": "itm_m1n2p3q4r5"
    }
  }
]
```

```bash
stuarty edit --project prj_7k2m9x4q1b --ops batch.json --json
```

**Over HTTP**

```bash
curl -X POST "http://127.0.0.1:7878/api/v1/projects/prj_7k2m9x4q1b/edit" \
  -H "Authorization: Bearer $STUARTY_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "base_revision": 12,
  "operations": [
    {
      "op": "clip.set_speed",
      "args": {
        "curve": [
          {
            "speed": "1x",
            "t": 0
          },
          {
            "speed": "3x",
            "t": 0.5
          },
          {
            "speed": "1x",
            "t": 1
          }
        ],
        "item_id": "itm_m1n2p3q4r5"
      }
    }
  ]
}'
```

The ids in the example are illustrative: read the real ones with `project_get`.
