Managing Audio Tracks Using the CMS API

In this topic, you will learn how to use the CMS API to get, update, and delete audio tracks of your videos.

Introduction

If your account is enabled for multiple audio tracks, you can retrieve all or a specific audio track for a video, and also update the metadata for the track, or delete it.

Also see Implementing Multiple Audio Tracks for information on ingesting audio tracks.

Authenticating requests

Requests to the CMS API require an authorization header which contains your access tokens. For details on how to obtain client credentials and use them to retrieve access tokens, see the Brightcove OAuth Overview.

The operations you will need to get and update video metadata are video-cloud/video/all.

See Overview: CMS API for more details on authentication.

Get audio tracks for a video

All audio tracks

Request

  
GET
https://cms.api.brightcove.com/v1/accounts/{account_id}/videos/{video_id}/audio_tracks
  
Sample response
[
	{
		"id": "en_main",
		"language": "en",
		"variant": "main",
		"duration": 25588,
		"encoding_rates": [
			63000,
			96000,
			127000,
			192000
		],
		"is_default": true
	},
	{
		"id": "es_alternate",
		"language": "es",
		"variant": "alternate",
		"duration": 27328,
		"encoding_rates": [
			64000,
			96000,
			128000,
			192000
		],
		"is_default": false
	}
]

One audio track

Request

  
GET
https://cms.api.brightcove.com/v1/accounts/{account_id}/videos/{video_id}/audio_tracks/{audio_track_id}
  
Sample response
{
	"id": "es_alternate",
	"language": "es",
	"variant": "alternate",
	"duration": 27328,
	"encoding_rates": [
		64000,
		96000,
		128000,
		192000
	],
	"is_default": false
}

Updating audio tracks

Request

  
PATCH
https://cms.api.brightcove.com/v1/accounts/{account_id}/videos/{video_id}/audio_tracks/{audio_track_id}
  

Sample request body

Sample response
{
  "language": "es-MX",
	"variant": "alternate",
	"is_default": false
}

The table below shows the audio track properties and indicates the ones that can be updated.

Audio Track Fields
Field Type Description
id String READ-ONLY value. Made up of the original language code and variant for the track.
duration Number READ-ONLY value. Duration of the audio track in milliseconds.
encoding_rates Array (integers) READ-ONLY value. Encoding rates for the transcoded audio track in KBPS
is_default Boolean Whether the track is the default track to be played
language String An ISO language code to identify the language of the audio. You can use basic codes such as fr or codes with a locale identifier, such as fr-CA. See the ISO Language Code Table.
variant Enum Valid values are:
  • main
  • alternate
  • dub
  • commentary
  • descriptive

Delete an audio track

Request

  
DELETE
https://cms.api.brightcove.com/v1/accounts/{account_id}/videos/{video_id}/audio_tracks/{audio_track_id}
  

A successful request will return a 204 NO CONTENT response.