I'm using Automator to run a shell script (ffmpeg transcode to h264) as a 'Service', so that I can just right click the high res .mov file and select the service. It works fine, but as it's ffmpeg it would be good to see the output in a Terminal window. Is there a way to see the output in real time?

Shouldn't make a difference, but here's the script just in case:

for f in "$@"
/usr/local/bin/ffmpeg -i "$f" -c:v libx264 -vf yadif -pix_fmt yuv420p -crf 21 -preset slow -movflags faststart -c:a copy ${f%.*}_h264_yadif.mov

This AppleScript will launch a Terminal window with the command you specified:

on run {input, parameters}
    tell application "Terminal"
        set filesString to ""
        repeat with file_ in input
            set filesString to filesString & " " & quoted form of (POSIX path of file_)
        end repeat
        do script "for f in" & filesString & "; do
/usr/local/bin/ffmpeg -i \"$f\" -c:v libx264 -vf yadif -pix_fmt yuv420p -crf 21 -preset slow -movflags faststart -c:a copy ${f%.*}_h264_yadif.mov
    end tell
    return input
end run

Create a “Run AppleScript” action in Automator and paste it in there.

| improve this answer | |
  • Works a like charm - thanks so much. I knew it would probably involve an AppleScript but was unsure of the voodoo to get the file path over to the shell script. – user1148106 Aug 29 '14 at 11:13

Nice and clean solution is to display message via Notification Center. Just execute the following terminal command in your script.

osascript -e 'display notification "All files converted" with title "ffmpeg converter"'

'osascript' command runs any AppleScript from terminal, 'display notification' pops up nice notification.

enter image description here

Also you can use 'display alert'. It has no limitation of message length and it's easy to add OK button to it.

osascript -e 'set alertResult to display alert "Bad news :( Error converting your video file." buttons {"OK"} as warning'

enter image description here

Here is Apple Script commands reference. Look for 'display notification' and 'display alert' for more information.

| improve this answer | |
  • Thanks - that's helpful for general things, but I'd really like to view ffmpeg's entire output. I also have a similar service that syncs a directory to my S3 backup via s3cmd. In both cases, the full output is sort of essential for handling errors properly... – user1148106 Aug 28 '14 at 12:28

Here's a simple solution that I got working, which shows the command output once it's finished:

  1. Pass the output of a Run Shell Script action to Set Value of Variable
  2. Use that variable to, for example, display a notification.

For example, with the test.py Python script, all I'm doing is printing the arguments passed (“Running a script with …”), so when I run it, after finishing, it shows:

| improve this answer | |

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .