Audio/Subtitle Streams
Reference for adding audio and/or subtitle tracks.
Prefer the official SDKs when available:
- Node.js / TypeScript SDK —
npm install @gumlet/nodejs-sdk - Python SDK —
pip install gumlet
- Audio Tracks: Allows delivering video with one or more audio streams in different languages.
- Subtitle Tracks: Allows delivering video with one or more subtitle streams (refers to the text on the screen for translation purposes) in different languages.
Gumlet transcodes and delivers audio and/or subtitle streams present in the video container. In addition to that, we also provide the functionality to add audio/subtitle streams into Gumlet for transcoding and delivery via API.
Audio stream files need to be in any of the following formats: mp3, opus, flac, wav, ac3, m4a, aac.
Subtitles need to be either an SRT or WebVTT file.
These tracks can be added via the Gumlet API using the additional_tracks parameter (in the Create Asset POST request), which takes an array of objects with the following fields.
| Parameter | Description |
|---|---|
| url | URL or web address of a file that Gumlet should download to add a stream. |
| type | Type of additional track. Value can be either audio or subtitle. |
language_code |
The language code value represents the BCP 47 specification compliant value. For example, en for English. |
| name | The name of the track containing a human-readable description. |
Except for the name field, all parameters are required.
import Gumlet from '@gumlet/nodejs-sdk';
const client = new Gumlet({
apiKey: process.env['API_KEY'],
});
const videoAsset = await client.videoAssets.create({
input: 'https://gumlet.sgp1.digitaloceanspaces.com/video/sample_1.mp4',
workspace_id: '<your workspace id>',
format: 'ABR',
additional_tracks: [
{
url: 'https://gumlet.sgp1.digitaloceanspaces.com/video/sample_1.aac',
type: 'audio',
language_code: 'en',
name: 'English',
},
],
});
console.log(videoAsset);
import os
from gumlet import Gumlet
client = Gumlet(
api_key=os.environ.get("API_KEY"),
)
video_asset = client.video_assets.create(
input="https://gumlet.sgp1.digitaloceanspaces.com/video/sample_1.mp4",
workspace_id="<your workspace id>",
format="ABR",
additional_tracks=[
{
"url": "https://gumlet.sgp1.digitaloceanspaces.com/video/sample_1.aac",
"type": "audio",
"language_code": "en",
"name": "English",
}
],
)
print(video_asset)
curl -L -X POST 'https://api.gumlet.com/v1/video/assets' \
-H 'Authorization: Bearer <YOUR_API_KEY>' \
-H 'Content-Type: application/json' \
-d '{
"input": "https://gumlet.sgp1.digitaloceanspaces.com/video/sample_1.mp4",
"workspace_id": "<your workspace id>",
"format": "ABR",
"additional_tracks": [
{
"url": "https://gumlet.sgp1.digitaloceanspaces.com/video/sample_1.aac",
"type": "audio",
"language_code": "en",
"name": "English"
}
]
}'
Example response:
{
"asset_id": "61246ef47f0b8e419df0406a",
"progress": 0,
"created_at": 1629777652652,
"status": "queued",
"tag": [],
"workspace_id": "5f462c1561cf8a766464ffc4",
"input": {
"transformations": {
"format": "ABR",
"video_codec": [
"libx264"
],
"audio_codec": [
"aac"
],
"thumbnail": [
"auto"
],
"thumbnail_format": "png",
"mp4_access": false,
"per_title_encoding": true,
"process_low_resolution_input": false,
"keep_original": true,
"audio_only": false
},
"source_url": "https://gumlet.sgp1.digitaloceanspaces.com/video/sample_1.mp4",
"additional_tracks": [
{
"url": "https://gumlet.sgp1.digitaloceanspaces.com/video/sample_1.aac",
"type": "audio",
"language_code": "en",
"name": "English"
}
]
},
"output": {
"format": "ABR",
"status_url": "https://api.gumlet.com/v1/video/assets/61246ef47f0b8e419df0406a",
"playback_url": "https://video.gumlet.io/5f462c1561cf8a766464ffc4/61246ef47f0b8e419df0406a/1.m3u8",
"thumbnail_url": [
"https://video.gumlet.io/5f462c1561cf8a766464ffc4/61246ef47f0b8e419df0406a/thumbnail-1-0.png"
]
}
}

