#945 wavinfo wrong output - fmt block size related

externals (234)

While using wavinfo on wav files (converted with ffmpeg), I noticed the sample count is wrong (real large).
The problem comes from the fact that ffmpeg always uses a 18 bytes block size for the fmt section, while wavinfo seems to assume it's always 16 bytes.
The standard says if type is PCM then size should be 16, but can be 18 for other formats.
wavinfo should either refuse to read the malformed wav file or use the actual fmt block size, not return nonsense. This involves splitting the wave_t structure in two or maybe using an union.

Attached is a sample wav file.

Note that readsf~ is able to read the file.

Thank you


  • Charles Goyard

    Charles Goyard - 2012-10-24
  • Charles Goyard

    Charles Goyard - 2012-10-24

    sorry, config info:
    pd-extended nightly build (comparable to 0.43.4).

  • Nobody/Anonymous

    BTW I filed a bug for ffmpeg, because it's not clear cut what the size of the header should be.

  • Hans-Christoph Steiner

    • assigned_to: nobody --> tmusil
  • Hans-Christoph Steiner

    assigned to Thomas Musil, he's the iemlib author

  • Charles Goyard

    Charles Goyard - 2012-10-27

    after further discussion with ffmpeg people, reading about the format, and study of wavinfo.c, the problems are:
    - that wavinfo assumes the fmt chunk is always 16 bytes. It can be as large as 40+ bytes in some cases.
    - that wavinfo assumes the data chunk is always following the fmt chunk, which is not guaranteed. There can be a LIST chunk in between (and the next ffmpeg release will do so it seems).

    However, iemlib's soundfile_info (which I didn't knew about before Hans assigned the bug) behaves correctly with every wav file I tried.

    So basically wavinfo and soundfile_info provide equivalent functionality, with ext13/wavinfo failing to do it well in some cases.
    Maybe its documentation can be updated to state it works only with certains wav files, and that soundfile_info is a better choice. Would have saved me a few hours.


  • IOhannes m zmölnig

    • assigned_to: tmusil --> nobody
  • IOhannes m zmölnig

    un-assigned tmusil, since he is not involved in [wavinfo] (which is part of ext13 by d13b).



Cancel  Add attachments