Moving on to better file formats

Good riddance to .jpg

A while ago, I reorganized my music library. Before the cleanup, I had a scattered mess of FLAC and MP3 files. Metadata was mostly missing or poorly tagged at best, some cover art was missing, and I’m pretty sure my lossy files might have just been Youtube rips (yikes).

Being pretty picky with any collection I have, I decided to overhaul things. My strategy from now on is to only download and archive FLAC, then transcode if I want to copy songs to devices with less storage. This lets me keep the lossless copy and have transparent compressed versions when storage is constrained.

I’ve also said goodbye to MP3. Opus is my new goto lossy codec. And it should be for you too.

What’s Opus?

In short, Opus is a much newer and more advanced audio file format than MP3. It’s notably used by video and music streaming services and lots of VoIP communications. Opus is much more efficient than MP3; so you can choose between equal quality and reduced file size, or same file size with higher quality.

MP3 is over 30 years old. The design scope of MP3 had to account for computers that were orders of magnitude slower and storage devices that had capacities up to a few megabytes. MP3 was revolutionary when it came out. A CD that stored 10-ish songs per disc was surpassed by a pocket-sized device that could store hundreds of songs. But while MP3 was great for its time, technology has improved a lot since.

Audio quality in a file format is determined mostly by bitrate. A higher bitrate captures more data from the analoge source, so it sounds better but the file size is bigger. At 320 kbps (kilobits per second), I think MP3 is virtually transparent (indistinguishable from lossless). A 3-4 minute song in 320 kbps MP3 is about 10 MB big. That’s good enough in a world where phones have at least 128 GB (and most people stream anyways). Still, smaller file sizes are always better. You can lower the bitrate and use 128 kbps MP3s, but the lower audio quality is noticeable even on cheap headphones.

Opus on the other hand is transparent down to at least 128 kbps, based on my experience. This means that an MP3 and Opus encoding of a song can sound exactly the same, but the Opus file is about 3 times smaller. I was able to shrink my music on my phone from 6 GB to about 2.5 GB. Opus is especially good at low bitrates. If you listen to any MP3 below 100 kbps, it sounds like garbage. I’ve heard that Opus maintains good quality down to about 50 kbps.

So Opus is way more efficient than MP3. It also is used widely so there are no compatibility problems. Plus there are other advantages like low latency, which is useful for RTC. There’s no downside to using Opus, unless you need to play audio on a 20 year old machine.

Replace your images as well

And if you’re going to use Opus for audio, it’s probably time to stop using JPEG and PNG for images. Although, this one is a bit harder to commit to.

The Opus analog for images is split into three file formats:

  1. WebP
  2. AVIF (my default for this website)
  3. JPEG XL

Out of these, WebP is the most common. It’s used commonly on websites. You might have encountered WebP images when trying to download an image, then finding out that your image viewer can’t open it. WebP gets some hate because of this; people expect a PNG or JPEG but get something they can’t view. Blame the program developers for not supporting WebP.

AVIF and JPEG XL are newer and less supported, especially JPEG XL. AVIF (my preferred format for now) is an image file format based on the AV1 video codec, which is a new codec made to replace H.264 (aka MP4 for most people). JPEG XL is a direct successor to JPEG, which is also about 30 years old.

Why replace images?

There are good reasons to use newer file formats for images.

First and foremost, you can save so much space by using newer image formats. Some people in my family have newer phones that have 3 camera lenses on the back. Each uncompressed JPEG they share uses around 7-8 MB. That’s actually crazy. One image from them uses 2x the space versus my Opus songs that play for 3 minutes. By using AVIF or WebP, you can easily compress image sizes by 50% while preserving 98% of the quality.

It actually bothers me so much that phone cameras are approaching fly eye-like appearances, and yet they still use JPEG for everything. This can probably lead to a conspiracy theory of companies intentionally using phone storage to push users to cloud subscriptions. Using newer image formats could easily save 50% or more space.

The second reason to use newer image formats is feature support. For example, JPEG doesn’t support transparency. Both JPEG and PNG don’t support animations (I’m not counting APNG here). Newer formats do these natively, and JPEG and PNG will increasingly become stagnant as time goes on.

The only problem with these image formats is that software support is oddly lacking. Web browsers support just about everything, but it’s surprisingly hard to find software that supports AVIF. WebP is more widely available at least. JPEG XL is basically in alpha so don’t expect to find much support for that yet.

I actually like WebP now

I also used to not like WebP. Whenever a file I tried to download was a WebP, I would get frustrated and say “why can’t it just be a PNG”? But because running a website makes you care about efficient file formats, I kind of like them. I just wish these newer file formats were better supported everywhere.

Newer formats are just technologically superior to old ones, and it’s a good idea to start using them when possible. Once my wallpaper setting program supports AVIF, I’ll convert all of my wallpapers to that.