Embedded Scripts

Get help. Get answers. Let others lend you a hand.

Moderator: Mr_Noodle

Embedded Scripts Mon May 11, 2009 10:43 pm • by kakkoiimac
I am trying to set up an embedded script to use ffmpeg to automatically process some videos. I am having trouble with the syntax with the way the embedded script works. I am a beginner with scripting so hopefully some one here can help me out. Here is the script I am typing in the embedded window:

(in the top box)
#!/bin/tcsh -f

(in the bottom box)
ffmpeg -i 1$ -vcodec mpeg4 -s 320x240 -b 300k -r 10 -acodec mp3 -ar 22050 -ab 64k -f avi 1$.avi


exit 0

I think that I am not sure how to use the 1$ thing properly. Here is what the log spits
out:

2009-05-11 16:41:52.344 (null)[0] dog.m4v: Rule Testing Rule matched.
2009-05-11 16:41:52.372 hazelfolderwatch[4218] Exception caught while executing shell script: launch path not accessible
2009-05-11 16:41:52.375 hazelfolderwatch[4218] [Error] Shell script failed: Error processing shell script on file /Test/dog.m4v.


Any help would be greatly appreciated.
kakkoiimac
 
Posts: 2
Joined: Mon May 11, 2009 10:13 pm

Re: Embedded Scripts Tue May 12, 2009 4:06 pm • by Mr_Noodle
I think the error is that you are putting in a comment in the shell field. Just enter the path to the shell plainly:

/bin/tcsh

Also, I'd avoid any arguments to the shell.

Lastly, I haven't really done much csh programming, but I think you are specifying the argument incorrectly. Even if using sh/bash, the argument is specified as $1 (not 1$). For csh/tcsh, I believe it should be $argv[1]. Though looking at your script, I'm not sure why you are using csh. I'd say just use sh and fix the 1$ to $1.

Let me know if any of the above helps.
Mr_Noodle
Site Admin
 
Posts: 11235
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Embedded Scripts Sun May 17, 2009 6:16 pm • by kakkoiimac
After messing around with the script I have gotten it to work properly. Thanks for the advice. Here is how it stands now and works great.

/bin/sh

/usr/local/bin/ffmpeg -i $1 -vcodec mpeg4 -s 320x240 -b 300k -r 10 -acodec mp3 -ar 22050 -ab 64k -f avi $1.avi

mv $1.avi /users/jordan/Movies/SD


exit 0

Thanks for the help. I am not sure why in hazel you have to use the full path name for the application and in just a regular script it finds it without, but it works nonetheless. Great product. I am recommending it to my brother who is starting a small business to keep all of his files organized nicely. I hope development continues for a long time!
kakkoiimac
 
Posts: 2
Joined: Mon May 11, 2009 10:13 pm

Re: Embedded Scripts Mon May 18, 2009 2:11 pm • by Mr_Noodle
Hazel executes in a different environment. Your script is probably running from your shell which sets up the PATH environment variable. Plus, it's good form to specify the full path in scripts for security (and debugging) reasons.
Mr_Noodle
Site Admin
 
Posts: 11235
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City


Return to Support

cron