CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Need a Custom or Prewritten Perl Program?: I need a program that...:
Runs mp4box with command lines

 



sderenzi
New User

Sep 25, 2007, 12:54 AM

Post #1 of 3 (2067 views)
Runs mp4box with command lines Can't Post

It's simple, I want to run mp4box on OS X, I've found a precompiled version for the PPC and I asked a fellow if he could make me a perl script that would run the following on any .aac files inside a folder.

mp4box -add filename.aac filename.m4a

It's very easy to do manually but there's like 300 files in the folder, could someone help fix this script cuz I can't figure out why it doesn't work, here's what it looks like:


Code
#!/usr/bin/perl 

use File::Find;

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

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


Now the error I get is:


Quote
syntax error at line 12, near "system" Execution of run.pl aborted due to compilation errors


So what am I missing? Basically it's searching for any files that are in the directory which are .aac, then it goes on to place them in the full command mp4box -add filename.aac filename.m4a

Can someone fix this?


(This post was edited by sderenzi on Sep 25, 2007, 12:57 AM)


KevinR
Veteran


Sep 25, 2007, 1:13 AM

Post #2 of 3 (2060 views)
Re: [sderenzi] Runs mp4box with command lines [In reply to] Can't Post

thisline is missing the ending semi-colon:

print "$cmd\n"

needs to be:

print "$cmd\n";

see if that helps
-------------------------------------------------


sderenzi
New User

Sep 25, 2007, 1:30 PM

Post #3 of 3 (2055 views)
Re: [KevinR] Runs mp4box with command lines [In reply to] Can't Post

You are right! Thanks man, I was totally confused lmao Here's the final perl I used:


Code
  #!/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 I got this to run in Terminal


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



(This post was edited by sderenzi on Sep 25, 2007, 1:32 PM)

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives