HydrogenAudio

Lossy Audio Compression => Other Lossy Codecs => Topic started by: Wally Walters on 2011-03-03 23:47:33

Title: How to tell if a file has been processed by LossyFLAC
Post by: Wally Walters on 2011-03-03 23:47:33
Just curious:  If a track has been converted to LossyFLAC and then the ".lossy" extension is removed, is there any way to tell that it's not a "lossless" track anymore?
Title: How to tell if a file has been processed by LossyFLAC
Post by: saratoga on 2011-03-04 00:01:12
Since lossy flac zeros bits in the file, I think it would be fairly easy to check if the decoded wav has the expected zero bits in its PCM samples.  I can't think of any other way this would happen, so its probably a pretty good bet that a file like that has been processed by lossywav.
Title: How to tell if a file has been processed by LossyFLAC
Post by: Batman321 on 2011-03-04 02:05:27
Is there a lossy FLAC? 
Title: How to tell if a file has been processed by LossyFLAC
Post by: SonicBooom! on 2011-03-04 09:31:25
http://www.hydrogenaudio.org/forums/index....showtopic=55522 (http://www.hydrogenaudio.org/forums/index.php?showtopic=55522)
Title: How to tell if a file has been processed by LossyFLAC
Post by: SonicBooom! on 2011-03-04 09:35:37
Is there a lossy FLAC? 

Yes, there is. And to blow your mind more, there's even a lossyWAV.

Read this (http://wiki.hydrogenaudio.org/index.php?title=Lossywav) for more info 
Title: How to tell if a file has been processed by LossyFLAC
Post by: GeSomeone on 2011-03-04 09:55:44
lossyWav writes an additional header to the .wav it generates. If in the subsequent FLAC encoding the flag --keep-foreign-metadata was used this header is kept in the .flac as well (I think this doesn't work when piping from lossyWac into FLAC).
In that case you can decode the .flac with flac.exe -d and check the resulting .wav with lossyWav.exe -c (or --check). LossyWav will tell you if the data chunk is present.

BTW I myself add a TAG "ENCODER" wth the lossyWav settings, just in case. But that's a manual extra step as foobar2000 seems to overwrite all tags.
Title: How to tell if a file has been processed by LossyFLAC
Post by: pdq on 2011-03-04 13:32:26
I believe lossy FLAC is a misnomer. You can apply lossy WAV to a file so that it compresses much more with FLAC, but the FLAC file is a lossless copy of the lossy WAV file.
Title: How to tell if a file has been processed by LossyFLAC
Post by: 2Bdecided on 2011-03-04 13:56:26
In the flac file, it would be useful to have a utility to plot the number of "wasted_bits" in each block. These would normally be zero. Occasionally you may happen to get some non zero values by accident. With lossyWAV/FLAC you would get lots of non-zero values in most files, typically somewhat related to signal amplitude.

In a wave file, it would be useful to have a utility to show the bit use with time. You'd expect the MSBs to be zero if the music was quiet - but blocks of zero LSBs (apart from silence) indicate the use of lossyWAV (or upconversion from a lower bitdepth file).

Anyone know of any utilities like this? You can see these in a hex editor, but it's not very clear. Unless you can get binary columns aligned with the audio samples.

Cheers,
David.
Title: How to tell if a file has been processed by LossyFLAC
Post by: romor on 2011-03-04 19:02:19
Interesting idea. I didn't think that byte distribution inside WAV file can reveal such info
It's easy to be spotted with hex editor which has such feature, like HxD and most commercial ones

I wrote simple python script to do the same:

Code: [Select]
import sys

def ByteToHex(byteStr): return '%02X' % ord(byteStr)

try:
    counter = {}

    for bytes in open(sys.argv[1], "rb").read():
        counter[ByteToHex(bytes)] = counter.get(ByteToHex(bytes), 0) + 1

    peak = max(counter.values())

    for key, value in sorted(counter.items(), key=lambda x:(x)):
        print '%s: %06d %s' % (key, value, '-' * (68 * value/peak))

except Exception, e:
    print e


http://pastebin.com/PxPgXLX7 (http://pastebin.com/PxPgXLX7)

Example:
(http://i53.tinypic.com/w1e89v_th.png) (http://i53.tinypic.com/w1e89v.png)
Title: How to tell if a file has been processed by LossyFLAC
Post by: Nick.C on 2011-03-04 19:51:51
There's another way, although manual.

Use the --sampledist or --blockdist parameters to look at the lsb / msb distribution for the audio on a per sample basis or a per codec-block basis:
Lossless Input:
Code: [Select]
lossyWAV beta 1.2.4a, Copyright © 2007-2011 Nick Currie. Copyleft.
Processed : 04/03/2011 19:50:07
Settings  : --quality standard
Filename  : eig.wav
File Info : 44.10kHz; 2 channel; 16 bit, 00:15.00, 2.523MiB
Results  : 2.7483 bits; 14.20x; 00:01.05; [F]

Codec-block least significant bit (lsb) distribution.
+---+------------------------------------+------------------------------------+
|Bit|Input codec-block lsb distribution  |Output codec-block lsb distribution |
+---+-------+----------------------------+-------+----------------------------+
|NUL|  0.00%|............................|  0.00%|............................|
|  0|100.00%|OOOOOOOOOOOOOOOOOOOOOOOOOOOO|  2.47%|O...........................|
|  1|  0.00%|............................|  5.34%|O...........................|
|  2|  0.00%|............................| 43.16%|OOOOOOOOOOOO................|
|  3|  0.00%|............................| 39.29%|OOOOOOOOOOO.................|
|  4|  0.00%|............................|  9.28%|OOO.........................|
|  5|  0.00%|............................|  0.46%|............................|
|  6|  0.00%|............................|  0.00%|............................|
|  7|  0.00%|............................|  0.00%|............................|
|  8|  0.00%|............................|  0.00%|............................|
|  9|  0.00%|............................|  0.00%|............................|
| 10|  0.00%|............................|  0.00%|............................|
| 11|  0.00%|............................|  0.00%|............................|
| 12|  0.00%|............................|  0.00%|............................|
| 13|  0.00%|............................|  0.00%|............................|
| 14|  0.00%|............................|  0.00%|............................|
| 15|  0.00%|............................|  0.00%|............................|
+---+-------+----------------------------+-------+----------------------------+

Codec-block most significant bit (msb) distribution.
+---+------------------------------------+------------------------------------+
|Bit|Input codec-block lsb distribution  |Output codec-block lsb distribution |
+---+-------+----------------------------+-------+----------------------------+
|NUL|  0.00%|............................|  0.00%|............................|
|  0|  0.00%|............................|  0.00%|............................|
|  1|  0.00%|............................|  0.00%|............................|
|  2|  0.00%|............................|  0.00%|............................|
|  3|  0.00%|............................|  0.00%|............................|
|  4|  0.00%|............................|  0.00%|............................|
|  5|  0.00%|............................|  0.00%|............................|
|  6|  0.00%|............................|  0.00%|............................|
|  7|  0.00%|............................|  0.00%|............................|
|  8|  0.00%|............................|  0.00%|............................|
|  9|  1.86%|O...........................|  1.78%|............................|
| 10| 12.76%|OOOO........................| 12.84%|OOOO........................|
| 11| 17.56%|OOOOO.......................| 17.48%|OOOOO.......................|
| 12| 24.05%|OOOOOOO.....................| 24.05%|OOOOOOO.....................|
| 13| 18.72%|OOOOO.......................| 18.79%|OOOOO.......................|
| 14| 25.06%|OOOOOOO.....................| 25.06%|OOOOOOO.....................|
| 15|  0.00%|............................|  0.00%|............................|
+---+-------+----------------------------+-------+----------------------------+

Sample least significant bit (lsb) distribution.
+---+------------------------------------+------------------------------------+
|Bit|Input sample lsb distribution   |Output sample lsb distribution   |
+---+-------+----------------------------+-------+----------------------------+
|NUL|  0.03%|............................|  0.18%|............................|
|  0| 50.03%|OOOOOOOOOOOOOO..............|  0.84%|............................|
|  1| 24.93%|OOOOOOO.....................|  2.11%|O...........................|
|  2| 12.50%|OOOO........................| 16.61%|OOOOO.......................|
|  3|  6.26%|OO..........................| 32.32%|OOOOOOOOO...................|
|  4|  3.14%|O...........................| 23.17%|OOOOOO......................|
|  5|  1.55%|............................| 12.47%|OOO.........................|
|  6|  0.79%|............................|  6.25%|OO..........................|
|  7|  0.39%|............................|  3.10%|O...........................|
|  8|  0.20%|............................|  1.56%|............................|
|  9|  0.10%|............................|  0.77%|............................|
| 10|  0.04%|............................|  0.38%|............................|
| 11|  0.02%|............................|  0.16%|............................|
| 12|  0.01%|............................|  0.06%|............................|
| 13|  0.00%|............................|  0.02%|............................|
| 14|  0.00%|............................|  0.01%|............................|
| 15|  0.00%|............................|  0.00%|............................|
+---+-------+----------------------------+-------+----------------------------+

Sample most significant bit (msb) distribution.
+---+-------+----------------------------+-------+----------------------------+
|Bit|Input sample msb distribution   |Output sample msb distribution   |
+---+-------+----------------------------+-------+----------------------------+
|NUL|  0.18%|............................|  0.03%|............................|
|  0|  0.00%|............................|  0.05%|............................|
|  1|  0.01%|............................|  0.11%|............................|
|  2|  0.11%|............................|  0.22%|............................|
|  3|  0.40%|............................|  0.42%|............................|
|  4|  0.81%|............................|  0.81%|............................|
|  5|  1.62%|............................|  1.62%|............................|
|  6|  3.22%|O...........................|  3.22%|O...........................|
|  7|  6.13%|OO..........................|  6.13%|OO..........................|
|  8| 11.07%|OOO.........................| 11.05%|OOO.........................|
|  9| 16.31%|OOOOO.......................| 16.28%|OOOOO.......................|
| 10| 18.41%|OOOOO.......................| 18.37%|OOOOO.......................|
| 11| 16.78%|OOOOO.......................| 16.75%|OOOOO.......................|
| 12| 11.77%|OOO.........................| 11.76%|OOO.........................|
| 13|  9.10%|OOO.........................|  9.10%|OOO.........................|
| 14|  4.08%|O...........................|  4.08%|O...........................|
| 15|  0.00%|............................|  0.00%|............................|
+---+-------+----------------------------+-------+----------------------------+
Lossy Input:
Code: [Select]
lossyWAV beta 1.2.4a, Copyright © 2007-2011 Nick Currie. Copyleft.
Processed : 04/03/2011 20:16:54
Settings  : --quality standard
Filename  : eig.wav
File Info : 44.10kHz; 2 channel; 16 bit, 00:15.00, 2.523MiB
Results  : 2.7015 bits; 14.80x; 00:01.01; [F]

Codec-block least significant bit (lsb) distribution.
+---+------------------------------------+------------------------------------+
|Bit|Input codec-block lsb distribution  |Output codec-block lsb distribution |
+---+-------+----------------------------+-------+----------------------------+
|NUL|  0.00%|............................|  0.00%|............................|
|  0|  2.47%|O...........................|  2.47%|O...........................|
|  1|  5.34%|O...........................|  3.09%|O...........................|
|  2| 43.16%|OOOOOOOOOOOO................| 36.66%|OOOOOOOOOO..................|
|  3| 39.29%|OOOOOOOOOOO.................| 44.62%|OOOOOOOOOOOO................|
|  4|  9.28%|OOO.........................| 11.91%|OOO.........................|
|  5|  0.46%|............................|  1.24%|............................|
|  6|  0.00%|............................|  0.00%|............................|
|  7|  0.00%|............................|  0.00%|............................|
|  8|  0.00%|............................|  0.00%|............................|
|  9|  0.00%|............................|  0.00%|............................|
| 10|  0.00%|............................|  0.00%|............................|
| 11|  0.00%|............................|  0.00%|............................|
| 12|  0.00%|............................|  0.00%|............................|
| 13|  0.00%|............................|  0.00%|............................|
| 14|  0.00%|............................|  0.00%|............................|
| 15|  0.00%|............................|  0.00%|............................|
+---+-------+----------------------------+-------+----------------------------+

Codec-block most significant bit (msb) distribution.
+---+------------------------------------+------------------------------------+
|Bit|Input codec-block lsb distribution  |Output codec-block lsb distribution |
+---+-------+----------------------------+-------+----------------------------+
|NUL|  0.00%|............................|  0.00%|............................|
|  0|  0.00%|............................|  0.00%|............................|
|  1|  0.00%|............................|  0.00%|............................|
|  2|  0.00%|............................|  0.00%|............................|
|  3|  0.00%|............................|  0.00%|............................|
|  4|  0.00%|............................|  0.00%|............................|
|  5|  0.00%|............................|  0.00%|............................|
|  6|  0.00%|............................|  0.00%|............................|
|  7|  0.00%|............................|  0.00%|............................|
|  8|  0.00%|............................|  0.00%|............................|
|  9|  1.78%|............................|  1.78%|............................|
| 10| 12.84%|OOOO........................| 12.84%|OOOO........................|
| 11| 17.48%|OOOOO.......................| 17.48%|OOOOO.......................|
| 12| 24.05%|OOOOOOO.....................| 24.05%|OOOOOOO.....................|
| 13| 18.79%|OOOOO.......................| 18.79%|OOOOO.......................|
| 14| 25.06%|OOOOOOO.....................| 25.06%|OOOOOOO.....................|
| 15|  0.00%|............................|  0.00%|............................|
+---+-------+----------------------------+-------+----------------------------+

Sample least significant bit (lsb) distribution.
+---+------------------------------------+------------------------------------+
|Bit|Input sample lsb distribution      |Output sample lsb distribution      |
+---+-------+----------------------------+-------+----------------------------+
|NUL|  0.18%|............................|  0.20%|............................|
|  0|  0.84%|............................|  0.84%|............................|
|  1|  2.11%|O...........................|  1.53%|............................|
|  2| 16.61%|OOOOO.......................| 12.96%|OOOO........................|
|  3| 32.32%|OOOOOOOOO...................| 32.73%|OOOOOOOOO...................|
|  4| 23.17%|OOOOOO......................| 24.65%|OOOOOOO.....................|
|  5| 12.47%|OOO.........................| 13.65%|OOOO........................|
|  6|  6.25%|OO..........................|  6.81%|OO..........................|
|  7|  3.10%|O...........................|  3.40%|O...........................|
|  8|  1.56%|............................|  1.71%|............................|
|  9|  0.77%|............................|  0.84%|............................|
| 10|  0.38%|............................|  0.41%|............................|
| 11|  0.16%|............................|  0.18%|............................|
| 12|  0.06%|............................|  0.06%|............................|
| 13|  0.02%|............................|  0.02%|............................|
| 14|  0.01%|............................|  0.01%|............................|
| 15|  0.00%|............................|  0.00%|............................|
+---+-------+----------------------------+-------+----------------------------+

Sample most significant bit (msb) distribution.
+---+-------+----------------------------+-------+----------------------------+
|Bit|Input sample msb distribution      |Output sample msb distribution      |
+---+-------+----------------------------+-------+----------------------------+
|NUL|  0.20%|............................|  0.18%|............................|
|  0|  0.00%|............................|  0.00%|............................|
|  1|  0.01%|............................|  0.01%|............................|
|  2|  0.09%|............................|  0.11%|............................|
|  3|  0.39%|............................|  0.40%|............................|
|  4|  0.81%|............................|  0.81%|............................|
|  5|  1.62%|............................|  1.62%|............................|
|  6|  3.22%|O...........................|  3.22%|O...........................|
|  7|  6.13%|OO..........................|  6.13%|OO..........................|
|  8| 11.07%|OOO.........................| 11.07%|OOO.........................|
|  9| 16.31%|OOOOO.......................| 16.31%|OOOOO.......................|
| 10| 18.41%|OOOOO.......................| 18.41%|OOOOO.......................|
| 11| 16.78%|OOOOO.......................| 16.78%|OOOOO.......................|
| 12| 11.77%|OOO.........................| 11.77%|OOO.........................|
| 13|  9.10%|OOO.........................|  9.10%|OOO.........................|
| 14|  4.08%|O...........................|  4.08%|O...........................|
| 15|  0.00%|............................|  0.00%|............................|
+---+-------+----------------------------+-------+----------------------------+
Title: How to tell if a file has been processed by LossyFLAC
Post by: romor on 2011-03-04 21:40:18
I wrote simple python script...

Couple of magnitudes faster script uploaded here: http://pastebin.com/j2x3zY99 (http://pastebin.com/j2x3zY99)
Title: How to tell if a file has been processed by LossyFLAC
Post by: skexu on 2011-03-19 19:51:57
Okay so if Audiochecker says 100% CD-DA (which is unimportant because Audiochecker doesn't recognize lossyWAV) and output of this python script looks like the example on the right, but in the end is reversing, is it then legit CD source?

If it is, let's allow some OT and tell me how a prog rock FLAC file can have bitrate of 585 kbps? Let's say a friend showed me it.
Title: How to tell if a file has been processed by LossyFLAC
Post by: dv1989 on 2011-03-19 20:06:21
Ask your friend if their file was processed by LossyWhatever or another (read: a conventional) lossy codec.