Skip to content

Instantly share code, notes, and snippets.

@QWxleA
Forked from krasCGQ/PreferredSettings.md
Created April 10, 2020 17:33
Show Gist options
  • Save QWxleA/1cf628ec6455933dedaac9e06b9b9c38 to your computer and use it in GitHub Desktop.
Save QWxleA/1cf628ec6455933dedaac9e06b9b9c38 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. This command below will silence all warnings, especially when dealing with Hi-Res audios: a.wav: WARNING: Legacy WAVE file has format type 1 but bits-per-sample=24

$ flac --totally-silent --delete-input-file --replay-gain -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.

Be noted that I only encode to MP3 just to play it on my legacy media player or when my friend requested me to do so.

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

Opus

I'll use 192kbps VBR (see here why), with maximum encoding complexity, default framesize (20), and no expected packet loss. The only consideration with the default framesize is that softer music will result in a slightly higher bit rate than what it should be with other encoders, which are mostly lower than targeted VBR (one of my soundtracks could reach up to 234kbps with my settings). If you prefer close-to-targeted VBR, --framesize 10 might worth trying.

Supported input formats: WAV, AIFF, FLAC, RAW PCM.

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

Notes:

  1. Android 6.0 doesn't recognize Opus audio with .opus container, use .ogg instead.
  2. Puddletag and some media players (e.g. Guayadeque) don't recognize Opus audio with .ogg container properly. Some of these players may fail to recognize metadata on these files.

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment