mp4box AppleScript

I’ve located a version of mp4box compiled for PPC (OS X). I want to use it on my .m4a’s in the following way.

mp4box -raw 1 filename.m4a

Can someone make me an AppleScript that would search through a directory looking for .m4a files then apply the above to them?

I’d also need a script for this:

mp4box -add filename.aac filename.m4a

So can someone help out, I’m confused how to do it :Z

Hi,

I don’t use mp4box so I couldn’t test these:

set theFolder to quoted form of POSIX path of (choose folder)
do shell script "find " & theFolder & " -prune -name '*.m4a' -exec mp4box -raw 1 '{}' \\;"
set theFolder to (choose folder)
tell application "Finder" to set theFiles to files of theFolder whose name extension is "aac"
repeat with oneFile in theFiles
	set newName to quoted form of POSIX path of ((theFolder as Unicode text) & text 1 thru -5 of name of (info for (oneFile as alias)) & ".m4a")
	do shell script "mp4box -add " & quoted form of POSIX path of (oneFile as alias) & space & newName
end repeat

Someone came up with this for me :smiley: It’s a perl script for OS X

#!/usr/bin/perl 

use File::Find; 

$basedir = "<path-to-your-folder>"; 

find( sub { 
  next unless /(.*)\.aac$/; 
  $fn = $1; 
  $cmd = qq(<path-to-mp4box> -add "$fn.aac" "$fn.m4a"); 
  print "$cmd\n"; 
  system $cmd; 
}, $basedir );

and this can be run in Terminal

find <path-to-your-folder> -name '*.m4a' -exec <path-to-mp4box> -isma {} \;