TWOLAME(1)
πΈ 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,48000Hz. default sample rate is44100Hz.--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 is2.-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 between0and1will reduce the audio gain, and a value above1will 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:48000Hz β Mono96, Stereo19244100Hz β Mono96, Stereo19232000Hz β Mono80, Stereo16024000Hz β Mono48, Stereo9622050Hz β Mono48, Stereo9616000Hz β Mono32, Stereo64
-P,--psyc-mode <int>β choose the psycho-acoustic model to use (-1to4). model number-1turns off psycho-acoustic modelling and uses fixed default values instead. please see the filepsychofor a full description of each of the models available. default model is3.-v,--vbrβ enable VBR mode. see thevbrdocumentation file for details. default VBR level is5.0.-V,--vbr-level <float>β enable VBR mode and set the quality level. the higher the number the better the quality. maximum range is-50to50but the useful range is-10to10. see thevbrdocumentation file for details.-l,--ath <float>β set the ATH level. default level is0.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 (0to10). default is2.--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 ππ
β¨
π¦ where this page comes from
- arch rolling: twolame 0.4.0-4 Β· LGPL2.1
- centos-stream 10: twolame 0.4.0-6.el10 Β· LGPL-2.1-or-later
- debian bookworm: twolame 0.4.0-2 Β· LGPL-2.0-or-later
- debian trixie: twolame 0.4.0-2+b2 Β· LGPL-2.0-or-later
- fedora 43: twolame 0.4.0-8.fc43 Β· LGPL-2.1-or-later
- fedora 44: twolame 0.4.0-9.fc44 Β· LGPL-2.1-or-later
- opensuse-leap 16.0: twolame 0.4.0-160000.2.2 Β· LGPL-2.1-only
- opensuse-leap 16.0: twolame 0.4.0-160000.2.2 Β· LGPL-2.1-only
- opensuse-leap 16.0: twolame 0.4.0-160000.2.2 Β· LGPL-2.1-only
- opensuse-leap 16.0: twolame 0.4.0-160000.2.2 Β· LGPL-2.1-only
- ubuntu jammy: twolame 0.4.0-2build2 Β· LGPL-2.0-or-later
- ubuntu noble: twolame 0.4.0-2build3 Β· LGPL-2.0-or-later
- ubuntu questing: twolame 0.4.0-2build3
- ubuntu resolute: twolame 0.4.0-2build4 Β· LGPL-2.0-or-later
- ubuntu stonking: twolame 0.4.0-3 Β· LGPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms