When users only need audio—such as in music apps, podcast players, or background audio playback of video content—transferring the full video file wastes bandwidth. Audio extraction lets CDN edge nodes strip the video track from a video file and return only the audio stream, reducing bandwidth consumption for audio-only use cases.
How it works
When a client requests a video file with the ali_audio_only=1 query parameter, the nearest CDN edge node intercepts the request, extracts the audio track, and returns only the metadata and audio data. The video data is never sent to the client.
The client must support chunked transfer encoding (Transfer-Encoding: chunked).
Enable audio extraction
-
Log on to the CDN console.
-
In the left navigation pane, click Domain Names.
-
On the Domain Names page, find the target domain name and click Manage in the Actions column.
-
In the domain's navigation pane, click Video.
In the Audio Extraction section, turn on the switch.
Make a request
After audio extraction is enabled, include ali_audio_only=1 in the request URL:
http://<domain>/<video-file>?ali_audio_only=1Replace the placeholders with your actual values:
Placeholder | Description | Example |
| Your CDN accelerated domain name |
|
| Path to the video file |
|
The CDN node returns only the metadata and audio data. If the parameter is absent or set to any value other than 1, audio extraction is not performed.
Supported formats
MP4
Metadata requirement: The metadata must be in the file header. Files with metadata in the file tail are not supported.
Box header size: Only MP4 files with an 8-byte box header are supported. MP4 files with a 16-byte (64-bit) box header are not supported.
Example request:
http://<domain>/video.mp4?ali_audio_only=1FLV
Metadata requirement: No requirements.
Example request:
http://<domain>/video.flv?ali_audio_only=1Limitations
Range requests are not supported. Browsers such as Safari automatically issue range requests when playing media. We recommend that you provide user-developed clients to your users for extracting audio data.
Seeking requires additional configuration. If users need to seek through audio content, enable the video seeking feature. Video seeking reads the file metadata to determine the total file length, which enables position-based seeking.
MP4 box header size
If an MP4 file fails to be processed by the audio extraction feature, the mdat box of the file may use an extended 16-byte header, which is not compatible with audio extraction. Use this section to understand box header sizes and verify whether your files are compatible.
About MP4 box headers
An MP4 file consists of multiple boxes (container units), such as the moov box and mdat box. Each box contains a header that describes the box size and type. There are two header formats:
Format | Header size | Description |
Standard header | 8 bytes (32-bit) | Contains a size field (4 bytes) and a box type field (4 bytes). The size field stores the actual size of the box. Used when the box size can be represented in 4 bytes. |
Extended header | 16 bytes (64-bit) | Contains a size field (4 bytes, fixed value of 1), a box type field (4 bytes), and a largesize field (8 bytes). When the size field equals 1, the largesize mechanism is enabled, and the actual box size is stored in the largesize field. Commonly used for mdat boxes with large data volumes. |
Check the box header size of an MP4 file
You can use the following tools to check the box header size of an MP4 file.
Method 1: Use the MP4Box.js online tool (recommended)
Upload your MP4 file.
In the left-side Box View tree, click mdat (MediaDataBox).
In the right-side Box Property View, check the
original_sizefield to determine the header size:original_sizeis 1: The mdat box header size is 16 bytes. Audio extraction is not supported.original_sizeis not displayed or is not 1: The mdat box header size is 8 bytes. Audio extraction is supported.
The following table compares the properties for both scenarios:
Property | Header size = 8 bytes (supported) | Header size = 16 bytes (not supported) |
size | Actual size value | Actual size value |
box_name | MediaDataBox | MediaDataBox |
start | Offset in bytes | Offset in bytes |
original_size | Not displayed | Displayed as 1 |
Method 2: Use the Bento4 command-line tool
Run the following command:
./mp4dump your-file.mp4 | grep -E "\[mdat\]|\[moov\]"Interpret the output:
[mdat] size=8+xxxxxx: Header size is 8 bytes. Audio extraction is supported.[mdat] size=16+xxxxxx: Header size is 16 bytes. Audio extraction is not supported.
Audio extraction header size limitation
Audio extraction supports only MP4 files in which the mdat box uses a standard 8-byte header. Files in which the mdat box uses an extended 16-byte header (largesize mechanism) are not supported.
MP4 file scenario | Header size | Audio extraction |
mdat box uses a standard header | 8 bytes | Supported |
mdat box uses an extended large-size header | 16 bytes | Not supported |
This limitation applies primarily to the mdat box, which stores the raw media data. Other boxes such as moov typically use the default 8-byte header and are not affected by this limitation.