Skip to main content

Topic: Detecting whether a 24-bit file has been upconverted from 16-bit? (Read 20326 times) previous topic - next topic

0 Members and 2 Guests are viewing this topic.
Detecting whether a 24-bit file has been upconverted from 16-bit?
Reply #25
I downloaded a FLAC album from online web store and it appears that the files I've downloaded are 24-bit. it's not a hd web store like hdtracks, it's generally a CD 16-bit 44.1kHz store with either FLAC or MP3 to choose from in its offerings.

I'm wondering whether the 24-bit files are real and were supplied as 24-bit from the label and they just didn't label it correctly on the download page, or whether there was an encoding error or just somehow it made its way from 16-bit files to 24-bit FLACs.

Is there a way I can definitively tell or analyze it (looking at spectral maybe) to see if it's been upconverted? Are there certain algorithms and 'good jobs' that can be done to make its 16->24 upconversion undetectable?


Many of the actual upconversions are going to be pretty hard to determine by simple means. For example it is pretty well known that about half of all so-called HD tracks started out as analog tapes or non-CD digital recordings that either came from or passed through the analog domain during the transcription process.

Catching only the clerical errors and obvious transcription errors  is only a partial solution.

  • Sparktank
  • [*]
Detecting whether a 24-bit file has been upconverted from 16-bit?
Reply #26
Code: [Select]
flac -ac foo.flac | findstr wasted_bits (for windows)

fbits:
Code: [Select]
#!/bin/bash

me="${0##*/}"

if [ -w "$TMPDIR" ]; then
tdir="$TMPDIR"
elif [ -w '/tmp' ]; then
tdir='/tmp'
elif [ -w "$HOME" ]; then
tdir="$HOME"
elif [ -w "$PWD" ]; then
tdir="$PWD"
else
echo "$me: error: can't find a writable directory for creating the temporary file" 1>&2 ; exit 1
fi

tf="$( TMPDIR="$tdir" mktemp "${tdir}/${me}.XXXX" 2>/dev/null )"
if [ -z "$tf" ]; then
echo "$me: error: can't create temporary file" 1>&2 ; exit 1
fi

checkbits ()
{
local bps abps tbps=0 n=0
bps="$( metaflac --show-bps "$1" )"
flac -ac "$1" 2>/dev/null | fgrep 'wasted_bits' | cut -d '=' -f 3 | cut -f 1 > "$tf"
while read wb; do
tbps=$(( tbps + ( bps - wb ) ))
((n++))
done < "$tf"
abps=$(( ( ( tbps * 10 / n) + 5 ) / 10 )) # (* 10 + 5) / 10 for proper rounding
printf "%2u/%2u bits\t%s\n" "$abps" "$bps" "$1"
}

for f in "$@"; do
case "$f" in
*.flac) checkbits "$f" ;;
*) continue ;;
esac
done

rm -f "$tf"

Usage:
Code: [Select]
fbits *.flac

Can anyone convert that Unix BASH script for Windows BATCH script?
I don't want to install anything more, I've got so much installed already.

Windows 7 (x64) and Windows XP (x86) user.

Using what nu774 provided gives me over 4,000 lines of text.
It would be more convenient to have summarized results in a printed text file.

Thanks for any help.

PS: I've ready looked at a few threads where people were trying, miserably, to install software to use BASH scripts on a Windows environment.
Those threads didn't seem entirely successful and were incomplete in instructions.
I like to use "HD audio" in PaulStretch. "HD audio", lol.

  • skamp
  • [*][*][*][*][*]
  • Developer
Detecting whether a 24-bit file has been upconverted from 16-bit?
Reply #27
Maybe Greynol can help?
See my profile for measurements, tools and recommendations.

  • Case
  • [*][*][*][*][*]
  • Developer (Donating)
Detecting whether a 24-bit file has been upconverted from 16-bit?
Reply #28
Here's a quick Windows .cmd script trying to do the same thing: [ Specified attachment is not available ]

  • Sparktank
  • [*]
Detecting whether a 24-bit file has been upconverted from 16-bit?
Reply #29
Here's a quick Windows .cmd script trying to do the same thing: (Attachment Link)


Thank you! But it's hard to figure out why it's not working.
I've replaced the only isntance of the program call with the filepath of the actual program.

It just opens and then closes right away.
I like to use "HD audio" in PaulStretch. "HD audio", lol.

  • Case
  • [*][*][*][*][*]
  • Developer (Donating)
Detecting whether a 24-bit file has been upconverted from 16-bit?
Reply #30
It's meant to be used from command prompt when flac.exe and metaflac.exe are in search path. You can add "pause" command as the last line and then you can drag and drop .flac files over it. For drag and drop use it's enough to have flac.exe and metaflac.exe in the same dir as the .cmd file.
  • Last Edit: 13 April, 2013, 05:11:33 AM by Case

  • mjb2006
  • [*][*][*][*][*]
Detecting whether a 24-bit file has been upconverted from 16-bit?
Reply #31
Thanks for the .cmd version.

I suggest modifying it to use flac -acs rather than flac -ac, so you don't get the copyright/warranty/license header after every file it processes. (Maybe this varies by flac build?)

Detecting whether a 24-bit file has been upconverted from 16-bit?
Reply #32
I downloaded a FLAC album from online web store and it appears that the files I've downloaded are 24-bit. it's not a hd web store like hdtracks, it's generally a CD 16-bit 44.1kHz store with either FLAC or MP3 to choose from in its offerings.

I'm wondering whether the 24-bit files are real and were supplied as 24-bit from the label and they just didn't label it correctly on the download page, or whether there was an encoding error or just somehow it made its way from 16-bit files to 24-bit FLACs.

Is there a way I can definitively tell or analyze it (looking at spectral maybe) to see if it's been upconverted? Are there certain algorithms and 'good jobs' that can be done to make its 16->24 upconversion undetectable?


It all depends on how the file was upconverted.

If a schlock job was done, and the file was converted from 16 to 24 by simply padding with zeroes, then that would be detectable by obvious means.

If a good job was done with a properly dithered conversion, then I don't know of a reliable numerical test for that.

I'd like to see people explain why their code fragments should be reliable, and then demonstrate that their code fragments are reliable detectors of upsampling if the file was upsampled correctly.

  • greynol
  • [*][*][*][*][*]
  • Global Moderator
Detecting whether a 24-bit file has been upconverted from 16-bit?
Reply #33
I don't see the point in adding dither when increasing the bit-depth.
13 February 2016: The world was blessed with the passing of a truly vile and wretched person.

Your eyes cannot hear.

  • skamp
  • [*][*][*][*][*]
  • Developer
Detecting whether a 24-bit file has been upconverted from 16-bit?
Reply #34
I'd like to see people explain why their code fragments should be reliable, and then demonstrate that their code fragments are reliable detectors of upsampling if the file was upsampled correctly.


Is that directed at me? I make no such claim.
See my profile for measurements, tools and recommendations.

Detecting whether a 24-bit file has been upconverted from 16-bit?
Reply #35
I don't see the point in adding dither when increasing the bit-depth.


Cover up. Keep it from being easy to detect your trickery.

Detecting whether a 24-bit file has been upconverted from 16-bit?
Reply #36
Anyone know how to adjust Skamp's script to work with wavpack files (hybrid in my case)? Wvunpack -ss doesn't seem to supply the needed information

Thanks
Music lover and recovering high end audiophile

Detecting whether a 24-bit file has been upconverted from 16-bit?
Reply #37
I don't see the point in adding dither when increasing the bit-depth.
Cover up. Keep it from being easy to detect your trickery.
I suppose you mean: make bits 17-24 active because them being static zeros would reveal that they are not part of the original signal.
To make sure all 8 bits are effected, a tiny bit of DSP (e.g. a level change of -0.01dB) would be more effective IME since dither might not toggle all 8 bits.

  • MikeFord
  • [*][*][*]
Detecting whether a 24-bit file has been upconverted from 16-bit?
Reply #38
How would this technique rate a file consisting of a single loud piano note every few seconds with some softly spoken voice?

How do different masterings come out, something lower level vs the loud nonoise version?

  • Sparktank
  • [*]
Detecting whether a 24-bit file has been upconverted from 16-bit?
Reply #39
Regarding the Windows fbits.cmd, I lost the version I had.

I downloaded the one provided and made some changes to it so it would not only scan the entire directory, but also print logs for each file (the detailed logs) and then pretty much keep the CMD screen clean (reporting only final results) and then printing those displayed results.

I don't know where I put the modified version and I can't remember what I did for the life of me, either.

My cmd skills aren't nearly enough to recreate the existing fbits.cmd and figure out how I did it before.

I remember taking a long time just to try things out and spend hours googling about cmd usage.

I've added FLAC folder (flac/metaflac) to the system_path (not user_path) and I frequently use "open CMD here" on directories via context menu, if that helps.

Whatever's going on in the current cmd doesn't process/summerize whole directory for me and all logs disappear.
I like to use "HD audio" in PaulStretch. "HD audio", lol.

  • Sparktank
  • [*]
Detecting whether a 24-bit file has been upconverted from 16-bit?
Reply #40
Anyone??
I can't even get the original one to work anymore.

I've the flac.exe and metaflac.exe in the same folder as fbits.cmd.

Is there anyone who can start from scratch who doesn't assume everyone who uses it will know automatically what to do?
Not everyone is advanced in batch/command scripting.
I like to use "HD audio" in PaulStretch. "HD audio", lol.

  • mjb2006
  • [*][*][*][*][*]
Detecting whether a 24-bit file has been upconverted from 16-bit?
Reply #41
It's not clear what you're asking for. You just want the original to work? Still works for me on the command line. I am using the original one provided here.

For one file in somefolder:
Code: [Select]
fbits "\somefolder\some FLAC file.flac"


For all files starting with "Don" in somefolder
Code: [Select]
fbits "\somefolder\Don*.flac


This isn't working for you?

  • Case
  • [*][*][*][*][*]
  • Developer (Donating)
Detecting whether a 24-bit file has been upconverted from 16-bit?
Reply #42
Batch files require some special care when dealing with variables that hold special characters like parenthesis or percentage sign. The attached fbits script is modified to handle files and dirs with these characters properly. It also recursively scans all FLAC files in a directory if you pass it a directory. And it pauses at the end automatically so it's directly suitable for drag & drop use. If you prefer to use it from the command prompt remove the "pause" near the end.
[ Specified attachment is not available ]