IPB

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
Renaming with batch file and Mp3 Gain
xulama
post Nov 2 2007, 03:50
Post #1





Group: Members
Posts: 8
Joined: 29-May 07
Member No.: 43785



For testing purposes, it helps me to rename files with a 'tag' that identifies what's been done. i.e a .wav file converted to .mp3 with Lame at 320 CBR, I might add "_L320" at the end of the file name; "_LV2X" tells me I used -V2 plus Mp3Gain etc. This way, when playing the files in differant mp3 players (most w/out real tag support), a quick check of the play list tells me what I'm listening to. It really helps to have these files automatically renamed as part of the conversion process. Thanks to Greynol, I can now do this with a batch file for Lame! I have tried to set this up for Mp3Gain but, alas, I don't know what I'm doing and thus far have been unsucsessful sad.gif . Any help would be greatly appreciated biggrin.gif
Go to the top of the page
 
+Quote Post
smok3
post Nov 2 2007, 09:26
Post #2


A/V Moderator


Group: Moderator
Posts: 1518
Joined: 30-April 02
From: Slovenia
Member No.: 1922



maybe post your current batch?


--------------------
PANIC: CPU 1: Cache Error (unrecoverable - dcache data) Eframe = 0x90000000208cf3b8
NOTICE - cpu 0 didn't dump TLB, may be hung
Go to the top of the page
 
+Quote Post
xulama
post Nov 2 2007, 09:38
Post #3





Group: Members
Posts: 8
Joined: 29-May 07
Member No.: 43785



QUOTE (xulama @ Nov 1 2007, 18:50) *
For testing purposes, it helps me to rename files with a 'tag' that identifies what's been done. i.e a .wav file converted to .mp3 with Lame at 320 CBR, I might add "_L320" at the end of the file name; "_LV2X" tells me I used -V2 plus Mp3Gain etc. This way, when playing the files in differant mp3 players (most w/out real tag support), a quick check of the play list tells me what I'm listening to. It really helps to have these files automatically renamed as part of the conversion process. Thanks to Greynol, I can now do this with a batch file for Lame! I have tried to set this up for Mp3Gain but, alas, I don't know what I'm doing and thus far have been unsucsessful sad.gif . Any help would be greatly appreciated biggrin.gif

Add'l explanation!

When encoding a .wav file to .mp3 with lame, using a batch script allows me to rename the resultant .mp3 with a 'tag-line' like "L320" or "LV2X" just to let me know what parameters were used for testing purposes i.e. "Song Title.wav" to "Song Title L320.mp3" tells me that the .mp3 was encoded at 320 CBR etc. (saves me having to rename the files manually after encoding is finished) This way, when I'm listening to tracks on my (non mp3 tag supporting) player, in the car, I can tell how the mp3 was encoded by checking the song title. Each Lame version/configuration is setup with its own corresponding batch file and renames the mp3's accordingly. Some examples:

Lame 3.90.3 > 320 CBR has the following batch script:
"C:\Program Files\Lame Convert\L390\lame.exe" -b 320 -m s -h %1 "%~dpn1 L320.mp3"

= "Song Title L320.mp3"

Lame 3.98 > V2 looks like this:
"C:\Program Files\Lame Convert\L398\lame.exe" -V2 --vbr-new -m s -q0 %1 "%~dpn1 LV2X.mp3"

= "Song Title LV2X.mp3"

etc. you get the idea; this all works great! The problem is that I can't get this to work with Mp3Gain even though I'm employing the same batch parameters and they should only be dependant on cmd.exe for executing the rename, not on lame.exe or mp3gain.exe! My goal is to rename the resultant mp3 (gain applied) with an additional tag-line like "GX" to show that gain has been applied. I can run Mp3Gain from a batch file without issue, it's only the rename part that has me stumped. Greynol... Help! Pleeeeez rolleyes.gif

@smok3

Sorry, just saw your post - hope the above helps!

This post has been edited by xulama: Nov 2 2007, 09:40
Go to the top of the page
 
+Quote Post
Synthetic Soul
post Nov 2 2007, 10:10
Post #4





Group: Super Moderator
Posts: 4732
Joined: 12-August 04
From: Exeter, UK
Member No.: 16217



To append "GX" to a filename you would use:

CODE
REN %1 "%~n1 GX%~x1"

This essentially says: RENAME "<name><.extn>" to "<name> GX<.extn>".

Therefore, you would run MP3Gain on the file and rename it after using a command as above.

If this MP3Gain action is part of your existing batch files then I suppose it may look something like:

CODE
"C:\Program Files\Lame Convert\L398\lame.exe" -V2 --vbr-new -m s -q0 %1 "%~dpn1 LV2X.mp3"
"C:\Program Files\MP3Gain\mp3gain.exe" [options] "%~dpn1 LV2X.mp3"
REN "%~dpn1 LV2X.mp3" "%~n1 LV2X GX.mp3"

... but then, why not just append the GX when you create the MP3 - if you know that you are going to put it through MP3Gain?

CODE
"C:\Program Files\Lame Convert\L398\lame.exe" -V2 --vbr-new -m s -q0 %1 "%~dpn1 LV2X GX.mp3"
"C:\Program Files\MP3Gain\mp3gain.exe" [options] "%~dpn1 LV2X GX.mp3"

Hopefully, there's enough in the above to let you do what you want anyway! If not, perhaps you could be more specific.
Go to the top of the page
 
+Quote Post
smok3
post Nov 2 2007, 11:43
Post #5


A/V Moderator


Group: Moderator
Posts: 1518
Joined: 30-April 02
From: Slovenia
Member No.: 1922



yes, that would do, addition would be checking if replaygain exited without error and then only renaming songs that were actually replaygained.


example on how i check if avisynth is installed/enabled:
CODE
reg query HKEY_CLASSES_ROOT\avsfile\ >nul 2>&1
if %ERRORLEVEL%==1 (
echo warning, avisynth registry entrie was not found
pause

)


only in this case you would have to negate.

This post has been edited by smok3: Nov 2 2007, 11:43


--------------------
PANIC: CPU 1: Cache Error (unrecoverable - dcache data) Eframe = 0x90000000208cf3b8
NOTICE - cpu 0 didn't dump TLB, may be hung
Go to the top of the page
 
+Quote Post
Synthetic Soul
post Nov 2 2007, 12:40
Post #6





Group: Super Moderator
Posts: 4732
Joined: 12-August 04
From: Exeter, UK
Member No.: 16217



Yes, a very good point.

I did mean to put in an example checking the return code of MP3Gain before renaming.

Edit: An alternative would be to use conditional execution, e.g.:

CODE
"C:\Program Files\MP3Gain\mp3gain.exe" [options] "%~dpn1 LV2X.mp3" && REN "%~dpn1 LV2X.mp3" "%~n1 LV2X GX.mp3"

REN will only run if MP3Gain executes successfully.

This post has been edited by Synthetic Soul: Nov 2 2007, 12:44
Go to the top of the page
 
+Quote Post
smok3
post Nov 2 2007, 14:01
Post #7


A/V Moderator


Group: Moderator
Posts: 1518
Joined: 30-April 02
From: Slovenia
Member No.: 1922



cool, i have to remember the && thingy smile.gif


--------------------
PANIC: CPU 1: Cache Error (unrecoverable - dcache data) Eframe = 0x90000000208cf3b8
NOTICE - cpu 0 didn't dump TLB, may be hung
Go to the top of the page
 
+Quote Post
greynol
post Nov 2 2007, 16:51
Post #8





Group: Super Moderator
Posts: 4793
Joined: 1-April 04
Member No.: 13167



QUOTE (xulama @ Nov 2 2007, 01:38) *
Greynol... Help! Pleeeeez
With Synthetic Soul and smok3 on the scene, you should be more than ok. smile.gif

EDIT: Didn't know that the drive and path weren't necessary for the destination on a rename operation. Thanks!

This post has been edited by greynol: Nov 2 2007, 18:49
Go to the top of the page
 
+Quote Post
xulama
post Nov 2 2007, 20:15
Post #9





Group: Members
Posts: 8
Joined: 29-May 07
Member No.: 43785



QUOTE (greynol @ Nov 2 2007, 07:51) *
QUOTE (xulama @ Nov 2 2007, 01:38) *
Greynol... Help! Pleeeeez
With Synthetic Soul and smok3 on the scene, you should be more than ok. smile.gif

EDIT: Didn't know that the drive and path weren't necessary for the destination on a rename operation. Thanks!

You're so right, they took gooooood care of me! biggrin.gif

@Synthetic Soul!

Awesome! I knew you could set me strait with this and it works beautifully!! (that && thing is gold!) Thank you!!! biggrin.gif (hey, where's the little smily that bows in worship when you need him!?) Anyway, I can't thank you enough; you really helped me out wink.gif

QUOTE
... but then, why not just append the GX when you create the MP3 - if you know that you are going to put it through MP3Gain?


That's probably what I'll end up with eventually but, for now, I just want to keep them seperate for testing purposes.

@smok3!

QUOTE
yes, that would do, addition would be checking if replaygain exited without error and then only renaming songs that were actually replaygained.


That's so cool, I didn't know that was even possible!! Great insight and advice! Thanks for your help and guidance in this. wink.gif

OK, to recap, I can now take any .wav file and with a right click, choose Encode to Mp3 with Lame (any version and configuration I set up) Currently I have 3.90.3 and 3.98b3 setup with differant configurations for differant tasks and testing. As the file is encoded to .mp3 it's also renamed with a tag code that tells me which version/ config settings were used. Now I can right click on any of these resultant .mp3 files and choose to apply Mp3Gain with set options and after gain is applied (and checked!), the new file is renamed with an additional 'GX' tag to show me the file has gain applied! Wow! What can I say, Thanks again guys!

Here's the final batch script (modified to allow 'generic' renaming with Mp3Gain):

CODE
"C:\Program Files\MP3Gain\mp3gain.exe" -a -k "%~dpn1.mp3" && REN "%~dpn1.mp3" "%~n1 GX.mp3"
Go to the top of the page
 
+Quote Post
mrees
post Jun 25 2008, 04:34
Post #10





Group: Members
Posts: 2
Joined: 25-June 08
Member No.: 54835



A Great thread. Im hoping this may be the right place to post this question as it is in line with what xulama was originally wanting to do.

I was wondering if I could ask you for some help. Im pretty hopeless remembering all the variables in dos CMD stuff.

What Im hoping to be able to do is:
I have a directory structure as follows:

\Artist\(year) Album name\tracks.mp3
[eg: \Pink Floyd\(1975) Wish You Were Here\1 - Shine On You Crazy Diamond (Part One).mp3]

From there, I want to run a batch file that will analyse the music using mp3gain and apply the 89db MP3 gain to every track (eventually this will be run on all my music collection and all future rips)

Once that is complete (as long as no errors are encountered), I want the mp3 files and folders (artist\album) to be moved to my \\server\music\ share that is located on my home server, ensuring that the artist folder and allbum folder is also moved.

I can pretty much understand all the MP3 gain command line stuff, but Im just having a few issues figurung out the order of things in the batch and to make sure that all the folders are correctly moved over.

Can anyone help?

Thanks for your time

This post has been edited by mrees: Jun 29 2008, 23:16
Go to the top of the page
 
+Quote Post
mrees
post Jun 30 2008, 20:33
Post #11





Group: Members
Posts: 2
Joined: 25-June 08
Member No.: 54835



BUMP!

smile.gif
Go to the top of the page
 
+Quote Post
starpause
post Jun 2 2009, 17:58
Post #12





Group: Members
Posts: 2
Joined: 22-May 06
Member No.: 31046



QUOTE (mrees @ Jun 24 2008, 21:34) *
From there, I want to run a batch file that will analyse the music using mp3gain and apply the 89db MP3 gain to every track (eventually this will be run on all my music collection and all future rips)


for the quoted step, see this thread:

http://www.hydrogenaudio.org/forums/lofive...php/t13162.html

Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 22nd November 2009 - 07:25