I want video show my video vertically in an aspect ratio of 9:16. Right now it shows horizontally.
You just need to set the output aspect ratio using the aspectRatio
parameter.
The JSON would look like as follows:
"output": {
"format": "mp4",
"resolution": "sd",
"aspectRatio": "9:16"
}
Full JSON below:
{
"timeline": {
"soundtrack": {
"src": "https://s3-ap-southeast-2.amazonaws.com/shotstack-assets/private/epic.mp3"
},
"background": "#000000",
"tracks": [
{
"clips": [
{
"asset": {
"type": "html",
"html": "<b>Horizontal Videos for Social Media</b>",
"css": "b { font-family: \"Open Sans\"; color: #ffffff; font-size: 24px; text-align: left; }",
"width": 400,
"height": 200,
"background": "transparent"
},
"start": 1.2,
"length": 5,
"position": "bottomLeft",
"offset": {
"x": 0.05,
"y": 0.05
},
"transition": {
"in": "fade",
"out": "fade"
}
}
]
},
{
"clips": [
{
"asset": {
"type": "video",
"src": "https://shotstack-assets.s3.ap-southeast-2.amazonaws.com/footage/hot-air-balloon-vertical.mp4",
"trim": 5
},
"start": 1,
"length": 6,
"transition": {
"in": "fade",
"out": "fade"
},
"fit": "contain"
}
]
}
]
},
"output": {
"format": "mp4",
"resolution": "hd",
"aspectRatio": "9:16"
}
}
Or with PHP you should be able to use ->setAspectRatio("9:16")
.
API reference doc is here: https://shotstack.io/docs/api