home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 6 / AACD06.ISO / AACD / Sound / LAME / USAGE < prev    next >
Text File  |  1999-11-28  |  18KB  |  553 lines

  1.  
  2. % lame [options] inputfile [outputfile]
  3.  
  4. =======================================================================
  5. Examples:
  6. =======================================================================
  7. fixed bit rate jstereo 128kbs encoding:
  8. % lame sample.wav  sample.mp3      
  9.  
  10. fixed bit rate jstereo 128kbs encoding, highest quality:  (recommended)
  11. % lame -h sample.wav  sample.mp3      
  12.  
  13. To disable joint stereo encoding (slightly faster, but less quality at bitrates<=128kbs)
  14. % lame -m s sample.wav  sample.mp3     
  15.  
  16. Fast encode, low quality  (no psycho-acoustics)
  17. % lame -f sample.wav  sample.mp3     
  18.  
  19. Variable Bitrate (VBR): (use -V n to adjust quality/filesize)
  20. % lame -h -v sample.wav sample.mp3
  21.  
  22. Note: VBR is currently under heavy development.  Right now it can
  23. often result in too much compression.  I would recommend using VBR
  24. with a minimum bitrate of 112kbs.  This will let LAME increase
  25. the bitrate for difficult-to-encode frames, but prevent LAME from
  26. being too aggressive for simple frames:
  27.  
  28. % lame -h -v -b 112  sample.wav sample.mp3
  29.  
  30.  
  31. =======================================================================
  32. LOW BITRATES
  33. =======================================================================
  34. At lower bitrates, (like 24kbs per channel), it is recommended that
  35. you use a 16kHz sampling rate.  Some commercial encoders (FhG, Xing)
  36. will do this automatically.  With LAME, you can use Sox, but you have
  37. to be careful to get good results.
  38.  
  39. The following information is from John Hayward-Warburton
  40. (john@billabong-media.com, http://billabong-media.com)
  41.  
  42. There seem to be two very important points:
  43.  
  44. 1)  make sure you have the very latest sox: the `resample' routine
  45.     was broken in all previous versions before 12.16, and was really 
  46.     quite awful. (latest version: http://home.sprynet.com/~cbagwell/sox.html)
  47.  
  48. 2)  use the resample options.  The defaults are not good for encoding
  49.     music or speech.  
  50.  
  51. Here are some options which work well, but more experimentation is
  52. needed.  When available, I'll update this with recommended settings
  53. for speech and music.
  54.  
  55.  
  56. % sox input.wav  -c 1 -r 16000 output.wav  resample 0.66
  57.  
  58. % sox INFILE.wav -c 1 -r 22050 OUTFILE.wav polyphase -cutoff 0.45
  59.  
  60.  
  61.  
  62.  
  63.  
  64. =======================================================================
  65. STREAMING EXAMPLES
  66. =======================================================================
  67. Streaming mono 22.05kHz raw pcm, 24kbs output:
  68. % cat inputfile | lame -r -m m -b 24 -s 22.05 - - > output
  69.  
  70. Streaming mono 22.05kHz raw pcm, with downsampling to 16kHz:
  71. % cat inputfile | sox -t raw -x -w -s -c 1 -r 22050 -  -t raw -x -w -s -c 1 -r 16000 - resample 0.66 | lame -r -m m -b 24 -s 16 - - > output
  72.  
  73. You may or may not need one or both of the "-x" (swap bytes) option in Sox.  
  74.  
  75.  
  76.  
  77.  
  78. =======================================================================
  79.  
  80. For more options, just type:
  81. % lame
  82.  
  83. Scripts are included to run lame on multiple files:
  84.  
  85. bach script:  mlame     Run "mlame -h" for instructions.
  86. sh script:    auenc     Run auenc for instructions
  87.  
  88.  
  89.  
  90. =======================================================================
  91. options guide:
  92. =======================================================================
  93. These options are explained in detail below.
  94.  
  95.  
  96. Quality related:
  97.  
  98. -m m/s/j/f     mode selection
  99. -f             disable psycho-acoustics.  Encoding much faster but lower quality
  100. -k             disable scalefactor band 21 cutoff
  101. -d             allow block types to differ between channels
  102. -h             higher quality but slower
  103. -b  n          set bitrate (8,16,24,...,320)
  104. --athonly      ignore psy-model output, only use masking from the ATH
  105. --voice        experimental voice encoding mode
  106. --noshort      disable short blocks
  107.  
  108. Variable Bit Rate (VBR)
  109. -v             VBR
  110. -V n           VBR quality setting  (0=highest quality, 9=lowest)
  111. -b  n          specify a minimum allowed bitrate (8,16,24,...,320)
  112. -B  n          specify a maximum allowed bitrate (8,16,24,...,320)
  113. -t             disable Xing VBR informational tag 
  114. --nohist       disable display of VBR bitrate histogram
  115.  
  116.  
  117. Experimental (undocumented):  may work better or worse:
  118.  
  119. -X n           try different quality measures (when comparing quantizations)
  120. -Y             try to use scalefac_select 
  121. -Z             try to use subblock_gain
  122.  
  123.  
  124. Operational:
  125.  
  126. -r             assume input file is raw PCM
  127. -s  n          input sampling frequency in kHz (for raw PCM input files)
  128. --resample n   output sampling frequency
  129. --mp3input     input file is an MP3 file.  decode using mpglib/mpg123
  130. -x             swap bytes of input file
  131. -a             downmix stereo input file to mono .mp3
  132. -e  n/5/c      de-emphasis
  133. -p             add CRC error protection
  134. -c             mark the encoded file as copyrighted
  135. -o             mark the encoded file as a copy
  136. -S             don't print progress report, VBR histogram
  137. -g             run MP3x, the graphical frame analyzer
  138.  
  139.  
  140. id3 tagging:
  141.  
  142. --tt "title"     title of song (max 30 chars)
  143. --ta "artist"    artist who did the song (max 30 chars)
  144. --tl "album"     album where it came from (max 30 chars)
  145. --ty "year"      year in which the song/album was made (max 4 chars)
  146. --tc "comment"   additional info (max 30 chars)
  147. --tg "genre"     genre of song (name or number)
  148.  
  149.  
  150.  
  151.  
  152.  
  153.  
  154. =======================================================================
  155. Detailed description of all options in alphabetical order
  156. =======================================================================
  157.  
  158.  
  159. =======================================================================
  160. downmix
  161. =======================================================================
  162. -a  
  163.  
  164. mix the stereo input file to mono and encode as mono.  
  165.  
  166. This option is only needed in the case of raw PCM stereo input 
  167. (because LAME cannot determine the number of channels in the input file).
  168. To encode a stereo PCM input file as mono, use "lame -m s -a"
  169.  
  170. For WAV and AIFF input files, using "-m m" will always produce a
  171. mono .mp3 file from both mono and stereo input.
  172.  
  173. =======================================================================
  174. ATH only
  175. =======================================================================
  176. --athonly
  177.  
  178. This option causes LAME to ignore the output of the psy-model and
  179. only use masking from the ATH.  Might be useful at very high bitrates
  180. or for testing the ATH.  
  181.  
  182.  
  183.  
  184.  
  185. =======================================================================
  186. bitrate
  187. =======================================================================
  188. -b  n
  189.  
  190. For MPEG1 (sampling frequencies of 32, 44.1 and 48kHz)
  191. n =   32,40,48,56,64,80,96,112,128,160,192,224,256,320
  192.  
  193. For MPEG2 (sampling frequencies of 16, 22.05 and 24kHz)
  194. n = 8,16,24,32,40,48,56,64,80,96,112,128,144,160
  195.  
  196.  
  197. The bitrate to be used.  Default is 128kbs MPEG1, 80kbs MPEG2.
  198.  
  199. When used with variable bitrate encodings (VBR), -b specifies the
  200. minimum bitrate to use.  This is useful to prevent LAME VBR from
  201. using some very aggressive compression which can cause some distortion
  202. due to small flaws in the psycho-acoustic model.
  203.  
  204. =======================================================================
  205. max bitrate
  206. =======================================================================
  207. -B  n
  208.  
  209. For MPEG1 (sampling frequencies of 32, 44.1 and 48kHz)
  210. n =   32,40,48,56,64,80,96,112,128,160,192,224,256,320
  211.  
  212. For MPEG2 (sampling frequencies of 16, 22.05 and 24kHz)
  213. n = 8,16,24,32,40,48,56,64,80,96,112,128,144,160
  214.  
  215. Maximum allowed bitrate when using VBR.
  216.  
  217.  
  218. =======================================================================
  219. copyright
  220. =======================================================================
  221. -c   
  222.  
  223. mark the encoded file as copyrighted
  224.  
  225.  
  226.  
  227. =======================================================================
  228. block type control
  229. =======================================================================
  230. -d 
  231.  
  232. Allows the left and right channels to use different block types.
  233. Normally this is not allowed, only because the FhG encoder does
  234. not seem to allow it either.  If anyone finds a sample where -d
  235. produces better results, let me know.  (mt@sulaco.org)
  236.  
  237.  
  238.  
  239. =======================================================================
  240. de-emphasis
  241. =======================================================================
  242. -e  n/5/c   
  243.  
  244.   n = (none, default)
  245.   5 = 0/15 microseconds
  246.   c = citt j.17
  247.  
  248. All this does is set a flag in the bitstream.  If you have a PCM
  249. input file where one of the above types of (obsolete) emphasis has
  250. been applied, you can set this flag in LAME.  Then the mp3 decoder
  251. should de-emphasize the output during playback, although most 
  252. decoders ignore this flag.
  253.  
  254. A better solution would be to apply the de-emphasis with a standalone
  255. utility before encoding.
  256.  
  257.  
  258.  
  259. =======================================================================
  260. fast mode
  261. =======================================================================
  262. -f   
  263.  
  264. disable psycho-acoustics.  Encoding much faster but lower quality
  265.  
  266.  
  267.  
  268. =======================================================================
  269. graphical frame analyzer
  270. =======================================================================
  271. -g
  272.  
  273. run MP3x, the graphical frame analyzer analysis on the inputfile.  The
  274. inputfile can be either an .mp3 file or uncompressed audio file.  MP3x
  275. support must be compiled into LAME, and requires GTK 1.2.
  276. Documentation is under the About pull down menu.
  277.  
  278.  
  279.  
  280. =======================================================================
  281. high quality
  282. =======================================================================
  283. -h
  284.  
  285. use (maybe) some quality improvements
  286.  
  287. LAME 3.21 and up:  -h enables specialized mid/side masking thresholds to
  288. be used in jstereo mode.  Will sound better in jstereo mode
  289. but is 20% slower.  No effect for mono files.
  290.  
  291. LAME 3.58beta and up: -h also enables a more accurate but slightly
  292. slower quantization formula.  
  293.  
  294.  
  295.  
  296.  
  297. =======================================================================
  298. sfb=21 cutoff
  299. =======================================================================
  300. -k   
  301.  
  302. At 128kbs and less, LAME will remove data in scalefactor band 21.
  303. This amounts to a low pass 16kHz filter.  -k will disable this
  304. feature.  However, these coefficients can take up a lot of bits that
  305. would be better used for lower, more important frequencies.
  306. Furthermore, the MPEG standard does not allow scalefactors or
  307. use psycho-acoustic information for this band.
  308.  
  309.  
  310.  
  311. =======================================================================
  312. Modes:
  313. =======================================================================
  314.  
  315. -m m           mono.  
  316. -m s           stereo
  317. -m j           jstereo
  318. -m f           forced mid/side stereo
  319.  
  320. mono is the default mode for mono input files.  If "-m m" is specified
  321. for a stereo input file, the two channels will be averaged into a mono
  322. signal.  
  323.  
  324. jstereo is the default mode for stereo files with VBR or fixed bitrates
  325. of 160kbs or less.  At higher fixed bitrates, the default is stereo.  
  326.  
  327. jstereo means the encoder can use (on a frame by frame bases) either
  328. regular stereo (just encode left and right channels independently)
  329. or mid/side stereo.  In mid/side stereo, the mid (L+R) and side (L-R)
  330. channels are encoded, and more bits are allocated to the mid channel
  331. than the side channel.  This will effectively increase the bandwidth
  332. if the signal does not have too much stereo separation.  
  333.  
  334. Mid/side stereo is basically a trick to increase bandwidth.  At 128kbs,
  335. it is clearly worth while.  At higher bitrates it is less usefull.  
  336.  
  337. Using mid/side stereo inappropriately can result in audible
  338. compression artifacts.  To much switching between mid/side and regular
  339. stereo can also sound bad.  To determine when to switch to mid/side
  340. stereo, LAME uses a much more sophisticated algorithm than that
  341. described in the ISO documentation.
  342.  
  343. -m f forces all frames to be encoded mid/side stereo.  It 
  344. should only be used if you are sure every frame of the input file
  345. has very little stereo seperation.  
  346.  
  347.  
  348.  
  349. =======================================================================
  350. MP3 input file
  351. =======================================================================
  352. --mp3input
  353.  
  354. Assume the input file is a MP3 file.  Usefull for downsampling 
  355. from one mp3 to another.  If the filename ends in ".mp3" LAME will
  356. assume it is an MP3.  For stdin or MP3 files which dont end in .mp3
  357. you need to use this switch.  
  358.  
  359.  
  360. =======================================================================
  361. disable historgram display
  362. =======================================================================
  363. --nohist
  364.  
  365. By default, LAME will display a bitrate histogram while producing
  366. VBR mp3 files.  This will disable that feature.
  367.  
  368.  
  369. =======================================================================
  370. disable short blocks
  371. =======================================================================
  372. --noshort
  373.  
  374. Encode all frames using long blocks.
  375.  
  376.  
  377.  
  378. =======================================================================
  379. non-original
  380. =======================================================================
  381. -o   
  382.  
  383. mark the encoded file as a copy
  384.  
  385.  
  386. =======================================================================
  387. CRC error protection
  388. =======================================================================
  389. -p  
  390.  
  391. turn on CRC error protection.  
  392. Yes this really does work correctly in LAME.  However, it takes 
  393. 16 bits per frame that would otherwise be used for encoding.
  394.  
  395.  
  396.  
  397. =======================================================================
  398. input file is raw pcm
  399. =======================================================================
  400. -r  
  401.  
  402. Assume the input file is raw pcm.  Sampling rate and mono/stereo/jstereo
  403. must be specified on the command line.  Without -r, LAME will perform
  404. several fseek()'s on the input file looking for WAV and AIFF headers.
  405.  
  406. Not supported if LAME is compiled to use LIBSNDFILE.
  407.  
  408.  
  409.  
  410. =======================================================================
  411. output sampling frequency in kHZ
  412. =======================================================================
  413. --resample  n
  414.  
  415. where n = 16, 22.05, 24, 32, 44.1, 48
  416.  
  417. Output sampling frequency.  Resample the input if necessary.  
  418. If not specified, defaults to the input sampling frequency.
  419. (resampling code not yet implemented)
  420.  
  421. =======================================================================
  422. sampling frequency in kHZ
  423. =======================================================================
  424. -s  n
  425.  
  426. where n = 16, 22.05, 24, 32, 44.1, 48
  427.  
  428. Required for raw PCM input files.  Otherwise it will be determined
  429. from the header information in the input file.
  430.  
  431.  
  432.  
  433. =======================================================================
  434. silent operation
  435. =======================================================================
  436. -S
  437.  
  438. don't print progress report
  439.  
  440.  
  441.  
  442. =======================================================================
  443. disable Xing VBR tag
  444. =======================================================================
  445. -t              
  446.  
  447. Disable writing of the Xing VBR Tag (only valid if -v flag is
  448. specified) This tag in embedded in frame 0 of the MP3 file.  It lets
  449. VBR aware players correctly seek and compute playing times of VBR
  450. files.
  451.  
  452.  
  453.  
  454. =======================================================================
  455. variable bit rate  (VBR)
  456. =======================================================================
  457. -v
  458.  
  459. Turn on VBR.  There are several ways you can use VBR.  I personally
  460. like using VBR to get files slightly bigger than 128kbs files, where
  461. the extra bits are used for the occasional difficult-to-encode frame.
  462. For this, try specifying a minimum bitrate to use with VBR:
  463.  
  464. lame -v -b 112  input.wav output.mp3
  465.  
  466. If the file is too big, use -V n, where n=0..9
  467.  
  468. lame -v -V n   -b 112  input.wav output.mp3
  469.  
  470.  
  471. If you wan to use VBR to get the maximum compression possible,
  472. and for this, you can try:  
  473.  
  474. lame -v  input.wav output.mp3
  475. lame -v -V n input.wav output.mp3         (to very quality/filesize)
  476.  
  477.  
  478.  
  479.  
  480. =======================================================================
  481. VBR quality setting
  482. =======================================================================
  483. -V n       
  484.  
  485. n=0..9.  Specifies the value of VBR_q.  default=4.  0=highest quality.
  486.  
  487.  
  488.  
  489. How is VBR_q used?
  490.  
  491. OVER = number of scalefactor bands with distortion that exceeds the
  492. allowed distortion given by the masking thresholds.  OVER is computed
  493. by outer_loop, and the masking thresholds are computed by the
  494. psycho-acoustic model. 
  495.  
  496. VBR_q = the minimum value of OVER which is to be allowed.
  497. LAME will choose the smallest bitrate for which OVER <= VBR_q.  
  498. (a minimum allowed bitrate can be set with -b.  default=64kbs)
  499.  
  500. If the frame contains short blocks, then the minimum bitrate is made
  501. much larger since the OVER does not adequately measure distortion
  502. caused by pre-echo.  LAME uses bitrates of at least 160kbs for short
  503. blocks to make sure they sound good.
  504.  
  505. *NOTE* No psy-model is perfect, so there can often be distortion which
  506. is audible even though the psy-model claims it is not!  Thus using a
  507. small minimum bitrate can result in some aggressive compression and
  508. audible distortion even with -V 0.  Thus using -V 0 does not sound
  509. better than a fixed 256kbs encoding.  For example: suppose in the 1kHz
  510. frequency band the psy-model claims 20db of distortion will not be
  511. detectable by the human ear, so LAME VBR-0 will compress that
  512. frequency band as much as possible and introduce at most 20db of
  513. distortion.  Using a fixed 256kbit framesize, LAME could end up
  514. introducing only 2db of distortion.  If the psy-model was correct,
  515. they will both sound the same.  If the psy-model was wrong, the VBR-0
  516. result can sound worse.
  517.  
  518.  
  519. =======================================================================
  520. voice encoding mode
  521. =======================================================================
  522. --voice
  523.  
  524. An experimental voice encoding mode.  Tuned for 44.1kHz input files.
  525.  
  526.  
  527. =======================================================================
  528. swapbytes   
  529. =======================================================================
  530. -x
  531.  
  532. swap bytes in the input file.  for sorting out little endian/big endian
  533. type problems.  If your encodings sound like static, try this first.
  534.  
  535.  
  536.  
  537.  
  538.  
  539.  
  540.  
  541.  
  542.  
  543.  
  544.  
  545.  
  546.  
  547.  
  548.  
  549.  
  550.  
  551.  
  552.  
  553.