Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7897263
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T08:07:19+00:00 2026-06-03T08:07:19+00:00

All, I have a shell script on Mac OS X which uses the mdls

  • 0

All,
I have a shell script on Mac OS X which uses the mdls command to fetch the Total bit-rate meta-attribute for all media files (mp3,mov,m4v etc.). I want to compare the output with a set threshold (XY Kbps) and raise a flag if the bit-rate exceeds XY for a media file. The issue is that the output doesn’t denote if it’s in Kbps or bits per second. For example I ran the mdls command on 2 audio files test1.m4a and test2.mp3 :

   mdls -name kMDItemTotalBitRate test1.m4a   
   Output -> kMDItemTotalBitRate = 249


   mdls -name kMDItemTotalBitRate test2.mp3   
   Output -> kMDItemTotalBitRate = 192000

On checking in iTunes , I saw that the number was 249 kbps for the former and 192 kbps for the latter. How can I force the mdls command to output kMDItemTotalBitRate in bits per second only so that the output is uniform for all files and removes confusion?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T08:07:21+00:00Added an answer on June 3, 2026 at 8:07 am

    As Ken Thomases correctly states in his comment, you are at the mercy of the Spotlight importer that stores the value when working with Spotlight attributes. Note Apple’s MDItem documentation omits all indication of the unit in which kMDItemTotalBitRate, a raw numeric value, should be measured. One might logically expect this to be bps, what with bps being the base bit rate unit, but there is no way to normalize stored values to bps if the Importer decides otherwise.

    An alternative to relying on Spotlight would be to analyze the file with a utility like MediaInfo (which can be installed using homebrew). The command

    mediainfo '--Inform=General;%BitRate%' "/path/to/your/media file"
    

    will return the bit rate of any supported media file, reliably in bps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a shell script which outputs all of the .js and .html files
All, I have shell script which goes through all the media (audio,video) files in
I have the shell script which first goes in home directory and backups all
I have a bash shell script that loops through all child directories (but not
I have the following shell script with finds all the files and then should
I have a shell script which works perfectly if I run it in the
I have a shell script which I'd like to trigger from a J2EE web
I have shell scripting knowledge. I have written a small shell script which will
Need to have a Shell script that will * Identify all the files [
I have a shell script that saves the output of a command that is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.