HydrogenAudio

Lossy Audio Compression => MP3 => MP3 - General => Topic started by: Kam1073 on 2012-07-23 20:13:51

Title: Lame Batch Convert
Post by: Kam1073 on 2012-07-23 20:13:51
Hello everyone!

I need a little help to write a simple batch file that can do the following:

Convert any .wav files in a directory to mp3 using the original file name and delete the original .wav file when complete.

This directory will always have a .wav file that is recording, so when the script hits the "file in use" error, it needs to skip it and move on.

I plan to take the batch file and have windows run it automatically on an hourly schedule.

My original plan was to run: C:\filepath\lame.exe" --preset cbr 256 d:\filepath\*.wav

But Lame will only encode a single file and then exit. 

Also not sure how to delete the original .wav file when complete..

Ideas?

Thanks!


Title: Lame Batch Convert
Post by: Kohlrabi on 2012-07-23 23:59:16
Try this:

Create a file called encode_and_delete_wav.bat, open it in an editor and add the following:
Code: [Select]
for /R %%f in (*.wav) do (
"C:\filepath\lame.exe" --preset cbr 256 "%%f" "%%~dpnf.mp3"
del %%f
)

Deploy the file into the folder where the WAV files reside, or edit the parameter *.wav describing the set, accordingly. I'm not sure whether it will skip the WAV file being written to, try it.