need help with afconvert command
hi
i am trying to use the afconvert command for the first time, to convert AAC audio files added to a specific folder in finder to WAV files. I have done a bit of searching about but can't work out how to write the afconvert command.
ultimately i would like to have a script with the afconvert command which would run as a folder action when AAC files are added to the folder, and ideally I would like the original AAC files to be deleted, but first off i need to get the afconvert command working.
i would be grateful if someone could let me know how to write the command line
thanks
nick
i am trying to use the afconvert command for the first time, to convert AAC audio files added to a specific folder in finder to WAV files. I have done a bit of searching about but can't work out how to write the afconvert command.
ultimately i would like to have a script with the afconvert command which would run as a folder action when AAC files are added to the folder, and ideally I would like the original AAC files to be deleted, but first off i need to get the afconvert command working.
i would be grateful if someone could let me know how to write the command line
thanks
nick
Comments
afconvert -f 'WAVE' -d I16@44100 input.aac output.wav
I'd recommend doing a move to trash instead of delete in case the program has some sort of error.
thanks a lot for the command. how would i use this in a folder action? do i have to put it in a script?
sorry for being a bit thick in this regard
nick
Or you can convert ONline
hey marvin
thanks a lot for the command. how would i use this in a folder action? do i have to put it in a script?
Yeah, you have to put it in an Applescript like this one:
on adding folder items to this_folder after receiving added_items
try
tell application "Finder"
set the folder_name to the name of this_folder
end tell
set the item_count to the number of items in the added_items
tell application "Finder"
repeat with opath in added_items
set ppath to quoted form of POSIX path of opath
if ppath as text does not end with ".wav'" then
do shell script "afconvert -f 'WAVE' -d I16@44100 " & ppath & "; mv " & ppath & " ~/.Trash"
end if
end repeat
end tell
end try
end adding folder items to
You'd open Applescript Script Editor, paste that into it and save it as something like wavconvert in the folder /Library/Scripts/Folder Actions. Then you'd right-click a folder and enable actions and assign that one to it. When you drop an audio file into it, it should trigger after a few seconds, convert to .wav and move the original to trash.
Folder actions are a bit odd because if you have a script that creates a file inside the folder, it triggers the action again. So for example, without the extension check above, if you drop an mp3 into the folder, it creates a wav file but the folder then thinks you've just added a wav file to it so it runs the script again and it goes into an infinite loop.
I think a more popular method is to use a droplet so you'd grab a bunch of files and drop them onto it. It would then start converting the files and move them to a given folder. This isn't as convenient if you have multiple folders setup or you change the location but you get more control.
you're a star. this script does exactly what i want it to do, and so far is working without any problems. thanks so much, you have really improved my workflow!!
nick
Here's a nice audio converter for core audio formats. http://gngrwzrd.com/microac/