Managing AI Chapters Using the CMS API

In this topic, you will learn how to generate, translate, find, publish, replace and remove AI Chapters tracks using the Ingest API and the CMS API.

Introduction

AI Chapters generates chapter markers for a video. The result is stored as a standard WebVTT text track with kind set to chapters, so the CMS API reads and manages it like captions or any other text track.

Use the Ingest API to generate, translate, import or edit chapters, and the CMS API to read the track, publish it, replace its file or remove it. Bulk generation is available in Studio only.

What the API can and cannot do

Chapter operations
Operation Available Where
Generate chapters for a video Yes Ingest API
Translate chapters into other languages Yes Ingest API
Import an attached chapter track Yes Ingest API
Edit chapter cues Yes Ingest API
Generate chapters in bulk No Studio, Media module
Read the track and its status Yes CMS API
Publish, replace or remove the track Yes CMS API
Attach a chapter track at ingest Yes Dynamic Ingest API

Prerequisites

  • The account needs the AI Chapters entitlement, and users need the AI Suite Access permission. For the feature itself, see AI Chapters.
  • Requests need an access token. For client credentials and tokens, see the Brightcove OAuth Overview.
  • Ingest API chapter jobs need the video-cloud/video/read operation.
  • CMS API requests need video-cloud/video/read, video-cloud/video/update or video-cloud/video/all.

Endpoints at a glance

Ingest API paths are relative to https://ingest.api.brightcove.com. CMS API paths are relative to https://cms.api.brightcove.com.

Endpoints
To Method Path API
Start a chapter job (generate, translate, import or edit) POST /v1/accounts/{{account_id}}/videos/{{video_id}}/ai/chapters, with /translate, /import or /edit Ingest
Read or cancel the latest job GET, DELETE /v1/accounts/{{account_id}}/videos/{{video_id}}/ai/chapters Ingest
List jobs for the account GET /v1/accounts/{{account_id}}/ai/chapters/jobs Ingest
Read chapter tracks GET /v1/accounts/{{account_id}}/videos/{{video_id}} CMS
Publish, replace or remove a track PATCH /v1/accounts/{{account_id}}/videos/{{video_id}} CMS
Attach a track at ingest POST /v1/accounts/{{account_id}}/videos/{{video_id}}/ingest-requests Dynamic Ingest

Start a chapter job

The four operations are POST requests under /v1/accounts/{{account_id}}/videos/{{video_id}}/ai/ and share the same response.

Generate chapters

POST /ai/chapters. Optional chapters_status (draft, the default, or published) and target_languages to translate in the same job.

      
        {
          "chapters_status": "draft",
          "target_languages": ["es-ES", "fr-FR"]
        }
      
    

Translate chapters

POST /ai/chapters/translate. Required target_languages. Optional main_language when the video has more than one chapter track.

      
        {
          "target_languages": ["es-ES", "fr-FR"]
        }
      
    

Import an attached track

POST /ai/chapters/import. Required language, the language of the attached track.

      
        {
          "language": "en-US"
        }
      
    

Edit chapter cues

POST /ai/chapters/edit. Required language and operations. Each operation is add_cue, delete_cue, update_timing or update_title, with the cue id.

      
        {
          "language": "en-US",
          "operations": [
            {
              "operation": "update_title",
              "cue_id": "8f14e45f-ea3b-4c1e-9c2a-2f4f7c9d1a01",
              "title": "Opening"
            }
          ]
        }
      
    

Each request returns the job id and status:

      
        {
          "job_id": "5c2a9b7e-1d4f-4a8c-9e3b-6f7a2c1d8b04",
          "job_status": "processing"
        }
      
    

Read the job with a GET to the same path until status is finished or failed. A failed job carries an error. Only the latest job is kept.

Find the chapter tracks

Read the video and look for entries in text_tracks where kind is chapters. A video can have one chapter track per language.

Request

      
        GET https://cms.api.brightcove.com/v1/accounts/{{account_id}}/videos/{{video_id}}
        Authorization: Bearer {{access_token}}
      
    

Response

The response is the full video object. The text_tracks array is abridged here, and the other video fields are omitted.

      
        {
          "id": "6300000000001",
          "name": "Quarterly update",
          "text_tracks": [
            {
              "id": "6300000000002",
              "src": "https://cf-videos.brightcove.com/chapters/en.vtt",
              "srclang": "en",
              "label": "Chapters",
              "kind": "chapters",
              "mime_type": "text/vtt",
              "asset_id": "6300000000003",
              "status": "draft",
              "default": false
            }
          ]
        }
      
    

An ingested track carries asset_id, and its src is generated. A remote track carries src and no asset_id.

Publish a draft track

AI Chapters saves generated chapters as a draft by default, so viewers do not see them. Set status to published to make the track visible.

Request

      
        PATCH https://cms.api.brightcove.com/v1/accounts/{{account_id}}/videos/{{video_id}}
        Authorization: Bearer {{access_token}}
        Content-Type: application/json
      
    
      
        {
          "text_tracks": [
            {
              "id": "6300000000002",
              "srclang": "en",
              "label": "Chapters",
              "kind": "chapters",
              "default": false,
              "status": "published"
            }
          ]
        }
      
    

Response

A successful patch returns 200 OK with the updated video object. Confirm the change by checking status in the returned text_tracks array.

Replace a track

To replace the file, ingest a new WebVTT file with the same srclang, kind and label. The CMS API cannot change src on an ingested track: Brightcove stores the file and generates the URL, so a patch that changes src has no effect.

Remove a track

Send the array without the entry you want to remove. To remove every text track from the video, send an empty array.

      
        {
          "text_tracks": []
        }
      
    

Attach a chapter track at ingest

You can attach a chapter track in the same request that ingests the video, by adding it to the text_tracks array of a Dynamic Ingest request. For the full request schema, see Ingesting WebVTT Files (Text Tracks/Captions).

      
        {
          "master": {
            "url": "https://example.com/masters/quarterly-update.mp4"
          },
          "text_tracks": [
            {
              "url": "https://example.com/chapters/en.vtt",
              "srclang": "en",
              "kind": "chapters",
              "label": "Chapters",
              "status": "draft"
            }
          ]
        }
      
    

Omit status and Dynamic Ingest publishes the track.

Chapter track fields

Fields that matter for a chapter track
Field Type Notes
id String Identifies the track when you update it. Read only.
srclang String Language of the track, for example en or en-US. One chapter track per language.
label String User-readable name. AI Chapters stores Chapters for every language.
kind Enum chapters for a chapter track. Case sensitive.
status Enum draft hides the track from viewers, published or null shows it.
src String URL of the WebVTT file. Required for a remote track, generated for an ingested one.
asset_id String System id of the ingested file, or null for a remote track.
default Boolean Enables the track by default.

For the complete list, see CMS API Video Fields Reference: Text Track Fields.

Player behavior

The player names the chapters menu in the language of the chapter track, for example Kapitel for German, and does not use the track's label.

The player selects the chapter track that matches its own language. To follow the caption or audio track the viewer selects instead, enable chapters.autoSwitchLanguage in the player configuration. The option requires Brightcove Player 7.56.1 or later.

      
        {
          "chapters": {
            "autoSwitchLanguage": true
          }
        }
      
    

The chapters menu is available in Prism players.

Rules to design around

  • The array is authoritative. Read it, change it, send the whole thing back.
  • An empty array deletes every text track on the video.
  • One chapter track per language.
  • One chapter operation per video at a time.
  • You cannot add or change text tracks on a video shared from another account.

Credit consumption

Brightcove Credits are consumed when AI Chapters generates a track, not when the API reads, publishes or removes an existing track. Generation is charged per track, per minute of source content, so each language is a separate charge.