malint - validate MPEG audio streams


malint [-cCdDEfFgGhIpPtTV] [-N MIN] [file ...]


The malint utility parses and validates the MPEG audio streams named in the file arguments (or standard input if none are given) and prints information about the streams and any format violations it finds.

The output for each file is grouped under a line with that file's name. The diagnostic and informative messages are preceded with the byte offset they pertain to.


For options that specify what test should be performed, a lower case letter turns the test on, and an upper case letter turns it off. For long options, prepend no- to turn them off.

The options are as follows:

Check CRC fields of the MPEG stream (default).
Don't check CRC fields of the MPEG stream.
Display duration of the stream (default).
Don't display duration of the stream.
Only display error diagnostics: ignore some warnings and don't display informational messages (tags and duration of the stream).
Display frame header field changes that occur in the stream (default).
Don't display changes in frame header fields.
Check for unused bytes in bit reservoir.
Don't check for unused bytes in bit reservoir (default).
Display help message.
Display only info (bit rate, length, tags at beginning and end), do not parse whole file.
--resync-count MIN
If the stream gets out of sync, require at least MIN consecutive frames to accept resync.
Check for missing padding in last frame (default).
Don't check for missing padding in last frame.
Display information about ID3 tags (default).
Don't display information about ID3 tags.
Display contents of ID3 tags (default). If tags are not displayed, their contents aren't displayed, either.
Do not display contents of ID3 tags. If tags are displayed, only their position and version is shown.
Display version information.

Error and warning messages

CRC error (calc:XXXX != file:YYYY)
The CRC calculated by malint for this frame (XXXX) differs from the CRC stored in the stream (YYYY).

frame data overflows frame (M > N)
The length of data in this frame (M, calculated from side-info or bit-alloc) is more than the frame can contain (N).

illegal header XXXXXXXX (AAAA)
A frame header was not found where expected, instead the four bytes XXXXXXXX (in hex, AAAA in ASCII) were found.

bit reservoir spans across ID3 tag
Parts of the bit reservoir are located before an ID3 tag, whereas this frame is located after it. This is dubious at best, since many players do not account for tags when finding the bit reservoir for a frame.

main_data_begin overflows bit reservoir (N > R)
main_data_begin says this frame uses N bytes of the bit reservoir, but the previous frame only left R bytes as bit reservoir.

gap in bit stream (N < R)
Only N of the R bytes in the bit reservoir are used. This is not an error, and some encoder limit the amount of bit reservoir they'll use (e.g. to one frame), and thus create gaps if it becomes bigger.

skipping N bytes
N bytes were skipped during resynchronization.

skipping N bytes, reaching EOF
N bytes were skipped during resynchronization, thus reaching the end of the stream. Resynchronization failed.

no sync found in 1mb, bailing out
no sync was found while scanning 1 megabyte. Resynchronization was given up.

short [last] frame N of L bytes (D+P=M missing)
The [last] frame should be L bytes long, but was found to be only N bytes long. D bytes of frame data and P bytes of padding (giving M bytes total) are missing.

padding missing from [last] frame (P bytes)
All P bytes of padding were found to be missing from the [last] frame. This shouldn't cause problems if it is the last frame.

padding missing from [last] frame (M of P bytes)
M of P bytes padding were found to be missing from the [last] frame. This shouldn't cause problems if it is the last frame.

Info messages

MPEG V layer L ...
Shows the MPEG version, audio layer and other parameters contained in the frame header. This is also output if header parameters change within the stream.

play time: HH:MM:SS (N frames)
Play time of this stream is HH:MM:SS, it contains N frames. (The play time calculation does not work if the sampling frequency is not constant throughout the stream.)

play time: HH:MM:SS (according to vbr tag)
If using fast info mode, the number of frames is not counted. According to the VBR tag, play time of this stream is HH:MM:SS.

play time: HH:MM:SS (aproximately)
If using fast info mode, the number of frames is not counted. Based on the assumption that bit rate and sampling frequency are constant throughout the stream, the number of frames is approximated as file-length/frame-length, giving a play time of HH:MM:SS.

ID3 tag version X found.

ID3v1 tag (in middle of file)
ID3v1 tags should be stored in the last 128 bytes of the stream. This tag was found in the middle of the stream, which might not be found by some players, or even cause problems (loss of sync).


Dieter Baron


VBR only works if the VBR tag is at the beginning of the stream (possibly after an ID3 tag) and spans to the end of the stream.

ID3v2 tags with unsynchronization are not handled properly.

Layer 2 CRC calculation is not performed.

Validation of the huffman data in layer 3 streams is not performed.