[Flac-dev] Detecting lossy encodes

Declan Kelly flac-dev at groov.ie
Fri Jan 7 16:27:41 PST 2011

On Sat, Jan 08, 2011 at 12:54:01AM +0100, jorgen at anion.no wrote:
> I think we agree now on that the "find mp3 before encoding" feature would not be a good idea to implement in the flac core. As Brian pointed out, it might be a better idea to create a program that automatically checks if a flac might have been an mp3 source. 

It would be more versatile to check if the uncompressed audio was taken
from a lossy source. And you'll be doing that anyway, just using libFLAC
to decode it first.
With all lossless encoding, we can be 100% sure that the uncompressed
audio that we get out was the same as what went in, so only checking a
FLAC file limits any tool to only working with FLAC.

There's one for Windows called EncSpot, and I just don't remember the
names of any of the others (but there are others). I'd suggest grabbing
as many of these as possible and especially those with source code
available, before reinventing the wheel.

Just as home taping (and vinyl bootlegging) resulted in many generations
of copies, I'm sure there are MP3 files floating around that were ripped
from CD, encoded at a low bitrate, burnt to CD, copied CD-to-CD on audio
CD recorders, and ripped again.
It might be easy to fingerprint which MP3 encoder was used (and at what
settings) for uncompressed source audio, but I'd be really impressed if
anyone could analyse an MP3 or other lossy file that had been transcoded
more than once.

> Another test, if the FFT test is unclear, is to check the correlation between left and right channel below 3kHz

You need to be careful about stereo separation at lower frequencies.
Every vinyl lab checks this, and almost every mastering house has
warnings about it on their website.
Due to the frequency response of vinyl as a medium, bass has to be cut
when recording, and boosted at playback. The RIAA standardised the vinyl
frequency response curves back in the 1950s or so - before that there
were competing systems using variations on the same frequency curve.
As stereo vinyl is cut at 45 degrees for mono compatibility (a form of
mid side encoding) the difference signal translates into vertical stylus
movement. So the needle will jump out of the groove if there is too much
separation at lower frequencies.
As the human hearing can't really tell direction with lower frequencies,
it's not as essential. This same shortcut is why most movie "surround
sound" systems have only one sub bass channel.


More information about the Flac-dev mailing list