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

Close

#945 wavinfo wrong output - fmt block size related

v0.43
open
nobody
externals (233)
5
2012-10-31
2012-10-24
Charles Goyard
No

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

Discussion

  • Charles Goyard
    Charles Goyard
    2012-10-24

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

     
  • Charles Goyard
    Charles Goyard
    2012-10-27

    Hi,
    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.

    Thanks,
    Charles

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

     


Anonymous


Cancel   Add attachments