Video
This section covers the Video API endpoints for managing video content.
Create video object
This endpoint is used to programmatically create a video object.
The request body when creating a video will look like this:
{
"type": "video",
"title": "string",
"description": "string",
"is_public": true,
"metadata": [
{
"key": "string",
"value": "string"
}
],
"qualities": [
{
"resolution": "string",
"type": "string",
"container_type": "string",
"video_config": {
"codec": "string",
"bitrate": 0,
"index": 0
},
"audio_config": {
"bitrate": 0,
"channels": "string",
"codec": "string",
"index": 0,
"language": "string",
"sample_rate": 0
}
}
],
"tags": ["string"]
}The type field is required and must be set to video. Requests that omit type will be rejected.
For example, this would be a simplified body for creating a video:
{
"title": "My Video Title",
"type": "video"
}Advanced Custom Encoding Configuration
For advanced users, you can create detailed, custom encoding configurations to precisely control the video and audio quality outputs.
Configuration Structure
The qualities field is an array containing one or more objects, each defining specific encoding parameters.
Fields available for each quality object:
| Field | Type | Description | Supported Values | Examples |
|---|---|---|---|---|
resolution | string | Resolution of the video output. Required if video_config is specified. | "240p", "360p", "480p", "720p", "1080p", "1440p", "2160p", "4320p" | "360p", "1080p" |
type | string | The streaming format. | "hls", "dash" | "hls" |
container_type | string | For hls, container_type supports mpegts or mp4. For dash, container_type supports fmp4. Must match the type field. | hls: "mpegts", "mp4",dash: "fmp4" | "mpegts" |
video_config | object | (Optional) Video encoding parameters. | See details below | See details below |
audio_config | object | (Optional) Audio encoding parameters. | See details below | See details below |
Video Config Details
This object lets you configure specific video encoding parameters:
| Field | Type | Description | Supported Values | Example |
|---|---|---|---|---|
codec | string | Codec used for video encoding | "h264", "h265" | "h264" |
bitrate | number | Target video bitrate (bits/sec) | Positive integer | 3000000 (~3Mbps) |
index | number | Video track index from input file | Usually 0 (default track) | 0 |
NOTE: On Apple platforms (Safari, iOS, tvOS), HLS supports HEVC/H.265 only when segments are fMP4/CMAF. HEVC in MPEG-TS segments is not supported. H.264/AVC works with both MPEG-TS and fMP4/CMAF.
Video resolutions and their corresponding dimensions and bitrate ranges are as follows:
| Resolution | Dimensions | Max Bitrate (bps) |
|---|---|---|
240p | 426 × 240 | 700,000 bps |
360p | 640 × 360 | 1,200,000 bps |
480p | 854 × 480 | 2,000,000 bps |
720p | 1280 × 720 (HD) | 4,000,000 bps |
1080p | 1920 × 1080 (Full HD) | 6,000,000 bps |
1440p | 2560 × 1440 (2K/QHD) | 12,000,000 bps |
2160p | 3840 × 2160 (4K/UHD) | 30,000,000 bps |
4320p | 7680 × 4320 (8K/UHD-2) | 60,000,000 bps |
Audio Config Details
This object configures specific audio encoding parameters:
| Field | Type | Description | Supported Values | Example |
|---|---|---|---|---|
codec | string | Codec for audio encoding | "aac" | "aac" |
bitrate | number | Target audio bitrate (bits/sec) | Positive integer | 128000 (~128kbps) |
channels | number | Number of audio channels | 1 (mono), 2 (stereo), 3 (2.1/3), 4 (Quad/4.0), 5 (5.0), 6 (5.1) | 2 |
sample_rate | number | Audio sampling rate (Hz) | Typically 44100 or 48000 | 44100 |
language | string | Audio track language (BCP 47 format) | "en", "es", "ja" | "en" |
index | number | Audio track index from input file | Usually 0 (default track) | 0 |
Recommended Audio Bitrates
| Audio Quality | Bitrate (bps) |
|---|---|
| Standard (Stereo) | 128,000 – 192,000 bps |
| High Quality | 192,000 – 256,000 bps |
Sample_rate only accepts the following values.
| Sample Rate (Hz) | Usage & Quality |
|---|---|
8,000 | Telephone quality (lowest) |
11,025 | Low-quality audio for voice recordings |
16,000 | Suitable for clear speech recordings |
22,050 | Medium-quality voice and music |
32,000 | Higher-quality audio, common for streaming voice |
44,100 | CD-quality audio (standard music/audio) |
48,000 | Professional audio & streaming standard |
88,200 | High-definition audio |
96,000 | Studio-grade audio quality |
Important Notes
-
video_configandaudio_configare optional:- If neither is specified, the server applies default encoding values for both audio and video.
- If only
video_configis specified, the encoded result may include only video. - If
video_config's resolution is higher than its source resolution, that quality will be ignored.
-
Track Index (
index):- Specifies which track from the original input file to encode. Typically, this is
0for single-track media. - Ensure correct indexing when dealing with multi-track input sources.
- Specifies which track from the original input file to encode. Typically, this is
-
On Apple platforms (Safari, iOS, tvOS), HLS supports HEVC/H.265 only when segments are fMP4/CMAF. HEVC in MPEG-TS segments is not supported. H.264/AVC works with both MPEG-TS and fMP4/CMAF.
-
Supported codecs:
- Video codecs: Only
H.264andH.265are currently supported. (H.264 maximum resolution is 4K and H.265 is 8K) - Audio codecs: Only
AACis supported.
- Video codecs: Only
Example Configuration
Video with Multiple Quality Settings
{
"title": "My Video",
"type": "video",
"qualities": [
{
"resolution": "1080p",
"type": "hls",
"container_type": "mpegts",
"video_config": {
"codec": "h264",
"bitrate": 5000000,
"index": 0
},
"audio_config": {
"codec": "aac",
"bitrate": 192000,
"channels": "2",
"sample_rate": 48000,
"language": "en",
"index": 0
}
},
{
"resolution": "720p",
"type": "hls",
"container_type": "mpegts",
"video_config": {
"codec": "h264",
"bitrate": 3000000,
"index": 0
},
"audio_config": {
"codec": "aac",
"bitrate": 128000,
"channels": "2",
"sample_rate": 44100,
"language": "en",
"index": 0
}
}
]
}Headers
Body
Response
curl --location https://api.aiozstream.network/api/media/create \
--header 'Authorization: Bearer your_access_token_here' \
# --header 'stream-public-key: your_public_key_here' \
# --header 'stream-secret-key: your_secret_key_here' \
--header 'Content-Type: application/json' \
--data '{
"title": "My Video Title",
"type": "video"
}'List videos
This endpoint lists and searches videos with multiple filters.
Headers
Body
Response
curl 'https://api.aiozstream.network/api/media' \
-H 'authorization: Bearer your_access_token_here' \
# --header 'stream-public-key: your_public_key_here' \
# --header 'stream-secret-key: your_secret_key_here' \
-H 'Content-Type: application/json' \
--data-raw '{"limit":10,"offset":0,"sort_by":"created_at","order_by":"desc","type":"video"}' \Get video detail
This API will show video's detail.
Parameters
Headers
Response
curl --location 'https://api.aiozstream.network/api/media/video_id' \
--header 'authorization: Bearer your_access_token_here'
# --header 'stream-public-key: your_public_key_here' \
# --header 'stream-secret-key: your_secret_key_here'Calculate transcode price
Calculate the estimated transcoding cost for a video based on duration and the selected output qualities. The returned cost is in USD.
NOTE: qualities can be provided as a comma-separated list (e.g. qualities=240p,360p) or as repeated query parameters (e.g. qualities=360p&qualities=1080p). The cost covers transcoding to all requested qualities.
Query
Headers
Response
curl --location 'https://api.aiozstream.network/api/media/cost?duration=60&type=video&qualities=360p%2C1080p' \
--header 'Authorization: Bearer your_access_token_here'
# --header 'stream-public-key: your_public_key_here' \
# --header 'stream-secret-key: your_secret_key_here'Upload video part
This API allows you to upload your video or a part of it. If your file size is larger than the chunk size (chunk size: 50MB – 200MB), split the file into parts and upload each one sequentially.
Parameters
Headers
Body
Response
curl --location 'https://api.aiozstream.network/api/media/video_id/part' \
--header 'Authorization: Bearer your_access_token_here' \
--header 'Content-Range: bytes 0-49999999/100000000' \
--form 'hash="part_content_md5_hash"' \
--form 'index="0"' \
--form 'file=@"/path/to/file"'Upload video completed
This API notifies the server that the video upload process is done. Call this endpoint after all parts have been uploaded successfully.
Parameters
Headers
Response
curl --location 'https://api.aiozstream.network/api/media/video_id/complete' \
--header 'Authorization: Bearer your_access_token_here'Update video info
This API allows you to update video's information.
Parameters
Headers
Body
Response
curl --location --request PATCH 'https://api.aiozstream.network/api/media/video_id' \
--header 'Authorization: Bearer your_access_token_here' \
# --header 'stream-public-key: your_public_key_here' \
# --header 'stream-secret-key: your_secret_key_here' \
--header 'Content-Type: application/json' \
--data '{
"description": "string",
"player_theme_id": "string",
"is_public": true,
"metadata": [
{
"key": "string",
"value": "string"
}
],
"tags": [
"string"
],
"title": "string"
}'Upload video thumbnail
This API allows you to upload a thumbnail for a video.
Parameters
Headers
Body
Response
curl --location 'https://api.aiozstream.network/api/media/video_id/thumbnail' \
--header 'Authorization: Bearer your_access_token_here' \
# --header 'stream-public-key: your_public_key_here' \
# --header 'stream-secret-key: your_secret_key_here' \
--form 'file=@"/path/to/file"'Delete video
Deletes a video object by ID.
Parameters
Headers
Response
curl --location --request DELETE 'https://api.aiozstream.network/api/media/video_id' \
--header 'Authorization: Bearer your_access_token_here'
# --header 'stream-public-key: your_public_key_here' \
# --header 'stream-secret-key: your_secret_key_here'