Generate Videos

How to generate videos - Abyssale REST API

Videos (mp4) can be created by sending data and customisation parameters to the POST /async/banner-builder/{template_id}/generate endpoint (with the image_file_type property equals to mp4), which will respond synchronously with only a generation_request_id property.

Once the generation is completed, the result will then be posted to the callback_url (webhooks system).

  • Supported template type: Animated

  • Generation response type: Asynchronous (Webhooks or Polling)

Generation Request (1st & 2nd)

Ensure the image_file_type parameter has the value mp4.

In addition to the supported image properties, a video property can be sent through the Abyssale REST API call to customise the output video. Here is the available option:

  • fps: Number of frames per second. Default value is 24

    • Min: 2

    • Max: 25

"video": { 
    "fps": 24 
},

Input videos

Videos can be added to your template & then can be customised via the video_url property:

For exemple:

    "video_element_name": {
      "video_url": "https://link-to-video.com/myVideo.mp4",
      "audio_muted": 0
    },
  • The video_url only accepts mp4, webm or mov video public URLs.

  • The maximum file size is 100Mo per video

  • The video can be trimmed using the following query properties to the video url:

    • trim_start: Start of the video in seconds. i.e: ?trim_start=2.5 to start your video at 2.5s

    • trim_end: End of the video in seconds. i.e: ?trim_end=10 to end your video at 10s

  • The generated video extension is mp4.

  • The sound can be muted by using the property audio_muted and set it to 1

File compression level

You can optionally set the file_compression_level. The "File Compression Level" option allows you to fine-tune the balance between file size and quality when processing files. You can choose a value between 1 and 100, where 1 represents the highest compression for the smallest file size (lower quality), and 100 signifies the best quality with larger file sizes. The default value is 100.

"file_compression_level": 100

Sample request

​Do not forget to replace {YOUR-API-KEY} and {templateId}

curl -X POST -H "x-api-key:{YOUR-API-KEY}" -H "Content-Type: application/json"  \
-d '{
  "callback_url": "https://webhook.mycompany.com/videos",
  "image_file_type": "mp4",
  "video": {
    "fps": 24
  },
  "template_format_names": ["facebook-feed", "instagram-post", "iab-medium"],
  "elements": {
    "primary_text": {
        "payload": "New branding available.",
        "color": "#FF0000"
    },
    "video_0": {
      "video_url": "https://local-banners.s3-eu-west-1.amazonaws.com/templates/v2/e0d292f2-ec21-11e9-a539-3c408bf94155/0386dce5-1d39-4b22-a6e2-50c1a680af72/v2_80332e7e-4e33-4f28-a397-2203dc63a5f5.mp4",
      "audio_muted": 0
    }
  }
}' \
https://api.abyssale.com/async/banner-builder/{template_id}/generate

All formats of a template can be generated by removing the template_format_names property.

Sample response

{
  "generation_request_id": "df75afa8-5a77-4e03-aeef-6d1b6dd0580a"
}

Generation response (3rd step)

The generation response can be obtained either by polling the API or by receiving the response directly to a callback_url that was announced during the generation request. Either way the payload of the response will look like the NEW_BANNER_BATCH event.

  • Each format will be returned as a mp4 file

  • The cdn_url property won't be returned

Response Example

{
  "id": "df75afa8-5a77-4e03-aeef-6d1b6dd0580a",
  "banners": [
    {
      "id": "3bbde867-9b8b-4b5a-b976-bff40ee34d8f",
      "format": {
        "id": "facebook-feed",
        "width": 1200,
        "height": 1090
      },
      "template": {
        "id": "0ebd5717-9c1e-46dc-9ac9-6fee030bdb1a",
        "name": "test video",
        "created_at": 1685093576,
        "updated_at": 1693300429
      },
      "file": {
        "type": "mp4",
        "url": "https://cdn.test.com/.../video.mp4"
        "filename": "video.mp4"
      }
    },
    ...
  ]
}

Last updated