TWOLAME(1)

πŸ“¦
version 0.4.0 Β· 2 versions
  • 0.4.0 Β· arch rolling, centos-stream 10, debian bookworm, debian trixie, fedora 43, fedora 44, opensuse-leap 16.0, ubuntu jammy, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking (latest)
  • 0.3.13 Β· centos-stream 9
, in arch rolling, centos-stream 10, debian bookworm, debian trixie, fedora 43, fedora 44, opensuse-leap 16.0, ubuntu jammy, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking

🌸 NAME 🌸

okay bestie, welcome to the twolame(1) manual page β€” yes, section 1, we're in the big leagues πŸ’…

twolame is an optimised MPEG Audio Layer 2 (MP2) encoder. that's it, that's the gig. ✨


πŸŽ€ SYNOPSIS πŸŽ€

twolame [options] <infile> [outfile]

πŸ¦‹ DESCRIPTION πŸ¦‹

TwoLAME is an optimised MPEG Audio Layer 2 (MP2) encoder, and it's literally built on the shoulders of giants: it's based on tooLAME by Mike Cheng, which in turn is based upon the ISO dist10 code plus portions of LAME. no cap. the actual encoding heavy lifting is done by the libtwolame library backend. she's not doing it alone, she's got a whole library behind her. periodt. πŸ‘‘


✨ OPTIONS ✨

πŸ“ Input File

twolame uses libsndfile for reading the input sound file, so your input can be in any format that libsndfile supports. slay, flexible queen 🌈

if you wanna read raw PCM audio from STDIN, just use - as the input filename. iconic.

πŸ’œ Output File

if you don't specify an output filename, then the suffix of the input filename gets automatically changed to .mp2. automatic glow-up ✨

if you wanna write the encoded audio to STDOUT, use - as the output filename.

🌸 Input Options

  • -r, --raw-input β€” tells it your input is raw signed PCM audio. if the audio is stereo, than audio samples are interleaved between the two channels.
  • -x, --byte-swap β€” force byte-swapping of the input. endian detection is handled automatically by libsndfile, so this option shouldn't normally be needed. it's giving "break glass in case of emergency" 🚨
  • -s, --samplerate <int> β€” if you're inputting raw PCM sound, you must specify the sample rate of the audio in Hz. valid sample rates: 16000, 22050, 24000, 32000, 44100, 48000 Hz. default sample rate is 44100 Hz.
  • --samplesize <int> β€” specifies the sample size (in bits) of the raw PCM audio. valid sample sizes: 8, 16, 24, 32. default sample size is 16-bit.
  • -N, --channels <int> β€” if you're inputting raw PCM sound, you must specify the number of channels in the input audio. default number of channels is 2.
  • -g, --swap-channels β€” swap the Left and Right channels of a stereo input file. left girlies, right girlies, we're switching places πŸ’«
  • --scale <float> β€” scale the input audio prior to encoding. all of the input audio gets multiplied by the specified value. a value between 0 and 1 will reduce the audio gain, and a value above 1 will increase the gain of the audio.
  • --scale-l <float> β€” same as --scale, but only affects the left channel.
  • --scale-r <float> β€” same as --scale, but only affects the right channel.

πŸŽ€ Output Options

  • -m, --mode <char> β€” choose the mode of the resulting audio. default is auto.
    • "a" auto β€” choose mode automatically based on the input
    • "s" stereo
    • "d" dual channel
    • "j" joint stereo
    • "m" mono
  • -a, --downmix β€” if the input file is stereo then, downmix the left and right input channels into a single mono channel.
  • -b, --bitrate <int> β€” sets the total bitrate (in kbps) for the output file. the default bitrate depends on the number of input channels and samplerate:
    • 48000 Hz β€” Mono 96, Stereo 192
    • 44100 Hz β€” Mono 96, Stereo 192
    • 32000 Hz β€” Mono 80, Stereo 160
    • 24000 Hz β€” Mono 48, Stereo 96
    • 22050 Hz β€” Mono 48, Stereo 96
    • 16000 Hz β€” Mono 32, Stereo 64
  • -P, --psyc-mode <int> β€” choose the psycho-acoustic model to use (-1 to 4). model number -1 turns off psycho-acoustic modelling and uses fixed default values instead. please see the file psycho for a full description of each of the models available. default model is 3.
  • -v, --vbr β€” enable VBR mode. see the vbr documentation file for details. default VBR level is 5.0.
  • -V, --vbr-level <float> β€” enable VBR mode and set the quality level. the higher the number the better the quality. maximum range is -50 to 50 but the useful range is -10 to 10. see the vbr documentation file for details.
  • -l, --ath <float> β€” set the ATH level. default level is 0.0.
  • -q, --quick <int> β€” enable quick mode. only re-calculate the psycho-acoustic model every specified number of frames.
  • -S, --single-frame β€” enables single frame mode: only a single frame of MPEG audio is output and then the program terminates. one (1) frame and she's done, we love a short king 🫢

🧚 Miscellaneous Options

  • -c, --copyright β€” turn on the Copyright flag in the output bitstream.
  • -o, --non-original β€” turn off the Original flag in the output bitstream.
  • --original β€” turn on the Original flag in the output bitstream.
  • -p, --protect β€” enable CRC error protection in the output bitstream. an extra 16-bit checksum is added to frames.
  • -d, --padding β€” turn on padding in the output bitstream.
  • -R, --reserve <int> β€” reserve the specified number of bits "in the each from" of the output bitstream. (that's literally what the page says bestie, typo and all πŸ’€)
  • -e, --deemphasis <char> β€” set the de-emphasis type (n/c/5). default is none.
  • -E, --energy β€” turn on energy level extensions.

πŸ’… Verbosity Options

  • -t, --talkativity <int> β€” set the amount of information to be displayed on stderr (0 to 10). default is 2.
  • --quiet β€” don't send any messages to stderr, unless there is an error. (same as --talkativity=0)
  • --brief β€” only display a minimal number of messages while encoding. this setting is quieter than the default talkativity setting. (same as --talkativity=1)
  • --verbose β€” display an increased number of messages on stderr. this setting is useful to diagnose problems. (same as --talkativity=4)

πŸ”₯ RETURN CODES πŸ”₯

if encoding completes successfully, then twolame will return 0. she ate and left no crumbs. 😌

however, if encoding is not successful, then it will return one of the following codes:

  • 1 (No encoding performed)
  • 2 (Error opening input file)
  • 4 (Error opening output file)
  • 6 (Error allocating memory)
  • 8 (Error in chosen encoding parameters)
  • 10 (Error reading input audio)
  • 12 (Error occurred while encoding)
  • 14 (Error writing output audio)

🌈 EXAMPLES 🌈

this will encode sound.wav to sound.mp2 using the default constant bitrate of 192 kbps and using the default psycho-acoustic model (model 3):

twolame sound.wav

constant bitrate of 160 kbps and joint stereo encoding, saved to file sound_160.mp2:

twolame -b 160 -m j sound.aiff sound_160.mp2

encode sound.wav to newfile.mp2 using psycho-acoustic model 2 and encoding with variable bitrate:

twolame -P 2 -v sound.wav newfile.mp2

same as the example above, except that the negative value of the "-V" argument means that the lower bitrates will be favoured over the higher ones:

twolame -P 2 -V -5 sound.wav newfile.mp2

resample an audio file using sox and pipe straight through twolame:

sox sound_11025.aiff -t raw -r 16000 | twolame -r -s 16000 - - > out.mp2

the pipe?? the flow?? she's a whole pipeline icon πŸ¦‹


πŸ‘‘ AUTHORS πŸ‘‘

the twolame frontend was (re)written by Nicholas J Humfrey. the libtwolame library is based on toolame by Mike Cheng. for a full list of authors, please see the AUTHORS file. give them their flowers πŸ’


⭐ RESOURCES ⭐

TwoLAME web site: http://www.twolame.org/


πŸ’– SEE ALSO πŸ’–

lame(1), mpg123(1), madplay(1), sox(1)


πŸŽ€ COPYING πŸŽ€

Copyright Β© 2004-2018 The TwoLAME Project. free use of this software is granted under the terms of the GNU Lesser General Public License (LGPL).


πŸ’œ AUTHOR πŸ’œ

Nicholas J Humfrey <njh@aelius.com>

  • Author.

okay that's the whole page bestie, nothing skipped, nothing summarised, every single flag accounted for 🫢

and that's a wrap on TWOLAME(1), dated 10/11/2019 β€” go forth and encode, you absolute legend πŸŒŸπŸ’…βœ¨