LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   encode multiples files with lame (https://www.linuxquestions.org/questions/linux-software-2/encode-multiples-files-with-lame-232432/)

kevinlux 09-19-2004 05:38 AM

encode multiples files with lame
 
I everyone,
here's my problem:
I want to enconde my mp3 files which have various bitrate (196,256,ecc) to 128.
I have put my mp3 in a new directory, and try with lame to encode with one command my mp3.
But lame accept only one files in input at time, if i try lame -b 128 * - (which mean : select all files and downsample to 128 bitrate and leave self name).
It does'nt works.
sorry for my enghlish
have a good time.

druuna 09-19-2004 06:02 AM

Haven't worked with lame myself, but if it only takes one infile at the time you might do something like this:

for THIS in *mp3
do
lame <whatever options> ${THIS}
done


$THIS holds the one filename that is processed and gives the file, one at the time, to lame untill all files are processed.

The above can be done from the command line. Just press enter/return after each line, after you press enter after entering done the process will start.

Like I stated before: I'm not a lame user, so you need to check that section of the above code.

Hope this helps.

kevinlux 09-19-2004 07:24 AM

Quote:

Originally posted by druuna
Haven't worked with lame myself, but if it only takes one infile at the time you might do something like this:

for THIS in *mp3
do
lame <whatever options> ${THIS}
done


$THIS holds the one filename that is processed and gives the file, one at the time, to lame untill all files are processed.

The above can be done from the command line. Just press enter/return after each line, after you press enter after entering done the process will start.

Like I stated before: I'm not a lame user, so you need to check that section of the above code.

Hope this helps.


Thanks a lot.
It work very fine
i have userd this code
Code:

for XX in *.mp3
do
lame -b 128 $XX newdir/$XX
done

but a more little problem with spaces.
If in a directory there are only files without spaces it works very very fine.
If a file is called for example "Elvis Presley - Lame RoX.mp3" lame don't recognize correctly variable $XX infact for lame input file is "$XX=RoX.mp3" that doesn't exist and it fail!
how i can resolve this problem???
thanks a lot!!

druuna 09-19-2004 08:04 AM

Spaces in filenames........

You could try something like this:
Code:

#!/bin/bash

find . -name "*mp3" | \
while read FILE
do
  lame -b 128 "$FILE" "$FILE.new"
done

Code might need some work (newdir/$FILE instead of $FILE.new), but I hope the working is clear.

kevinlux 09-19-2004 11:53 AM

Quote:

Originally posted by druuna
Spaces in filenames........

You could try something like this:
Code:

#!/bin/bash

find . -name "*mp3" | \
while read FILE
do
  lame -b 128 "$FILE" "$FILE.new"
done

Code might need some work (newdir/$FILE instead of $FILE.new), but I hope the working is clear.

works greatly...!!
Thanks a lot for your help!!!


All times are GMT -5. The time now is 11:58 PM.