PDA

View Full Version : Apple Automator Application using Terminal




lldubbs
Apr 12, 2013, 07:55 PM
Hello,

I have a lot of family videos that I want to extract stills from. I use VLC to do this manually by using the following command in the terminal. But I get tired of typing in the command every time.

/Applications/VLC.app/Contents/MacOS/VLC /Users/mac/Downloads/1.mp4 --video-filter=scene --scene-prefix=movie --scene-ratio=48 --scene-path=/Users/mac/Desktop/images

I was wondering if there is a way to make an automator application so that I drop my video file on the automator application icon, then it reads the filename (ex "1.mp4") and puts in the terminal command above with the appropriate filename. For example, if I dropped a video named 32.mp4 on there, it would change the "1.mp4" in the line above to "34.mp4" and put that into terminal.

I've only done basic stuff with automator. Can someone show me the way, if this is possible.



Red Menace
Apr 12, 2013, 08:48 PM
You can use the Run Shell Script action, and set the option Pass input: as arguments. This will set up a script that loops through the items passed to the action - the default script just echoes the individual items, but you can put in your own script, for example:

for f in "$@"
do
/Applications/VLC.app/Contents/MacOS/VLC "$f" --video-filter=scene --scene-prefix=movie --scene-ratio=48 --scene-path=/Users/mac/Desktop/images
done

lldubbs
Apr 12, 2013, 11:40 PM
Good god, that was easy and painless. Worked beautifully! Thanks for your help! :)

ytk
Apr 15, 2013, 10:15 AM
FWIW, you can also make your script into a standalone application, bypassing Automator, using Platypus (http://sveinbjorn.org/platypus). You'd do it basically the same way, but I find Automator to be a bit slow and kludgy, and this way you can easily have the script output appear in a window if you like.