title: Batch or VBS | How to check the bitrate of a music file?
body: <p>I need to check the bitrate of a music file, I need to receive the number in digits like: 192000 (for 192 kbps), 320000 (for 32kbps) or (+)3000000 for wavs and uncompressed music. I mean I need exactly the number, If an MP3 is VBR and is compressed at 194 kbps, I need the 194000 number, not the current CBR 192000.</p>
  
  <p>I was do this job with <strong>MEDIAINFO</strong> (x64) CLI Program, In Batch:</p>
  
  <pre><code>for /f "tokens=*" %%%% in ('mediainfo "%%a" "--Inform=General;%%BitRate/String%%"') do set "BitRate=%%~%%"
  </code></pre>
  
  <p>But I have 35.000+ files to check and then the comprobation of all files is more than 2 hours of time.</p>
  
  <hr>
  
  <p>I need a simple code to check it, Not a program which need to execute it and to waste that lot of time...</p>
  
  <p>Is very important that the code needs to recognize at least this filetypes (I mean the internal bitrate):
  <strong>AIFF, FLAC, M4A, MP3, OGG, WAV, WMA.</strong></p>
  
  <p>And can't be a code for Ruby or Python, because I'll need to "compile" it and sure when is "compiled" waste a lot of time to check much files (Cause the uncompression of the .exe compiled).</p>
  
  <p>More info: I thinked about store the results in a file and then do a comparision to chek only new added files, But I can't store the result to do a comparision at the next run cause sometimes I'll need to replace checked files (old files). By the way neither I can't handle this by file datestamps. Need to be one unique procediment to check ALL the files, Ever (Or this is what I think...).</p>
  
  <hr>
  
  <p>I tried another method to check the bitrates, I'm really sure this is what I need but I can't get it run like I want...</p>
  
  <p><strong>This VBS uses the DBPowerAmp program API, And shows a window with info (included the bitrate), But with a window I can't do nothing... Maybe if I can redirect the windows info to a text file... And then set the variable "Bitrate" by reading the bitrate info in the text file... But I don't know how to do that:</strong>  </p>
  
  <pre><code>' create shell object
  Set WshShell = CreateObject("WScript.Shell")
  
  ' Create dMC Object
  Set dMC = CreateObject("dMCScripting.Converter")
  
  'Read audio properties of a file
  Dim AudioProps
  AudioProps = dMC.AudioProperties("C:\test.aac")
  Call WshShell.Popup(AudioProps, , "Returned Audio Properties", 0)
  </code></pre>
  
  <p>I've tried to "convert" that code into Batch, like this, But don't run, I get nothing:</p>
  
  <pre><code>@echo off
  rundll32.exe dMCScripting.Converter.AudioProperties("C:\Test.aac") &gt; test.txt
  exit
  </code></pre>
  
  <p>Oh and I've tried this too, but waste more time than mediainfo:</p>
  
  <pre><code>mplayer "test.aac" -frames 0 | findstr "kbit"
  </code></pre>