Skip to content

decode_audio crashes with "Frame does not match AudioFifo parameters" on files whose sample rate/format changes mid-stream #1451

@raivisdejus

Description

@raivisdejus

decode_audio fails on audio files whose stream changes sample rate (or sample format) partway through. _group_frames creates an AudioFifo() and writes every decoded frame into it, but the FIFO locks onto the parameters of the first frame and rejects any later frame that differs:

  File "faster_whisper/audio.py", line 96, in _group_frames
      fifo.write(frame)
    File "av/audio/fifo.pyx", line 81, in av.audio.fifo.AudioFifo.write
  ValueError: Frame does not match AudioFifo parameters.

The AudioResampler later in the chain would happily normalize these frames, but the crash happens in _group_frames, before resampling.

Sample audio that produces the issue.
whisper-french-mixed-samplerate.mp3

This issue has been reported in my project by user. The sample file above is a synthetic/crafted example, but apparently such issue can happen in the wild.
Love faster whisper, excellent tool!
Best regards and much energy in future development of faster whisper!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions