Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: metamp3 - command line tool (Read 224671 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

metamp3 - command line tool

Here's a new tool I've been writing for my own needs, but I think it will be useful for many here. In addition to the features already available, I'd like to add it to automatically write SoundCheck tag values for the iPod, when it computes and writes replaygain id3tags. A useful link is here, but I must know exactly how to convert the replaygain value to a SoundCheck value in order to do that.

Download: metamp3v0.91.zip (about 105 kb)

Latest beta: metamp3v092b5.zip
(note that some command line options has changed, and are not backward compatible).

You must have the vc sp1 redististributable runtime libraries to get it working. Get it from here:
http://www.apachelounge.com/download/vcredist_x86-sp1.exe

Update aug 2007: The latest beta 5 is now linked with the VC8 runtime libs, so you need not install vcredist.

Some examples of usage:

# Standard id3v1 and id3v2 tagging, and adding picture (type 3 = Front cover):
metamp3 --artist "Pink Floyd" --album "The Dark Side Of The Moon" --track 2/9 --title "On The Run" --year 1973 --genre "Rock" --comment "Tagged with metamp3" --pict {3}folder.jpg "02 - On The Run.mp3"

# Adding replaygain id3v2.3 tags (not APEv2 tags):
metamp3 --replay-gain *.mp3

# Changing volume to 3dB above suggested album gain:
metamp3 --apply-gain album+3 *.mp3

# Remove picture tags with empty description:
metamp3 --remove APIC *.mp3

# Remove all replaygain tags, by using wildcards in descriptions:
metamp3 --remove [replaygain_*]TXXX --remove [mp3gain_*]TXXX *.mp3


The metamp3.txt file:
Code: [Select]
MetaMP3 v0.91 - command line meta-data processing for mp3 files
_______________________________________________________________

I wrote this because I wanted a command line tool that could
add album art to (and save from) mp3 files, compute replaygain
and save them as ID3 tags (readable by Winamp, etc).


Features
--------
- Write (all) Text, URL and Picture frame tags, with description.
- Compute replay-gain values and set them as ID3v2.3 tags.
- Apply and Undo volume gain (as mp3gain).
- Extract pictures from mp3 files.
- Inspect ID3 v1.1, v2.3, and v2.4 tags
- Inspect detailed info on mp3 files, including lametag data.

    
Usage
-----
metamp3.exe [options] [mp3files]

options:
   --artist <artist>               audio/song artist
   --album <album>                 audio/song album
   --track <track>[/total]         audio/song track number
   --title <title>                 audio/song title
   --year <year>                   audio/song year of issue (1 to 9999)
   --genre <genre>                 audio/song genre name
   --comment [[desc]][{lng}]<text> add user-defined text
   --user-text [[desc]]<text>      add user text frame (TXXX)
   --user-url [[desc]]<URL>        add user URL frame (WXXX)
   --frame <frame:text>            set any T* or W* type frame
   --pict [[desc]][{type}]<file>   add picture artwork
   --save-pict <pict>              pict=[[desc]][{type}]<file>
   --list-pict-types               list possible picture type numbers
   --list-frames                   list Text and URL id3v2.3 frames
   --list-genres                   list standard id3v1.1 genres
   --1                             add id3v1 tag only (default both v1 and v2)
   --2                             add id3v2 tag only (--1 --2 will add both)
   --fit                           add id3v1 + id3v2 if tag does not fit id3v1
   --remove [[desc]]<frame>        remove frame(s). accepts wildcards *,?
   --replay-gain                   calculate and set replay gain tags
   --apply-gain <gain>             change volume. gain=[album|radio]<+dB|-dB>
   --undo-gain                     undo previous apply-gain
   --info                          print detailed mp3/lametag info
   --version                       show version info
   --info                          show this help  

    
Notes
-----
- Files can be specified with wildcards (*,?)
- When using any of the *-gain options on files that previously was scanned
  using mp3gain, metamp3 will convert the APEv2 tags written by mp3gain to
  ID3v2.3 equals.
- Picture, User Text/URL, and Comment may all be specified with a Description-field.
- Picture and Comment may be specified with Type and Language, correspondingly.


Thanks
------
- Thijmen Klok (and others) for the id3lib source code.
- Glen Sawyer for the mp3gain source code.
- GuerillaSoft for the EncSpotConsole source code.
- Nyaochi for the command line parser.


Tycho,
November 2006.
[/size]

metamp3 - command line tool

Reply #1
I have uploaded a new version 0.91, which fixes a bug, and I wrote some examples of usage.

metamp3 - command line tool

Reply #2
Very nice little tool.
Would it be possible for it to read files with multibyte char filename? (e.g. chinese)

metamp3 - command line tool

Reply #3
It unfortunately does not work for me.
Tried to embed folder.jpg as illustration in mp3 files with

metamp3 --pict {18} folder.jpg *.mp3

none of the mp3 got changed, though a weird message :
updating: folder.jpg appears.

Help needed !!!

Arnaud

metamp3 - command line tool

Reply #4
great tool, is there any way to access the lyrics frame USLT, or even COMM as --comments doesn't seem to map to the comments in iTunes

metamp3 - command line tool

Reply #5
The tool doesn\'t work for me either. I\'m on XPSP2 at home. I click on the exe and I get a message that says the app is not properly configured and reinstalling may solve the problem.  I tried the exe on my work pc (XP SP2) and it runs.  I copied a few disks using REACT2, and I ended up with a properly tagged wavpack image file (with cuesheet) but tag-less mp3 tracks. Is there some sort of library or DLL that I need to install? Can\'t find anything in the readme. Thanks in advance.
WavPack 4.31 / LAME 3.98 alpha 3 -V9 -vbr-new

metamp3 - command line tool

Reply #6
@kindofblue: metamp3.exe is compiled with VC++ 2005, and requires the VC8 runtime libraries (MSVCP80.dll and MSVCR80.dll), I'm afraid. A lot of programs installs these nowadays, so most people will have them already on their computer. The performance with VC6 seemed bad, so I switched to VC8.

@Arnaud: There should be no space between {18} and the filename.

@dillio: Only text, user-text, comment and picture frames are supported, so no USLT. Use --user-text "[iTUNNORM]some text" to add a "iTunes tags". Also --comment "[description]my comment" create a comment tag with description.

metamp3 - command line tool

Reply #7
Thanks for the info, Tycho. I copied the msvc DLLs and .manifest file into REACT\'s tools folder and that seemed to do the trick. Can\'t wait to do some encoding later. Really appreciate your work on this tool and REACT. Thanks a lot.
WavPack 4.31 / LAME 3.98 alpha 3 -V9 -vbr-new

metamp3 - command line tool

Reply #8
Thanks for the info, Tycho. I copied the msvc DLLs and .manifest file into REACT\'s tools folder and that seemed to do the trick. Can\'t wait to do some encoding later. Really appreciate your work on this tool and REACT. Thanks a lot.

You are welcome. To install the VC8 runtime libraries properly on your machine, download and run the vcredist_x86.exe package from http://go.microsoft.com/fwlink/?linkid=65127&clcid=0x409 (and delete your local copied dlls).

metamp3 - command line tool

Reply #9
First of all, thanks for this handy utility. But there is a little glitch that make it un-usable for me: it does not support unicode? I have files tagged with characters like é,á, etc., and even when I just add a tag frame (without changing the fields with those characters), those characters are changed to something else - very annoying, like from ü to |, ó to s, etc.

Is it a problem with my system or it is just not supported?

metamp3 - command line tool

Reply #10
This is very interesting... i've been using an "id3.exe" file i found on the internet for Omni Encoder, and might consider switching to yours because of the art tagging functionality.

What is the licensing on this? (Omni Encoder is GPL).

metamp3 - command line tool

Reply #11
@tycho

I have two requests for your excelent metamp3.exe command line tool, which i would appreciate if you would consider implementing.

1. When RG scanning files without applying the suggested gain change i.e. "--replay-gain", then besides the four standard RG tags, then there are also added the tags : "MP3GAIN_MINMAX" and "MP3GAIN_ALBUM_MINMAX". Those two later tags are totally redundan't IMHO and i would appreciate if they weren't set, or if there where an option to disable them(instead of having to use the "--remove" switch afterwards everytime).

2. The RG gain analysis algorithm i.e. "Gain_Analysis.c" from mp3gain has a problem with long periods of silence in either the middle or at the end of the files, like e.g. silence pre-ceding hidden tracks etc. The problem was discovered after RG analysis was added to lame.exe by default and where people where experiencing big slowdowns on tracks where there where large passages of silence either in the middle or the end of tracks, which where because of the RG calculation. The LAME devs fixed the problem in "Gain_Analysis.c" and it was included in LAME v3.97b2. I would then also recommend that this fix also was added to the "Gain_Analysis.c" file of metamp3 sources. Here is a quote from Gabriel, where he suggests that the fix for denormals is applied to the "Gain_Analysis.c" file :

For those interested, the LGPL source for the replaygain analysis code is here:  http://forums.winamp.com/showthread.php?s=...threadid=256408

Main change from the MP3Gain-sourced code is the ability to run multiple instances simultaneously (via a context pointer)

I'd suggest you to also apply the fix for denormals:
http://lame.cvs.sourceforge.net/lame/lame/...p;diff_format=l

From the thread "Winamp 5.3 Released" located here :
http://www.hydrogenaudio.org/forums/index....showtopic=48796

CU, Martin.

metamp3 - command line tool

Reply #12
@tycho

Hmm, i've been thinking about it and i think that i would prefer that you didn't include my second request i.e. the LAME patch for "Gain_analysis.c" anyway. So the only request i have now, is my first request about the redundant "MP3GAIN_*" tags added during the RG analysis

The reason for that, is that it seems that the fix is actually a "hack" and works by introducing a small error into the calculations as to avoid denormals occuring and which is supposed to be neglible to the over-all gain analysis, but since the issue of large silent parts in the middle or at the end of a track only happens very rare and that the only downside of this is some added processing time, then i think that i would prefer to keep metamp3.exe's current way of calculating the gain i.e. with the help of the latest official and un-modified algorithm code of Glen Sawyer, Frank Klemm and Marcel Muller(MP3Gain source), as opposed to introducing an error to all the calculations just to avoid an issue that occures extremely rarely(LAME patch)...

CU, Martin.

metamp3 - command line tool

Reply #13
Sorry, last post on this issue

@tycho

I have just browsed the mp3gain CVS Repository(why didn't i think of that at first  ) and then i found that Snelg indeed has added Gabriel's fix for denormals to his Revision 1.8 of "Gain_Analysis.c" and also made additionally a revision 1.9 with a small fix that prevents Visual Studio 2005 from complaining, and so based on this, then i have changed my mind(again ) and so i would actually really appreciate if you would please think about compiling metamp3.exe with the newest revision of Snelg's "Gain_Analysis.c" source file which includes the fix for denormals ? The issue can be easilly reproduced by adding e.g. a minutte of silence to  either the middle or the end of an MP3 file with a WAV editor and then running metamp3.exe "--replay-gain *.exe" on it and then the analysis will proced with about 1% every 5 seconds or so, when the silent part has been reached, as opposed to proceding from 1% to 100% in about 5 seconds on my P4-1700MHz PC.

Latest revision(v1.9) of Snelg's "Gain_Analysis.c" (rightclick/save...) :
http://mp3gain.cvs.sourceforge.net/*checko....c?revision=1.9

mp3gain's CVS Repository of "Gain_Analysis.c" :
http://mp3gain.cvs.sourceforge.net/mp3gain...ysis.c?view=log

(No changes for the last 3 years on Snelg's "gain_analysis.h")

Also i have emailed Snelg about if it would be safe to re-compile mp3gain v1.4.6 sources with latest revision(v1.9) of "gain_analysis.c", and he answered that there wouldn't be any problems with that.

Thank's in advance

CU, Martin.

metamp3 - command line tool

Reply #14
A final small feature request from me

Snelg implemented 6 decimal places for the "REPLAYGAIN_TRACK_GAIN" and "REPLAYGAIN_ALBUM_GAIN" tags since that was the format fb2k was currently using at the time and he deliberately wanted the two apps to use uniform tagging implementations(mp3gain used originally 4 decimal places just as fb2k, but changed to 6 when fb2k also did). Later on, then fb2k has changed it's RG tagging-scheme to only use 2 decimal places for those tags instead(not the peak values though, as they continue to be 6 decimal places). I know the mp3gain tags can still be read by fb2k, but i would personally appreciate if you would consider changing the decimal places that metamp3.exe sets on those tags to use the same format as fb2k does i.e. 2 decimal places ? I guess the reason that fb2k changed to only two decimal places, where because of this quote from 2Bdecided :

Storing Replay Gain values with more than 1 decimal place is pretty silly. More than 2 is just plain stupid. Really. It's just like having a broken calculator which you know doesn't usually get the answer correct to the nearest whole number, let alone several decimal places - but writing down the answer it gives you to 6 decimal places anyway! It won't do any harm, but it won't do any good either. And it may make people think that those decimal places are significant - they're not. At all. Ever.

Source : http://www.hydrogenaudio.org/forums/index.php?showtopic=9692

Thank's in advance.

CU, Martin.

Edit: Changed to Ogg Vorbis for lossy, so you don't need to respond to these feature requests anyway...

metamp3 - command line tool

Reply #15
Great app, but I'd like to see support for accented characters. Right now, "é" is written as "i" in tags, and "ê" as "j", etc.

metamp3 - command line tool

Reply #16
This is exactly what I am looking for. I want to scan and update tags with MP3gain but then store those values in ID3v.2 tags, transfer the track gain a newly created ITUNNORM field. My problem is, and pardon my ignorance, I don't know how to use this program. I understand it is a command line program, but I'm not sure what that means. I would love to be able to use all the fetures of REACT 2.0 but for transcoding form Flac to Lame rather than ripping. Any assistance would be greatly appreciated.

metamp3 - command line tool

Reply #17
I've replaced id3.exe with metamp3 in Omni Encoder CVS... its working well, and I appreciate the added functionality (replaygain, album art tagging).

I have a question, and a couple of comments:

1) What's the license? Is it okay that I'm including/distributing this binary with my program?

2) Genres 126 - 147 aren't supported by a lot of apps (iTunes being a prominent example). If for instance I tag something as "Britpop" it writes the tag as "(132)Britpop" which iTunes simply ignores. Could you maybe just write those ones as "Britpop" in ID3v2, and "132" in ID3v1? Right now i'm sort of working around it by writing a custom TCON frame for those ones, but its clunky and doesn't write anything for ID3v1.

3) Also in regards to iTunes compatibility: I've noticed that comments only work if you set them as english, like "{eng}This is a comment". Art work doesn't seem to be displayed if you set it as "{3}Folder.jpg" like you suggest... iTunes will display it if you omit the {3}. I just thought i'd mention these... nothing you need to do about them really except possibly a note in the readme.

Thanks again for a great app!

metamp3 - command line tool

Reply #18
1) What's the license? Is it okay that I'm including/distributing this binary with my program?
Tycho's metamp3 distibution includes COPYING.txt :
Code: [Select]
Copyright © 2003, 2004, 2005, 2006 Tycho.
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

 1. Redistributions of source code must retain the above copyright
    notice, this list of conditions and the following disclaimer.

 2. Redistributions in binary form must reproduce the above copyright
    notice, this list of conditions and the following disclaimer in the
    documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

metamp3 - command line tool

Reply #19
Is it possible to have zero-padded track values written with metamp3?  I use REACT 2 and I can't seem to make it work.  All my metadata for mp3 tracks is written as 1/5, 2/5, etc. instead of 01/05, 02/05, etc.

In the commandline passed to metamp3 it is receiving --track 01/05 so it must be an issue with how it writes the actual tag.

Also, when writing FLAC images with REACT 2, I have the same issue.  However I assume that is something to do with how flac.exe imports the cuesheet via --tag-from-file.

Some help here?  Maybe an updated version of metamp3 that writes zero-padded track values if supplied via commandline?

metamp3 - command line tool

Reply #20
@tycho

I have again changed back to using MP3 track files for playback, so if you ever had some free time and the motivation and thinks that these suggestions are good, then i would really appreciate if you would implement them.

1. This is the most important thing. The gain_analysis.c revision used in metamp3 will slow insanely down on silent passages. Glen has fixed this problem in CVS, and i have asked him about it, and he replied that it is safe to recompile e.g. metamp3.exe with the latest revision of his gain_analysis.c source file. The file can be directly downloaded from here(rightclick/Save as...) : http://mp3gain.cvs.sourceforge.net/*checko....c?revision=1.9

2. When using the switch "--replay-gain", then besides the four standard RG tags which e.g. fb2k/winamp understands, then metamp3.exe also sets these two tags : "MP3GAIN_MINMAX" and "MP3GAIN_ALBUM_MINMAX". These tags are IMHO very annoying, as they show up together with the other normal tags, since they aren't recogniced as RG tags and so i must remove them after every time i run "--replay-gain", with the added command "--remove [mp3gain_*]TXXX". I would really appreciate if you would disable this default behaviour of setting those "MP3GAIN_*" tags, when just using "--replay-gain".

Thank you in advance.

metamp3 - command line tool

Reply #21
I have found a bug in metamp3.exe and i have sent tycho an email about it, so that when he has some free time, then he will hopefully release a new version which fixes this bug. The bug is that when metamp3.exe sets the ID3v2.3 TXXX frame "replaygain_album_gain", then only the value is set, but not the following "dB" notation.

Here are an example of what i mean :

When running "metamp3 --replay-gain *.mp3" on more than one MP3 track file, in a command prompt, then the following ID3v2.3 TXXX frames are set :

replaygain_track_gain    : x.xxxxxx dB
replaygain_track_peak  : x.xxxxxx
replaygain_album_gain  : x.xxxxxx
replaygain_album_peak  : x.xxxxxx 
mp3gain_minmax          : xxx,xxx
mp3gain_album_minmax : xxx,xxx

The album gain is still picked up by fb2k though, but nonetheless, i hope that tycho will be so kind as to fix this bug and release a new version, as i personally will have to stop using metamp3.exe for ReplayGain scanning untill this bug is fixed.

metamp3 - command line tool

Reply #22
I have found a bug in metamp3.exe and i have sent tycho an email about it, so that when he has some free time, then he will hopefully release a new version which fixes this bug. The bug is that when metamp3.exe sets the ID3v2.3 TXXX frame "replaygain_album_gain", then only the value is set, but not the following "dB" notation.

Here are an example of what i mean :

When running "metamp3 --replay-gain *.mp3" on more than one MP3 track file, in a command prompt, then the following ID3v2.3 TXXX frames are set :

replaygain_track_gain    : x.xxxxxx dB
replaygain_track_peak  : x.xxxxxx
replaygain_album_gain  : x.xxxxxx
replaygain_album_peak  : x.xxxxxx 
mp3gain_minmax          : xxx, xxx
mp3gain_album_minmax : xxx, xxx

The album gain is still picked up by fb2k though, but nonetheless, i hope that tycho will be so kind as to fix this bug and release a new version, as i personally will have to stop using metamp3.exe for ReplayGain scanning untill this bug is fixed.


Thanks, Martin. One problem is that I've lost the source of v0.91 - but I have the source of 0.90. Don't remember exactly what I did between those two revisions, but I think it was a rather small change. I have now put the code into Subversion revision control, so this will not happen again.

Ok, when I get time I'll do:

- add fix of Gain_analysis.c
- use two decimal places only for gain values
- not write the MINMAX tags - I don't see the need for them either.
- possibility to add track/total tracks with leading zeros
- append " dB" to replay_album_gain tag
- maybe some command line argument improvements.

PS: I did develop metamp3 further after v0.91 (and I have the code), where I added possibilities to add and extract text tags from/to files, similar to metaflac, but something in id3lib crashed on my Win64 XP computer (but not on Win32 XP). If I can fix that, it will also be included

Cheers.

metamp3 - command line tool

Reply #23
Ok, when I get time I'll do:

- add fix of Gain_analysis.c
- use two decimal places only for gain values
- not write the MINMAX tags - I don't see the need for them either.
- possibility to add track/total tracks with leading zeros
- append " dB" to replay_album_gain tag
- maybe some command line argument improvements.

PS: I did develop metamp3 further after v0.91 (and I have the code), where I added possibilities to add and extract text tags from/to files, similar to metaflac, but something in id3lib crashed on my Win64 XP computer (but not on Win32 XP). If I can fix that, it will also be included

Hi tycho

I can't tell you how gratefull i am for you including all my feature requests and suggestions into your todo list above 

Thank you so much, my friend 

Take care and best regards

Sincerly,

Martin.

metamp3 - command line tool

Reply #24
@tycho

I don't know if it maybe has changed in a newer version, but i have read in the id3lib documentation that id3lib can have padding enabled or disabled and that it has it enabled by default. This is great as i and most others wants padding enabled for fast tag updating later on, but the doc then said that the amount of padding was not a fixed value, but instead id3lib just padded the total file + tag length up to an even multiple of 2KB. My question to you then is if you can see from the code if there then is a minimum amount of padding defined that always needs to be applied, or if this "nearest multiple of 2KB" is just used no matter what ?

To clarify what i mean alittle better, then here is an example of what i'm worrying about :

If the total file + tag length is only 2 bytes from being an even multiple of 2KB, then is there then just added 2 bytes of padding or is there instead added 2KB + 2 bytes of padding(since 2 bytes of padding would be lower than some minimum defined amount) ? 

To me, then this "padd to nearest multiple of 2KB" approach only makes sence if there is defined a minimum amount of padding to be used also, since else we will sometimes end up with only very little padding applied(like only a few bytes sometimes - or even one byte!).

CU, Martin.