Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

In the wild found a wav with 0 bits_per_sample in hound that audacity can play. #50

Open
Cocalus opened this issue Feb 17, 2021 · 2 comments

Comments

@Cocalus
Copy link

Cocalus commented Feb 17, 2021

Someone I work with found a wav file that according to ffmpeg -i used the encoder (may have gone through other tools)

Adobe Premiere Pro CC 2017.1 (Windows)

But hound is returning that is has 0 bit samples.
audacity and ffmpeg can read it, but sox can't. soxi returns
"WAVE file fmt with padded samples is not supported yet"

It appears the extended header has wValidBitsPerSample set to zero. I'm guessing ffmpeg and audacity fall back to wBitsPerSample (16 in this case) when that happens.

It looks to be an easy enough change to hound to have such a fallback. But we've only found one example so far and I don't know if there maybe other reasons not to support that kind of fallback.

@ruuda
Copy link
Owner

ruuda commented Feb 17, 2021

Thank you for taking the time to open an issue!

The wValidBitsPerSample field is redundant in most cases, where it is equal to wBitsPerSample, but wValidBitsPerSample can also be smaller than a multiple of 8. 0 bits per sample is silly, so it probably has a different meaning. The field in WAVEFORMATEXTENSIBLE is part of a union, but the docs don't say which value is valid in which case. It could be that Premiere interpreted the field as the wReserved field, which must be 0.

Your suggestion to fall back to the wBitsPerSample if wValidBitsPerSample is zero makes sense to me, and it could be done without breaking any files that are currently supported.

Would you be able to provide a test file for this, to confirm a fix, and to add as a regression test? It should be stripped of most audio data to keep the repository small and also to ensure there is no copyrighted audio in there. A file with ~10 samples or so would be ideal.

@Cocalus
Copy link
Author

Cocalus commented Feb 19, 2021

The original is about 177MB and I doubt I could share it, I could try to trim it but I suspect any tools I have that accept it would likely "fix" the header in the process. I can try to hexedit one of the current examples and see if it fails the same way on my end.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants