Skip to content

Instantly share code, notes, and snippets.

@krasCGQ
Last active March 4, 2024 17:09
Show Gist options
  • Save krasCGQ/4377f912e124b99d5ea388258655da95 to your computer and use it in GitHub Desktop.
Save krasCGQ/4377f912e124b99d5ea388258655da95 to your computer and use it in GitHub Desktop.
My personal prefered settings for encoding media files, especially audio.

Disclaimer

If you decide to follow my settings, I'm not responsible for anything that happens if you decide to go careless and become a priceless dumb. All commands are done in Linux PC using corresponding CLI programs. In Windows, just add .exe after CLI program name.

Free Lossless Audio Codec (FLAC)

I prefer maximum compression as possible with replay gain applied.

$ flac --delete-input-file --replay-gain -s -V8 <input-file>.wav

MPEG Audio Layer 3 (MP3) - LAME

LAME is so far the best MP3 encoder out there. This is my encoding settings to achieve the best quality to play on my MP3 player. No ReplayGain flag is passed since it doesn't append the calculated value anyway. Use foobar2000 (run it in Wine) if you want to apply ReplayGain in MP3 files.

$ lame --silent --noreplaygain --flush --vbr-new -V0 -q0 -m j -p <input-file>.wav

Opus

In Opus I'll look at overhead, but in common I'll use --framesize 10 or --framesize 20 for several tracks that I'm going to play in my Android devices and not whole music collections. No, no, no, just let the default framesize. I'll use 192kbps VBR (see here why), with maximum encoding complexity and no expected packet loss.

$ opusenc --quiet --vbr --bitrate 192 --comp 10 --expect-loss 0 --framesize <input-file>.wav <output-file>.ogg

Notes:

  1. Android 6.0 doesn't recognize Opus audio with .opus container, use .ogg instead.
  2. Puddletag doesn't recognize Opus audio with .ogg container. Change file format to .opus and back to .ogg when you're done with metadata editing in Puddletag.

auCDtect (Windows)

Doesn't fall at encoding at all, but useful to verify WAVE files ripped from a CD. Use the slowest, most accurate settings of auCDtect. Also, print summary conclusions.

auCDtect.exe -m0 -d <input-file.wav>
@gnsfujiwara
Copy link

gnsfujiwara commented Jan 27, 2022

what do you think about AAC?

I'm currently using these settings and it produces pretty decent audio:

$ fdkaac --silent --profile 2 --bitrate-mode 5 --afterburner 1 <input-file>.wav -o <output-file>.m4a

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment