Skip to content

@seydx/rtsp / RawAudioInput

Interface: RawAudioInput

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

Description of the raw framed audio pushed into a RawAudioTranscoder.

Each frame handed to push() must be exactly one coded audio frame in this format — raw elementary frames carry no sync or length information of their own, so the framing (one buffer per frame) is what makes them decodable.

Properties

channels

channels: number

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

Number of audio channels in the incoming frames (1 for mono, 2 for stereo).


codec

codec: string

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

Lower-case FFmpeg codec name of the incoming frames (for example aac, pcm_mulaw).

Determines the RTP payload mapping used internally and, unless RawAudioInput.decoder overrides it, the decoder that consumes the frames.


config?

optional config?: string

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

Hex-encoded codec configuration announced to the decoder (for AAC this is the AudioSpecificConfig, for example from buildAacEldConfig).

Raw elementary frames carry no codec parameters in-band, so most formats — and every AAC object type — need this for the decoder to interpret the frames at all. May be omitted for self-describing codecs such as G.711.


decoder?

optional decoder?: string

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

Explicit decoder implementation to use instead of the codec's default.

FFmpeg's built-in decoder is not always able to handle every profile of a codec: raw AAC-ELD, for example, decodes only with libfdk_aac. When omitted, the default decoder for RawAudioInput.codec is used.


sampleRate

sampleRate: number

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

Sample rate of the incoming audio in hertz (for example 16000).


samplesPerFrame

samplesPerFrame: number

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

Number of PCM samples each pushed frame decodes to (for example 480 for AAC-ELD with the 480-sample frame length, 1024 for AAC-LC).

Drives the synthesized timestamps, so a wrong value plays the audio too fast or too slow rather than failing outright.