Renaming with batch file and Mp3 Gain |
![]() ![]() |
Renaming with batch file and Mp3 Gain |
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
|
|
|
|
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 |
|
|
|
Nov 2 2007, 09:38
Post
#3
|
|
|
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 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 @smok3 Sorry, just saw your post - hope the above helps! This post has been edited by xulama: Nov 2 2007, 09:40 |
|
|
|
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. |
|
|
|
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 |
|
|
|
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 |
|
|
|
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
-------------------- PANIC: CPU 1: Cache Error (unrecoverable - dcache data) Eframe = 0x90000000208cf3b8
NOTICE - cpu 0 didn't dump TLB, may be hung |
|
|
|
Nov 2 2007, 16:51
Post
#8
|
|
|
Group: Super Moderator Posts: 4793 Joined: 1-April 04 Member No.: 13167 |
|
|
|
|
Nov 2 2007, 20:15
Post
#9
|
|
|
Group: Members Posts: 8 Joined: 29-May 07 Member No.: 43785 |
Greynol... Help! Pleeeeez With Synthetic Soul and smok3 on the scene, you should be more than ok. 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! @Synthetic Soul! Awesome! I knew you could set me strait with this and it works beautifully!! (that && thing is gold!) Thank you!!! 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. 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"
|
|
|
|
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 |
|
|
|
Jun 30 2008, 20:33
Post
#11
|
|
|
Group: Members Posts: 2 Joined: 25-June 08 Member No.: 54835 |
BUMP!
|
|
|
|
Jun 2 2009, 17:58
Post
#12
|
|
|
Group: Members Posts: 2 Joined: 22-May 06 Member No.: 31046 |
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 |
|
|
|
![]() ![]() |
|
Lo-Fi Version | Time is now: 22nd November 2009 - 07:51 |