Create a video with your own photo

Preset avatars may not suitable if you need to use your own portrait, or when you need more customized portraits.

The greatest thing is, you can make your own avatar with only one photo. We call that a "Talking Photo".

Next, we'll show you how to create a talking photo with your own photo.

Prepare a photo

There are some restricts on the photo you provided:

  • The face is intact and clearly visible.
  • Recommend using real human faces.
  • Only one face shows in the photo.
  • The resolution of the face area is larger than 200x200 pixels.

Upload the talking photo image

Upload a local file with the upload endpoint

curl -XPOST https://upload.heygen.com/v1/talking_photo
     -H 'x-api-key: ZTQwYTY0Y2RiZDc0NDc3MjkyMWJkMGE2NTRiMmMwYTAtMTY4MjEwODI1NA=='
     --data-binary '@<local file path>'
     -H 'Content-Type: image/jpeg'

The only argument you need to pass is the content type of the image. We listed the mapping of the file type and the content type.

File typeContent type
JPEGimage/jpeg
PNGimage/png

The API will respond to you with two things: talking_photo_id and talking_photo_url

{
  "code": 100,
  "data": {
    "talking_photo_id": "your talking photo id",
    "talking_photo_url": "your talking photo url"
  },
  "msg": null
}

Create video with the talking photo id

curl -XPOST https://api.heygen.com/v1/video.generate -H 'x-api-key:<your api key>' -H 'Content-Type: application/json' \
-d '{
  "background": "#ffffff",
  "clips": [
    {
      "talking_photo_id": "<your talking photo id>",
      "input_text": "Welcome to HeyGen API",
      "scale": 1,
      "voice_id": "1bd001e7e50f421d891986aad5158bc8"
    }
  ],
  "ratio": "16:9",
  "test": true,
  "version": "v1alpha"
}'