Apple Automator Application using Terminal

Discussion in 'Mac Programming' started by lldubbs, Apr 12, 2013.

  1. lldubbs macrumors newbie

    Apr 12, 2013

    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/ /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.
  2. Red Menace macrumors 6502

    Red Menace

    May 29, 2011
    Littleton, Colorado, USA
    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 "$@"
      /Applications/ "$f" --video-filter=scene --scene-prefix=movie --scene-ratio=48 --scene-path=/Users/mac/Desktop/images
  3. lldubbs thread starter macrumors newbie

    Apr 12, 2013
    Good god, that was easy and painless. Worked beautifully! Thanks for your help! :)
  4. ytk macrumors regular

    Jul 8, 2010
    FWIW, you can also make your script into a standalone application, bypassing Automator, using 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.

Share This Page