| 1 |
.TH mp3info 1 "November 6, 2006" "mp3info" |
| 2 |
|
| 3 |
.SH NAME |
| 4 |
mp3info \- MP3 technical info viewer and ID3 tag editor |
| 5 |
|
| 6 |
.SH SYNOPSIS |
| 7 |
.B mp3info \fP[\fB -h \fP|\fB -G \fP]\fB |
| 8 |
.PP |
| 9 |
.B mp3info \fP[\fB-x\fP] [\fB-F\fP] [\fB-r a\fP|\fBm\fP|\fBv\fP] [\fB-p\fP \fIFORMAT_STRING\fP] \fIfile...\fR |
| 10 |
.PP |
| 11 |
.B mp3info \fP[\fB-d\fP]\fB \fIfile...\fP |
| 12 |
.PP |
| 13 |
.B mp3info \fP[\fB-i\fP] [\fB-t \fItitle\fP] [\fB-a \fIartist\fP] [\fB-l \fIalbum\fP] [\fB-y \fIyear\fP] [\fB-c \fIcomment\fP] [\fB-n \fItrack\fP] [\fB-g \fIgenre\fP] \fIfile...\fP |
| 14 |
.br |
| 15 |
|
| 16 |
.SH DESCRIPTION |
| 17 |
.B mp3info |
| 18 |
is a utility used to read and modify the ID3 tags in MPEG |
| 19 |
layer 3 (MP3) files. It can also (optionally) display various technical |
| 20 |
attributes of the MP3 file. |
| 21 |
|
| 22 |
.SH OPTIONS |
| 23 |
.B |
| 24 |
.IP "-a \fIartist\fP" |
| 25 |
Specify ID3 artist name |
| 26 |
.B |
| 27 |
.IP "-c \fIcomment\fP" |
| 28 |
Specify ID3 comment |
| 29 |
.B |
| 30 |
.IP "-g \fIgenre\fP" |
| 31 |
Specify ID3 genre (use \fB-G\fP option for a list of valid genres). |
| 32 |
You may specify either a genre name or a number. |
| 33 |
.B |
| 34 |
.IP "-l \fIalbum\fP" |
| 35 |
Specify ID3 album name |
| 36 |
.B |
| 37 |
.IP "-n \fItrack\fP" |
| 38 |
Specify ID3 v1.1 track number |
| 39 |
.B |
| 40 |
.IP "-t \fItitle\fP" |
| 41 |
Specify ID3 track title |
| 42 |
.B |
| 43 |
.IP "-y \fIyear\fP" |
| 44 |
Specify ID3 copyright year |
| 45 |
.B |
| 46 |
.IP -G |
| 47 |
Display a list of valid genres and their associated numeric codes. These are the only |
| 48 |
values accepted by the \fB-g\fP switch. |
| 49 |
.B |
| 50 |
.IP -h |
| 51 |
Display a help page |
| 52 |
.B |
| 53 |
.IP -x |
| 54 |
Display technical attributes of the MP3 file |
| 55 |
.B |
| 56 |
.IP "-r a\fP|\fBm\fP|\fBv" |
| 57 |
Report bit rate of Variable Bit Rate (VBR) files as one of the following |
| 58 |
(See the section below entitled \fBBit Rates\fP for more information): |
| 59 |
.PP |
| 60 |
.RS 7 |
| 61 |
.PD 0 |
| 62 |
.HP |
| 63 |
.B a |
| 64 |
\- Average bit rate [float](Note: this option also causes the bit rates of |
| 65 |
non-VBR files to be displayed as floating point values). |
| 66 |
.LP |
| 67 |
.HP |
| 68 |
.B m |
| 69 |
\- Median bit rate [integer] |
| 70 |
.LP |
| 71 |
.HP |
| 72 |
.B v |
| 73 |
\- Simply use the word 'Variable' [string] (this is the default). |
| 74 |
.PD |
| 75 |
.RE |
| 76 |
.B |
| 77 |
.IP -i |
| 78 |
Edit ID3 tag interactively (uses curses/ncurses functions) |
| 79 |
.B |
| 80 |
.IP -d |
| 81 |
Delete ID3 tag (if one exists) |
| 82 |
.B |
| 83 |
.IP -f |
| 84 |
Force Mode: Treat all files as MP3s even if MP3 frames can't be found |
| 85 |
.B |
| 86 |
.IP -F |
| 87 |
Do a Full scan for technical information (see the section \fBSpeed Considerations\fP below for more information) |
| 88 |
.PP |
| 89 |
.B |
| 90 |
-p "\fIFORMAT_STRING\fP" |
| 91 |
.IP |
| 92 |
Print MP3 attributes according to \fIFORMAT_STRING\fP. \fIFORMAT_STRING\fP is |
| 93 |
similar to a \fBprintf(3)\fP format string in that it is printed verbatim except |
| 94 |
for the following conversions and escape sequences. Any conversion specifier may |
| 95 |
optionally include the various alignment, precision, and field width modifiers |
| 96 |
accepted by \fBprintf(3)\fP. See |
| 97 |
the \fBEXAMPLES\fP section below for examples of how format strings are used |
| 98 |
in mp3info. |
| 99 |
.PP |
| 100 |
.IP |
| 101 |
.B Conversion Specifiers |
| 102 |
.PP |
| 103 |
.RS 10 |
| 104 |
.PD 0 |
| 105 |
.B |
| 106 |
.IP %f |
| 107 |
Filename without the path [string] |
| 108 |
.B |
| 109 |
.IP %F |
| 110 |
Filename with the path [string] |
| 111 |
.B |
| 112 |
.IP %k |
| 113 |
File size in KB [integer] |
| 114 |
.B |
| 115 |
.IP %a |
| 116 |
Artist [string] |
| 117 |
.B |
| 118 |
.IP %c |
| 119 |
Comment [string] |
| 120 |
.B |
| 121 |
.IP %g |
| 122 |
Musical genre [string] |
| 123 |
.B |
| 124 |
.IP %G |
| 125 |
Musical genre number [integer] |
| 126 |
.B |
| 127 |
.IP %l |
| 128 |
Album name [string] |
| 129 |
.B |
| 130 |
.IP %n |
| 131 |
Track [integer] |
| 132 |
.B |
| 133 |
.IP %t |
| 134 |
Track Title [string] |
| 135 |
.B |
| 136 |
.IP %y |
| 137 |
Year [string] |
| 138 |
.B |
| 139 |
.IP %C |
| 140 |
Copyright flag [string] |
| 141 |
.B |
| 142 |
.IP %e |
| 143 |
Emphasis [string] |
| 144 |
.B |
| 145 |
.IP %E |
| 146 |
CRC Error protection [string] |
| 147 |
.B |
| 148 |
.IP %L |
| 149 |
MPEG Layer [string] |
| 150 |
.B |
| 151 |
.IP %O |
| 152 |
Original material flag [string] |
| 153 |
.B |
| 154 |
.IP %o |
| 155 |
Stereo/mono mode [string] |
| 156 |
.B |
| 157 |
.IP %p |
| 158 |
Padding [string] |
| 159 |
.B |
| 160 |
.IP %v |
| 161 |
MPEG Version [float] |
| 162 |
.B |
| 163 |
.IP %u |
| 164 |
Number of good audio frames [integer] |
| 165 |
.B |
| 166 |
.IP %b |
| 167 |
Number of corrupt audio frames [integer] |
| 168 |
.B |
| 169 |
.IP %Q |
| 170 |
Sampling frequency in Hz [integer] |
| 171 |
.B |
| 172 |
.IP %q |
| 173 |
Sampling frequency in KHz [integer] |
| 174 |
.B |
| 175 |
.IP %r |
| 176 |
Bit Rate in KB/s (type and meaning affected by \fB-r\fP option) |
| 177 |
.B |
| 178 |
.IP %m |
| 179 |
Playing time: minutes only [integer] |
| 180 |
.B |
| 181 |
.IP %s |
| 182 |
Playing time: seconds only [integer] (usually used in conjunction with \fB%m\fP) |
| 183 |
.B |
| 184 |
.IP %S |
| 185 |
Total playing time in seconds [integer] |
| 186 |
.B |
| 187 |
.IP %% |
| 188 |
A single percent sign |
| 189 |
.RE |
| 190 |
.PD |
| 191 |
.PP |
| 192 |
.RS 7 |
| 193 |
.B "Escape Sequences" |
| 194 |
.RE |
| 195 |
.PP |
| 196 |
.PD 0 |
| 197 |
.RS 10 |
| 198 |
.B |
| 199 |
.IP \en |
| 200 |
Newline |
| 201 |
.B |
| 202 |
.IP \et |
| 203 |
Horizontal tab |
| 204 |
.B |
| 205 |
.IP \ev |
| 206 |
Vertical tab |
| 207 |
.B |
| 208 |
.IP \eb |
| 209 |
Backspace |
| 210 |
.B |
| 211 |
.IP \er |
| 212 |
Carriage Return |
| 213 |
.B |
| 214 |
.IP \ef |
| 215 |
Form Feed |
| 216 |
.B |
| 217 |
.IP \ea |
| 218 |
Audible Alert (terminal bell) |
| 219 |
.B |
| 220 |
.IP \ex\fIhh\fB |
| 221 |
Any arbitrary character specified by the hexidecimal number \fIhh\fP |
| 222 |
.B |
| 223 |
.IP \e\fIooo\fB |
| 224 |
Any arbitrary character specified by the octal number \fIooo\fP |
| 225 |
.B |
| 226 |
.IP \fB\e\e\fP |
| 227 |
A single backslash character |
| 228 |
.RE |
| 229 |
.PP |
| 230 |
.PD |
| 231 |
|
| 232 |
|
| 233 |
.SH USAGE |
| 234 |
|
| 235 |
Specifying MP3 files without any other options displays the existing ID3 tag (if any). |
| 236 |
.PP |
| 237 |
Specifying a track number of 0 reverts an ID3 tag to 1.0 format |
| 238 |
.PP |
| 239 |
Non-specified ID3 fields, if existant, will remain unchanged. |
| 240 |
.PP |
| 241 |
Genres can be specified as numbers or names: \fB-g 17\fP same as \fB-g Rock\fP |
| 242 |
.PP |
| 243 |
Multiple word fields must be enclosed in quotes (eg: \fB-t "A title"\fP) |
| 244 |
|
| 245 |
.SH NOTES |
| 246 |
|
| 247 |
.IP "\fBSpeed Considerations\fP" |
| 248 |
In order to determine certain technical attributes (playing time, number of |
| 249 |
frames, number of bad frames, and in a few cases the bit rate) with absolute |
| 250 |
certainty, it would be necessary to read the entire MP3 file. Mp3info normally |
| 251 |
tries to speed things up by reading a handful of frames from various points in |
| 252 |
the file and estimating the statistics for the rest of the file based on those |
| 253 |
samples. Usually, this results in very accurate estimates. Audio playing times |
| 254 |
are usually off by no more than a second, and the number of frames is off by |
| 255 |
less than 0.1%. Often the estimates agree exactly with the full scans. |
| 256 |
Nevertheless, the user may wish to ensure that she is getting exact information. |
| 257 |
.IP |
| 258 |
One should specify the \fB-F\fP switch if one wants mp3info to read the entire |
| 259 |
MP3 file when determining this information. Note that a full scan will only |
| 260 |
affect mp3info's output if the \fB-x\fP switch is used or the \fB-p\fP switch is |
| 261 |
used with a FORMAT_SPECIFIER containing \fB%m\fP, \fB%s\fP, \fB%S\fP, \fB%u\fP |
| 262 |
or (rarely) \fB%r\fP. Using the \fB-F\fP switch under other conditions will |
| 263 |
only slow down mp3info. Also note that a FORMAT_SPECIFIER containing \fB%b\fP |
| 264 |
or a VBR MP3 file will automatically trigger a full scan even if the \fB-F\fP |
| 265 |
switch is not used. |
| 266 |
.IP |
| 267 |
Several users have noted that the \fB%u\fP specifier used alone: |
| 268 |
.PP |
| 269 |
.IP |
| 270 |
.B |
| 271 |
mp3info -p "%u" song.mp3 |
| 272 |
.IP |
| 273 |
sometimes gives a different number of good frames than when used with the \fB%b\fP specifier: |
| 274 |
.IP |
| 275 |
.B |
| 276 |
mp3info -p "%u %b" song.mp3 |
| 277 |
.IP |
| 278 |
This is because when you use \fB%u\fP by itself, mp3info only estimates the |
| 279 |
number of frames based on the bitrate and the size of the file. When you use |
| 280 |
the \fB%b\fP specifier, you force mp3info to do a full scan of the file which |
| 281 |
guarantees an accurate count of both the good and bad frames. If you want to |
| 282 |
guarantee an accurate count of the number of good frames when using \fB%u\fP |
| 283 |
by itself, you should use the \fB-F\fP option. |
| 284 |
|
| 285 |
.IP "\fBBit Rates\fP" |
| 286 |
MP3 files are made up of many (usally several thousand) audio blocks called 'frames'. |
| 287 |
Each of these frames is encoded at a specific 'bit rate' which |
| 288 |
determines both the quality of the sound and the size of the frame itself. Bit |
| 289 |
rates can range from 8 Kb/s (kilobits per second) to 320 Kb/s. Note that the |
| 290 |
MP3 specification only allows 14 discreet bit rates for an MP3 file, so, for |
| 291 |
instance, a stereo MP3 could have frames with bit rates of 128 Kb/s and 160 |
| 292 |
Kb/s, but nowhere in between. |
| 293 |
.IP |
| 294 |
Audio frames with high bit rates sound much better than those with lower bit |
| 295 |
rates, but take up more space. Obviously, one would like to use a bit rate that |
| 296 |
is only high enough to maintain a comfortable level of audio quality. Normally, |
| 297 |
all the frames in an MP3 file are encoded at the same bit rate. A few MP3 |
| 298 |
files, however, are encoded such that the bit rate may vary from one frame to |
| 299 |
the next. These MP3 files are called Variable Bit Rate (or VBR) files. Since |
| 300 |
VBR files do not have one single bit rate, attempting to report the bit rate of |
| 301 |
the file as a whole can be problematic. Consequently, |
| 302 |
mp3info allows you to specify how you want this value reported. |
| 303 |
.IP |
| 304 |
The default is to simply print the word 'Variable' where the bit rate would |
| 305 |
normally appear. Another option is to print the mathematical average of all |
| 306 |
the frames. This has the advantage of being completely accurate, but the number |
| 307 |
printed may not correspond to one of the 14 discreet bit rates that would be |
| 308 |
allowed for that file. The third alternative solves that problem by allowing |
| 309 |
the bit rate to be reported as the median bit rate which is what you would get |
| 310 |
if you lined up all the frames in the file by bit rate from lowest to highest |
| 311 |
and picked the |
| 312 |
frame closest to the middle of the line. |
| 313 |
.IP |
| 314 |
For more specific usage information, see the \fB-r\fP switch and the \fB%r\fP |
| 315 |
conversion specifier under the description of |
| 316 |
\fB-p\fP's FORMAT_SPECIFIER. |
| 317 |
|
| 318 |
|
| 319 |
.SH EXAMPLES |
| 320 |
|
| 321 |
Display existing ID3 tag information (if any) in song.mp3 |
| 322 |
.PP |
| 323 |
.IP |
| 324 |
.B |
| 325 |
mp3info song.mp3 |
| 326 |
.PP |
| 327 |
Set the title, author and genre of song.mp3. (All other fields unchanged) |
| 328 |
.IP |
| 329 |
.B |
| 330 |
mp3info -t "Song Title" -a Author -g "Rock & Roll" song.mp3 |
| 331 |
.PP |
| 332 |
Set the album field of all MP3 files in the current directory |
| 333 |
to "The White Album" |
| 334 |
.PP |
| 335 |
.IP |
| 336 |
.B |
| 337 |
mp3info -l "The White Album" *.mp3 |
| 338 |
.PP |
| 339 |
Delete the entire ID3 tag from song1.mp3 and song2.mp3 |
| 340 |
.IP |
| 341 |
.B |
| 342 |
mp3info -d song1.mp3 song2.mp3 |
| 343 |
.PP |
| 344 |
Delete the comment field from the ID3 tags of all MP3 files |
| 345 |
in the current directory. (All other fields unchanged) |
| 346 |
.IP |
| 347 |
.B |
| 348 |
mp3info -c "" *.mp3 |
| 349 |
.PP |
| 350 |
Display the Title, Artist, Album, and Year of all MP3 files in the current directory. |
| 351 |
We include the labels 'File', etc. and insert newlines (\fB\en\fP) to make things |
| 352 |
more readable for humans: |
| 353 |
.IP |
| 354 |
.B |
| 355 |
mp3info -p "File: %f\enTitle: %t\enArtist: %a\enAlbum: %l\enYear: %y\en\en" *.mp3 |
| 356 |
.PP |
| 357 |
Say you want to build a spreadsheet of your MP3 files. Here's a command you might use |
| 358 |
to help you accomplish that. Most spreadsheet programs will import an ASCII file and treat |
| 359 |
a given character as a field separator. A commonly used field separator is the tab character. |
| 360 |
For each MP3 file in the current directory, we want to output the filename, title, artist, |
| 361 |
and album on a single line and have the fields separated by a tab (\fB\et\fP) character. Note |
| 362 |
that you must include a newline (\fB\en\fP) at the end of the format string in order |
| 363 |
to get each file's information on a separate line. Here's the command: |
| 364 |
.IP |
| 365 |
.B |
| 366 |
mp3info -p "%f\et%t\et%a\et%l\et%y\en" *.mp3 |
| 367 |
.PP |
| 368 |
Some spreadsheets or other software may allow importing data from flat files |
| 369 |
where each field is a specific width. Here's where the format modifers come into |
| 370 |
play. This next command outputs the same information as the command above, but uses |
| 371 |
fixed-width fields instead of tab separators. The filename field is defined as |
| 372 |
50 characters wide, the title field is defined as 31 characters wide, and so on. |
| 373 |
.IP |
| 374 |
.B |
| 375 |
mp3info -p "%50f%31t%31a%31l%4y\en" *.mp3 |
| 376 |
.PP |
| 377 |
The problem with the output of this command is that all strings are normally right- |
| 378 |
justified within their fields. This looks a little odd since most western |
| 379 |
languages read from left to right. In order to make |
| 380 |
the fields left-justified, add a minus sign (\fB-\fP) in front of the field-width: |
| 381 |
.IP |
| 382 |
.B |
| 383 |
mp3info -p "%-50f%-31t%-31a%-31l%-4y\en" *.mp3 |
| 384 |
.PP |
| 385 |
Now suppose you just want the running time of each MP3 file specified in minutes |
| 386 |
and seconds. Simple enough: |
| 387 |
.IP |
| 388 |
.B |
| 389 |
mp3info -p "%f: %m:%s\en" *.mp3 |
| 390 |
.PP |
| 391 |
You may notice when you do this, however, that leading zeros are not displayed |
| 392 |
in the seconds field (\fB%s\fP). So for instance, if you had a |
| 393 |
track four minutes and two seconds long its running time would be displayed |
| 394 |
as '4:2' instead of '4:02'. In order to tell mp3info to pad an integer field |
| 395 |
with zeros, you need to use a field width modifier and place a zero in front of it. |
| 396 |
The following command is the same as the previous one, but it specifies that mp3info |
| 397 |
is to display the seconds field with a fixed |
| 398 |
field-width of two characters and to pad the field with leading zeros if necessary: |
| 399 |
.IP |
| 400 |
.B |
| 401 |
mp3info -p "%f: %m:%02s\en" *.mp3 |
| 402 |
.PP |
| 403 |
The last trick we have to show you is the precision specifier for floating point |
| 404 |
variables. The following command displays the filename and average bit rate for |
| 405 |
all MP3 files in the current directory. |
| 406 |
.IP |
| 407 |
.B |
| 408 |
mp3info -r a -p "%f %r\en" *.mp3 |
| 409 |
.PP |
| 410 |
By default, the floating point value of the average bit rate is displayed with six |
| 411 |
digits past the decimal point (ex: 175.654332). If you are like me, this seems like a bit |
| 412 |
of overkill. At most you want one or two digits beyond the decimal place displayed. Or you |
| 413 |
might not want any. The following command displays the average bit rate with first two, then |
| 414 |
zero digits beyond the decimal point: |
| 415 |
.IP |
| 416 |
.B |
| 417 |
mp3info -r a -p "%f %.2r %.0r\en" *.mp3 |
| 418 |
.PP |
| 419 |
If you wanted to specify a field width for a floating point value, you could do that by |
| 420 |
placing the field-width before the decimal point in the field modifier. This command does |
| 421 |
just that -- specifying an average bit-rate field six characters wide that will show two |
| 422 |
digits of precision beyond the decimal point: |
| 423 |
.IP |
| 424 |
.B |
| 425 |
mp3info -r a -p "%f %6.2r\en" *.mp3 |
| 426 |
.SH BUGS |
| 427 |
There's no "save and quit" in interactive mode. You must fill in all the |
| 428 |
fields (even if it is with blanks) and let the program finish by itself. |
| 429 |
CTRL+C does leave MP3info, but the data isn't saved. |
| 430 |
.PP |
| 431 |
Using space to erase tags in interactive mode does not work correctly if you |
| 432 |
then backspace over the deleted text. |
| 433 |
.PP |
| 434 |
The title, author, album, and comment fields are limited to 30 characters. |
| 435 |
This is a limitation of the ID3 1.0 tag format, not MP3Info. If you specify |
| 436 |
the track number (with the \fB-n\fP switch), the ID3 1.0 tag becomes a 1.1 tag and the |
| 437 |
comment field is limited to 28 characters. This is because the difference |
| 438 |
between ID3 1.0 and 1.1 is that the tag number is stored in the last byte of |
| 439 |
the comment field. This trick "borrows" two bytes from the fixed-length |
| 440 |
comment field effectively reducing the maximum comment by two characters. |
| 441 |
.PP |
| 442 |
Genres cannot be specified arbitrarily. They must be specified from a |
| 443 |
pre-determined list (use \fBmp3info -G\fP to see that list). Again, this is a |
| 444 |
limitation of the ID3 1.0 tag format. |
| 445 |
.PP |
| 446 |
Only ID3 versions 1.0 and 1.1 are supported. ID3V2 is a much more powerful |
| 447 |
standard and is planned for some as-yet-undetermined future version. Unfortunately, |
| 448 |
a clean implementation is a heck of a lot of work and I'm unbelievably lazy, so don't |
| 449 |
hold your breath. It is probably worth noting at this juncture, however, that I do |
| 450 |
accept patches. :-) |
| 451 |
.PP |
| 452 |
Exit codes are somewhat haphazard and not well documented. |
| 453 |
|
| 454 |
.SH AUTHOR |
| 455 |
Cedric Tefft <[email protected]> |
| 456 |
|
| 457 |
.SH "SEE ALSO" |
| 458 |
\fBprintf\fP(3)\fB |