Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Compile mp3info and install from source UNIX
Sure you could install mp3info with MacPorts, but if you prefer to build it manually -- this hint is for you.

From the developer page:

MP3Info is a little utility used to read and modify the ID3 tags of MP3 files. MP3Info can also display various technical aspects of an MP3 file including playing time, bit-rate, sampling frequency and other attributes in a pre-defined or user-specifiable output format.

This process requires the Apple Developer Tools to compile the source code.

Copy and paste the following code into a text document named 'compilemp3info'; make it executable; chmod 755 compilemp3info, then run it by typing ./compilemp3info. The code will download the mp3info source code, patch the code with the patch from MacPorts, then build and install.
#!/bin/bash

# create temporary build directory (optional)
mkdir BUILD
cd BUILD

# download mp3info src
curl -O ftp://ftp.ibiblio.org/pub/linux/apps/sound/mp3-utils/mp3info/mp3info-0.8.5a.tgz

# download MacPorts patch
curl -O http://mirror.lug.udel.edu/pub/macports/dpupdate/dports/audio/mp3info/files/patch-mp3tech.c.diff

# create Makefile patch (optional)
# this just removes all the GTK GUI build stuff that won't compile in Mac OS X
cat > patch-Makefile.diff <<'EOF'
--- Makefile-orig  2010-07-29 12:44:04.000000000 -0400
+++ Makefile  2010-07-29 12:43:47.000000000 -0400
@@ -47,7 +47,7 @@
 CC = gcc
 CFLAGS = -g -O2 -Wall
 
-all: mp3info gmp3info doc
+all: mp3info doc
 
 doc: mp3info.txt
 
@@ -77,7 +77,7 @@
   $(STRIP) gmp3info
   $(INSTALL) gmp3info $(bindir)/gmp3info
 
-install: install-mp3info install-gmp3info
+install: install-mp3info
 
 uninstall:
   rm -f $(bindir)/mp3info
EOF

# decompress
tar -zxvf mp3info-0.8.5a.tgz
cd mp3info-0.8.5a

# patch file
patch -i ../patch-mp3tech.c.diff
patch -i ../patch-Makefile.diff

# make and install
make         # ignore errors that appear
sudo make install  # install into /usr/local/bin



[crarko adds: I only partially tested this. This is a nice little script that could be adapted to other projects if you wish to modify it. It was modified to use curl instead of wget since curl is installed by default in the system. I've mirrored the script code here. If it opens in your browser window just do a Save As... ]
    •    
  • Currently 2.00 / 5
  You rated: 5 / 5 (26 votes cast)
 
[5,924 views]  

Compile mp3info and install from source | 7 comments | Create New Account
Click here to return to the 'Compile mp3info and install from source' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Compile mp3info and install from source
Authored by: xcgr on Aug 02, '10 08:28:41AM

How is this any better than looking at your MP3 file's info in iTunes, or it's extended info in the Finder's Get Info window?



[ Reply to This | # ]
Compile mp3info and install from source
Authored by: neuralstatic on Aug 02, '10 10:09:28AM

people like doing things in different ways. but i see two reasons probably:
it has many more options, and lets you do some things that itunes wants to prevent.
and it's bash scriptable.

my question is why not just install it from macports?

-------------------------
from the man:

OPTIONS
-a artist Specify ID3 artist name
-c comment Specify ID3 comment
-g genre Specify ID3 genre (use -G for genre list)
-l album Specify ID3 album name
-n track Specify ID3 v1.1 track number
-t title Specify ID3 track title
-y year Specify ID3 copyright year

-G Display valid genres
-h Display this help page
-x Display technical attributes of the MP3 file
-r a|m|v Report bit rate of (VBR) files as:
a - Average bit rate (float)
m - Median bit rate (integer)
v - Simply use the word 'Variable' (string) [default]

-i Edit ID3 tag interactively
-d Delete ID3 tag (if one exists)
-f Force processing if file is not a standard MP3
-F Full Scan (see man page for details)


-p "FORMAT_STRING" Print FORMAT_STRING with substitutions

Conversion Specifiers

%f Filename without the path (string)
%F Filename with the path (string)
%k File size in KB (integer)

%a Artist (string)
%c Comment (string)
%g Musical genre (string)
%G Musical genre (integer)
%l Album name (string)
%n Track (integer)
%t Track Title (string)
%y Year (string)

%C Copyright flag (string)
%e Emphasis (string)
%E CRC Error protection (string)
%L MPEG Layer (string)
%O Original material flag (string)
%o Stereo/mono mode (string)
%p Padding (string)
%v MPEG Version (float)

%u Number of good audio frames (integer)
%b Number of corrupt audio frames (integer)
%Q Sampling frequency in Hz (integer)
%q Sampling frequency in KHz (integer)
%r Bit Rate in KB/s (see also '-r')

%m Playing time: minutes only (integer)
%s Playing time: seconds only (integer)
%S Total playing time in seconds (integer)

%% A single percent sign



[ Reply to This | # ]
Compile mp3info and install from source
Authored by: bluehz on Aug 02, '10 07:41:40PM

I am the author of this post - not sure why it shows up as "anonymous"

Yes - all this can be done using iTunes and many other GUI apps - but I do a lot of batch runs and bash scripting and I always like the option to do something through the terminal.

As far as why I don't install MacPorts... I used to be a big Fink fan - from first days of Mac OS X... but I just found it got to be so big and overwhelming and I had no idea what exactly was going on with it in terms of my compilations. I much prefer a more hands on approach. Also - I found that by manually compiling I learned how to solve dependency issues, patching issues, and customization issues that were often lost in the MacPorts/Fink methodology. Its really just a personal preferences - I throw this hint out there just as a notation in case anyone else wants to do the same task.



[ Reply to This | # ]
Compile mp3info and install from source
Authored by: Gnarlodious on Aug 31, '10 07:40:01AM

The main advantage of the mp3info tool is to show an obsolete MP3 tag that iTunes infowindow ignores. The Terminal output of this command is not the same as what shows in iTunes and incidentally may display all sorts of irrelevant, embarrassing or incriminating data. You may also notice the strings are truncated at 30 characters because the inventors of this primitive tag did not imagine song titles exceeding 30 characters.

For a more modern printout of metadata use the id3info or id3v2 CLI tools. However, as you explore more modern metadata be prepared to see all sorts of junk you wish wasn't there.



[ Reply to This | # ]
Compile mp3info and install from source
Authored by: burntout on Aug 02, '10 03:41:11PM

This would be better in Homebrew: http://mxcl.github.com/homebrew/
It's like a lightweight MacPorts. It's goodstuff.



[ Reply to This | # ]
Compile mp3info and install from source
Authored by: brh on Aug 03, '10 04:50:25PM

Seconded! For simple builds, I prefer to just do stuff from source these days. But I still use package managers for dependency-heavy packages, etc… And Fink felt like it died long ago, MacPorts feels like it's dying… Homebrew feels the most vivacious of the bunch, and definitely the simplest.



[ Reply to This | # ]
Compile mp3info and install from source
Authored by: jpclark49 on Aug 30, '10 09:07:57AM

This is the mp3 tool I've been looking for! But I don't have the developer tools to compile it. Can anyone give me a quick how to using Homebrew or ? I've compiled programs before, but not for several years, so I'm rusty at it.

Thank you.



[ Reply to This | # ]