Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Shouldn't Automator be easier to use than writing shell scripts?
#1
Programming is not really my thing, but I have managed to get this far... I managed to write up a Shell script (bash) that uses ffmpeg and LAME to batch convert .aif files into both .ogg and .mp3 at the same time, but apparently it is beyond my ability to get Automator to set that up to run as a drag&drop application.

The script goes like this, and works fine in the Terminal:
for x in *.aif;
do name=`echo $x | cut -d'.' -f1`;
echo $name;
ffmpeg -i $x -acodec libvorbis -aq 8 $name.ogg;
lame $x -ab 128k $name.mp3;
done

You just cd to the directory in which you have the .aif files you want to process, then run the script and it spits out .ogg and .mp3 copies for each .aif.

I added that to a "Run Shell Script" node in Automator, and tried all manner of options to get the input (folder from Finder, or just files) to process, but I always get an error saying that the Run Shell Script action encountered an error, with no more details.

Based on my searches I am pretty sure I need to add in a variable to the script that tells it the location of the Folder I have selected in the Finder using "$@":
for x in "$@";
do name=`echo $x | cut -d'.' -f1`;
echo $name;
ffmpeg -i $x -acodec libvorbis -aq 8 $name.ogg;
lame $x -ab 128k $name.mp3;
done

but that didn't help at all. I have tried changing the Pass input setting from "as arguments" to "to stdin", and don't know where to go next... Any ideas?
Reply


Messages In This Thread
Shouldn't Automator be easier to use than writing shell scripts? - by mikebw - 01-15-2013, 09:53 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)