Help - Search - Members - Calendar
Full Version: metamp3 - command line tool
Hydrogenaudio Forums > Lossy Audio Compression > MP3 > MP3 - General
Pages: 1, 2, 3
tycho
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

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.
tycho
I have uploaded a new version 0.91, which fixes a bug, and I wrote some examples of usage.
lapyu
Very nice little tool.
Would it be possible for it to read files with multibyte char filename? (e.g. chinese)
Arnaud
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
dillio
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
kindofblue
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.
tycho
@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.
kindofblue
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.
tycho
QUOTE(kindofblue @ Dec 14 2006, 19:07) *

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).
thzxcyl
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?
Jebus
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).
Martin H
@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 :
QUOTE(Gabriel @ Sep 28 2006, 16:10) *

QUOTE(benski @ Sep 28 2006, 16:55) *

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.
Martin H
@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 smile.gif

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.
Martin H
Sorry, last post on this issue smile.gif

@tycho

I have just browsed the mp3gain CVS Repository(why didn't i think of that at first crying.gif ) 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 smile.gif) 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 smile.gif

CU, Martin.
Martin H
A final small feature request from me smile.gif

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 :

QUOTE(2Bdecided @ May 27 2003, 12:06) *

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...
Funkdude
Great app, but I'd like to see support for accented characters. Right now, "é" is written as "i" in tags, and "ê" as "j", etc.
cpalcott
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.
Jebus
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!
Martin H
QUOTE(Jebus @ Jan 28 2007, 17:30) *

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
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.
wraithdu
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?
Martin H
@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.
Martin H
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.
tycho
QUOTE(Martin H @ Feb 19 2007, 02:12) *

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 smile.gif

Cheers.
Martin H
QUOTE(tycho @ Feb 19 2007, 12:15) *

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 smile.gif

Hi tycho smile.gif

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

Thank you so much, my friend smile.gif

Take care and best regards smile.gif

Sincerly,

Martin.
Martin H
@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.
Jebus
QUOTE(tycho @ Feb 19 2007, 04:15) *

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 smile.gif

Cheers.


Thanks Tycho. Please also maybe take a look at how ver. 2.3 genres are tagged as I mentioned in a previous post... putting non-standard genres like "(133)Post-Punk" (for example, I made that one up) prevents iTunes from reading it altogether. For any genre index past 125, it would be best to just write the name without the index (since the WinAmp extensions aren't supported everywhere).
wraithdu
Thanks for the update for track numbers!

I have another question, maybe bug, not sure. Can I use metamp3 to update just one field? I've tried things such as

metamp3 --track 8/10 test.mp3

and all other tag data (just about) is erased or mangled.

For example tag data before above commandline -

Artist: (+44)
Title: Interlude
Album: When Your Heart Stops Beating
Year: 2006
Genre: Rock
Tracknumber: 08
Totaltracks: 14

tag data after -

Artist: (+44)
Title: (blank)
Album: (blank)
Year: 2006; 2006
Genre: (blank)
Tracknumber: 8
Totaltracks: 10

Any idea what that's all about?
Martin H
Hi wraithdu smile.gif

The problem is that metamp3.exe uses id3lib for tag reading/writing and that id3lib dosen't fully support the ID3v2.4 spec. When you set a new tag to a file, then id3lib also rewrites all the old tags of the file also, and since id3lib cannot correctly read all the tags of the file(as they are in ID3v2.4 format), then id3lib will only rewrite the frames that it understands(and also mangle some of them in the process).

You can solve this problem by selecting to use fb2k's "ID3v2 Writer Compatibility Mode" under the "Advanced" settings dialog.

wraithdu
I had a suspicion that was the problem. Will the next version of metamp3 that Tycho is working on support id3v2.4 by chance?

Obviously this is not such a big issue for new rips, but I use foobar2k and mp3tag and would like to stick with v2.4 tags. If I decide to embed some art or some such change in the future, this would be a problem.
Martin H
@tycho

I have lately been reading up a little on the id3lib library and then i stumpled upon this quote :

QUOTE
id3lib is seriously outdated and doesn't appear to
be maintained anymore. And the API is just awful. There's a couple of
critical bugs in the 3.8.3 code that haven't been officially added yet
(fortunately there are patches on the SF page, but most packagers
don't include them, sadly)
.

Source : http://www.arcknowledge.com/gmane.comp.aud...0/msg00003.html

So i was thinking that if you haven't done so allready, then if you would please be so kind as to compile metamp3.exe with those extra id3lib patches for the next release of metamp3.exe.

Also, i have been thinking about that the lack of ID3v2.4 parsing support of id3lib is not only meaning that we can't parse those tags from MP3's, but also that if we e.g. RG scan or embed a cover picture into some MP3's with ID3v2.4 tags, then those files tags would be completely mangled and useless afterwards, so i was thinking that if you ever had some free time later on and was thinking about something to add to a later version of metamp3.exe, then here are a suggestion :

You could change metamp3.exe to only use id3lib for writing tags and then add support for the libid3tag library to parse tags from MP3's instead of using id3lib for that. libid3tag is a ID3 tag manipulation library from the MAD project with full support for reading ID3v1, ID3v1.1, ID3v2.2, ID3v2.3 and ID3v2.4 tags, as well as support for writing ID3v1, ID3v1.1, and ID3v2.4 tags. Also, if you felt like it, then you could add ID3v2.4 tagging support to metamp3.exe with the libid3tag library, besides the standard ID3v2.3 tag writing support of id3lib, so that people where able to write ID3v2.4 UTF-8 encoded unicode tags.

I know that this is a pretty big project to make happen and i am also not making this idea out to be a feature request, but just to give you some inspiration for if you where ever feeling bored wink.gif If you should ever decide to take a stab at this, then "The Code Project" has a Wrapper Class for the libid3tag Library, which will make parsing ID3 tags(all revisions) from MP3's very easy : http://www.codeproject.com/audio/MP3ID3.asp

CU, Martin.
Replika
Could you please add --fromfile switch (copy id3 from a file to another) like tag.exe

I'm now using Multi frontend to convert mp3. It uses tag.exe to preserve id3 tags but tag.exe only can write to id3v1.
CODE
"tag.exe" --fromfile "source.mp3" "target.mp3"

Some of your program's command line is the same to it, so i think it can be changed by yours biggrin.gif
tycho
@Martin: I am aware of that id3lib is outdated and has quite a few bugs. Also that it only support v2.3 tags. However, I have already included those patches to the code (it was required to avoid crashes with VC++ 2005 Express to begin with), in addition to adding some improvements myself. It now seems to be quite stable, but admittably there are a few functional quirks left. When it comes to v2.4 tags, I have modified id3lib so that it accepts v2.4 text frames (but only on v2.4 tags written at the beginning of the file). Take a look at the id3v2.4.0-changes. So limited support (the new text frames) for v2.4 tags should be possible, but I'm not sure.

@Replika: The version I am working on does already support this. E.g.
metamp3 --title "@titlefile.txt" file.mp3

Any text input can be specified from a file by prefixing a filename with @.
Replika
QUOTE(tycho @ Feb 22 2007, 03:32) *

The version I am working on does already support this. E.g.
metamp3 --title "@titlefile.txt" file.mp3
Any text input can be specified from a file by prefixing a filename with @.

I convert mp3s to mp3s. And i want preserve all id3 tags, so the command is:

CODE
metamp3 --artist "@source.mp3" --album "@source.mp3" --track "@source.mp3" --title "@source.mp3" year "@source.mp3" --comment "@source.mp3" [etc...] "target.mp3"

?

I've found ID3 mass tagger, has duplication id3 function
QUOTE
id3 -D source.mp3 -1 -2 dest.mp3
Copy ID3v1 and ID3v2 tags of source.mp3 to dest.mp3
tycho
QUOTE(Replika @ Feb 21 2007, 20:00) *

I convert mp3s to mp3s. And i want preserve all id3 tags, so the command is:
CODE
metamp3 --artist "@source.mp3" --album "@source.mp3" --track "@source.mp3" --title "@source.mp3" year "@source.mp3" --comment "@source.mp3" [etc...] "target.mp3"

?

In the next version, you transfer tags in the following way:
CODE
metamp3 --extract TPE1:x_artist.txt --extract TALB:x_album.txt --extract TIT2:x_title.txt --extract TRCK:x_track.txt --extract TCON:x_genre.txt --extract TYER:x_year.txt --extract COMM:x_comment.txt  source.mp3
metamp3 --artist @x_artist.txt --album @x_album.txt --track @x_track.txt --title @x_title.txt --year @x_year.txt --year @x_genre.txt --comment @x_comment.txt target.mp3
REM remove temporary files:
del x_*.txt

Martin H
QUOTE(tycho @ Feb 21 2007, 21:32) *

@Martin: I am aware of that id3lib is outdated and has quite a few bugs. Also that it only support v2.3 tags. However, I have already included those patches to the code (it was required to avoid crashes with VC++ 2005 Express to begin with), in addition to adding some improvements myself. It now seems to be quite stable, but admittably there are a few functional quirks left. When it comes to v2.4 tags, I have modified id3lib so that it accepts v2.4 text frames (but only on v2.4 tags written at the beginning of the file). Take a look at the id3v2.4.0-changes. So limited support (the new text frames) for v2.4 tags should be possible, but I'm not sure.

Hi tycho.

Thank you very much for your reply. I'm very pleased to hear that you allready have included those id3lib patches to metamp3.exe and also that you even have improved upon it further. I can see that metamp3.exe writes it's ID3v2.3 frames with ISO-8859-1 encoding, so another nice feature for metamp3.exe could maybe be an additional switch for alternatively enabling the writing of UTF-16 encoded ID3v2.3 frames with id3lib(i believe that id3lib supports that too), but of course, it's up to you - but i was just thinking about the posts in this thread about the missing unicode support of metamp3.exe. I really think that it's cool that you have enabled support for ID3v2.4 text frames and that would make my previous suggestion of using another library than id3lib redundant. I think that most apps that write ID3v2.4 tags, writes them as UTF-8 encoded ID3v2.4 frames, or atleast fb2k and Mp3tag does that. What encoding of ID3v2.4 text frames have you enabled support for ?

I have an MP3 track file which is tagged with fb2k and it has the following UTF-8 encoded ID3v2.4 text frames :

TALB: Fallen
TPE1: Evanescence
TCON: Rock
TIT2: Going Under (Album Version)
TRCK: 1/11
TYER: 2003
TXXX: [replaygain_album_gain]: -9.67 dB
TXXX: [replaygain_album_peak]: 1.376862
TXXX: [replaygain_track_gain]: -9.28 dB
TXXX: [replaygain_track_peak]: 1.238594

But when i run "metamp3 *.mp3" in a command prompt on that file, then metamp3.exe outputs only :

TIT2:
TALB:
TCON:
TDRC: 2003
TRCK: 1/11
TXXX: []:
TPE1: Evanescence
TYER: 2003

Then if i e.g. run "metamp3 --comment test *.mp3" in a command prompt on that file, then a "comment" tag with the value "test" is correctly set, but then you can see in fb2k and Mp3tag that the "date" tag is now mangled like this : "2003;2003" and also the following tags are completely deleted from the file : album, title, genre and all four ReplayGain tags.

This is not a problem for me personally, since i use fb2k if i need to change or add a tag, and only use metamp3.exe to set the initial tags as part of your genious REACT EAC plugin, but nonetheless, i just thought that i would let you know(and the same goes for the request for the UTF-16 encoded ID3v2.3 tags, as i'm personally perfectly happy with using ISO-8859-1 encoded ID3v2.3 tags).

Personally, then what i care about is :

To get the "dB" notation appended on the "replaygain_album_gain" TXXX frame.
Disable the setting of the "mp3gain_minmax" and "mp3gain_album_minmax" TXXX frames.
Update to newest revision of the ReplayGain calculation algorithm C code i.e. mp3gain.exe's "gain_analysis.c".
Only use two decimal places for the gain value TXXX frames, but still keep the 6 places on the peak ones.

There are actually also one thing that i would really like also : hack the mp3gain sources to ignore encoder and decoder delay, so that e.g. the leading 1152 silent samples will be ignored instead of as it is presently, where those samples are also taken into consideration when determining the loudness and recommended gain change. The difference is not very big, though - but nonetheless...

Again, many thank's for all your great work that you continue to contribute with - it's trully appreciated.

Edit: Btw, if you happened to know the answer to my padding question that i posted previously, then i would be happy to hear it.
tycho
Alright, here is a beta version that you may try out. A later release version will be available in the uploads section. Pretty much of the discussed matters should be fixed, and a set of new import/export features are added. Also --fit should now work as expected. Note that a few command line options are changed/removed (non backward compatible). I will add a complete change list later.

metamp3v092b1.zip

Note: The following features are currently missing :

- other encodings than frames with ISO-8859-1 (UTF-8, UTF-16 will not work)
- support for v2.4 tags
- hack the mp3gain sources to ignore encoder and decoder delay, so that e.g. the leading 1152 silent samples will be ignored
Martin H
Hi tycho.

Thank you so much for this beta, my friend smile.gif

Also, i hope that you understand that i'm extremely gratefull for you implementing the suggestions i have made smile.gif

I will test it out now and report back if i see any problems.

Again, please accept my deepest gratitude for your continued efforts, mate smile.gif

You rock, tycho smile.gif

Sincerly,

Martin.

Martin H
@Tycho

When i run "metamp3.exe" on the command prompt, then the console outputs : "The system cannot execute the specified program". I have the VC8 runtimes installed correctly(with the official installer) and when i check the executable with "Dependency Walker", then i can see that two dependencys are missing i.e. the "msvcr80.dll" and "msvcp80.dll" VC8 runtime files ? The old v0.91 of metamp3.exe which also is dynamically linked to those two files runs perfectly and "Dependency Walker" also lists that executable to have no problems finding the "msvcr80.dll" and "msvcp80.dll" VC8 runtime files. Also i have tested this on another PC which also has the VC8 runtimes installed correctly with the official installer and it's the exact same problem there.
Martin H
Okay, i have just gotten the beta to run by making a .manifest file and placing it into the folder where metamp3.exe is located.

For people that want to run this beta, then it's not enough to have the VC8 runtimes installed, but you guys also need to copy/paste the following text into a file called "metamp3.exe.manifest" :

CODE
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
  <dependency>
    <dependentAssembly>
      <assemblyIdentity type="win32" name="Microsoft.VC80.CRT" version="8.0.50608.0" processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b"></assemblyIdentity>
    </dependentAssembly>
  </dependency>
</assembly>


Okay, i will now begin to test the new features and fixes of this new beta and report back soon.
Martin H
@Tycho

Okay, i have tested the new beta and everything works perfectly. This is really an awesome release Tycho - a big thumbs up from me, that's for sure. I'm very pleased about the added "dB" notation on the "replaygain_album_gain" TXXX frame's gain value and also for omitting those redundant "mp3gain_minmax" and "mp3gain_album_minmax" TXXX frames, when RG scanning MP3's. Then the trimming to only 2 decimal places for the gain values is also just great. Also, i added some silence to the middle of a WAV file and encoded it to MP3 and then ReplayGain scanned it with first metamp3.exe v0.91 and then afterwards with v0.92b1 and i could clearly notice that you had used another revision of "gain_analysis.c", since metamp3.exe v0.91 took about 600% longer to RG scan that MP3 than the new beta release. Then i tested the new "@" importing function of the "--frame" and "--artist" "--album" etc switches and that worked perfectly and also the new "--extract" switch worked like a charm. Also, i think that it is smart thinking of you to make it possible to now also define TXXX frames with the general "--frame" switch, instead of having an additional "--user-text" switch for only defining that one single frame type. Also, if i define an "album artist" TXXX frame with the "--fit" switch also in the command-line, then now an additional ID3v2.3 tag is now made with that TXXX frame also, instead of as before, where that TXXX frame would just be completely ommited and only make an ID3v1 tag only.

There are only one little thing that i would suggest to you and that is when defining a genre which isn't in the ID3v1 genre list, then instead of ommiting that genre completely, then i think that it would be better to in this case add an additional ID3v2.3 tag also, so as to not loose that defined genre, just like allready is done when defining a TXXX frame, or when defining the "track" tag to also have an additional total-tracks value.

Again, thank you so much Tycho for this new release, it is very much appreciated. Also thank you so much for adding me to your "Thanks" section of metamp3.txt - you are too kind, my friend smile.gif

Btw, the info i gave you previously about what needed to be skipped(the encoder/decoder delay) where actually wrong and so here are the correct information. Please note that this is a pretty big job to implement i guess, so please only do it if you absolutely want to yourself...

What needs to be skipped is : encoder + decoder delay at the beginning of the decoded output and encoder padding - decoder delay at the end of the decoded output.

lame.exe only cuts the encoder + decoder delay from the beginning of the decoded output when decoding, except v3.97 at rarewares, which john33 has fixed to also cut the trailling encoder padding - decoder delay from the decoded output, and that patch has been added to current LAME CVS and hence, is included in latest LAME alpha i.e. v3.98a11. I don't really know if mp3gain.exe cuts anything or if it cuts the same amount as lame.exe(without john33's fix), but atleast i know that mp3gain.exe dosen't cut everything like it should, since that has Glen told me. mp3gain.exe uses a "light" version of the mpglib decoding library from the mpg123 project, where he has removed all unnecessary parts and lame.exe also uses mpglib for decoding. Glen has changed mpglib so that the librarys routines will pass back the raw double decoded values instead of rounding(and clipping) them to 16-bit integers.

Example: A MP3 is listed in it's INFO tag to have an encoder delay of 576 samples(newer lame.exe's always has that) and encoder padding of 2220 samples(varies for each file). mpglib, which both mp3gain.exe and lame.exe uses for decoding, has a decoding delay of 529 samples. Then the decoded output would need to get the initial 1105 samples skipped(576+529) and the last 1691 samples skipped(2220 - 529).

Here are the part of the INFO tag spec. which decribes how to read out the encoder delay and encoder padding values from the INFO tag :
QUOTE

bytes $B1-$B3 Encoder delays

store in 3 bytes:

[xxxxxxxx][xxxxyyyy][yyyyyyyy]

the 12 bit values (0-4095) of how many samples were added at start (encoder delay) in X and how many 0-samples were padded at the end in Y to complete the last frame.

so ideally you could do: #frames*(#samples/frame)-(these two values) = exact number of samples in original wav.

so worst case scenario you'd have a 48kHz file which would give it a range of 0.085s at the end and at the start.

example:
[01101100][00010010][11010010]

X = (011011000001)b = (1729)d, so 1729 samples is the encoder delay
Y = (001011010010)b = (722)d, so 722 samples have been padded at the end of the file

The complete INFO tag spec. : http://gabriel.mp3-tech.org/mp3infotag.html


CU, Martin.
tycho
I have uploaded v0.92 beta 2 - download from first post.

Changes from previous beta:
- Changed some command line options again (see examples)
- Fixed a small bug --remove.
- Now outputs separate list for id3v1 and id3v2 when inspecting metadata on files.

Examples:

1) Add artist, album, comment (no descr, english), and picture (no descr, type {0}=Other):
metamp3 --artist "Joe" --album "Average" --comment "Cool" --frame "APIC:folder.jpg" "file.mp3"

2) Add norwegian comment with description, and album artist as user text field:
metamp3 --frame "COMM[test]{nor}:hallo" --frame "TXXX[album artist]:Joe" "file.mp3"

Hint: remember to put quotes around the complete argument after --frame

Do all of you still need a separate .manifest file? I find it strange, because the compiler say it embeds it in the exe file on linking...
Martin H
Hi Tycho.

Thank you so much for this new beta release. In my testing i couldn't find anything wrong with it, and i really like the way that you have simplified the command-line interface with these two betas - thumbs up, mate. Also, the new displaying of seperate ID3v1.1 and ID3v2.3 tags is also very welcomed indeed. If i could humbly suggest one single modification to this feature, then that would be to change the listed ID3v1.1 tags to use ID3v1.1 field names i.e. Artist, Album, Track, Year, Genre and Comment, instead of showing the ID3v2.3 native frame names for ID3v1.1 tags. Another little thing i've been thinking about, is that when running the "--undo-gain" switch on some MP3's, then there is still left behind the now redundant "mp3gain_undo" tag, with it's "000,000,N" value. Lastly, i still think that changing the "--fit" switch to set an additional ID3v2.3 tag when a genre is defined which isn't in the ID3v1 genre list, instead of just ommiting that genre tag completely.

About the manifest file, then i can tell you that i have this problem on two different PC's running Windows XP Pro. SP2 with all high-priority updates applied. Something must have changed in your VC8 compiling process, since v0.91 works without an external manifest file, but these two new betas dosen't. I keep my PC very clean and only have about 20 apps installed and i always ghost my machine back to a previous state whenever i have tested new software or if i just have been changing many things temporarilly and i frequently run Reg/temp files cleaner apps. Also, both PC's have the VC8 runtimes installed with the official installer.

Again, thank you so much Tycho, and i really appreciate all the great work you have done on this nice tool smile.gif



Martin H
@Tycho

Could you please check the following :

From : Troubleshooting C/C++ Isolated Applications and Side-by-side Assemblies :
http://msdn2.microsoft.com/en-us/library/ms235342.aspx

To check whether the manifest is embedded inside the binary, open your binary in Visual Studio and browse through the resources of this binary. You should be able to find a resource named RT_MANIFEST. If you cannot find a manifest embedded inside the binary, check for an external file named something like <binary_name>.<extension>.manifest. If a manifest is not present, you need to ensure that the linker generates a manifest for your project. You need to check the linker option Generate manifest in the Project Properties dialog for this project. Building Visual C++ projects without manifest generation is not supported. Any C/C++ program built in Visual C++ 2005 has to include a manifest describing its dependencies on Visual C++ libraries. If the manifest is embedded inside the binary, ensure that the ID of RT_MANIFEST is correct for this type of the binary. For applications, ID should be equal to 1, for most DLLs ID should be equal to 2. If the manifest is in an external file, open it in an XML editor or text editor.

Also, if this dosen't help, then could you please then tell me which version number is defined for the "Microsoft.VC80.CRT" assembly in your metamp3 projects manifest file. In my VC8 runtimes policy file, then i can see that i can handle version numbers of that assembly between : 8.0.41204.256 and 8.0.50608.0.
Martin H
@Tycho

Since you have changed metamp3.exe to not write ID3v1 genre identify numbers over "(125)" into the ID3v1 "Genre" tag(and also omitting them infront of the ID3v2 "TCON" frame), then i would suggest that you also change the switch "--list-genres" to only show the ID3v1 genres up to "(125)".

Thank's in advance.

Martin H
I have been thinking alot about this genre stuff and have changed my mind about it, so i don't think that it's a good idea to do what i described in my previous post afterall. The de-facto ID3v1 genre list is genre numbers between 0 - 147 and this is also what's shown when running lame.exe's "--list-genres" switch. This is also id3libs default standard and both lame.exe and fb2k also sets ID3v1 genre tags up to number "(147)". If i may humbly suggest something, then that would be to change metamp3 to do like fb2k does : ID3v1 genre tags are set between 1 - 147. ID3v2 "TCON" frames are set as a text-string only, without any ID3v1 genre numbers at all, so if we set a "Rock" genre tag to a MP3 with fb2k, then an ID3v1 genre tag of "(17)" is set and an ID3v2 "TCON" frame of "Rock" is set and if we set a "Goa" tag, then fb2k sets an ID3v1 genre tag of "(126)" and an ID3v2 "TCON" frame of "Goa". I personally think that this makes more sence and is cleaner than to set ID3v2.3 "TCON" frames with ID3v1 genre numbers in front of the text-string for only ID3v1 genres between 0 - 125 and then completely ommiting the ID3v1 genre number for ID3v1 genres between 126 - 147 + all other genres. This would also still fix Jebus's iTunes problem. So if you agree with me(and fb2k), then make metamp3 also set ID3v1 genre tags between 126 - 147 and stop setting ID3v1 genre numbers in front of the ID3v2.3 "TCON" frames text-strings, no matter what genre is set.
Jebus
QUOTE(Martin H @ Mar 2 2007, 04:28) *

I have been thinking alot about this genre stuff and have changed my mind about it, so i don't think that it's a good idea to do what i described in my previous post afterall. The de-facto ID3v1 genre list is genre numbers between 0 - 147 and this is also what's shown when running lame.exe's "--list-genres" switch. This is also id3libs default standard and both lame.exe and fb2k also sets ID3v1 genre tags up to number "(147)". If i may humbly suggest something, then that would be to change metamp3 to do like fb2k does : ID3v1 genre tags are set between 1 - 147. ID3v2 "TCON" frames are set as a text-string only, without any ID3v1 genre numbers at all, so if we set a "Rock" genre tag to a MP3 with fb2k, then an ID3v1 genre tag of "(17)" is set and an ID3v2 "TCON" frame of "Rock" is set and if we set a "Goa" tag, then fb2k sets an ID3v1 genre tag of "(126)" and an ID3v2 "TCON" frame of "Goa". I personally think that this makes more sence and is cleaner than to set ID3v2.3 "TCON" frames with ID3v1 genre numbers in front of the text-string for only ID3v1 genres between 0 - 125 and then completely ommiting the ID3v1 genre number for ID3v1 genres between 126 - 147 + all other genres. This would also still fix Jebus's iTunes problem. So if you agree with me(and fb2k), then make metamp3 also set ID3v1 genre tags between 126 - 147 and stop setting ID3v1 genre numbers in front of the ID3v2.3 "TCON" frames text-strings, no matter what genre is set.


I'm fine either way.
Martin H
@Jebus

QUOTE(tycho @ Feb 25 2007, 17:09) *

I have uploaded v0.92 beta 2 - download from first post.

[...]

Do all of you still need a separate .manifest file?

tycho
Thanks, Martin.

metamp3 v0.92 beta 3. (download first post)

- id3v1 tags are shown with descriptive names.
- TXXX[mp3gain_undo] frame is removed after --undo-gain
- id3v2 genre is nolonger prefixed with id3v1 genre number.

I have used the unmodifed solution/project files from version v0.90, but I couldn't see any significant difference, so I am still not sure why you need the .manifest file (I don't). The only difference I can think of since 0.90 is that I installed VC++ 2005 express service pack 1.
Jebus
I don't think --genre is working at all now (at least it didn't seem to work for me).

Thanks for the other fixes though!

And I didn't need a manifest, either.
tycho
Sorry, beta 4 fixes the genre, and should work fine for both id3 v1 and v2.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2008 Invision Power Services, Inc.