BobaBanana API

Motion transfer: copy a clip's motion onto your character

POST /v1/videos with motion_video makes your subject perform the motion, gestures and camera move of a clip you send, for as long as the clip. The subject is a picture in image or one character or object in assets. It keeps its own face, clothing and proportions; the person in the clip is not copied. Price it first with POST /v1/videos/estimate.

View as Markdown

At a glance

Endpoint
POST /v1/videos with motion_video; price it with POST /v1/videos/estimate
Auth
Authorization: Bearer bb_...
Returns
202 with a job; output.video.url is an MP4
Clip
MOV, MP4, 1 to 15 s, up to 50 MB, 23.976 to 60 fps, each side 256 to 4096 px
Price keys
video_motion (live quote) or video_motion_local, plus one image per pose-matched picture
Idempotent
yes, with an Idempotency-Key header
Price check
POST /v1/videos/estimate, dry_run: true or max_credits

What it does#

  1. You send a clip of someone moving (a dance, a gesture, a walk, a camera move) and the subject to move.
  2. Pose match (match_pose, on by default) redraws your subject standing like the person in the clip's opening, middle and closing frames: the same pose, position, size in frame and camera angle.
  3. Motion: the clip's motion is applied to your subject, guided by those pictures. It is made in the studio when the studio can make it in time, otherwise with premium rendering.
  4. Sound (keep_sound, on by default): the clip's own sound is put on the result.

The video is as long as the clip, rounded to whole seconds; duration_seconds and resolution are ignored and the result is 720p.

Request#

curl
curl https://bobabanana.com/api/v1/videos \
  -H "Authorization: Bearer $BOBABANANA_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{
    "image": {
      "url": "https://example.com/maya.png"
    },
    "motion_video": {
      "url": "https://example.com/dance.mp4"
    },
    "prompt": "she dances in a sunny studio",
    "max_credits": 200
  }'
Python
import os
import uuid

import requests

r = requests.post(
    "https://bobabanana.com/api/v1/videos",
    headers={"Authorization": f"Bearer {os.environ['BOBABANANA_API_KEY']}", "Idempotency-Key": str(uuid.uuid4())},
    json={
        "image": {
            "url": "https://example.com/maya.png",
        },
        "motion_video": {
            "url": "https://example.com/dance.mp4",
        },
        "prompt": "she dances in a sunny studio",
        "max_credits": 200,
    },
    timeout=60,
)
r.raise_for_status()
print(r.json())
JavaScript
const res = await fetch("https://bobabanana.com/api/v1/videos", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.BOBABANANA_API_KEY}`,
    "Content-Type": "application/json",
    "Idempotency-Key": crypto.randomUUID(),
  },
  body: JSON.stringify({
    "image": {
      "url": "https://example.com/maya.png"
    },
    "motion_video": {
      "url": "https://example.com/dance.mp4"
    },
    "prompt": "she dances in a sunny studio",
    "max_credits": 200
  }),
});
if (!res.ok) throw new Error(JSON.stringify(await res.json()));
console.log(await res.json());
Request
Field Value
motion_video The clip: a url (up to 50 MB) or base64 data (about 25 MB). A file_id is not accepted: POST /v1/files stores pictures and audio only
image or assets The subject: a picture, or exactly one character or object asset (its main view is used)
prompt or motion Optional: details to keep, such as clothing or the background
match_pose Default true. false animates your picture as it is; only premium rendering can make that
keep_sound Default true: the clip's sound goes on the result when it has sound
first_shot_only Default false. For a clip with cuts, true makes only the first shot
aspect_ratio Optional. With match_pose the video takes the clip's shape; otherwise aspect_ratio or the subject's shape
max_credits Recommended: refuse the job if it would cost more

Leave out extend_video, last_frame, reference_images, voice, script, audio and sound_effect: with motion_video they are 400 invalid_request. The clip must have each side at least 256 px and a frame rate of 23.976 to 60 fps; a clip that breaks a rule is 400 invalid_video and the message names the rule.

The job's input shows what was made: motion_video.seconds, duration_seconds, aspect_ratio, match_pose, keep_sound, keyframes (how many pose-matched pictures were made first) and, for a clip with cuts, scenes.

Pose match#

With match_pose on, your subject is first redrawn in the poses of the clip's opening, middle and closing frames (the opening frame only for a clip under 2 seconds, and one opening-frame picture when the studio makes the video). Each picture is a picture step at the image price. Matching the start, middle and end keeps the character steady and makes the result follow the clip much more closely. Turn it off only when your picture already matches the clip's first frame.

Keep the clip's sound#

keep_sound: true (the default) puts the clip's own sound on the result when the clip has sound. Send false for a silent video, for example to add your own soundtrack later.

Clips with cuts#

A clip that cuts between shots (a tutorial, an edited reel) is recognised when you send it. Quick motion, a hand passing the lens and on-screen text are not cuts. Each scene is then made on its own:

  1. every scene gets its own pose-matched pictures from its own frames;
  2. every scene's motion is applied to your subject;
  3. the scenes are joined in their original order, each as long as in your clip, under the clip's own sound.

A clip can have up to 6 scenes, each at least 1.0 second long; otherwise the request is 400 motion_scenes with the reason (too_many or too_short) and the scene facts. Send first_shot_only: true to make only the first shot, at the normal price of a clip that long; its own sound is kept up to the cut.

{
  "assets": [
    "@maya"
  ],
  "motion_video": {
    "url": "https://example.com/trailer.mp4"
  },
  "first_shot_only": true
}

Price it first#

Post the same body to POST /v1/videos/estimate. It finds the clip's cuts and answers the price; nothing is queued, held or stored.

curl
curl https://bobabanana.com/api/v1/videos/estimate \
  -H "Authorization: Bearer $BOBABANANA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "image": {
      "url": "https://example.com/maya.png"
    },
    "motion_video": {
      "url": "https://example.com/dance.mp4"
    }
  }'
Python
import os

import requests

r = requests.post(
    "https://bobabanana.com/api/v1/videos/estimate",
    headers={"Authorization": f"Bearer {os.environ['BOBABANANA_API_KEY']}"},
    json={
        "image": {
            "url": "https://example.com/maya.png",
        },
        "motion_video": {
            "url": "https://example.com/dance.mp4",
        },
    },
    timeout=60,
)
r.raise_for_status()
print(r.json())
JavaScript
const res = await fetch("https://bobabanana.com/api/v1/videos/estimate", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.BOBABANANA_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "image": {
      "url": "https://example.com/maya.png"
    },
    "motion_video": {
      "url": "https://example.com/dance.mp4"
    }
  }),
});
if (!res.ok) throw new Error(JSON.stringify(await res.json()));
console.log(await res.json());
{
  "object": "estimate",
  "credits_estimate": 150,
  "duration_seconds": 9,
  "scenes": 3,
  "scenes_made": 3,
  "scene_seconds": [
    3.2,
    2.5,
    3.3
  ],
  "price_multiplier": 1.5,
  "normal_credits": 100,
  "first_shot_only": false,
  "reason": "This clip has 3 scenes"
}

credits_estimate is what the job would hold if you sent it now; normal_credits is what one continuous clip of the same length costs; price_multiplier is above 1 when several scenes are made. A clip whose scenes cannot be made answers 400 motion_scenes, as the job would. dry_run: true on POST /v1/videos also answers the price, without the scene details.

Pricing#

A motion transfer is priced on the clip's length: video_motion when premium rendering makes it (from a live quote) or video_motion_local when the studio makes it, plus one image per pose-matched picture. cost.credits_estimate is held when the job is accepted and is the most it can cost; you are charged what it really cost, never more. Several scenes cost more (the estimate's price_multiplier). GET /v1/prices shows video_motion with "pricing": "live_quote". Always send max_credits, or price the clip first.

When it cannot be made#

The request answers 400 motion_unavailable with the reason when the motion transfer cannot be made for your workspace now, for example when premium rendering is needed and the workspace's Settings switch "Make work quickly at busy times" is off, or when pictures cannot be made for the pose match (send match_pose: false, or retry later). If the render fails after the job was accepted, the job fails and its credits are released.

Errors for this page#

Errors for this page
Status Code Meaning What to do
400 cost_above_max The job would cost more than max_credits. credits_estimate gives the price. Raise max_credits to at least credits_estimate, or change the request (shorter, smaller, fewer steps).
400 fetch_failed Downloading a URL input failed or returned an HTTP error. Open the URL without cookies to check it; signed links may have expired.
400 file_too_large A file or inline data is over its size limit. Images 25 MB, audio 60 MB, motion clips 50 MB, extend clips 100 MB, inline base64 about 25 MB: give a url or upload first.
400 invalid_request A field is missing, has the wrong type or breaks a rule. param names the field. Type and range problems found while reading the body are 422 with the same code. Read error.param and error.message, fix that field and send again. Do not retry unchanged.
400 invalid_video The video could not be read, or it breaks a clip rule (length, frame rate, size). Read the message: it names the rule. Re-export the clip as H.264 MP4 within the limits.
400 motion_scenes The motion clip has more scenes than can be made, or a scene is too short. Trim the clip, or send first_shot_only: true; price it first with POST /v1/videos/estimate.
400 motion_unavailable A motion transfer cannot be made for this request right now. Read the message; for example send match_pose: false, or retry later.
400 unsupported_file The file is not a supported image, audio or video format. Images: PNG, JPG, WEBP. Audio: WAV, MP3, M4A, OGG, FLAC. Videos: MP4 or MOV (WEBM for extend).
400 wrong_asset_kind The asset is the wrong kind for this field (for example a voice used as a picture). Use GET /v1/assets?kind=... to find an asset of the right kind.
402 insufficient_credits The workspace's available credits are less than the job's estimate. required and available give both numbers. Add credits in the studio, or make a smaller job. Nothing was held.

Tips#

  1. Use a clip with one person, fully in view, on a steady camera.
  2. Pick a subject picture with similar framing to the clip (full body for a dance, head and shoulders for a talk).
  3. Trim the clip to the part you need: you pay for its length.
  4. Price clips with cuts first; use first_shot_only when one shot is enough.

Frequently asked questions#

How long can the motion clip be?#

1 to 15 seconds, up to 50 MB by URL. The video is as long as the clip; duration_seconds is ignored.

Can I use a library character as the subject?#

Yes. Send exactly one character or object in assets, for example "assets": ["@maya"], instead of image. Its main view is used. A voice or place asset is refused with 400 wrong_asset_kind.

Why did my clip cost more than expected?#

It had cuts: each scene is made and joined on its own, at a higher price. Post the body to POST /v1/videos/estimate first to see scenes and price_multiplier, or send first_shot_only: true.

Can a motion transfer speak or have a sound effect?#

No. With motion_video, voice, script, audio and sound_effect are refused. The clip's own sound is kept with keep_sound.

Last updated · View as Markdown · llms.txt