News for hackers. Stuff that matters.
Re:FLAC – Format overview by hnuser123456 on Monday September 05, 2022 @04:56PM (#32729369)
Are there any good ways to tell if audio has been lossy compressed but then re-encoded in a lossless format, or deceptively high lossy bitrate?
Re:FLAC – Format overview by gsora on Monday September 05, 2022 @05:04PM (#32729454)
You can read the spectrogram.

https://interviewfor.red has lots of info about that exact thing, because in some uh… very peculiar communities, sharing a lossy file passed as a lossless file is a serious offense.

Re:FLAC – Format overview by crazygringo on Monday September 05, 2022 @08:15PM (#32731012)
Yup, it's incredibly clear in the spectogram.

You're basically looking for two things: first, an abrupt stop to frequencies above a certain point -- compression uses applies a low-pass filter to eliminate them.

Second, a bunch of rectangular-ish boxes where signal is missing. The spectrogram will look like swiss cheese in a way -- this is where the compression algorithm decides audio information can be deleted because it's "masked" by e.g. louder surrounding sounds.

(Generally speaking, the more aggressive the compression, the lower the frequency ceiling, and the more/bigger swiss cheese holes.)

On the other hand, if you run e.g. AAC compression at a very high bitrate and explicitly force no lowpass filter at all (which virtually nobody does in practice, but you can do from a command-line tool)... you won't be able to see any qualitative difference. Because you won't be able to hear any qualitative difference either. :)

Re:FLAC – Format overview by piperswe on Monday September 05, 2022 @05:40PM (#32729821)
I love how that site has become the de facto main introduction resource to audio compression - makes sense though!
Re:FLAC – Format overview by gsora on Monday September 05, 2022 @06:01PM (#32730017)
It’s the best layman resource out there IMO, also the fact that you might get a chance to get into RED… nothing wrong in that :-)
Re:FLAC – Format overview by aaaaaaaaaaab on Monday September 05, 2022 @06:23PM (#32730203)
I see you’re a man of culture ( ͡° ͜ʖ ͡°)
Re:FLAC – Format overview by dmitri_ignat on Monday September 05, 2022 @04:59PM (#32729407)
You can view it with a spectrogram, audio which has been lossily encoded will have a telltale cutoff in the high frequencies. The lossier the encoding, the lower the frequency ceiling will be.
Re:FLAC – Format overview by sdenton4 on Monday September 05, 2022 @05:36PM (#32729779)
Another thing to look for is deleted or very flat energy between harmonics. Reducing bit rate in inter harmonic regions is most of what's meant by 'psychoacoustics.'

I imagine low pass filtering depends a bit on which compression you're using.

None of these tricks will work for detecting GAN compressed audio, though.

Re:FLAC – Format overview by TonyTrapp on Monday September 05, 2022 @05:54PM (#32729942)
Audiochecker (https://archive.org/details/Audiochecker.v2.0.Beta.Build.457) is amazingly good at detecting WAV/FLAC that is really just a re-encoded from MPEG. It's specific to MPEG though, so it wouldn't be able to detect e.g. Vorbis converted to FLAC.
Re:FLAC – Format overview by pabs3 on Tuesday September 06, 2022 @12:24AM (#32732817)
Looks like that uses aucdtect:

http://tausoft.org/wiki/aucdtect

I wonder if there is any open source implementation of the algorithm it uses.

http://tausoft.org/wiki/True_Audio_Checker_Algorithm

Re:FLAC – Format overview by mustache_kimono on Monday September 05, 2022 @05:01PM (#32729425)
There are a number of python utilities (via scipy, etc.) that claim to do this by checking for the frequency cutoff. See FLAD and fakeflac.
Re:FLAC – Format overview by joveian on Tuesday September 06, 2022 @08:08AM (#32735984)
I couldn't find FLAD but fakeflac doesn't seem to work, even given actual mp3s it claims they are fine :(.

I'm guessing sometimes frequency cutoff is due to using less than ideal microphones, although not the extreme cutoffs (I'm fairly sure it would be gradual in that case). It also seems there is often a fair amount of noise around 20kHz that I'm guessing is from recording equipment, sometimes on tracks that otherwise look suspiciously like they are from lossy audio. Additionally, in some cases there could potentially be high frequency cutoffs in processing while otherwise being lossless, particularly stuff like electronic music where there can be a lot of processing in general. So I'm not sure if it is necessarily all that easy to tell in general, although there are certainly some from Bandcamp that seem highly likely to be conversions from lossy formats :(.

Re:FLAC – Format overview by dTal on Tuesday September 06, 2022 @08:21AM (#32736125)
There is https://losslessaudiochecker.com/ - not sure how well it works.