Facial Expressions

✴️ Controlling Your Avatar's Expressions


Creating engaging visuals is all about capturing the attention of the viewer. With D-ID's API, you can take your visuals to the next level by controlling the expressions of your avatar. Adding expressions to your avatar can make them more engaging, fun, and lifelike. This can help boost the engagement with your viewers and increase the overall enjoyment of your visuals.

✴️ Expressions in Action

Standard Result
Neutral Expression
Results with Expressions
Different facial expressions results


Neutral Happy Surprise Serious

✴️ Control Expressions of the Entire Video

To apply an expression to your avatar throughout the entire video, simply add a driver_expressions parameter under the config object of the API request body. For example:

POST https://api.d-id.com/talks | Create a talk

{
  "source_url": "https://myhost.com/image.jpg",
  "script": {
    "type": "text",
    "input": "Hello world!"
  },
  "config": {
    "driver_expressions": {
      "expressions": [
        {
          "start_frame": 0,
          "expression": "surprise",
          "intensity": 1
        }
      ]
    }
  }
}
{
    "id": "tlk_TMj4G1wiEGpQrdNFvrqAk",
    "created_at": "2023-03-22T16:38:49.723Z",
    "created_by": "google-oauth2|12345678",
    "status": "created",
    "object": "talk"
}

The driver_expressions parameter takes an array of objects, each containing the start_frame, expression, and intensity of the expression. To apply the same expression to the entire video add a single expression object and the start_frame of it to 0. Use the expression parameter to control the type of emotion to display, and intensity with a float value between 0 to 1.0 to control the intensity of the emotion.


✴️ Creating a Sequence of Expressions

You can also create a sequence of expressions by adding multiple expressions in the configuration object. For example, the following code snippet shows how you can set your avatar's expression to surprise at the start of the video, happy at frame 50, serious at frame 100, and back to neutral at frame 150. The transition between each expression will take 20 frames in order to create a smooth animation.
By changing the transition_frames argument you can control the smoothness of the transition between the different expressions. Example:

POST https://api.d-id.com/talks | Create a talk

{
  "source_url": "https://url.to.my/image.jpg",
  "config": {
     "driver_expressions": {
        "expressions": [
            {
                "start_frame": 0,
                "expression": "surprise",
                "intensity": 1.0
            },
            {
                "start_frame": 50,
                "expression": "happy",
                "intensity": 1.0
            },
            {
                "start_frame": 100,
                "expression": "serious",
                "intensity": 0.6
            },
            {
                "start_frame": 150,
                "expression": "neutral",
                "intensity": 1.0
            }
        ],
        "transition_frames": 20
    }
  },
  "script": {
    "type": "audio",
    "audio_url": "https://url.to.my/audio.mp3"
  }
}

✴️ Available Expressions

D-ID currently supports the following expressions:

ExpressionDescription
neutralThe default expression each video starts with
happyMakes the avatar smile, affecting the mouth and eyes
surpriseMakes the avatar raises their eyebrows and open their mouth wider
seriousMakes the avatar firm the eyebrows and toughen the lips to create a more serious tone

✴️ Support


Have any questions? We are here to help! Please leave your question in the Discussions section and we will be happy to answer shortly.

Ask a question