Ask Different is a question and answer site for power users of Apple hardware and software. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I often use ffmpeg off the command line to convert video files into mp4 on my Mac (running Mavericks). Do note, however, that I am NOT re-encoding my videos; am just changing the container from an avi or an mkv to an mp4. The exact command I run on Terminal is as follows:

/Users/Amit/Documents/Scripts/ffmpeg -i /input.mkv -c:v copy -c:a copy /output.mp4

As can be seen, this involves a lot of typing (for example, the entire path for ffmpeg and the source and target videos) and since I do a lot of such conversions, it would be great to have some Automator help here.

So, how can one go about creating a Finder Service that automates this activity? I would prefer a Finder Service instead of a standalone app or menu item.

share|improve this question
up vote 6 down vote accepted

Automator Service

You can use Automator to create a new service or droplet:

  1. Launch
  2. Create a new service with service receives files or folders in any application
  3. Add a Run Shell Script action
  4. Set Pass input: to as arguments
  5. Within the script, replace echo with the script below.
  6. Save your workflow as a service.

Shell Script

for f in "$@"
    /Users/Amit/Documents/Scripts/ffmpeg -i "$f" -c:v copy -c:a copy "${f%.*}.mp4"

Automator ffmpeg

To learn more about using Automator, see Apple's Mac Basics: Automator.

share|improve this answer
Thank you for your help. I did exactly as you suggest but it does nothing. I do have the service available on Finder as intended but when I select an mkv file and run the service, it does nothing. :( – TheLearner May 7 '14 at 14:46
Never mind, I figured it out. Just replaced "$fbname" with "${f%.*}.mp4" as suggested by Lauri Ranta. Damn, I wish I could accept both answers because both were equally helpful to my workaround! – TheLearner May 7 '14 at 15:22

You could also add a function like this to a shell configuration file like ~/.bash_profile:

mp4() {
  for f; do
    ffmpeg -i "$f" -c copy "${f%.*}.mp4"

Then you can just run mp4 input.mkv.

You can replace /Users/Amit/Documents/Scripts/ffmpeg with just ffmpeg if you move ffmpeg somewhere like /usr/bin or if you add PATH=~/Documents/Scripts:$PATH to ~/.bash_profile.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.