The AudioFIFO API provides a first in first out buffer for audio samples. This is useful for buffering audio data between different processing stages.
const fifo = new ffmpeg.AudioFIFO(sampleFormat, channels, nbSamples)sampleFormat(number|string): The audio sample formatchannels(number): Number of audio channelsnbSamples(number): Initial buffer size in samples
Returns: A new AudioFIFO instance
const fifo = new ffmpeg.AudioFIFO(ffmpeg.constants.sampleFormats.S16, 2, 1024)Gets the number of samples currently in the FIFO.
Returns: number
Gets the number of samples that can be written to the FIFO.
Returns: number
Writes samples from a frame to the FIFO. The FIFO will automatically grow if needed.
Parameters:
frame(Frame): The audio frame containing samples to write
Returns: number of samples written
Reads samples from the FIFO into a frame.
Parameters:
frame(Frame): The frame to read samples intonbSamples(number): Number of samples to read
Returns: number of samples actually read
Reads samples from the FIFO without removing them.
Parameters:
frame(Frame): The frame to read samples intonbSamples(number): Number of samples to peek
Returns: number of samples peeked
Removes samples from the FIFO without reading them.
Parameters:
nbSamples(number): Number of samples to drain
Returns: void
Resets the FIFO to empty state.
Returns: void
Destroys the AudioFIFO and frees all associated resources. Automatically called when the object is managed by a using declaration.
Returns: void