Create a Video Clip

📽️ Generate a single-scene video with customized background and an avatar.

In this guide, we will discover how to create a video and customize the background using the Yepic API.

Create a Video

Let's create a single-scene video with an avatar overlay narrating a script by following these easy steps:

  1. Set a title for your video, for example, "My first video".
  2. Inside the slides array, create your asset objects.
  3. Set the type of asset item you want to add, in this case, it's an "AvatarOverlay".
  4. Use assetId and voiceId to add an avatar and voice as assets. For this example, we have used [Yvonne] as our avatar (assetId: 1a901a33-8783-418e-af6a-a66dae945673).
  5. Type in your script to be narrated, i.e., "Well done! This is your first video using Yepic's API.".
  6. Define the insertion point of the avatar into the scene using the variables xPosition and yPosition.

🚧

Caution:

Don't forget to replace the placeholder "YOUR_API_KEY" with your unique API key in the header. If you haven't obtained one yet, please contact us at [email protected], and we will provide one as soon as possible.

The following is a basic request example of creating a video:

curl -X 'POST' \
  'https://api.yepic.ai/v1/videos' \
  -H 'accept: application/json' \
  -H 'X-Api-Key: 194bbf67-e6fd-45da-943f-773ee2ed83a2' \
  -H 'Content-Type: application/json' \
  -d '{
  "parentId": null,
  "groupId": null,
  "draft": false,
  "videoTitle": "My video from Swagger",
  "videoFormat": "mp4",
  "videoHeight": 1080,
  "videoWidth": 1920,
  "slides": [
    {
      "id": "19a90b4c-ae86-49fd-ab54-154b01f4bece",
      "slideDuration": null,
      "backgroundColor": "#ffffff",
      "soundtrack": null,
      "transition": null,
      "overlays": [
        {
          "type": "AvatarOverlay",
          "assetId": "3bfc9743-a530-44d7-9980-6af1993e81b2",
          "assetName": null,
          "assetUrl": null,
          "xPosition": 448,
          "yPosition": 56,
          "height": 1024,
          "width": 1024,
          "script": "Creating eye-catching videos is a must-have for anyone, not just marketers, as the Internet becomes synonymous with video.",
          "voiceId": "en-US-JennyMultilingualNeural",
          "voiceOverId": null,
          "voiceOverName": null,
          "voiceOverUrl": null,
          "insideShape": null,
          "shapeBackgroundColor": ""
        },
        {
          "type": "TextOverlay",
          "text": "Creating eye-catching videos is a must-have for anyone, not just marketers, as the Internet becomes synonymous with video.",
          "xPosition": 0,
          "yPosition": 0,
          "font": "",
          "fontSize": 120
        },
        {
          "type": "ImageOverlay",
          "assetId": "00000000-0000-0000-0000-000000000000",
          "assetName": "",
          "assetUrl": "",
          "xPosition": 0,
          "yPosition": 0,
          "height": null,
          "width": null,
          "scale": 1,
          "angle": 0
        },
        {
          "type": "VideoOverlay",
          "assetId": "00000000-0000-0000-0000-000000000000",
          "assetName": "",
          "assetUrl": "",
          "xPosition": 0,
          "yPosition": 0,
          "height": null,
          "width": null,
          "scale": 1,
          "length": "Full",
          "volume": 1,
          "angle": 0
        },
        {
          "type": "CircleOverlay",
          "centerX": 0,
          "centerY": 0,
          "radius": 100
        },
        {
          "type": "EllipseOverlay",
          "centerX": 0,
          "centerY": 0,
          "radiusX": 100,
          "radiusY": 100,
          "angle": 0
        },
        {
          "type": "RectangleOverlay",
          "xPosition": 0,
          "yPosition": 0,
          "height": 100,
          "width": 100,
          "angle": 0
        }
      ]
    }
  ]
}'

The request body may contain the following fields:

FieldsData TypeRequiredDescription
videoTitlestringYesThe title of the video.
visibilitystringNoThe visibility of the video, it can be either "public" or "private".
slidesarray of objectYesThe scenes of the video.
videoHeightstringNo
videoWidthstringNo

A slides is an array of objects, it contains assets. For details of avatar asset fields, refer to the table below:

FieldsData TypeRequiredDescription
typestringYesThe type of the asset overlay, for example, "AvatarOverlay", "ImageOverlay", "TextOverlay", etc.
assetIdstringYesThe unique identifier of the avatar. Please refer here for more information.
voiceIdstringNoThe unique identifier of the voice asset.
scriptstringNoThe script of the scene. The maximum length of the script is 4000 characters. If the script is not specified, speech-to-text won't be activated.
xPositionnumberNoThe x-coordinate of the asset's insertion point.
yPositionnumberNoThe y-coordinate of the asset's insertion position.
heightnumberNoThe height of the asset. If height is specified, the scale value will be ignored.
widthnumberNoThe width of the asset. If width is specified, the scale value will be ignored.
scalestringNoThe scale factor being applied over the asset's shape, i.e., height and width.
stylestringNoThe style of the selected avatar, (for example, upper-body or circle).
circleBackgroundColorstringNoThe background color of the circle. This is only applicable if the avatar style is circle.

✅Congratulations! Your first video has been generated!

Edit Background

It is possible to customize the background to your preference. You can change the background color by specifying the color field in the scenes array. Hex color codes can be used to specify the canvas's color.

📘

Info:

Hex color codes are a combination of six letters or numbers with a pound or hash sign (#) at the beginning. To obtain the desired color's hex values, you can utilize a variety of RGB to hex color converters.

A request example of creating a single-scene video with the background color specified is as follows:

curl --request POST \
     --url https://api.yepic.ai/v1/videos \
     --header 'X-Api-Key: YOUR_API_KEY' \
     --header 'accept: application/json' \
     --header 'content-type: application/json' \
     --data @- <<EOF
{
     "slides": [
          {
               "overlays": [
                    {
                         "type": "AvatarOverlay",
                         "assetId": "1a901a33-8783-418e-af6a-a66dae945673",
                         "voiceId": "en-US-JennyMultilingualNeural",
                         "script": "Well done! This is your first video using Yepic's API.",
                         "xPosition": 448,
                         "yPosition": 56,
                         "width": 1024,
                         "height": 1024
                    }
               ]
          }
     ],
     "color": "#fc0a41"
     "videoTitle": "My first video"
}
EOF

A scenes object may contain the following fields (in this scenario, we are only using the color field):

FieldsData TypeDescription
assetsarrayList of assets.
soundtrackobjectThe specified sound track.
colorstringThe background color of the scene in hex format. The default value is plain white #ffffff.
transitionobjectThe transition between the scenes.

The following video will be generated with the background color as specified in the request.

✅Congratulations! You have successfully edited your video background using our API!

📌 Need help?

If you require assistance or encounter any issues, we recommend referring to our FAQ page first. If you are still unable to resolve your issue, please don't hesitate to contact us for further support.