Videos
Create video object
This endpoint is used to programmatically create a video object.
The request body when create a video object will look like this:
{
"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"],
"title": "video's title"
}
Notice the title
is required.
For example, this would be a simplified body for this request:
{
"title": "video's title"
}
Advanced Custom Encoding Configuration
For advanced users, you can create detailed, custom encoding configurations to precisely control the video and audio quality outputs. Below you'll find a comprehensive guide on configuring the qualities
field in your encoding JSON.
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 | (Conditional) Resolution of the video output. Required if video_config is specified. For audio-only configurations, this can be any descriptive string. | "240p" , "360p" , "480p" , "720p" , "1080p" , "1440p" , "2160p" , "4320p" , or any descriptive label for audio-only | "360p" , "1080p" , "audio-only" |
type | string | The streaming format. | "hls" , "dash" | "hls" |
container_type | string | Container format for the output stream. 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: apple hls only support h265
codec in mp4 container type.
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 | string | Number of audio channels | "1" (mono), "2" (stereo) | "2" |
sample_rate | number | Audio sampling rate (Hz) | Typically 44100 or 48000 | 44100 |
language | string | Audio track language (ISO code) | "en" , "es" , "jp" | "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 |
Your audio must use one of the following valid sample rates:
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_config
andaudio_config
are optional:- If neither is specified, the server applies default encoding values for both audio and video.
- If only one (
video_config
oraudio_config
) is specified, the encoded result may include only video or audio, respectively.
-
Track Index (
index
):- Specifies which track from the original input file to encode. Typically, this is
0
for 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
-
Supported codecs:
- Video codecs: Only
h264
andh265
are currently supported. - Audio codecs: Only
aac
is supported.
- Video codecs: Only
-
Apple HLS supports the
h265
(HEVC) codec exclusively with themp4
container type. Usingmpegts
with HEVC (h265
) is not supported on Apple devices and will result in playback failures. -
Invalid configurations:
- If the
qualities
array is empty or not provided, the server will return an error. - If both
video_config
's resolution is higher than its source resolution, that quality will be ignored.
- If the
Example Advanced Configuration
Here's a practical example to illustrate custom encoding settings clearly:
{
"qualities": [
{
"resolution": "1080p",
"type": "hls",
"container_type": "mpegts",
"video_config": {
"codec": "h265",
"bitrate": 5000000,
"index": 0
},
"audio_config": {
"codec": "aac",
"bitrate": 192000,
"channels": "2",
"sample_rate": 48000,
"language": "en",
"index": 0
}
},
{
"resolution": "720p",
"type": "dash",
"container_type": "fmp4",
"video_config": {
"codec": "h264",
"bitrate": 3000000,
"index": 0
}
// No audio_config specified, video-only output for this quality.
},
{
"resolution": "audio",
"type": "dash",
"container_type": "fmp4",
"audio_config": {
"codec": "aac",
"bitrate": 192000,
"channels": "2",
"sample_rate": 48000,
"language": "en",
"index": 0
}
// No video_config specified, audio-only output for this quality.
// Video only resolutions will use this audio playlist.
}
]
}
Headers
Body
Response
curl --location https://api.aiozstream.network/api/videos \
--header 'Accept-Language: en-US,en;q=0.9' \
--header 'Authorization: Bearer <YOUR_JWT_TOKEN>' \
--data '{
"title": "video's title"
}'
List videos
This API will list all your videos.
Headers
Body
Response
curl 'https://api.aiozstream.network/api/videos' \
-H 'accept: application/json, text/plain, */*' \
-H 'authorization: Bearer <YOUR_JWT_TOKEN>' \
--data-raw '{"limit":10,"offset":0,"sort_by":"created_at","order_By":"desc"}' \
Get video object
This API will show video's detail.
Parameters
Headers
Response
curl --location 'https://api.aiozstream.network/api/videos/video_id' \
--header 'accept: application/json, text/plain, */*' \
--header 'authorization: Bearer <YOUR_JWT_TOKEN>'
Calculate transcode price
This endpoint allows you to calculate the price to transcode your video based on your choice of qualities and video's duration.
Query
Headers
Response
curl --location 'https://api.aiozstream.network/api/videos/cost?duration=60&qualities=360p%2C1080p' \
--header 'accept: application/json' \
--header 'Authorization: Bearer <YOUR_JWT_TOKEN>'
Upload video part
This API allows you to upload your video or a part of it if your video's size is larger than chunk size (chunk size: 50MB - 200MB).
Parameters
Headers
Body
Response
curl --location 'https://api.aiozstream.network/api/videos/video_id/part' \
--header 'accept: application/json, text/plain, */*' \
--header 'authorization: Bearer <YOUR_JWT_TOKEN>' \
--header 'content-range: bytes {start_pos}-{end_pos}/{file_size}' \
--form 'hash="part\'s content MD5 hash"' \
--form 'index="part\'s index"' \
--form 'file=@"/path/to/file"'
Upload video completed
This API notify server that video's uploading process is done.
Parameters
Headers
Response
curl --location 'https://api.aiozstream.network/api/videos/video_id/complete' \
--header 'accept: application/json, text/plain, */*' \
--header 'authorization: Bearer <YOUR_JWT_TOKEN>'
Update video object
This API allow you to update video's information.
Parameters
Headers
Body
Response
curl --location --request PATCH 'https://api.aiozstream.network/api/videos/video_id' \
--header 'accept: application/json' \
--header 'Authorization: Bearer <YOUR_JWT_TOKEN>' \
--header 'Content-Type: application/json' \
--data '{
"description": "string",
"player_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 certain video.
Parameters
Headers
Body
Response
curl --location 'https://api.aiozstream.network/api/videos/video_id/thumbnail' \
--header 'accept: application/json' \
--header 'Authorization: Bearer <YOUR_JWT_TOKEN>' \
--form 'file=@"/path/to/file"'
Delete video
This API will delete certain video.
Parameters
Headers
Response
curl --location --request DELETE 'https://api.aiozstream.network/api/videos/video_id' \
--header 'accept: application/json' \
--header 'Authorization: Bearer <YOUR_JWT_TOKEN>'