Hi, can my video’s length by dynamic depending on the length of my source clip?
Yes. You can set "length"
to "auto"
which will dynamically set the length. of the clip based on the asset source.
You can also set the "length"
to "end"
which will make the clip last for the duration of the whole Edit.
You can find more information in the docs.
{
"timeline": {
"fonts": [
{
"src": "https://shotstack-assets.s3-ap-southeast-2.amazonaws.com/fonts/MovieLetters.ttf"
}
],
"background": "#000000",
"tracks": [
{
"clips": [
{
"asset": {
"type": "text",
"text": "HELLO {{ NAME }}",
"font": {
"family": "Clear Sans",
"color": "#ffffff",
"size": 80
},
"alignment": {
"horizontal": "center"
},
"width": 720,
"height": 212
},
"start": 4,
"length": "end",
"transition": {
"in": "fade",
"out": "fade"
},
"fit": "none",
"scale": 1,
"offset": {
"x": -0.206,
"y": -0.138
},
"position": "center",
"effect": "zoomIn"
}
]
},
{
"clips": [
{
"asset": {
"type": "video",
"src": "https://shotstack-assets.s3-ap-southeast-2.amazonaws.com/footage/earth.mp4"
},
"start": 0,
"length": "auto"
}
]
},
{
"clips": [
{
"asset": {
"type": "audio",
"src": "https://shotstack-ingest-api-v1-sources.s3.ap-southeast-2.amazonaws.com/wzr6y0wtti/zzy8xbmk-1il3-dk4w-qubt-0p4qjs31tpw2/source.mp3"
},
"start": 0,
"length": "end"
}
]
}
]
},
"output": {
"format": "mp4",
"size": {
"width": 1280,
"height": 720
}
}
}
thanks, is there a way to set a clip’s start to an arbitrary point near the end (like 5 seconds before a video (set to auto length) ends?
Basically I have videos of varying lengths, but on all of them I want branding to come up 5 seconds before the end.
We’ve explored options such as setting a clip’s start property dynamically to another clip. Is this what you’re after?
{
"timeline": {
"tracks": [
{
"clips": [
{
"asset": {
"type": "text",
"text": "Welcome to Shotstack",
"font": {
"family": "Clear Sans",
"color": "#ffffff",
"size": 46
},
"alignment": {
"horizontal": "left"
},
"width": 566,
"height": 70
},
"start": "alias://video",
"length": "end",
]
},
{
"clips": [
{
"alias": "video",
"asset": {
"type": "video",
"src": "https://shotstack-assets.s3-ap-southeast-2.amazonaws.com/footage/earth.mp4"
},
"start": 0,
"length": "auto",
"transition": {
"in": "fade",
"out": "fade"
}
}
]
}
]
},
"output": {
"format": "mp4",
"size": {
"width": 1280,
"height": 720
}
}
}
Hi, I see that the text is starting at
alias://video
I am not sure what the means. wouldn’t that make it start at the same time the alias “video” starts? I copy and pasted this into the api playground, and hit render, but it defaults back to the old hello world sample that is in there where the text starts at 4 seconds. Is there a save button I’m missing? I tried in chrome and firefox.
I tried copy and pasting this code into the studio editor as well, but I got an error.