HydrogenAudio

Lossy Audio Compression => MP3 => MP3 - General => Topic started by: tycho on 2006-10-30 22:28:38

Title: metamp3 - command line tool
Post by: tycho on 2006-10-30 22:28:38
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 (http://www.hydrogenaudio.org/forums/index.php?showtopic=24620&hl=rgsc.cpp), but I must know exactly how to convert the replaygain value to a SoundCheck value in order to do that.

Download: metamp3v0.91.zip (http://home.broadpark.no/~tylovset/files/metamp3v0.91.zip) (about 105 kb)

Latest beta: metamp3v092b5.zip (http://home.broadpark.no/~tylovset/files/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 (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]
Title: metamp3 - command line tool
Post by: tycho on 2006-10-31 06:35:53
I have uploaded a new version 0.91, which fixes a bug, and I wrote some examples of usage.
Title: metamp3 - command line tool
Post by: lapyu on 2006-11-05 15:22:39
Very nice little tool.
Would it be possible for it to read files with multibyte char filename? (e.g. chinese)
Title: metamp3 - command line tool
Post by: Arnaud on 2006-11-12 19:45:47
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
Title: metamp3 - command line tool
Post by: dillio on 2006-11-17 20:07:41
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
Title: metamp3 - command line tool
Post by: kindofblue on 2006-12-13 05:45:07
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.
Title: metamp3 - command line tool
Post by: tycho on 2006-12-13 08:53:23
@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.
Title: metamp3 - command line tool
Post by: kindofblue on 2006-12-15 03:07:23
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.
Title: metamp3 - command line tool
Post by: tycho on 2006-12-15 09:15:45
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 (http://go.microsoft.com/fwlink/?linkid=65127&clcid=0x409) (and delete your local copied dlls).
Title: metamp3 - command line tool
Post by: thzxcyl on 2006-12-22 00:00:11
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?
Title: metamp3 - command line tool
Post by: Jebus on 2006-12-22 00:58:17
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).
Title: metamp3 - command line tool
Post by: Martin H on 2006-12-29 17:45:27
@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 (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 (http://lame.cvs.sourceforge.net/lame/lame/libmp3lame/gain_analysis.c?r1=1.14&r2=1.14.2.1&diff_format=l)

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

CU, Martin.
Title: metamp3 - command line tool
Post by: Martin H on 2006-12-29 23:25:36
@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.
Title: metamp3 - command line tool
Post by: Martin H on 2006-12-31 01:12:41
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 (http://mp3gain.cvs.sourceforge.net/*checkout*/mp3gain/mp3gain/gain_analysis.c?revision=1.9)

mp3gain's CVS Repository of "Gain_Analysis.c" :
http://mp3gain.cvs.sourceforge.net/mp3gain...ysis.c?view=log (http://mp3gain.cvs.sourceforge.net/mp3gain/mp3gain/gain_analysis.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.
Title: metamp3 - command line tool
Post by: Martin H on 2007-01-02 00:47:44
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 (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...
Title: metamp3 - command line tool
Post by: Funkdude on 2007-01-09 16:36:59
Great app, but I'd like to see support for accented characters. Right now, "é" is written as "i" in tags, and "ê" as "j", etc.
Title: metamp3 - command line tool
Post by: cpalcott on 2007-01-28 15:24:26
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.
Title: metamp3 - command line tool
Post by: Jebus on 2007-01-28 16:30:55
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!
Title: metamp3 - command line tool
Post by: Martin H on 2007-01-29 13:38:14
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.
Title: metamp3 - command line tool
Post by: wraithdu on 2007-02-04 03:02:22
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?
Title: metamp3 - command line tool
Post by: Martin H on 2007-02-14 12:41:05
@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 (http://mp3gain.cvs.sourceforge.net/*checkout*/mp3gain/mp3gain/gain_analysis.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.
Title: metamp3 - command line tool
Post by: Martin H on 2007-02-19 10:12:14
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.
Title: metamp3 - command line tool
Post by: tycho on 2007-02-19 11:15:50
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.
Title: metamp3 - command line tool
Post by: Martin H on 2007-02-19 12:12:48
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.
Title: metamp3 - command line tool
Post by: Martin H on 2007-02-19 13:11:45
@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.
Title: metamp3 - command line tool
Post by: Jebus on 2007-02-19 15:30:42
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.


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).
Title: metamp3 - command line tool
Post by: wraithdu on 2007-02-20 01:28:56
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?
Title: metamp3 - command line tool
Post by: Martin H on 2007-02-20 21:56:50
Hi wraithdu

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.
Title: metamp3 - command line tool
Post by: wraithdu on 2007-02-20 22:22:30
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.
Title: metamp3 - command line tool
Post by: Martin H on 2007-02-21 12:57:13
@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 (http://www.arcknowledge.com/gmane.comp.audio.easytag.general/2005-10/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  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 (http://www.codeproject.com/audio/MP3ID3.asp)

CU, Martin.
Title: metamp3 - command line tool
Post by: Replika on 2007-02-21 16:06:38
Could you please add --fromfile switch (copy id3 from a file to another) like tag.exe (http://members.home.nl/w.speek/download/Tag.zip)

I'm now using Multi frontend (http://members.home.nl/w.speek/multi.htm) to convert mp3. It uses tag.exe to preserve id3 tags but tag.exe only can write to id3v1.
Code: [Select]
"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
Title: metamp3 - command line tool
Post by: tycho on 2007-02-21 20:32:29
@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 (http://www.id3.org/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 @.
Title: metamp3 - command line tool
Post by: Replika on 2007-02-22 04:00:52
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: [Select]
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 (http://home.wanadoo.nl/squell/id3.html), has duplication id3 function
Quote
id3 -D source.mp3 -1 -2 dest.mp3
Copy ID3v1 and ID3v2 tags of source.mp3 to dest.mp3
Title: metamp3 - command line tool
Post by: tycho on 2007-02-22 08:08:24
I convert mp3s to mp3s. And i want preserve all id3 tags, so the command is:
Code: [Select]
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: [Select]
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
Title: metamp3 - command line tool
Post by: Martin H on 2007-02-22 13:12:52
@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 (http://www.id3.org/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.
Title: metamp3 - command line tool
Post by: tycho on 2007-02-22 22:34:37
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 (http://home.broadpark.no/~tylovset/files/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
Title: metamp3 - command line tool
Post by: Martin H on 2007-02-22 23:12:06
Hi tycho.

Thank you so much for this beta, my friend 

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

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 

You rock, tycho

Sincerly,

Martin.
Title: metamp3 - command line tool
Post by: Martin H on 2007-02-22 23:54:19
@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.
Title: metamp3 - command line tool
Post by: Martin H on 2007-02-23 00:35:40
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: [Select]
<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.
Title: metamp3 - command line tool
Post by: Martin H on 2007-02-23 03:07:36
@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 

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 (http://gabriel.mp3-tech.org/mp3infotag.html)


CU, Martin.
Title: metamp3 - command line tool
Post by: tycho on 2007-02-25 16:09:56
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...
Title: metamp3 - command line tool
Post by: Martin H on 2007-02-26 01:23:24
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
Title: metamp3 - command line tool
Post by: Martin H on 2007-02-26 20:23:12
@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 (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.
Title: metamp3 - command line tool
Post by: Martin H on 2007-03-01 10:59:47
@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.
Title: metamp3 - command line tool
Post by: Martin H on 2007-03-02 11:28:09
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.
Title: metamp3 - command line tool
Post by: Jebus on 2007-03-02 17:50:54
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.
Title: metamp3 - command line tool
Post by: Martin H on 2007-03-02 22:56:38
@Jebus

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

[...]

Do all of you still need a separate .manifest file?
Title: metamp3 - command line tool
Post by: tycho on 2007-03-04 09:48:31
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.
Title: metamp3 - command line tool
Post by: Jebus on 2007-03-04 17:28:28
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.
Title: metamp3 - command line tool
Post by: tycho on 2007-03-04 20:00:08
Sorry, beta 4 fixes the genre, and should work fine for both id3 v1 and v2.
Title: metamp3 - command line tool
Post by: Martin H on 2007-03-04 23:40:08
@Tycho

Thank you so much for this great release Tycho. Also, this version is working perfectly without needing an external manifest file, so that is also great. Btw, i have also VC++ 2005 Express SP1 installed and have compiled and built wavpack.exe, wvunpack.exe and wvgain.exe and i didn't need an external manifest file there either. Anyway, i'm just glad that the issue is no longer present now. This version really kicks a** and once again, thank you so much for implementing my suggestions, i really appreciate it. Now the ID3v2.3 "mp3gain_undo" TXXX frame is deleted upon using the "--undo-gain" switch. The ID3v1 genres are being set up to number 147 perfectly and the ID3v2.3 TCON frames are not pre-fixed with the ID3v1 genre identify numbers anymore. Finally, ID3v1.1 tags are shown with their de-facto names. I am really excited about these changes and the tool is just awesome, so again, many thank's Tycho, for all your efforts. The only thing i would still like is to get an ID3v2.3 TCON frame set, when running "metamp3 --fit --genre Testing *.mp3", but since you haven't implemented that change, then you must then not think that it's logical and that's also perfectly fine with me and i'm just so gratefull for all the suggestions of mine that you do have implemented.

@Jebus

Thank's for letting me/us know about if you had any manifest file problems.
Title: metamp3 - command line tool
Post by: tycho on 2007-03-05 14:49:20
Hmm. Windows 64 refuses to run metamp3 beta 4 (in 32-bit mode): 'The system cannot execute the specified program.' Strange, because v0.91 worked fine. I may have to create completely new project files.

@martin, thanks again. --fit will take unknown genres into account in the next release.
Title: metamp3 - command line tool
Post by: Martin H on 2007-03-05 15:16:17
@Tycho

Yesterday when i told you that this new beta worked on my system, then i can now see that this was only because i had just installed VC++ 2005 Express SP1, but i had no clue about that this was the reason for it working at that time. I only installed VC++ 2005 Express SP1 to make a couple of compiles and i didn't have any use for it after that, so i have just ghosted my C:\ drive back to a state just before i had installed VC++ 2005 Express SP1 and then when i was about to do some more tests with metamp3, then it again said "The system cannot execute the specified program" and so i had to make an external manifest file and place it in the apps folder and now it works again. I have the VC8 runtimes installed perfectly and it's the same problem on two PC's, and the evidence for that my VC8 runtime installs on the two PC's are working propperly, is that metamp3 v0.91 works without a problem and without a need for an external manifest file on both PC's.

Btw, i forgot to ask you about this at yesterday, so could you please tell me if i'm understanding the new displayed console message : "Arg Used: x x" right in that the first "x" is the number of metamp3.exe switches used and the final "x" is the total amount of commands/switches/parameters used in the whole command-line ?

Also, i'm very gratefull for you implementing my suggested change to the "--fit" switch for the next release, i really appreciate it.

Again, i can't thank you enough for all your efforts, my friend.

CU, Martin.
Title: metamp3 - command line tool
Post by: Martin H on 2007-03-05 20:29:52
[...] 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 (http://www.hydrogenaudio.org/forums/index.php?showtopic=24620&hl=rgsc.cpp), but I must know exactly how to convert the replaygain value to a SoundCheck value in order to do that.

Just in case you should have missed it :
Quote
The C code for converting ReplayGain to SoundCheck is : soundcheck = 1000 * pow(10.0, (-0.1 * gain))

Source : http://www.hydrogenaudio.org/forums/index....st&p=230971 (http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=24620&view=findpost&p=230971)
Title: metamp3 - command line tool
Post by: Martin H on 2007-03-06 17:56:19
Hi again, Tycho.

When having files called e.g. : "01 - TrackName.wav.mp3", then you can't run "metamp3 [...] *.mp3", but only "metamp3 [...] *.wav.mp3", as else the files isn't found.

Btw, i don't normally have files named like that, but i noticed it just because i had first tested something about genre setting with lame.exe and then afterwards used that output file to test something with metamp3.exe, and when you don't specify an output name to lame.exe, then it names the output files like that.

CU, Martin.
Title: metamp3 - command line tool
Post by: Martin H on 2007-03-06 19:42:23
I have also just noticed that the command-line parser in metamp3.exe treats the filename parameter case-sensitively, so if we have a file named "01 - TrackName.mp3", then this wouldn't work : metamp3 [...] "01 - trackname.mp3", but only this : metamp3 [...] "01 - "TrackName.mp3".
Title: metamp3 - command line tool
Post by: Landoro on 2007-03-06 22:17:43
@Tycho

Thanks for your excellent tool.
I appreciate the possibility to add the command line option for preserve the original file date and time.

For example:

mp3gain.exe
/p  (Preserve original file timestamp)

metaflac.exe
--preserve-modtime  (Preserve the original modification time in spite of edits)



Thanks.
Title: metamp3 - command line tool
Post by: JJZolx on 2007-03-11 21:47:33
Hmm. Windows 64 refuses to run metamp3 beta 4 (in 32-bit mode): 'The system cannot execute the specified program.'

I get this same error when trying to run 0.92b4 in 32-bit Windows XP Pro.
Title: metamp3 - command line tool
Post by: Martin H on 2007-03-11 23:49:06
Instructions for getting the metamp3 beta to run :

First the VC8 runtimes needs to be installed, if they aren't allready :
http://www.microsoft.com/downloads/details...;displaylang=en (http://www.microsoft.com/downloads/details.aspx?familyid=32BC1BEE-A3F9-4C13-9C99-220B62A191EE&displaylang=en)

Then copy and paste the following text into a file named "metamp3.exe.manifest" and place it in metamp3's folder.
Code: [Select]
<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>


Alternative solution for people that dosen't want to install the VC8 runtimes with the official installer :

First download "msvcr80.dll (http://www.dll-files.com/dllindex/download.php?msvcr80download0UJfTGUMfU)" and "msvcp80.dll (http://www.dll-files.com/dllindex/download.php?msvcp80download0UJfTGUDmW)" and place them + the above mentioned manifest file into metamp3's folder. Then another manifest file is needed, which also should be placed in metamp3's folder and named "microsoft.vc80.crt.manifest" :
Code: [Select]
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!-- Copyright © 1981-2001 Microsoft Corporation-->
<assembly xmlns="urn:schemas-microsoft-com:asm.v1"
                                 manifestVersion="1.0">
  <noInheritable/>
  <assemblyIdentity
    type="win32"
    name="Microsoft.VC80.CRT"
    version="8.0.50608.0"
    processorArchitecture="x86"
    publicKeyToken="1fc8b3b9a1e18e3b" />
  <file name="msvcr80.dll"/>
  <file name="msvcp80.dll"/>
</assembly>


Note: If having VC++ 2005 Express or Visual Studio 2005 installed, then metamp3 can run without any changes needed.
Title: metamp3 - command line tool
Post by: nyaochi on 2007-03-12 13:00:44
Hi tycho,

Thanks for the nice tool. There's no such handy and modern command-line tool for tagging MP3 files other than metamp3.

I have one fatal problem. As lapyu reported in the post #3, the current metamp3 still cannot handle multibyte characters in a filename. I uploaded the screenshot as you might not be familar with multi-byte characters.
http://nyaochi.sakura.ne.jp/temp/metamp3_ja.png (http://nyaochi.sakura.ne.jp/temp/metamp3_ja.png)
In short, metamp3 rejects MP3 files with Japanese names.
Title: metamp3 - command line tool
Post by: Nik on 2007-03-22 22:40:05
1. Is metamp3 supporting /k option from mp3gain, so it prevents clipping?

I don't see it in the list of command line parameters.
 
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 

I like that it writes ID3v2 tags, instead of APEv2

2. When it calculates and applies Replay Gain, does it do album gain or track gain?
Title: metamp3 - command line tool
Post by: LazyBoy on 2007-03-23 12:57:38
Why not use/preserve the mp3gain style tags?

I'm a fan of mp3gain and EAC, which has led me to REACT and metamp3.  Reading about metamp3, I can't help but wonder why you didn't want to be compatible with mp3gain. 

It seems that the ability to use either tool (without re-analysis & without two sets of tags if you run mp3gain after metamp3) would be good.  Must I give up mp3gain if I use metamp3?

Are the APEv2 tags so distasteful?

LB
Title: metamp3 - command line tool
Post by: Nik on 2007-03-23 13:46:38
Why not use/preserve the mp3gain style tags?

I'm a fan of mp3gain and EAC, which has led me to REACT and metamp3.  Reading about metamp3, I can't help but wonder why you didn't want to be compatible with mp3gain. 

It seems that the ability to use either tool (without re-analysis & without two sets of tags if you run mp3gain after metamp3) would be good.  Must I give up mp3gain if I use metamp3?

Are the APEv2 tags so distasteful?

LB


Not really.
They use same source, so they are more or less the same.
The only reasons why I would like ID3 instead of APE is consistency (lame writes other tags in ID3 format) and avoiding possible problems in the future.
I read that some players had (or still have) problems reading APE tags.
But, I'm using WinAmp, so I should be O.K.

Much bigger issue is clipping.
I would like to use some equivalent of /k option in metamp3, so I'm protected from clipping, but I don't see it
Title: metamp3 - command line tool
Post by: kolossal on 2007-03-23 14:48:18
This is exaclty the tool that i need, but i'm a linux user...
Any chance for a Linux release anytime soon?
Thanks
Title: metamp3 - command line tool
Post by: LazyBoy on 2007-03-23 19:38:53
I read that some players had (or still have) problems reading APE tags.

Players don't need to read the mp3gain tags.
Title: metamp3 - command line tool
Post by: tycho on 2007-03-23 22:35:48
Hi all,
As you probably can guess, I am terrible occupied so I haven't been able to work much on metamp3 (or REACT). When there is time, adding all mp3gain (equivalent) options should be fairly easy. Also allowing multi-byte char filenames, and UTF-8 support if it's not too hard should be next.  I don't think a Linux will be made in the near future, I'm afraid.

You should also look at the recent lame patch made by john33 that allows to add both command line album art frame and any text-frame id3v2.3 tags.
Title: metamp3 - command line tool
Post by: Jebus on 2007-03-24 17:29:41
Hi all,
As you probably can guess, I am terrible occupied so I haven't been able to work much on metamp3 (or REACT). When there is time, adding all mp3gain (equivalent) options should be fairly easy. Also allowing multi-byte char filenames, and UTF-8 support if it's not too hard should be next.  I don't think a Linux will be made in the near future, I'm afraid.

You should also look at the recent lame patch made by john33 that allows to add both command line album art frame and any text-frame id3v2.3 tags.


Thanks Tycho! I'd use Lame's built-in routines, but you can't tag an existing mp3 with them AFAICT (only encode a new one).

Could you please, at your earliest op, at least roll a static binary with no dependencies so people without visual studio can use this .exe without any manifest or .dlls or such? This beta seems to be working fine!
Title: metamp3 - command line tool
Post by: mRuss on 2007-03-29 02:43:25
Tycho, please update your readme.txt file with the link to the VC++ runtime files that users need to have installed for your program to work. 

http://www.microsoft.com/downloads/details...;displaylang=en (http://www.microsoft.com/downloads/details.aspx?familyid=32BC1BEE-A3F9-4C13-9C99-220B62A191EE&displaylang=en)

I had much trouble getting REACT to function because it uses your program and their documentation does not mention the runtime files either.

Other than that, your program works very well and very fast.  Thanks for your efforts.

Russ.
Title: metamp3 - command line tool
Post by: tycho on 2007-03-29 08:59:04
Tycho, please update your readme.txt file with the link to the VC++ runtime files that users need to have installed for your program to work. 

http://www.microsoft.com/downloads/details...;displaylang=en (http://www.microsoft.com/downloads/details.aspx?familyid=32BC1BEE-A3F9-4C13-9C99-220B62A191EE&displaylang=en)

I had much trouble getting REACT to function because it uses your program and their documentation does not mention the runtime files either.

Other than that, your program works very well and very fast.  Thanks for your efforts.

Russ.


I will. However, the reason why the beta versions doesn't work for most people is because they were compiled with VC++ 2005 SP1. It requires a new vcredist_x86-sp1.exe which is not available from Microsoft's site - nore is it included in the VC 2005 Express installation!!!  It is however in the VC++ 2005 Standard version. I can get hold of this file, but then I'm not sure I am allowed to redistribute it, although the name should imply it

There are three ways:
1) Distribute vcredist_x86-sp1.exe (if legal)
2) Uninstall SP1, recompile
3) Link statically with runtime libraries: compiler option /MT instead of /MD. This will create a rather bloated .exe file, but should always work!

Any suggestions?


Edit: read the gory details about all the problems with SP1: http://blogs.msdn.com/vcblog/archive/2006/...1-released.aspx (http://blogs.msdn.com/vcblog/archive/2006/12/18/visual-studio-2005-sp1-released.aspx)
Title: metamp3 - command line tool
Post by: Nik on 2007-03-29 11:16:02

I read that some players had (or still have) problems reading APE tags.

Players don't need to read the mp3gain tags.

If they cannot read mp3gain tags (i.e. Replay Gain tags) then they are what's on this forum usually called non-Replay Gain aware players.
They will play with the gain adjusted with mp3gain.
However Replay Gain aware players (the ones that can read mp3gain tags) have two advantages:
1. They can adjust gain more precisely (non RG aware players have resolution of 1.5dB)
2. You can choose whether to play tracks with AlbumGain or TrackGain.
With non-RG aware player, you can play with the gain which is applied to the track and that can be only one of them, of course.

Everyone will decide for himself whether these two issues are important to him.

I showed examples and more details in the guide (http://www.hydrogenaudio.org/forums/index.php?showtopic=53440), to get clearer picture.
Title: metamp3 - command line tool
Post by: Martin H on 2007-03-29 11:35:07
There are three ways:
1) Distribute vcredist_x86-sp1.exe (if legal)
2) Uninstall SP1, recompile
3) Link statically with runtime libraries: compiler option /MT instead of /MD. This will create a rather bloated .exe file, but should always work!

Any suggestions?

Ahh, nice to know what the problem was about  Just do whatever you preffer, but i would personally link statically  Thank's, mate.
Title: metamp3 - command line tool
Post by: tycho on 2007-03-29 16:00:09
I have made a link to vcredist_x86-sp1.exe in the first post (which should fix all manifest problems), and also made a link to metamp3 0.92 beta 5. I built that some time ago, and don't exactly remember what it fixed (probably a minor thing). More details later.

edit: now I remember: command line syntax changed a little. Hopefully more consistent.
Title: metamp3 - command line tool
Post by: Jebus on 2007-03-29 17:34:28
A static binary would be excellent.
Title: metamp3 - command line tool
Post by: Nik on 2007-03-30 09:58:33
1. Is metamp3 supporting /k option from mp3gain, so it prevents clipping?

2. When it calculates and applies Replay Gain, does it do album gain or track gain?


Anyone can answer this?
I would guess from Tycho's reply that answer on 1. is No. 

Thanks
Title: metamp3 - command line tool
Post by: tycho on 2007-04-02 09:03:41
1. Next version will support the prevent clipping option, along with other mp3gain options (equals).

2. It does both when specifying multiple input files, e.g. *.mp3, just like mp3gain. Only track gain when specifying one input file.

edit: also, the executable will be linked statically with the VC8 runtime libraries.
Title: metamp3 - command line tool
Post by: gsa999 on 2007-04-02 12:45:37
(note that some command line options has changed, and are not backward compatible).


Can you advise which commands are NOT backward compatible. With beta 5 REACT2 does not seem to work properly. I think it might be related to the pict command
Title: metamp3 - command line tool
Post by: Nik on 2007-04-02 19:59:17
2. It does both when specifying multiple input files, e.g. *.mp3, just like mp3gain. Only track gain when specifying one input file.

But it cannot apply both!
I understand that it calculates and writhes both in tags, but only one can be applied in global gain field, so non-ReplayGain aware players can play files with adjusted gain.
Title: metamp3 - command line tool
Post by: steve3386 on 2007-04-21 08:22:07
Quote
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.


Tycho, the following thread has info on this.  Look at the posts from 2006-2007.  There are two programs there that copy the RG values to the soundcheck tags.  You may be able to use these in metamp3, or incorporate them into REACT2.  It sure would be great to write the RG album value to the soundcheck tag when ripping (or at least while RG tagging) so that it is all done at once.
Link (http://www.hydrogenaudio.org/forums/index.php?showtopic=24620)
Title: metamp3 - command line tool
Post by: davelasker on 2007-04-22 23:21:29
Quote
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.

Also, take a look at this page. (http://robinbowes.com/projects/flac2mp3/ticket/30) Towards the bottom you will find some perl code which converts a replaygain volume adjustment (i.e. a signed number of dB) into the hexadecimal values found in the iTunNORM tag.

The formula for converting replaygain adjustment to a soundcheck adjustment in iTunNORM is:

Code: [Select]
sc = pow(10, -rg/10) * base,

where:
rg = replaygain adjustment, in +/- dB
base = 1000 for the 1st and 2nd numbers in iTunNORM tag, and
          2500 for the 3rd and 4th numbers in iTunNORM tag
sc = value of the 1st 4 numbers in iTunNORM using the above base.

I did some experiments that indicate this is correct:
1) I manually set 1st 4 hex numbers in iTunNORM tag using the above formula and verified that iTunes's Get Info command shows the same dB adjustment.
2) I used MP3Gain to alter the volume of a track, removed its iTunNORM tag, reimported it into iTunes to generate a new iTunNORM tag, and used the inverse of the above formula
Code: [Select]
rg = -10 * log10(sc/base)
to verify that 1st 4 numbers of iTunNORM tag changed by the same amount as the MP3Gain adjustment.

Hope that helps...

Dave
Title: metamp3 - command line tool
Post by: tycho on 2007-04-23 10:17:15
Thanks folks. I hope I find a few hours to implement this soon. Actually, I'd like to add an option to take the track replay gain value from the lame header and copy it to a regular id3v2 RG tag. (metamp3 is already capable to read the replaygain value created by lame in the lametag). How is then the formula to compute the album RG from a set of mp3 files with precomputed track RGs? I guess it is some kind of avaraging?

With this, we could write album RG, track RG, and SoundCheck tags, without doing any file scanning at all!
Title: metamp3 - command line tool
Post by: davelasker on 2007-04-23 18:25:24
How is then the formula to compute the album RG from a set of mp3 files with precomputed track RGs? I guess it is some kind of avaraging?

Sorry but I don't think this is possible. To compute the album gain, you need to playback all of the album's tracks, and feed their pcm values to the replaygain algorithm. The album gain calculation essentially treats all the album's tracks as a single track, and computes that track's track gain.

You might get a rough approximation by averaging the track gain values, but it won't be the same as computing it via playback.

Dave
Title: metamp3 - command line tool
Post by: tycho on 2007-04-23 21:17:42

How is then the formula to compute the album RG from a set of mp3 files with precomputed track RGs? I guess it is some kind of avaraging?

Sorry but I don't think this is possible. To compute the album gain, you need to playback all of the album's tracks, and feed their pcm values to the replaygain algorithm. The album gain calculation essentially treats all the album's tracks as a single track, and computes that track's track gain.

You might get a rough approximation by averaging the track gain values, but it won't be the same as computing it via playback.

Dave

Yep, I think you're right. I still suppose that track gains weighted with number of seconds divided on total number of seconds for the album should be pretty close, but I won't try it.
Title: metamp3 - command line tool
Post by: scooterfrog on 2007-04-26 05:16:55
synching / fixing soundcheck and mp3gain /metamp3  gains would be great.

I have run into problems appplying mp3 gain to soundchecked files only to find them doubley alterd when played back with soundcheck on.

when tis is ready ( the soundcheck part.
I will use tis progeam to celanup all my gain tags/levels.
for a simple radio ( track gain)  that will acutally work no matter where I play it.
Title: metamp3 - command line tool
Post by: steve3386 on 2007-04-30 06:26:30
That would be great if we could write the RG values to the soundcheck tags.  The program would be most flexible if you could choose thorugh a command line switch which RG value (track or album) to write to the soundcheck tag.  Then, for those like me that do not scale their tracks using RG track values, they could use the RG album value as the soundcheck tag.  Just my two cents.
Title: metamp3 - command line tool
Post by: gsa999 on 2007-10-26 14:34:52
I'm sure this is a really dumb question but how can I get metamp3 to work recursively through all my folders. I want it to replaygain all my mp3's

Rgds
Title: metamp3 - command line tool
Post by: tycho on 2007-10-26 20:26:50
I'm sure this is a really dumb question but how can I get metamp3 to work recursively through all my folders. I want it to replaygain all my mp3's

Rgds

You can do it with a dos command batch script. But it's much simpler and faster to use foobar2000 for this  - especially when you have a dual core machine.

Also to convert RG tags to SoundCheck itunes tags, load the RG'd files into mp3tag and apply one of the RG to SC actions (you'll find the actions to use by searching in the forum).
Title: metamp3 - command line tool
Post by: jespers on 2007-10-29 12:50:29
metamp3 seems like a nice tool for applying track- and album-gain to id3v2-tags. My only gripe with it is that no version is available for linux. I'd rather not use wine for such a processor-intensive task as calculating replaygain info.
Does anyone know of a similar tool for linux, or a port of metamp3 somewhere?
Title: metamp3 - command line tool
Post by: noorotic on 2007-11-25 10:37:20
-tycho:  Thank You very much for this tool.. it is what I've been looking for.  I have been using ID3 but have been unable to figure out the syntax (if it is even possible) for it to write 'undefined' tags, such as Venue, etc.

I have some questions regarding correctly using metamp3 as far as when and where to use ID3v2 defined tags for things like composer, and when to define a tag within the TXXX frame (if I am even using the correct terminology).

My application is writing tags for recordings of live concerts, etc... non-commercial recordings.

Any suggestions anyone, for a forum or thread where I might find such assistance?

Thanks,

Bob 
Title: metamp3 - command line tool
Post by: Synthetic Soul on 2007-11-25 19:10:14
I'm certainly no expert in this field, but I would always consider the ID3v2 specs (http://www.id3.org/id3v2.3.0#head-e4b3c63f836c3eb26a39be082065c21fba4e0acc), and use the defined frames where possible (e.g.: TCOM for composer).  If you wish to store information that is not covered by any of the defined frames then, and only then, revert to using a TXXX frame.

I have referenced the 2.3 spec, as metamp3 currently writes 2.3 tags.

Edit: As another point of reference, it may be useful to take a look at the foobar2000 ID3 tag mapping (http://wiki.hydrogenaudio.org/index.php?title=Foobar2000:ID3_Tag_Mapping).
Title: metamp3 - command line tool
Post by: noorotic on 2007-11-26 08:30:47
Synthetic Soul, I'd say you are about as close to expert-level as anyone.    I am using Tag for everything but ID3, including (at the moment) reading and parsing existing tags.  I do not necessarily need to be totally compatibile with Foobar2000, as I personally am using the ID3v2.3 'compatibility' setting.

I am to a point now of allowing people to add their own custom fields.  I may pre-design any of the standard fields in, but much of what might be included would be for example, taping details, who initially distributed the recording and when, etc.  These would not likely be recognized by many players, but they are more for archival purposes, and would probably be in FLAC files.  Some method of retrieving outside of a player software would be needed.  Still, I would like as much to be compatible with portable players, etc, as possible.

I appreciate your suggestions, I've read much of ID3.org.

I am very grateful to tycho.  I see many requests online for this, it would be nice if more easily found, probably.


Bob
Title: metamp3 - command line tool
Post by: bilbo on 2008-06-13 03:25:24
Thanks folks. I hope I find a few hours to implement this soon. Actually, I'd like to add an option to take the track replay gain value from the lame header and copy it to a regular id3v2 RG tag. (metamp3 is already capable to read the replaygain value created by lame in the lametag). How is then the formula to compute the album RG from a set of mp3 files with precomputed track RGs? I guess it is some kind of avaraging?

With this, we could write album RG, track RG, and SoundCheck tags, without doing any file scanning at all!


Has this ever been implemented in metamp3?
Title: metamp3 - command line tool
Post by: Vitriolic on 2008-09-28 09:05:44
I've noticed a weird buggy thing - I am using this to embed album art in foobar using foo_run.  I also have created a "styles" tag that is a multiple entry tag, with the entries deliminated by our pal the ';'.  Once I update the MP3 file by embedding the art, these multiple entry tags seem to be corrupted, with a tab space placed after the semicolon rather than the space which was there prior to adding the album art.

As an example, I whipped up this image - The top shows what happens once I run the tool on it, (and I just noticed it ate the ö as well.  Huh.)  The bottom shows what it should look like.  I embedded the actual tag in each example as well. 
(http://b.imagehost.org/0178/example.jpg)
Another odd thing is that until I actually play one of the files, these changes don't show up.  I can actually open the properties and copy the tag, then paste it back down again, and the problem goes away. 

Weird.  Any ideas?
Title: metamp3 - command line tool
Post by: Moonbase on 2008-10-29 05:24:49
First, I wish to thank you, Tycho, for all your incredible efforts and for taking up suggestions and feature requests so readily! This has really become a very usable and handy tool! Also, let me thank all of the others above who helped with their testing, suggestions and requests.

I’m just playing around with metamp3 v0.92b5 and have some questions:

1. Would it be possible to completely remove a set of tag info, i.e. ID3v1?

I tried

metamp3 --1 --remove * *.mp3
and
metamp3 --1 --remove
  • *.mp3[/b]

    and it tells me about Updating ID3: <filenames> but apparently something must have been left behind:

    When doing a
    metamp3 --info *.mp3

    it tells me:
    ID3v1.1 tags:


    ID3v2.3 tags:

      TXXX: [replaygain_album_peak]: 1.180283
      TXXX: [replaygain_album_gain]: -8.79 dB
      TXXX: [replaygain_track_peak]: 1.054268
      TXXX: [replaygain_track_gain]: -8.55 dB
      TALB: Kingdom Of Rock
      TPE1: Guardian
      TBPM: 0
      TCON: Christian Rock
      TIT2: Voyager
      TRCK: 10/10
      TYER: 1996


    This can be verified with other tagging software like Mp3tag, all of these state there would be ID3v1 and ID3v2.3 tags in the file. The ID3v1 tags are nonexistant (at least not shown) after above remove, the ID3v2.3 tags still unharmed (as expected).

    What am I doing wrong?

    ---

    2. I found I was unable to remove an unknown frame SEBR from a file (list shows it).

    If it’s not my error, could you find the heart to implement something like: if doing a remove, try to find one or more tags that correspond to what the user has typed (i.e. SEBR, SE*) and, if a match was found, remove it regardless? This would allow removing non-standard tags someone left in the files.

    Of course we couldn’t add, extract, or list these (because we don’t know their structure), but being able to at least remove them would be just great and make metamp3 even more versatile!

    ---

    3. Do I understand correctly, that
    • if you use --replay-gain, only the gain is calculated and written to (ID3) tags, and nothing else is changed, and
    • if you use --apply-gain, it will do what MP3Gain does, i.e. change the audio frames?
    [/i]

    ---

    The intention of all this (for me) is, I want to do some »cleaning up«, i.e. remove ID3v1 tags completely, remove »foreign« tags like SEBR and the like, and do some album-replaygaining, all from batch files. I use ID3v2.3 with ISO-8859-1 encoding throughout, so after some research, I found your tool being »just the Good Thing«.

    Many thanks again.
Title: metamp3 - command line tool
Post by: tycho on 2008-10-29 10:39:01
First, I wish to thank you, Tycho, for all your incredible efforts and for taking up suggestions and feature requests so readily! This has really become a very usable and handy tool! Also, let me thank all of the others above who helped with their testing, suggestions and requests.

Well, I haven't been to much help lately (for at least a year or so), but thanks anyway.

Quote
1. Would it be possible to completely remove a set of tag info, i.e. ID3v1?

Sorry, no. I think it only blanks tags in the ID3v1 block. It would have to analyse if all the tags where blanked and then remove the complete ID3v1 block. Or a specific option could do it (e.g. --remove-all-id3v1).

Quote
2. I found I was unable to remove an unknown frame SEBR from a file (list shows it).
If it’s not my error, could you find the heart to implement something like: if doing a remove, try to find one or more tags that correspond to what the user has typed (i.e. SEBR, SE*) and, if a match was found, remove it regardless? This would allow removing non-standard tags someone left in the files.

Of course we couldn’t add, extract, or list these (because we don’t know their structure), but being able to at least remove them would be just great and make metamp3 even more versatile!

Well, I'm relying on the functionality of id3lib to remove tags, which unfortunately is a little limited.
Quote
3. Do I understand correctly, that
  • if you use --replay-gain, only the gain is calculated and written to (ID3) tags, and nothing else is changed, and
  • if you use --apply-gain, it will do what MP3Gain does, i.e. change the audio frames?
[/i]

You are correct.

Quote
The intention of all this (for me) is, I want to do some »cleaning up«, i.e. remove ID3v1 tags completely, remove »foreign« tags like SEBR and the like, and do some album-replaygaining, all from batch files. I use ID3v2.3 with ISO-8859-1 encoding throughout, so after some research, I found your tool being »just the Good Thing«.

There are severe limitations in using id3lib as basis for the tool, as it has: no multi-byte characters support - only ansi, no id3v2.4 support, and it is a little buggy. I once started to implement metamp3 using TagLib (http://developer.kde.org/~wheeler/taglib.html) instead, but it also was somewhat buggy at the time. Taglib 1.5 may be better, and I really would like to rewrite metamp3 using that (+ it would support vorbistags, ape, and aac tags). TagLib is well-written C++ code, and is therefore much easier to use and extend with e.g. specific features that you suggest. One issue with TagLib though is that it only support writing of id3 v2.4. I will have to add support for writing id3v2.3, which is the defacto id3v2 standard.  I'll let you know if/when I get this started.
Title: metamp3 - command line tool
Post by: Moonbase on 2008-10-29 17:11:52
Or a specific option could do it (e.g. --remove-all-id3v1).

Would it be a terrible effort to put this in before something new starts?

I'll let you know if/when I get this started.

Count me in for testing (or maybe help). You might want to drop me an email then, since I’m on so many forums, I might overlook it otherwise … ;-)

Cheers for the quick answers!
Title: metamp3 - command line tool
Post by: UberNewf on 2008-10-29 17:39:15
Hello,

===ISSUE 1===
I want to 0-pad track numbers when making MP3s with React2\ACDIR\MetaMP3\EAC. This was asked back in 2007 (http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=49751&view=findpost&p=469103) but I did not see an answer to it. I am a new user and I have the same problem/request. Can anyone help, please?


===ISSUE 2===
May or may not be caused by MetaMP3 but I also want to name my files like this:

      01 - A Perfect Circle - Mer de Noms - The Hollow.mp3

I tried this in my REACT.INI (in the [UserOutputNames] section), but it causes ACDIR to actually crash!

    TrackName_SA_acdir=$N - $~A - $C - $T

Any ideas (or recommendation for the proper forum <g> if not here)?

THX,
UN
Title: metamp3 - command line tool
Post by: Moonbase on 2008-10-29 19:03:38
I just did some testing and found that metamp3 seems to be extremely »intelligent« on updating replay gain values:

I used a command like
metamp3.exe --2 --replay-gain "file1.mp3" "file2.mp3" "file3.mp3" …
on the tracks of an album that had replaygain tags before, except that I deleted them from one file, to see what it would do.

Apparently it »detected« that one file from the album had no replaygain tags and so it would have to recalculate all files in order to find an appropriate album gain. (Which it did.)

When using exact the same command again, it would just say »Updating ID3…« and be finished much faster (without re-calculating all the gains again).

Can this really be true? Did anyone verify this?

If that is really how it works – KUDOS again to Tycho!!!

And we all will have an integration with Mp3tag to do »failsafe« correct album+track replay gains on whole collections soon, hooray! (That’s what I’m currently working on, because not everyone loves foobar2000 and it tends to choke on samplers where the single titles are scattered all over the disc, i.e., if your folder structure is artist-oriented.)
Title: metamp3 - command line tool
Post by: Synthetic Soul on 2008-10-29 19:20:58
Any ideas (or recommendation for the proper forum <g> if not here)?
I think you should post your questions to the REACT 2 thread.  Issue 2 is certainly not related to metamp3 in any way (and I'm not sure that you actually believe that it is).
Title: metamp3 - command line tool
Post by: UberNewf on 2008-10-29 19:46:27
Any ideas (or recommendation for the proper forum <g> if not here)?
I think you should post your questions to the REACT 2 thread.  Issue 2 is certainly not related to metamp3 in any way (and I'm not sure that you actually believe that it is).


Fair 'nuf.
Title: metamp3 - command line tool
Post by: Akkurat on 2008-10-30 23:42:01
The "--list-picture-types" option which is documented in metamp3.txt and in command line help doesn't work in 0.92b5. The "--list-pict-types" from older versions works.
Title: metamp3 - command line tool
Post by: tycho on 2008-10-31 09:51:47
I just did some testing and found that metamp3 seems to be extremely »intelligent« on updating replay gain values:

I used a command like
metamp3.exe --2 --replay-gain "file1.mp3" "file2.mp3" "file3.mp3" …
on the tracks of an album that had replaygain tags before, except that I deleted them from one file, to see what it would do.

Apparently it »detected« that one file from the album had no replaygain tags and so it would have to recalculate all files in order to find an appropriate album gain. (Which it did.)

When using exact the same command again, it would just say »Updating ID3…« and be finished much faster (without re-calculating all the gains again).

Can this really be true? Did anyone verify this?

If that is really how it works – KUDOS again to Tycho!!!

Yes, this is how it was supposed to work, but I seem to recall that this logic was basically taken from the mp3gain code, so we should give kudos to the author of mp3gain as well.

I guess I could start with making a new id3lib based beta with some of the suggestions that has been made here as they are quite minor. I will in any case have to start out with the current metamp3 code base.

Cheers.
Title: metamp3 - command line tool
Post by: Moonbase on 2008-11-01 02:59:39
I guess I could start with making a new id3lib based beta with some of the suggestions that has been made here as they are quite minor. I will in any case have to start out with the current metamp3 code base.

That’d be fantastic since it seems it’s the most versatile command line tool around, and it can so readily be integrated into other workflows (I mostly use it in conjunction with Mp3tag and automated batch file processes). Just the thing to save a lot of valuable time.

Thanks for considering some updates of your tool after all that time!
And yes, kudos to Glen Sawyer and Dave Lasker.
Title: metamp3 - command line tool
Post by: Akkurat on 2009-02-11 23:27:30
Found a bug in metamp3 (tested with versions: 0.91 and 0.92 beta 5).

If the filename ends in ..mp3 (or with any multiples of 2 consecutive period chars) (e.g. 01 Theme From M.A.S.H..mp3 or 02 My Only Friend, The End....mp3), metamp3 fails to parse these filenames correctly, in example when running --apply-gain or --replay-gain functions with *.mp3 (e.g. metamp3.exe --replay-gain *.mp3). In order to get also these "special" files to count in these function calculations, you need to execute the command with all the filenames wrapped in quotes ( " ) (e.g. metamp3.exe --replay-gain "01 Theme From M.A.S.H..mp3" "02 My Only Friend, The End....mp3").
Title: metamp3 - command line tool
Post by: BigIUFan on 2009-03-17 16:56:20
Tycho,

Perhaps you have already addressed this, but do you have plans to make the source available?

Thanks.
Title: metamp3 - command line tool
Post by: djrobx on 2009-04-01 01:23:37
Another possible, minor bug.  I'm trying to add the tag to tell iTunes it's part of a gapless album. 

--frame "COMM[iTunPGAP]{eng}:1"

*should* work, but the resulting file is slightly different than what iTunes outputs.  Comparing the binary files, metamp3 puts 0x0e 00 00 00 + "engiTunPGAP" where iTunes has 0x10 00 00 00 + "engiTunPGAP"

Title: metamp3 - command line tool
Post by: Tronar on 2009-04-19 01:23:42
1. Next version will support the prevent clipping option, along with other mp3gain options (equals).

2. It does both when specifying multiple input files, e.g. *.mp3, just like mp3gain. Only track gain when specifying one input file.

edit: also, the executable will be linked statically with the VC8 runtime libraries.

Hi,

does anyone know if these functions found their way into the latest metamp3 (v0.92b5)?
According to the date of the post of the author tycho (02-Apr-2007) and the creation date of the metamp3.exe (29-Mar-2007) I am afraid that this was not the case. 

On the other hand tycho stated in his post, that "the [new] executable [including those features] will be linked statically with the VC8 runtime libraries."
Well, the latest available beta 5 says it "is now linked with the VC8 runtime libs"... Hmmm. 

So maybe these features did indeed find their way into that last version tycho has published. 

Can anyone shed some light onto that topic?

Thanks in advance,

Tronar
Title: metamp3 - command line tool
Post by: Forfit on 2009-09-15 22:33:28
I have a list of MP3s with the lyrics saved in Minilyrics.
there is a software to extract all the lyrics in single file. txt?
for example alfa.mp3 -> alfa.txt
Title: metamp3 - command line tool
Post by: mkm-8765654009 on 2009-12-01 09:25:51
hi tycho,
thanks a lot for your excellent tool. you said post feature requests as a reply, so here is one: is it possible to add the tag "Album-Interpret" to the list of supported tags? or is that already supported and i'm overseeing something? i'm using v092b5.
best regards, mkm
Title: metamp3 - command line tool
Post by: stereotype on 2011-03-21 19:24:23
Any chance of open sourcing this excellent tool?
Title: metamp3 - command line tool
Post by: BigIUFan on 2013-09-10 19:48:36
I think we can put a fork in it, it's done. I was hoping that Tycho would make the source available to those of us that might carry it forward.
Title: Re: metamp3 - command line tool
Post by: Moonbase on 2019-07-08 16:02:08
Yep. If you should ever read this, Tycho, thanks a million nevertheless! I’ve been using your metamp3 until mid-2019, the last 5 years on Linux (using Wine).

Nowadays, I’ve moved to FLAC, mainly, and made my own "ReplayGainer" tool (Open Source, for Linux): https://github.com/Moonbase59/loudgain

(This is strictly a ReplayGain tool and will never do all the things metamp3 could. Waving goodbye to a great tool …)
Title: Re: metamp3 - command line tool
Post by: elcosomalo on 2023-04-28 22:03:16
So, this app is not working as it should anymore. It gives  unconsistent results, sometimes it tags properly, sometimes it just embeds the artwork but not the rest of the tags and a weird thing I noticed is that windows Xcopy, copy and robocopy commands delete the tags added by this app when copying. Only powershell "copy-item" retained the tags (this doesn't happen for files tagged with other software like foobar)

Can anybody tell me if there is a windows exe that I can use in a common bat file that can tag and embed images as a replacement? I need to tag files automatically from a windows CLI.
Title: Re: metamp3 - command line tool
Post by: Marsu42 on 2023-10-24 13:16:53
Can anybody tell me if there is a windows exe that I can use in a common bat file that can tag and embed images as a replacement? I need to tag files automatically from a windows CLI.

You can go from ancient mp3meta to bleeding edge tone: https://github.com/sandreas/tone
Title: Re: metamp3 - command line tool
Post by: Marsu42 on 2023-10-24 23:35:28
You can go from ancient mp3meta to bleeding edge tone: https://github.com/sandreas/tone

Another stable command line tool is https://kid3.kde.org/#download - when (and if) you figure out the correct syntax. To add an image file on Windows, it's:  kid3-cli.exe -c "set picture: 'C:/dir/file.jpg'" 'C:/dir/file.mp3'
Title: Re: metamp3 - command line tool
Post by: jprjr on 2023-10-26 15:51:00
I've been using eyeD3 for all my id3 tagging for years. https://eyed3.readthedocs.io/en/latest/

Everything is implemented as plugins, the default is classic, you can view what tags it lets you edit here - https://eyed3.readthedocs.io/en/latest/plugins/classic_plugin.html - handles adding/removing/extracting images also.