As far as I'm concerned, there's no easy way to tell FFmpeg to set the album artwork for an MP4 container, which you'd typically use for AAC audio (.m4a
). You can however use AtomicParsley to add the artwork later, via command line.
Here's how you can install AtomicParsley:
- All operating systems have binaries from the SourceForge page
- Linux distributions might have it in the packages, i.e.
apt-get install atomicparsley
- OS X through Homebrew with
brew install atomicparsley
But first, we'll need to extract the artwork, e.g. as a JPEG file:
ffmpeg -i input.mp3 artwork.jpg
We can then use AtomicParsley to add the album artwork:
AtomicParsley output.m4a --artwork artwork.jpg
This will not overwrite the original file but create a temporary file instead, e.g. output-temp-15274.m4a
. If you want the original to be overwritten, add the --overWrite
option to the command, e.g.:
AtomicParsley output.m4a --artwork artwork.jpg --overWrite
And voilà:
When you talk about "efficiency", you probably mean the subjective audio quality one codec offers at a given bit rate, i.e. how humans perceive the quality of a sound under certain conditions.
What are the most commonly used and most efficient audio codecs?
Now, there are far too many codecs to be able to compare those. Today, the most relevant and most efficient are:
- AAC
- Opus (which is specifically targeted at low bitrates)
And, while a little older, still relevant, but not as efficient:
Which one is the best?
In general, you can say that the AAC family of codecs is much more efficient than MP3. It is probably the codec of choice for most of today's multimedia applications. Opus again is the best choice for almost any application – particularly voice over IP –, but it is not as widely supported on standalone multimedia devices.
For a quality comparison of different codecs, have a look at this figure from the Opus website:
The higher the curve, the better the quality–bitrate tradeoff. You can see how Opus outperforms the other codecs, but AAC is close behind in higher bitrate ranges (which would be typical for complex sound such as music). Notice how bad MP3 is in comparison to most of these codecs?
So, in summary, I would recommend to stick to AAC for multimedia applications.
What versions of AAC are there?
There are various versions of AAC, depending on what features are used. Those are called "profiles". Particularly well known are AAC-LC (low complexity) and HE-AAC (high efficiency). The European Broadcasting Union (EBU) has published a detailed technical review of HE-AAC v2 in 2006, which gives more details about the implementation, its differences from "normal" AAC-LC and compares it to other codecs.
Also, MP3 is quite easily outperformed by AAC and Vorbis in low-bitrate scenarios.
More details on codecs please?
Often, a codec specification only tells you how to decode (i.e. how to structure and parse the bitstream). This means there are no limits on how to write an encoder. Because of that, you can experience drastic differences in the subjective quality between two different MP3 encoders, for example. The same goes for AAC and Vorbis as well.
Since encoders are not standardized, there's quite a bit of competition on the market, and in some cases, "market leaders" have emerged, such as LAME in the section of free MP3 encoders, or FAAC for free AAC encoders (although fdk-aac is supposed to be better). Of course, commercial encoders such as the Fraunhofer MP3 encoder or the Nero AAC encoder exist as well.
It ultimately comes down to personal preference. Naturally, you can't objectively evaluate how "good" an encoder is. You need to get a number of people and have them listen to sound examples. This is called a codec listening test. There are multiple variants of tests, depending on what exactly you want to find out, e.g.:
- Is codec A better than B? (For example, if AAC is better than MP3 at low bitrates)
- Which codec is the best? (For example, all kinds of codecs are sorted by preference)
The possible combinations are near endless, and of course these tests are carried out with specific encoders (e.g. FAAC) rather than just testing "AAC" as a codec. As those tests take time and careful preparation, and the results cannot be summarized in one sentence, I suggest you take a look at Wikipedia's result section, where quite a number of test results have been publicized.
Depending on your application, you will find the "most efficient" format under the winners there. For example, here's a listening test taken from the EBU tech report I linked to above, which shows how AAC generally outperforms MP3 and Windows Media Audio at 48 kBit/s (low bitrate):
Another report from the EBU is available, which gives you even more details about the actual test, including the codecs and test settings involved.
Best Answer
Use Variable Bit Rate (VBR)
You can use the
-q:a
option inffmpeg
to create a variable bitrate (VBR) MP3 output:What
-q:a
values to useFrom FFmpeg Wiki: MP3:
You'll have to experiment to see what value is acceptable for you. Also see Hydrogen Audio: Recommended LAME Encoder Settings.
Encoding multiple files
In Linux and macOS you can use a Bash "for loop" to encode all files in a directory: