New To Mac-Forums?

Welcome to our community! Join the discussion today by registering your FREE account. If you have any problems with the registration process, please contact us!

Get your questions answered by community gurus • Advice and insight from world-class Apple enthusiasts • Exclusive access to members-only contests, giveaways and deals

Join today!

 
Start a Discussion
 

Mac-Forums Brief

Subscribe to Mac-Forums Brief to receive special offers from Mac-Forums partners and sponsors

Join the conversation RSS
OS X - Operating System General OS operation information and support

Need help with applescript to convert audio files using ffmpeg


Post Reply New Thread Subscribe

 
Thread Tools
nick_harambee

 
Member Since: Feb 24, 2007
Posts: 100
nick_harambee is on a distinguished road

nick_harambee is offline
Hi

I have installed ffmpeg using MacPorts and am trying to work out a script that will convert audio files in a specified folder to mp3 files, outputting the converted files as mp3 files in another folder.

So far the script looks like this:

Code:
set convertPath to "Macintosh HD:opt:local:bin:ffmpeg"
set convertCommand to quoted form of POSIX path of convertPath & " -i {infile} -f mp3 -ar 44100 -ab 128 -acodec mp3 - "

tell application "Finder"
	set inPath to "Macintosh HD:Users:nick:Desktop:new:"
	set outPath to "Macintosh HD:Users:nick:Desktop:new2:"
	set myFiles to (files of entire contents of inPath whose name ends with ".m4a") as alias list
	
	repeat with i from 1 to count of myFiles
		do shell script convertCommand
	end repeat
	
end tell
With this script I am getting the error : "Can’t make every file of «class ects» of "Macintosh HD:Users:nick:Desktop:new:" whose name ends with ".m4a" into type alias list."

Another issue is that I am not sure how to define the do shell script command so that it outputs an MP3 file in the output directory.

Could someone help me get this working?

Thanks

Nick

OS X 10.5.7
Mac Pro
2 x 3 GHz Dual-Core Intel Xeon
8 GB RAM
QUOTE Thanks
louishen

 
louishen's Avatar
 
Member Since: Oct 22, 2007
Location: London
Posts: 8,941
louishen has a brilliant futurelouishen has a brilliant futurelouishen has a brilliant futurelouishen has a brilliant futurelouishen has a brilliant futurelouishen has a brilliant futurelouishen has a brilliant futurelouishen has a brilliant futurelouishen has a brilliant futurelouishen has a brilliant futurelouishen has a brilliant future
Mac Specs: Mac Mini Core i7 2012 | White 2009 MacBook 2 Ghz | 733 Mhz G4 Quicksilver

louishen is offline
might be easier to use this, or at least look at these Apple Scripts
Doug's AppleScripts for iTunes ♫ Doug's Actions for iTunes Volume 1 v1.0

Member of the Month September 2008 & August 2012 | Found advice useful? – use the rep system
QUOTE Thanks
nick_harambee

 
Member Since: Feb 24, 2007
Posts: 100
nick_harambee is on a distinguished road

nick_harambee is offline
thanks, but i'd rather stick to AppleScript if possible as the conversion will be part of a larger script performing a few functions, and I'd also like to use ffmpeg for precise control of bitrate, etc. within the script

OS X 10.5.7
Mac Pro
2 x 3 GHz Dual-Core Intel Xeon
8 GB RAM
QUOTE Thanks

Post Reply New Thread Subscribe


« Filevault Issues | Removed Applications from Dock »
Thread Tools

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread
Thread Starter
Forum
Replies
Last Post
Artwork, iTunes and icons for audio files in Finder Theophil iOS and Apps 2 11-27-2008 09:55 AM

All times are GMT -4. The time now is 02:39 PM.

Powered by vBulletin
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
X

Welcome to Mac-Forums.com

Create your username to jump into the discussion!

New members like you have made this community the ultimate source for your Mac since 2003!


(4 digit year)

Already a member?