> ## Documentation Index
> Fetch the complete documentation index at: https://docs.melius.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Ditto

> Replace characters, props and backgrounds in your own video with mel ditto.

`mel ditto` replaces characters, props and backgrounds in a video you supply. It runs the same Ditto as Melius, charges your team's credits, and puts finished videos in Ditto's **History**. The [command reference](https://docs.melius.com/cli/commands.md#ditto) lists every command.

**Prepare** measures the source and quotes the edit without generating, **run** starts the paid edit, and **wait** blocks until it's done.

## 1. Upload the video and images

```bash theme={null}
mel ditto upload clip.mp4 --role source
mel ditto upload jen.png --role reference
```

Each upload returns an `assetId`. The source is MP4 or MOV. To use an avatar instead of an image, list them with `mel ditto avatars` and send its `{ "kind", "id" }` as `avatar`.

## 2. Prepare the edit

```json input.json theme={null}
{
    "sourceAssetId": "<videoAssetId>",
    "replacements": [
        { "referenceAssetId": "<personImageId>", "targetKind": "character" },
        {
            "avatar": { "kind": "curated", "id": "<avatarId>" },
            "targetKind": "character",
            "targetDescription": "the man on the right"
        }
    ]
}
```

```bash theme={null}
mel ditto prepare --input-file input.json > review.json
```

One edit holds up to 30 replacements, applied together in one generation with one price. `targetKind` is `character`, `prop` or `background`. Describe each target when you replace two or more props or two or more backgrounds. `mel ditto prepare --help` lists the optional fields, such as `sourceRange` and `audioMode`.

The review has the `attemptId`, the normalized `input`, the source duration, each model's availability and the `quote`. When no model can make the edit, `quote` is `null` and the models' reasons say why, such as a source that is too long.

## 3. Run and wait

```bash theme={null}
jq '.input' review.json > reviewed-input.json
mel ditto run --input-file reviewed-input.json \
  --attempt-id "$(jq -r .attemptId review.json)" \
  --quote-id "$(jq -r .quote.id review.json)" \
  --max-credits 500
mel ditto wait <generationId>
mel ditto download <generationId>
```

`--max-credits` is optional: the edit doesn't start if it costs more. After a lost response, run the same command again with the same attempt ID and input to get the same edit back. A new attempt ID starts a new paid edit.

`mel cast replacement` is an alias for `mel ditto`, kept for older scripts.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.