MACRO: Convert selected videos in Finder into QuickTime-compatible mp4 format

My Mac has tons of video clips, accumulated over literally decades. Many are from cameras that didn't support QuickTime formats at the time the camera existed. Or are in the old .wmv Windows format. Or .avi, .mkv, or who knows what else.

There are myriad ways to convert these videos using tools like Handbrake, and I've done some of that in the past. But using such an app requires that I find the videos, then decide to do something about their old formats, then figure out what settings to use in the app, etc. By the time I've done all that, I'm usually ready to just move on to some other project.

But it annoys me having these videos playing in something other than QuickTime, so I wrote (what started as) a simple macro to just convert whatever I'd selected in Finder into mp4 format. It wound up not quite so simple, but it works really well:

An animated GIF hides within

video_converter

The macro

4 - Convert videos to mp4 format.kmmacros (47 KB)

Screenshot of the main converter macro

How it works

I select any number of video files in Finder, then press either Shift-Ctrl-V or Shift-Ctrll-Opt-V. If I use the Option key version, the result is what you see in the video above: A pop-up menu lets me choose the conversion method from one of three available. But if I leave it out, the macro runs with whatever converter I pre-set in the macro's settings.

The macro uses the Unix package ffmpeg to convert videos, so you must have that installed. In addition, if you have Lisa Melton's other-transcode Ruby Gem installed, the macro can use that to do a better job with the conversions. The macro's documentation provides at least basic guidance on installing these packages, but if you're not comfortable in Terminal, this is probably not the macro for you :).

Using the macro

Please start by reading 1 - Documentation, which covers exactly what you need to do to get going—it's not quite as simple as "install macro, run macro."

Because of the tools this macro uses, there's a required preflight macro, fittingly named "2 - Preflight" that you have to run (just one time) before using the macro. This preflight macro checks that you have ffmpeg installed, and brings in your user's Unix path, which is needed by other-transcoding to do its job (as it checks for some apps to verify it can run, and it can't find those on the default path).

After running "2 - Preflight," take a look at the settings in "3 - Prefs," which control how the macro behaves. By default, you will see notifications from the macro, and it will stick a color label on the old files (green = converted, yellow = failed to convert). Optionally, the macro will rename the old files with a prefix of your choosing, to make them sort together in the folder. Here's how that looks after converting a few files (also with the Finder labels enabled):

Finally, prefs is where you set your preferred converter from the three available. The default is Basic, which is just a very simple set of ffmpeg settings that should work, but may not be optimal for every video. The second is Melton, which you can use only if you've installed the other-transcoding package linked above. The first is Fast, which I don't recommend unless you know it will work: This doesn't actually convert anything, it just changes the wrapper to mp4. This can work for some videos, depending on how they were encoded, but it won't work for most.

Caveats

I've tried to catch all the conditions that might come up, but as I originally wrote this as a quick and dirty solution for my own needs, I'm not sure I've caught everything. I also don't have every video format known to exist, so I don't know if there are files this macro won't be able to convert.

The macro—especially if you disable file renaming and file labeling—never modifies or deletes the original files, so it's non-destructive to use. If you have any troubles with it, please let me know.

-rob.

1 Like