Skip to content

@seydx/rtsp / buildAacEldConfig

Function: buildAacEldConfig()

buildAacEldConfig(sampleRate, channels, frameLength): string

Defined in: sources/raw-audio-transcoder.ts:178

Build the AudioSpecificConfig for raw AAC-ELD, hex-encoded.

AAC-ELD (Enhanced Low Delay, audio object type 39) cannot be carried in ADTS — the ADTS header has only a 2-bit profile field — so devices that speak it tend to deliver bare frames that are undecodable without this out-of-band configuration. The returned hex string plugs directly into RawAudioInput.config.

Parameters

sampleRate

number

Sample rate in hertz; must be a standard MPEG-4 rate (e.g. 16000).

channels

number

Channel count (1–7) written as the channel configuration.

frameLength

480 | 512

Samples per ELD frame; 480 or 512.

Returns

string

The hex-encoded AudioSpecificConfig (for example f8f03000 for 16 kHz mono, 480-sample frames).

Throws

If the sample rate is not a standard MPEG-4 rate or the frame length is invalid.

Example

typescript
import { buildAacEldConfig } from '@seydx/rtsp';

const config = buildAacEldConfig(16000, 1, 480); // 'f8f03000'