afconvert and avconv performance

Software

My Rubenerd Show podcast episodes are produced with a series of shell scripts to save me time and effort, so I’m always looking for ways to optimise them.

Today I learned about Apple’s afconvert utility. The manpage may as well have been written by GNU given its lack of useful info, but “-h” tells you all you need to know.

Currently I use avconv (previously ffmpeg) to convert CAFs from my iTelephone to an intermediate format. This is then rendered as FLAC for archival purposes, and MP3 for the podcast feed:

$ avconv -i "source.caf" "output.aiff"

Through some digging, the afconvert equivilent is:

$ afconvert -f caff -d BEI16 "source.caf" "output.aiff"

But how do they stack up? I ran these three times on the same 201.1MiB source file using afconvert in macOS Sierra, and the latest avconv from Homebrew:

Pass afconvert avconv
1 0.416s 1.189s
2 0.577s 1.339s
3 0.416s 1.302s

The results from this (albeit limited) test are clear, afconvert is faster. Whether I’d notice a second or two difference is another question, but I’ll be adjusting the scripts to preference afconvert when available.

Author bio and support

Me!

Ruben Schade is a technical writer and infrastructure architect in Sydney, Australia who refers to himself in the third person. Hi!

The site is powered by Hugo, FreeBSD, and OpenZFS on OrionVM, everyone’s favourite bespoke cloud infrastructure provider.

If you found this post helpful or entertaining, you can shout me a coffee or send a comment. Thanks ☺️.