Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo


#945 wavinfo wrong output - fmt block size related

externals (233)
Charles Goyard

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

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

  • Charles Goyard
    Charles Goyard

    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.


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



Cancel   Add attachments