Automating ffmpeg using Automator Service 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.
Automator Service

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


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


Shell Script

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




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