IPB

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
How to tell if a file has been processed by LossyFLAC
Wally Walters
post Mar 4 2011, 00:47
Post #1





Group: Members
Posts: 19
Joined: 16-April 07
Member No.: 42587



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?
Go to the top of the page
+Quote Post
saratoga
post Mar 4 2011, 01:01
Post #2





Group: Members
Posts: 5055
Joined: 2-September 02
Member No.: 3264



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.
Go to the top of the page
+Quote Post
Batman321
post Mar 4 2011, 03:05
Post #3





Group: Members
Posts: 67
Joined: 28-December 09
Member No.: 76405



Is there a lossy FLAC? ohmy.gif
Go to the top of the page
+Quote Post
SonicBooom!
post Mar 4 2011, 10:31
Post #4





Group: Members
Posts: 118
Joined: 16-February 11
Member No.: 88210



http://www.hydrogenaudio.org/forums/index....showtopic=55522


--------------------
sin(α) = v sound/v object = Mach No.
Go to the top of the page
+Quote Post
SonicBooom!
post Mar 4 2011, 10:35
Post #5





Group: Members
Posts: 118
Joined: 16-February 11
Member No.: 88210



QUOTE (Batman321 @ Mar 4 2011, 10:05) *
Is there a lossy FLAC? ohmy.gif

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

Read this for more info biggrin.gif


--------------------
sin(α) = v sound/v object = Mach No.
Go to the top of the page
+Quote Post
GeSomeone
post Mar 4 2011, 10:55
Post #6





Group: Members
Posts: 922
Joined: 22-October 01
From: the Netherlands
Member No.: 335



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.
Go to the top of the page
+Quote Post
pdq
post Mar 4 2011, 14:32
Post #7





Group: Members
Posts: 3426
Joined: 1-September 05
From: SE Pennsylvania
Member No.: 24233



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.
Go to the top of the page
+Quote Post
2Bdecided
post Mar 4 2011, 14:56
Post #8


ReplayGain developer


Group: Developer
Posts: 5191
Joined: 5-November 01
From: Yorkshire, UK
Member No.: 409



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.
Go to the top of the page
+Quote Post
romor
post Mar 4 2011, 20:02
Post #9





Group: Members
Posts: 680
Joined: 16-January 09
Member No.: 65630



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
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:


--------------------
scripts: http://goo.gl/M1qVLQ
Go to the top of the page
+Quote Post
Nick.C
post Mar 4 2011, 20:51
Post #10


lossyWAV Developer


Group: Developer
Posts: 1805
Joined: 11-April 07
From: Wherever here is
Member No.: 42400



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
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
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%|............................|
+---+-------+----------------------------+-------+----------------------------+


This post has been edited by Nick.C: Mar 4 2011, 21:18


--------------------
lossyWAV -q X -a 4 --feedback 4| FLAC -8 ~= 320kbps
Go to the top of the page
+Quote Post
romor
post Mar 4 2011, 22:40
Post #11





Group: Members
Posts: 680
Joined: 16-January 09
Member No.: 65630



QUOTE (romor @ Mar 4 2011, 20:02) *
I wrote simple python script...

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


--------------------
scripts: http://goo.gl/M1qVLQ
Go to the top of the page
+Quote Post
skexu
post Mar 19 2011, 20:51
Post #12





Group: Members
Posts: 44
Joined: 6-February 11
Member No.: 87966



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.

This post has been edited by skexu: Mar 19 2011, 20:56
Go to the top of the page
+Quote Post
db1989
post Mar 19 2011, 21:06
Post #13





Group: Super Moderator
Posts: 5275
Joined: 23-June 06
Member No.: 32180



Ask your friend if their file was processed by LossyWhatever or another (read: a conventional) lossy codec.
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 1st November 2014 - 12:07