minimp4
minimp4 copied to clipboard
minimp4 parses samplerate as 0 when audio track uses 32-bit format
When minimp4 parses the audio track samplerate, it assumes the samplerate field is stored as a 16.
#if MP4D_INFO_SUPPORTED
SKIP(6*1+2/*Base SampleEntry*/ + 4*2);
tr->SampleDescription.audio.channelcount = READ(2);
SKIP(2/*samplesize*/ + 2 + 2);
tr->SampleDescription.audio.samplerate_hz = READ(4) >> 16;
#else
However, some encoders — such as Matroska-based muxers or FFmpeg — write this value as a full 32-bit integer. As a result, when minimp4 parses the field, the samplerate is set to 0 instead of the correct value.
The parser should correctly handle 32-bit samplerate values written by these encoders.