How to Compare Two Lossless Audio Files on Linux

alacaudioffmpegflaclinux

I have an M4A file which is also converted to a FLAC file. I'd like to see if the conversion is lossless, namely, whether the output to pcm from M4A is exactly identical to the one from FLAC decoding.

I assume there's a way to use FFmpeg or Libav to produce some "raw" output and compare them?

Best Answer

I'd try converting them both to WAV and comparing their checksums.

ffmpeg -i file1.m4a file1.wav
ffmpeg -i file2.flac file2.wav
md5sum file1.wav
md5sum file2.wav
rm file?.wav

Compare the md5s produced. If they match, congratulations! Your files contain the same data. If they don't match, post the output of those commands here, and I'll look. Potentially there is a bitrate difference or something (there ought not to be... but there may be, I don't know.)

Note that the ffmpegs will generate comparatively large intermediate files.

Related Question