Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .sdk.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"id": "6058b2ba-30f8-46d6-9c9d-83938cbf7071",
"id": "f9ec36d6-0cad-4012-a8e7-478a6f07234f",
"tracked_paths": [
{
"editable": true,
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "magic-hour",
"version": "0.68.0",
"version": "0.69.0",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"exports": {
Expand Down
2 changes: 1 addition & 1 deletion src/environment.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export enum Environment {
Environment = "https://api.magichour.ai",
MockServer = "https://api.sideko.dev/v1/mock/magichour/magic-hour/0.69.0",
MockServer = "https://api.sideko.dev/v1/mock/magichour/magic-hour/0.70.0",
}
24 changes: 13 additions & 11 deletions src/resources/v1/character-replace/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,16 +84,19 @@ For detailed examples, see the [product page](https://magichour.ai/products/char

#### Parameters

| Parameter | Required | Description | Example |
| ------------------ | :------: | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------ |
| `assets` | ✓ | Source video and reference character image for the job. | `{"imageFilePath": "api-assets/id/5678.png", "videoFilePath": "api-assets/id/1234.mp4"}` |
| `└─ imageFilePath` | ✓ | Reference character image used as the replacement or animation target. This value is either - a direct URL to the video file - `file_path` field from the response of the [upload urls API](https://docs.magichour.ai/api-reference/files/generate-asset-upload-urls). See the [file upload guide](https://docs.magichour.ai/api-reference/files/generate-asset-upload-urls#input-file) for details. | `"api-assets/id/5678.png"` |
| `└─ videoFilePath` | ✓ | Source video containing the subject to replace or animate. This value is either - a direct URL to the video file - `file_path` field from the response of the [upload urls API](https://docs.magichour.ai/api-reference/files/generate-asset-upload-urls). See the [file upload guide](https://docs.magichour.ai/api-reference/files/generate-asset-upload-urls#input-file) for details. | `"api-assets/id/1234.mp4"` |
| `endSeconds` | ✓ | End time of your clip (seconds). Must be greater than start_seconds. | `15.0` |
| `name` | ✗ | Give your video a custom name for easy identification. | `"My Character Replace video"` |
| `resolution` | ✗ | Output video resolution. Defaults to 480p, the lowest resolution available on your plan. | `"720p"` |
| `startSeconds` | ✗ | Start time of your clip (seconds). Must be ≥ 0. | `0.0` |
| `style` | ✗ | Optional style controls for replace vs animate mode and subject selection. | `{"mode": "replace", "selectionMode": "auto"}` |
| Parameter | Required | Description | Example |
| ------------------ | :------: | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- |
| `assets` | ✓ | Source video and reference character image for the job. | `{"imageFilePath": "api-assets/id/5678.png", "videoFilePath": "api-assets/id/1234.mp4"}` |
| `└─ imageFilePath` | ✓ | Reference character image used as the replacement or animation target. This value is either - a direct URL to the video file - `file_path` field from the response of the [upload urls API](https://docs.magichour.ai/api-reference/files/generate-asset-upload-urls). See the [file upload guide](https://docs.magichour.ai/api-reference/files/generate-asset-upload-urls#input-file) for details. | `"api-assets/id/5678.png"` |
| `└─ videoFilePath` | ✓ | Source video containing the subject to replace or animate. This value is either - a direct URL to the video file - `file_path` field from the response of the [upload urls API](https://docs.magichour.ai/api-reference/files/generate-asset-upload-urls). See the [file upload guide](https://docs.magichour.ai/api-reference/files/generate-asset-upload-urls#input-file) for details. | `"api-assets/id/1234.mp4"` |
| `endSeconds` | ✓ | End time of your clip (seconds). Must be greater than start_seconds. | `15.0` |
| `name` | ✗ | Give your video a custom name for easy identification. | `"My Character Replace video"` |
| `resolution` | ✗ | Output video resolution. Defaults to 480p, the lowest resolution available on your plan. | `"720p"` |
| `startSeconds` | ✗ | Start time of your clip (seconds). Must be ≥ 0. | `0.0` |
| `style` | ✗ | Optional style controls for replace vs animate mode and subject selection. | `{"mode": "replace", "selectionMode": "auto"}` |
| `└─ mode` | ✗ | Processing mode. `replace` swaps the detected subject with your reference character. `animate` transfers motion from the video onto your character image. | `"replace"` |
| `└─ points` | ✗ | On-frame markers for manual subject selection. Required when `selection_mode` is `point`. Ignored when `selection_mode` is `auto` or omitted. | `[{"positionX": 320, "positionY": 180, "timeSeconds": 2.5}]` |
| `└─ selectionMode` | ✗ | How to locate the subject in the source video. `auto` detects a person automatically. `point` uses your `points` to mark the subject. Defaults to `auto`. | `"auto"` |

#### Example Snippet

Expand All @@ -110,7 +113,6 @@ const res = await client.v1.characterReplace.create({
name: "My Character Replace video",
resolution: "720p",
startSeconds: 0.0,
style: { mode: "replace", selectionMode: "auto" },
});
```

Expand Down
12 changes: 10 additions & 2 deletions test/v1-character-replace.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@ describe("tests client.v1.characterReplace.create", () => {
name: "My Character Replace video",
resolution: "720p",
startSeconds: 0.0,
style: { mode: "replace", selectionMode: "auto" },
style: {
mode: "replace",
points: [{ positionX: 320, positionY: 180, timeSeconds: 2.5 }],
selectionMode: "auto",
},
})
.asResponse(),
client.v1.characterReplace.create({
Expand All @@ -32,7 +36,11 @@ describe("tests client.v1.characterReplace.create", () => {
name: "My Character Replace video",
resolution: "720p",
startSeconds: 0.0,
style: { mode: "replace", selectionMode: "auto" },
style: {
mode: "replace",
points: [{ positionX: 320, positionY: 180, timeSeconds: 2.5 }],
selectionMode: "auto",
},
}),
]);
expect(rawResponse.status).toBe(200); // Exact status code match
Expand Down
Loading