I solve this problem using some bash script kung-fu. It might be ugly or not the best solution, but it work for me.
First, I create an executable script file with this content:
--- convert.sh script start ---
#!/bin/bash--- script end ---
(
IFS=$'\n';
mkdirhier $2$1;
for j in `ls $1*.ogg`
do
k=`basename $j`;
gst-launch-0.10 filesrc location="$1$k" ! oggdemux ! vorbisdec !
audioconvert ! lame ! filesink location="$2$1$k.mp3";
done
)
And then, to use this script to convert many ogg to mp3, I use this command on bash prompt:
IFS is Input Field Separator, an environment variable used by bash to split inputs. Here we need to only split input by newline ('\n').
(
IFS=$'\n'
for i in "folder1/" "nested/folder2/" "here is another folder/with ogg/";
do
./convert.sh $i /destination/folder/;
done
)
Hope it helps some poor soul out there :-)
Oh btw, because I'm using gstreamer here, this script can easily be changed to convert __any__ multimedia file to any multimedia file that supported by gstreamer.
No comments:
Post a Comment