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:
- Set a title for your video, for example, "My first video".
- Inside the
slides
array, create your asset objects. - Set the
type
of asset item you want to add, in this case, it's an "AvatarOverlay". - Use
assetId
andvoiceId
to add an avatar and voice as assets. For this example, we have used [Yvonne] as our avatar (assetId: 1a901a33-8783-418e-af6a-a66dae945673). - Type in your script to be narrated, i.e., "Well done! This is your first video using Yepic's API.".
- Define the insertion point of the avatar into the scene using the variables
xPosition
andyPosition
.
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 --request POST \
--url https://api.yepic.ai/v1/videos \
--header 'Authorization: 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
}
]
}
],
"videoTitle": "My first video"
}
EOF
The request body may contain the following fields:
Fields | Data Type | Required | Description |
---|---|---|---|
videoTitle | string | Yes | The title of the video. |
visibility | string | No | The visibility of the video, it can be either "public" or "private". |
slides | array of object | Yes | The scenes of the video. |
videoHeight | string | No | |
videoWidth | string | No |
A slides
is an array of objects, it contains assets
. For details of avatar
asset fields, refer to the table below:
Fields | Data Type | Required | Description |
---|---|---|---|
type | string | Yes | The type of the asset overlay, for example, "AvatarOverlay", "ImageOverlay", "TextOverlay", etc. |
assetId | string | Yes | The unique identifier of the avatar. Please refer here for more information. |
voiceId | string | No | The unique identifier of the voice asset. |
script | string | No | The 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. |
xPosition | number | No | The x-coordinate of the asset's insertion point. |
yPosition | number | No | The y-coordinate of the asset's insertion position. |
height | number | No | The height of the asset. If height is specified, the scale value will be ignored. |
width | number | No | The width of the asset. If width is specified, the scale value will be ignored. |
scale | string | No | The scale factor being applied over the asset's shape, i.e., height and width. |
style | string | No | The style of the selected avatar, (for example, upper-body or circle ). |
circleBackgroundColor | string | No | The 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 'Authorization: YOUR_API_KEY' \
--header 'content-type: application/json' \
--data @- <<EOF
{
"slides": [
{
"slides": [
{
"type": "avatarAvatar",
"assetId": "1a901a33-8783-418e-af6a-a66dae945673",
"xPosition": 448,
"yPosition": 52,
"script": "Well done! This is your first video using Yepic's API.",
"voiceId": "en-US-JennyMultilingualNeural"
}
],
"color": "#fc0a41"
}
],
"title": "My first video"
}
A scenes
object may contain the following fields (in this scenario, we are only using the color
field):
Fields | Data Type | Description |
---|---|---|
assets | array | List of assets. |
soundtrack | object | The specified sound track. |
color | string | The background color of the scene in hex format. The default value is plain white #ffffff . |
transition | object | The 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?
Updated 2 days ago