---
url: https://api-doc.aive.com/guides/reframe-montage.md
---
# Reframe a montage

The Aive API allows you to recompute a montage's video framing for a new target format — for example, converting a landscape montage to a vertical or square one.

Reframing a montage is a three-step process:

1. Read the montage's current content.
2. Set the desired format on that content, then call `reframeMontageContent` to recompute the crop/pan of every video lane for it.
3. Save the reframed content by calling `updateMontage`.

## Prerequisites

Before reframing a montage:

* You know your workspace ID. Retrieving a workspace ID works exactly the same way as for scoring — follow [steps 1 of Score a container](/guides/score-container#step-1-get-your-workspace-id) if you haven't done so yet.
* You know the ID of the montage to reframe.
* You know the target format (width and height) you want to reframe the montage to.

## Step 1 - Read the montage content {#step-1-read-the-montage-content}

Query the montage by ID, selecting its `content` field.

### Montage query

```graphql
query MontageContent($id: ID!) {
  montage(id: $id) {
    content
  }
}
```

### Montage variables

```json
{
  "id": "<montage_id>"
}
```

### Montage response

```json
{
  "data": {
    "montage": {
      "content": {
        "lanes": [],
        "timeMarkers": [],
        "settings": {
          "duration": "...",
          "format": { "width": 1920, "height": 1080 },
          "backgroundColor": "#000000",
          "pointOfInterest": {},
          "reframeParams": {
            "removeBlackBars": true,
            "scaleMode": "auto",
            "laneItemResizeMode": "..."
          }
        }
      }
    }
  }
}
```

Keep the `content` value — you'll edit it in the next step and pass it to `reframeMontageContent`.

## Step 2 - Set the target format and reframe

`reframeMontageContent` does not take a target format as one of its own arguments. Instead, the target format — and the reframe behavior applied to it — is read from the `settings` object inside the `MontageContent` you pass in. See the [`MontageContent`](/api/types/scalars/montage-content) reference for the full shape.

Before calling `reframeMontageContent`, take the content you read in [Step 1](#step-1-read-the-montage-content) and set, on a copy of it:

* `settings.format` — the new target `{ width, height }`.
* `settings.reframeParams` — optionally, adjust `removeBlackBars` and `scaleMode` if you want different cropping behavior for the new format.

Then call `reframeMontageContent` with the edited content. Aive recomputes the crop/pan of every video lane to match the new `settings.format` and returns the updated content.

### ReframeMontageContent mutation

```graphql
mutation ReframeMontageContent($input: ReframeMontageContentInput!) {
  reframeMontageContent(input: $input) {
    ... on ReframeMontageContentResult {
      content
    }
  }
}
```

### ReframeMontageContent variables

```json
{
  "input": {
    "workspaceId": "<workspace_id>",
    "content": "<content_with_updated_settings_format>",
    "args": {}
  }
}
```

`content` is the `MontageContent` JSON object itself, not a string: replace the placeholder, quotes included, with the edited object. The same goes for the `content` of `updateMontage` and `createMontage` below.

### ReframeMontageContent input parameters

| Parameter              | Type           | Description                                                                                                                                                                    |
| ---------------------- | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `workspaceId`          | ID             | The workspace you're working within.                                                                                                                                           |
| `content`              | MontageContent | The montage content to reframe, with `settings.format` (and optionally `settings.reframeParams`) already set to the desired target format.                                     |
| `args`                 | Object         | Required. Pass `{}` to keep each video lane's own blur settings.                                                                                                               |
| `args.blur`            | BlurInput      | Optional. Overrides the blur mode/radius used to fill the background behind reframed video lanes. When omitted, each video lane's own `blurMode`/`blurRadius` is used instead. |
| `args.blur.blurMode`   | Enum           | One of `none`, `cover`, `splitCover`, `splitContain`.                                                                                                                          |
| `args.blur.blurRadius` | Int            | The blur radius to apply when `blurMode` is set.                                                                                                                               |

### ReframeMontageContent response

```json
{
  "data": {
    "reframeMontageContent": {
      "content": {
        "lanes": [],
        "timeMarkers": [],
        "settings": {
          "format": { "width": 1080, "height": 1920 }
        }
      }
    }
  }
}
```

`reframeMontageContent` is synchronous — the reframed content is returned directly in the mutation response. There is no job to poll and no webhook event to subscribe to.

Reframing does not save anything by itself — the montage you read in Step 1 is left untouched until you persist the result in the next step.

## Step 3 - Save the reframed content

Call `updateMontage` with the content returned by `reframeMontageContent` to persist it as the montage's new content.

### UpdateMontage mutation

```graphql
mutation UpdateMontage($input: UpdateMontageInput!) {
  updateMontage(input: $input) {
    ... on UpdateMontageResult {
      ack
    }
    ... on UpdateMontageError {
      code
      message
    }
  }
}
```

### UpdateMontage variables

```json
{
  "input": {
    "id": "<montage_id>",
    "content": "<reframed_montage_content>"
  }
}
```

### UpdateMontage response

```json
{
  "data": {
    "updateMontage": {
      "ack": true
    }
  }
}
```

You could also use the changed montage content to create a new montage, allowing in effect to create variants of a montage in different formats:

### CreateMontage mutation

```graphql
mutation CreateMontage($input: CreateMontageInput!) {
  createMontage(input: $input) {
    ... on CreateMontageResult {
      id
    }
  }
}
```

### CreateMontage variables

```json
{
  "input": {
    "folderId": "<folder_id>",
    "name": "<montage_name>",
    "content": "<reframed_montage_content>"
  }
}
```

### CreateMontage input parameters

| Parameter  | Type           | Description                                                                   |
| ---------- | -------------- | ----------------------------------------------------------------------------- |
| `folderId` | ID             | The destination folder for the new montage.                                   |
| `name`     | String         | The name of the montage.                                                      |
| `content`  | MontageContent | The initial content, typically the value returned by `reframeMontageContent`. |

### CreateMontage response

```json
{
  "data": {
    "createMontage": {
      "id": "<montage_id>"
    }
  }
}
```

## Errors

`reframeMontageContent` does not return a mutation-specific typed error — failures such as a missing permission or insufficient credits surface as [standard errors](/getting-started/error-handling#standard-errors).

`updateMontage` returns a typed error through its output union:

| Error code        | Description                                                                                                       |
| ----------------- | ----------------------------------------------------------------------------------------------------------------- |
| `MontageIsLocked` | The montage is locked by a user other than its creator. Only the creator of a locked montage can still update it. |

See [Error handling](/getting-started/error-handling) for how these errors are returned.

## Best practices

* Always edit `settings.format` on the content itself before calling `reframeMontageContent` — the mutation's own `args` only control blur/background-fill behavior, not the target format.
* Treat the `MontageContent` value as opaque beyond the fields you need to edit — pass everything else through unchanged.
* `reframeMontageContent` is synchronous, so there's no need to poll or wait for a webhook event before moving on to `updateMontage`.
* Always call `updateMontage` afterwards — `reframeMontageContent` only computes the new content, it does not save it.
* Expect `updateMontage` to fail with `MontageIsLocked` if another user currently has the montage locked; only the montage's creator can update it while it's locked.
