IPB

Welcome Guest ( Log In | Register )

Detecting whether a 24-bit file has been upconverted from 16-bit?
vincefalks
post Nov 6 2012, 05:50
Post #1





Group: Members
Posts: 37
Joined: 23-August 09
Member No.: 72571



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?

happy to upload a sample if it helps.

thanks
vince
Go to the top of the page
+Quote Post
 
Start new topic
Replies
nu774
post Nov 6 2012, 06:31
Post #2





Group: Developer
Posts: 514
Joined: 22-November 10
From: Japan
Member No.: 85902



Try something like the following to see if wasted bits is equal to or greater than 8 for each FLAC sub-frames.
CODE
flac -ac foo.flac | findstr wasted_bits (for windows)
flac -ac foo.flac | grep wasted_bits (for Unix like OS)

Go to the top of the page
+Quote Post
skamp
post Nov 6 2012, 12:06
Post #3





Group: Developer
Posts: 1408
Joined: 4-May 04
From: France
Member No.: 13875



QUOTE (nu774 @ Nov 6 2012, 06:31) *
Try something like the following to see if wasted bits is equal to or greater than 8 for each FLAC sub-frames.


Thanks! I used your idea to make a BASH script that prints out the average number of effective bits of FLAC files.

fbits:
CODE
#!/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
fbits *.flac


Output with a lossyFLAC album (Daft Punk - Homework):
CODE
12/16 bits 01. Daftendirekt.lossy.flac
11/16 bits 02. WDPK 83.7 FM.lossy.flac
11/16 bits 03. Revolution 909.lossy.flac
10/16 bits 04. Da Funk.lossy.flac
11/16 bits 05. Phnix.lossy.flac
10/16 bits 06. Fresh.lossy.flac
11/16 bits 07. Around the World.lossy.flac
10/16 bits 08. Rollin' & Scratchin'.lossy.flac
11/16 bits 09. Teachers.lossy.flac
10/16 bits 10. High Fidelity.lossy.flac
10/16 bits 11. Rock'n Roll.lossy.flac
12/16 bits 12. Oh Yeah.lossy.flac
11/16 bits 13. Burnin'.lossy.flac
10/16 bits 14. Indo Silver Club.lossy.flac
10/16 bits 15. Alive.lossy.flac
11/16 bits 16. Funk Ad.lossy.flac


Output with a "true" 24 bit album (The Beatles - Love):
CODE
23/24 bits 01. Because.flac
22/24 bits 02. Get Back.flac
22/24 bits 03. Glass Onion.flac
23/24 bits 04. Eleanor Rigby ∕ Julia (transition).flac
22/24 bits 05. I Am the Walrus.flac
21/24 bits 06. I Want to Hold Your Hand.flac
22/24 bits 07. Drive My Car ∕ The World ∕ What You're Doing.flac
23/24 bits 08. Gnik Nus.flac
22/24 bits 09. Something ∕ Blue Jay Way (transition).flac
22/24 bits 10. Being for the Benefit of Mr. Kite ∕ I Want You (She's So Heavy) ∕ Helter Skelter.flac
21/24 bits 11. Help.flac
22/24 bits 12. Blackbird ∕ Yesterday.flac
22/24 bits 13. Strawberry Fields Forever.flac
22/24 bits 14. Within You Without You ∕ Tomorrow Never Knows.flac
22/24 bits 15. Lucy in the Sky With Diamonds.flac
22/24 bits 16. Octopus's Garden.flac
22/24 bits 17. Lady Madonna.flac
22/24 bits 18. Here Comes the Sun ∕ The Inner Light (transition).flac
22/24 bits 19. Come Together ∕ Dear Prudence ∕ Cry Baby Cry (transition).flac
22/24 bits 20. Revolution.flac
22/24 bits 21. Back in the U.S.S.R..flac
23/24 bits 22. While My Guitar Gently Weeps.flac
22/24 bits 23. A Day in the Life.flac
22/24 bits 24. Hey Jude.flac
22/24 bits 25. Sgt. Pepper's Lonely Hearts Club Band (reprise).flac
22/24 bits 26. All You Need Is Love.flac


Output with a 16 bit album, upsampled to 24 bits (Daft Punk - Homework):
CODE
16/24 bits 01. Daftendirekt.flac
16/24 bits 02. WDPK 83.7 FM.flac
16/24 bits 03. Revolution 909.flac
16/24 bits 04. Da Funk.flac
16/24 bits 05. Phnix.flac
16/24 bits 06. Fresh.flac
16/24 bits 07. Around the World.flac
16/24 bits 08. Rollin' & Scratchin'.flac
16/24 bits 09. Teachers.flac
16/24 bits 10. High Fidelity.flac
16/24 bits 11. Rock'n Roll.flac
16/24 bits 12. Oh Yeah.flac
16/24 bits 13. Burnin'.flac
16/24 bits 14. Indo Silver Club.flac
16/24 bits 15. Alive.flac
16/24 bits 16. Funk Ad.flac


--------------------
See my profile for measurements, tools and recommendations.
Go to the top of the page
+Quote Post

Posts in this topic
- vincefalks   Detecting whether a 24-bit file has been upconverted from 16-bit?   Nov 6 2012, 05:50
- - nu774   Try something like the following to see if wasted ...   Nov 6 2012, 06:31
|- - skamp   QUOTE (nu774 @ Nov 6 2012, 06:31) Try som...   Nov 6 2012, 12:06
|- - julf   QUOTE (skamp @ Nov 6 2012, 12:06) I used ...   Nov 8 2012, 16:33
|- - Sparktank   QUOTE (nu774 @ Nov 6 2012, 06:31) CODEfla...   Apr 13 2013, 01:47
- - bandpass   QUOTE (vincefalks @ Nov 6 2012, 04:50) Ar...   Nov 6 2012, 09:11
- - spoon   >Are there certain algorithms and 'good job...   Nov 6 2012, 11:47
- - nu774   BTW, I think just a slight gain scaling from the o...   Nov 6 2012, 12:31
- - greynol   You can add noise or simply use Audacity which can...   Nov 6 2012, 12:42
- - 2Bdecided   There's no way of knowing for sure. Unlike low...   Nov 6 2012, 12:45
- - vincefalks   Thanks guys (and yeah thanks greynol for pointing ...   Nov 6 2012, 16:29
|- - skamp   QUOTE (vincefalks @ Nov 6 2012, 16:29) Th...   Nov 6 2012, 17:40
|- - vincefalks   QUOTE (skamp @ Nov 6 2012, 17:40) QUOTE (...   Nov 6 2012, 18:44
||- - skamp   QUOTE (vincefalks @ Nov 6 2012, 18:44) it...   Nov 6 2012, 18:58
||- - Porcus   QUOTE (vincefalks @ Nov 6 2012, 19:44) it...   Nov 8 2012, 17:33
|- - Destroid   Interesting discussion. I hope the market does not...   Nov 6 2012, 23:21
|- - Porcus   QUOTE (Destroid @ Nov 7 2012, 00:21) I ho...   Nov 8 2012, 17:38
- - greynol   Don't blame flac.exe. It will not take 16-bit...   Nov 6 2012, 17:23
|- - vincefalks   QUOTE (greynol @ Nov 6 2012, 17:23) Don...   Nov 6 2012, 17:47
- - greynol   6dB of gain was applied to the master with no furt...   Nov 6 2012, 17:42
- - greynol   You would really have to go out of your way to do ...   Nov 6 2012, 17:59
- - 2Bdecided   An even smarter analysis can figure out which 24-b...   Nov 8 2012, 17:16
- - pdq   Let's not forget that a file that was up-conve...   Nov 8 2012, 18:27
|- - 2Bdecided   QUOTE (pdq @ Nov 8 2012, 18:27) Let's...   Nov 9 2012, 10:33
|- - julf   QUOTE (pdq @ Nov 8 2012, 18:27) Let's...   Nov 9 2012, 13:39
- - pdq   ...and it makes sense that if the tracks had been ...   Nov 9 2012, 15:11
- - Arnold B. Krueger   QUOTE (vincefalks @ Nov 5 2012, 23:50) I ...   Nov 9 2012, 16:01
- - skamp   Maybe Greynol can help?   Apr 13 2013, 07:41
- - Case   Here's a quick Windows .cmd script trying to d...   Apr 13 2013, 09:39
|- - Sparktank   QUOTE (Case @ Apr 13 2013, 01:39) Here...   Apr 13 2013, 09:59
- - Case   It's meant to be used from command prompt when...   Apr 13 2013, 10:11
- - mjb2006   Thanks for the .cmd version. I suggest modifying ...   Apr 13 2013, 10:40
- - Arnold B. Krueger   QUOTE (vincefalks @ Nov 6 2012, 00:50) I ...   Apr 13 2013, 16:12
|- - skamp   QUOTE (Arnold B. Krueger @ Apr 13 2013, 17...   Apr 13 2013, 17:28
- - greynol   I don't see the point in adding dither when in...   Apr 13 2013, 16:18
|- - Arnold B. Krueger   QUOTE (greynol @ Apr 13 2013, 11:18) I do...   Apr 13 2013, 22:22
|- - Kees de Visser   QUOTE (Arnold B. Krueger @ Apr 13 2013, 22...   Apr 14 2013, 15:23
- - BearcatSandor   Anyone know how to adjust Skamp's script to wo...   Apr 14 2013, 01:00
- - MikeFord   How would this technique rate a file consisting of...   Apr 16 2013, 21:11


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: 22nd July 2014 - 11:57