Docs

Audio exports

Extract AAC audio from a video or audio Source and save it in an M4A file.

Select m4a_aac to create an audio-only file from a Source that contains audio. Video Sources and audio-only Sources use the same request.

Defaults are 128000 bits per second, 48000 Hz, and two channels. Set audio_bitrate, audio_samplerate, and channels when you need different audio settings.

Create an M4A transcode

Run these examples on your server after setting up your SDK and Source. Replace the token and Source ID.

These examples save the file in your Project's output storage. Set storage.path to the filename you want to use.

import Chunkify from '@chunkify/chunkify';

async function main() {
    const client = new Chunkify({
        projectAccessToken: 'My Project Access Token',
    });

    const transcoding = await client.transcodings.create({
        source_id: 'src_2G6MJiNz71bHQGNzGwKx5cJwPFS',
        format: {
            id: "m4a_aac",
            audio_bitrate: 128000,
        },
        storage: {
            path: 'exports/audio.m4a',
        },
    });

    console.log(transcoding.id, transcoding.status);
}

main().catch((error) => {
    console.error(error);
    process.exitCode = 1;
});

Select an interval

Use seek and duration to export part of the Source. The accepted interval is aligned to audio samples and capped at the Source end. It must retain at least 0.001 seconds.

The response omits video dimensions, video codec, and video encoding progress for audio-only output. Follow status and processing_stage, then read the published files collection.

Audio-only selection from a video format

Setting disable_video: true on a video format also resolves to AAC M4A. Its output filename must end in .m4a. Omit video-specific settings, including dimensions, per-title optimization, CRF, and video bitrate.

Encoding parameters

AAC audio-only export from a video or audio Source.

id
"m4a_aac"
string
required

Id specifies an AAC M4A export.

audio_bitrate
default: 128000
integer

AudioBitrate specifies the output audio bitrate in bits per second. Defaults to 128000.

Required range: 32000 <= x <= 512000
audio_samplerate
default: 48000
integer

AudioSamplerate specifies the output sample rate in Hz. Defaults to 48000. WebM Opus audio uses 48000.

Available options:
80001102512000160002205024000320004410048000640008820096000
channels
default: 2
integer

Channels specifies the output channel count. Defaults to stereo. Six channels means 5.1; eight means 7.1.

Available options:
1268
duration
number

Duration specifies the requested output length in seconds. Defaults to the remaining source duration and is capped at the source end. Audio-only output must resolve to at least 0.001 seconds after trimming and sample rounding. The accepted interval determines the fixed price.

seek
number

Seek specifies the start in source seconds. Defaults to zero and must precede the source end. The accepted interval uses the output frame or sample timeline. Audio-only output must retain at least 0.001 seconds after sample rounding.

Required range: x >= 0