Skip to main content

Topic: How to tell if a file has been processed by LossyFLAC (Read 5873 times) previous topic - next topic

0 Members and 1 Guest are viewing this topic.
How to tell if a file has been processed by LossyFLAC
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?

  • saratoga
  • [*][*][*][*][*]
How to tell if a file has been processed by LossyFLAC
Reply #1
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.

  • Batman321
  • [*][*]
How to tell if a file has been processed by LossyFLAC
Reply #2
Is there a lossy FLAC? 

How to tell if a file has been processed by LossyFLAC
Reply #3
sin(α) = v sound/v object = Mach No.

How to tell if a file has been processed by LossyFLAC
Reply #4
Is there a lossy FLAC? 

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

Read this for more info 
sin(α) = v sound/v object = Mach No.

  • GeSomeone
  • [*][*][*][*][*]
How to tell if a file has been processed by LossyFLAC
Reply #5
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.
In theory, there is no difference between theory and practice. In practice there is.

  • pdq
  • [*][*][*][*][*]
How to tell if a file has been processed by LossyFLAC
Reply #6
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.

  • 2Bdecided
  • [*][*][*][*][*]
  • Developer
How to tell if a file has been processed by LossyFLAC
Reply #7
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.

  • romor
  • [*][*][*][*][*]
How to tell if a file has been processed by LossyFLAC
Reply #8
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

Example:

  • Nick.C
  • [*][*][*][*][*]
  • Developer
How to tell if a file has been processed by LossyFLAC
Reply #9
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%|............................|
+---+-------+----------------------------+-------+----------------------------+
  • Last Edit: 04 March, 2011, 03:18:59 PM by Nick.C
lossyWAV -q X -a 4 -s h -A --feedback 1| FLAC -5 -e -p -b 512 -P=4096 -S- ~= 320kbps

  • romor
  • [*][*][*][*][*]
How to tell if a file has been processed by LossyFLAC
Reply #10
I wrote simple python script...

Couple of magnitudes faster script uploaded here: http://pastebin.com/j2x3zY99

  • skexu
  • [*]
How to tell if a file has been processed by LossyFLAC
Reply #11
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.
  • Last Edit: 19 March, 2011, 03:56:13 PM by skexu

  • db1989
  • [*][*][*][*][*]
  • Global Moderator
How to tell if a file has been processed by LossyFLAC
Reply #12
Ask your friend if their file was processed by LossyWhatever or another (read: a conventional) lossy codec.