## how to list bit depth and bit rate of all. files in a set of nested folders?

0

I have a large collection of music and would like to know the bit rate and bit depth of the individual files. What is the simplest/easiest way to achieve this?

EDIT FOR ADDED DETAILS: I am using Windows 10 and it does not show properties of all the files in folders (there is no way to 'expand' a folder as on a mac when in detail view). I know how to add the bit depth label and bit rate label to a window when I open the folder to view the files in it. But I need to find all files for example that have a bit depth of 24 bits in a set of nested folders that contain many music files : some 16 bit and some 24 bit. The goal of this exercise is to segregate all files> 16 bits to another directory.

I tried using mp3 tag, an application that lists these properties for all files in a directory (even those deeply nested) but it is agonizingly slow on my laptop (30000 files would take 5 hours just to list). I tried using mediainfo (from mediaarea.net) but it only works on individual files. I tried mapping the network folder (where the files exist) and using the 'tree' command but it does not work either. A google search for 'recursively list bit rate of all files in windows' gave a few links one of which was 11 years old here. I modified it for flac like so

function Get-FLACs( [string]$directory = "$pwd", [int]$minimumBitrate = 32 ) {$shellObject = New-Object -ComObject Shell.Application
$bitrateAttribute = 0 # Find all flac files under the given directory$flacFiles = Get-ChildItem $directory -recurse -filter '*.flac' foreach($file in $flacFiles ) { # Get a shell object to retrieve file metadata.$directoryObject = $shellObject.NameSpace($file.Directory.FullName )
$fileObject =$directoryObject.ParseName( $file.Name ) Write-Output ("filename",$fileObject)

# Find the index of the bit depth attribute, if necessary.
for( $index = 5; -not$bitdepthAttribute; ++$index ) {$name = $directoryObject.GetDetailsOf($directoryObject.Items, $index ) if($name -eq 'Bit depth' ) {
$bitdepthAttribute =$index
Write-Output ("bit depth index",$bitdepthAttribute)$bitdepthString = $directoryObject.GetDetailsOf($fileObject, $bitdepthAttribute ) Write-Output ("bit depth",$bitdepthString)
}
}
}


I tried to test the above script on a folder with 2 flac files both of which are 24 bit depth and 96 khz sample rate.

The output of the script above was

       Directory: C:\Users\Stefan\Downloads\Compare formats

Mode                LastWriteTime         Length Name
----                -------------         ------ ----
-a----        6/15/2014  11:27 PM       66131611 BATIK - The Old Man FLAC.flac
174

-a----        4/26/2014   8:41 PM       34188974 Carmen Gomes Inc - A 1000 Shades of Blue FLAC.flac

filename

Application  : System.__ComObject
Parent       : System.__ComObject
Name         : BATIK - The Old Man FLAC
GetFolder    :
IsFolder     : False
IsFileSystem : True
IsBrowsable  : False
ModifyDate   : 6/15/2014 11:27:46 PM
Size         : 66131611
Type         : FLAC File

bit depth index
174
bit depth

filename
Application  : System.__ComObject
Parent       : System.__ComObject
Name         : Carmen Gomes Inc - A 1000 Shades of Blue FLAC
GetFolder    :
IsFolder     : False
IsFileSystem : True
IsBrowsable  : False
ModifyDate   : 4/26/2014 8:41:08 PM
Size         : 34188974
Type         : FLAC File


For the first file it found the attribute 'bit-depth' and its index (174) but did not find the attribute for the second file. In neither case did the script actually find the correct bit depth but just left the value blank.

This is just far too broad & shows no research effort. Simplest way is set the appropriate headers as visible in iTunes… but as you have given us no clue as to what OS, for what purpose, no-one's going to come up with anything better. – Tetsujin – 2020-08-01T12:18:54.900

Thanks for the edit. I've retracted my downvote & also voted to reopen, but I'm afraid I know nothing of Windows, so can't help, sorry. Wish you luck. – Tetsujin – 2020-08-06T10:16:47.327

2

SoX (Sound Exchange), the self-described Swiss Army knife of sound processing programs is super-useful for these kind tasks.

soxi is the specific tool to list audio file information and on Linux (or MacOS) the command to recursively list all the information for all the audio files would be:

find . -name "*" -exec soxi {} 2> /dev/null \;


(the 2> /dev/null discards the errors for all unrecognised files).

Sample output:

Input File     : './Music/Chi Might III/MP3/10_BegginForFame48_CD.mp3'
Channels       : 2
Sample Rate    : 48000
Precision      : 16-bit
Duration       : 00:03:00.05 = 8642304 samples ~ 13503.6 CDDA sectors
File Size      : 7.20M
Bit Rate       : 320k
Sample Encoding: MPEG audio (layer I, II or III)

Input File     : './Music/Chi Might III/MP3/03_BalladOfAnEnglishMansSon48_CD.mp3'
Channels       : 2
Sample Rate    : 48000
Precision      : 16-bit
Duration       : 00:03:15.53 = 9385344 samples ~ 14664.6 CDDA sectors
File Size      : 7.82M
Bit Rate       : 320k
Sample Encoding: MPEG audio (layer I, II or III)


You can tailor the output for the information you need using either the command line options or grep.

I figured it out with the help of this post: https://github.com/MediaArea/MediaInfo/blob/master/Source/Resource/Plugin/Custom/en.Example.csv I use as a template General; %FileName% Audio;: %Format_String% , %BitDepth/String%,%SamplingRate_String%\r\n

– aquagremlin – 2020-08-07T15:52:21.590