Page 1 of 1

LAME command line

PostPosted: Sun Nov 09, 2008 1:13 am
by PieterB
Could someone tell me if I can change the settings of LAME within Subsonic's settings?

Settings > Advanced > Downsample Command: lame -S -h -b %b %s -

What should this line be (if possible) to downsample my WMA Lossless to 196 kbps

Should also Settings > Transcoding > Step 2 be changed?

Thanks,

PieterB

PostPosted: Sun Nov 09, 2008 1:38 pm
by sindre_mehus
I guess it can be a bit confusing, but the downsample command is only used for mp3, so you should change Settings > Transcoding > Step2.

Try adding -b %b or -b 196.

Hope this helps,
Sindre

PostPosted: Sun Nov 09, 2008 1:43 pm
by PieterB
Thank you for your help. Another issue:

I just changed LAME 3.89 to a recent version LAME 3.98.2
That version doesn't seem to work, is that correct?

[11/9/08 2:37:27 PM CET] INFO PlaylistInputStream Opening new song \\Naslite-11\disk-1\Music\Beady Belle\Home\11 Consolatory Dance Beady Belle Home.wma
[11/9/08 2:37:27 PM CET] DEBUG TranscodeInputStream Starting transcoder: Starting transcoder: [c:\subsonic\transcode\wmadec] [\\Naslite-11\disk-1\Music\Beady Belle\Home\11 Consolatory Dance Beady Belle Home.wma]
[11/9/08 2:37:27 PM CET] DEBUG TranscodeInputStream Starting transcoder: Starting transcoder: [lame] [-b] [128] [-x] [-] [-]
[11/9/08 2:37:27 PM CET] DEBUG InputStreamReaderThread (lame) Warning: unsupported audio format
[11/9/08 2:37:27 PM CET] DEBUG InputStreamReaderThread (c:\subsonic\transcode\wmadec) Reading from stream failed with error code 0xffffffff
[11/9/08 2:37:29 PM CET] INFO StreamController Stopping stream PieterB@83.84.141.237:1150 (MediaMonkey)

What version should I use??

Thanks for answering!
PieterB

PostPosted: Sun Nov 09, 2008 1:51 pm
by sindre_mehus
Sorry, I haven't tried those versions, but I'll look into it. What kind of error do you see, and what platform are you on?

The Windows transcoding pack uses LAME 3.96.1, so that version is used by a lot of people.

Sindre

PostPosted: Sun Nov 09, 2008 1:56 pm
by PieterB
I just re-edited my post with the log file....
I am on XP/Firefox

PieterB

PostPosted: Sun Nov 09, 2008 2:18 pm
by PieterB
The Windows transcoding pack uses LAME 3.96.1, so that version is used by a lot of people


That one works fine.

On the command line issue: if the -V command is used, does that mean that the -b 196 should be left out, or are they competible?

Thanks again.
PieterB

PostPosted: Sun Nov 09, 2008 2:26 pm
by sindre_mehus
From lame --longhelp:
Code: Select all
  VBR options:
    -v              use variable bitrate (VBR) (--vbr-old)
    --vbr-old       use old variable bitrate (VBR) routine
    --vbr-new       use new variable bitrate (VBR) routine
    -V n            quality setting for VBR.  default n=4
                    0=high quality,bigger files. 9=smaller files
    -b <bitrate>    specify minimum allowed bitrate, default  32 kbps
    -B <bitrate>    specify maximum allowed bitrate, default 320 kbps
    -F              strictly enforce the -b option, for use with players that
                    do not support low bitrate mp3
    -t              disable writing LAME Tag
    -T              enable and force writing LAME Tag


So you probably should use -B 196 instead.

PostPosted: Sun Nov 09, 2008 3:40 pm
by PieterB
The following LAME command line works fine:

Code: Select all
lame -v -V 0 -b 96 -B 320 -x - -


Where:

-v = use variable bitrate
-V = indicates the quality (0=highest, 9=lowest)
-b = lowest possible bitrate
-B = highest possible bitrate

This was certainly very helpful. Thank you for your kind assistence.

PieterB

PostPosted: Sun Apr 25, 2010 9:07 pm
by cooperg21
Where did you input that command line? When I put your command line into "step 2" all I get is static when streamed onto my android phone (motorola droid).

I prefer VBR over CBR and would like to have everything stream using lame's VBR settings at a decent quality. I have many FLAC files and would love to have access to them at a decent bitrate on my phone.

Any help that anyone could provide would be greatly appreciated.

Thanks!

PostPosted: Mon Apr 26, 2010 5:47 am
by PieterB
Settings > Transcoding:

The actual transcoding is done by third-party command line programs which must be installed in c:\subsonic\transcode. A transcoding pack for Windows is available here. You can add your own custom transcoder given that it fulfills the following requirements:

* It must have a command line interface.
* It must be able to send output to stdout.
* If used in step 2 or 3, it must be able to read input from stdin.

Note that transcodings are activated on a per-player basis from the player settings page. If "Default" is checked, the transcoding is automatically activated for new players.

Please let me know if I have this correct

PostPosted: Tue Apr 27, 2010 6:17 pm
by cooperg21
So if I understand this correctly, I cannot simply change step 2 or 3, I have to change what is stored in "c:\subsonic\transcode"? I just installed the basic pack that was linked to on the Subsonic website. Nothing fancy.

I thought that what was stored in "c:\subsonic\transcode" was simply a set of codecs/converters with the ability to convert different bitrates (such as flac) to a constant or variable mp3 bitrate. But if I understand this correctly, it can only convert one way and it can't convert way.... a constant mp3 to a flac file or better yet, a variable bit rate mp3 without changing what is in the "c:\subsonic\transcode" folder. (Which I'm guessing means recompiling code, which I have no idea how to do...)

Do I have this correct?

PostPosted: Thu Apr 29, 2010 5:18 pm
by cooperg21
Okay, think that I am good to go!

Found the link below and I think that it might help out some people.

I used the following in Step 2
Code: Select all
lame --vbr-new -v -V0 -b b32 - -


http://lame.cvs.sourceforge.net/*checko ... itchs.html

Full command line switch reference

note: Options which could exist without being documented here are considered as experimental ones. Such experimental options should usually not be used.

switch parameter
-a downmix stereo file to mono
--abr average bitrate encoding
-b bitrate (8...320)
-B max VBR/ABR bitrate (8...320)
--bitwidth input bit width
-c copyright
--cbr enforce use of constant bitrate
--clipdetect clipping detection
--comp choose compression ratio
--decode decoding only
--disptime time between display updates
-e de-emphasis (n, 5, c)
-f fast mode
-F strictly enforce the -b option
--freeformat free format bitstream
-h high quality
--help help
--highpass highpass filtering frequency in kHz
--highpass-width width of highpass filtering in kHz
--lowpass lowpass filtering frequency in kHz
--lowpass-width width of lowpass filtering in kHz
-m stereo mode (s, j, f, m)
--mp1input MPEG Layer I input file
--mp2input MPEG Layer II input file
--mp3input MPEG Layer III input file
--noasm disable assembly optimizations (mmx/3dnow/sse)
--nohist disable histogram display
--noreplaygain disable ReplayGain analysis
--nores disable bit reservoir
-o non-original
-p error protection
--preset use built-in preset
--priority OS/2 process priority control
-q algorithm quality selection
--quiet silent operation
-r input file is raw PCM
--replaygain-accurate compute ReplayGain more accurately and find the peak sample
--replaygain-fast compute ReplayGain fast but slightly inaccurately (default)
--resample output sampling frequency in kHz (encoding only)
-s sampling frequency in kHz
-S silent operation
--scale scale input
--scale-l scale input channel 0 (left)
--scale-r scale input channel 1 (right)
--silent silent operation
--strictly-enforce-ISO strict ISO compliance
-t disable INFO/WAV header
-V VBR quality setting, integer or floating point number [0,...,10[
--vbr-new new VBR mode
--vbr-old older VBR mode
--verbose verbosity
-x swapbytes
-X change quality measure

* -a downmix
Mix the stereo input file to mono and encode as mono.
The downmix is calculated as the sum of the left and right channel, attenuated by 6 dB.

This option is only needed in the case of raw PCM stereo input (because LAME cannot determine the number of channels in the input file).
To encode a stereo PCM input file as mono, use "lame -m s -a".

For WAV and AIFF input files, using "-m m" will always produce a mono .mp3 file from both mono and stereo input.


* --abr n average bitrate encoding

Turns on encoding with a targeted average bitrate of n kbits, allowing to use frames of different sizes. The allowed range of n is 8-310, you can use any integer value within that range.

It can be combined with the -b and -B switches like:
lame --abr 123 -b 64 -B 192 a.wav a.mp3
which would limit the allowed frame sizes between 64 and 192 kbits.


* -b n bitrate

For MPEG-1 (sampling frequencies of 32, 44.1 and 48 kHz)
n = 32,40,48,56,64,80,96,112,128,160,192,224,256,320

For MPEG-2 (sampling frequencies of 16, 22.05 and 24 kHz)
n = 8,16,24,32,40,48,56,64,80,96,112,128,144,160

For MPEG-2.5 (sampling frequencies of 8, 11.025 and 12 kHz)
n = 8,16,24,32,40,48,56,64

When used with variable bitrate encoding (VBR), -b specifies the minimum bitrate to be used. However, in order to avoid wasted space, the smallest frame size available will be used during silences.


* -B n maximum VBR/ABR bitrate

For MPEG-1 (sampling frequencies of 32, 44.1 and 48 kHz)
n = 32,40,48,56,64,80,96,112,128,160,192,224,256,320

For MPEG-2 (sampling frequencies of 16, 22.05 and 24 kHz)
n = 8,16,24,32,40,48,56,64,80,96,112,128,144,160

For MPEG-2.5 (sampling frequencies of 8, 11.025 and 12 kHz)
n = 8,16,24,32,40,48,56,64

Specifies the maximum allowed bitrate when using VBR/ABR

The use of -B is NOT RECOMMENDED. A 128kbps CBR bitstream, because of the bit reservoir, can actually have frames which use as many bits as a 320kbps frame. VBR modes minimize the use of the bit reservoir, and thus need to allow 320kbps frames to get the same flexibility as CBR streams.

note: If you own an mp3 hardware player build upon a MAS 3503 chip, you must set maximum bitrate to no more than 224 kpbs.

* --bitwidth 8/16/24/32 input bit width

Required only for raw PCM input files. Otherwise it will be determined from the header of the input file.


* --clipdetect clipping detection

Enable --replaygain-accurate and print a message whether clipping occurs and how far in dB the waveform is from full scale.

This option is not usable if the MP3 decoder was explicitly disabled in the build of LAME.

See also: --replaygain-accurate



* --cbr enforce use of constant bitrate

This switch enforces the use of constant bitrate encoding.



* --comp choose compression ratio

Instead of choosing bitrate, using this option, user can choose compression ratio to achieve.



* --decode decoding only

Uses LAME for decoding to a WAV file. The input file can be any input type supported by encoding, including layer I,II,III (MP3) and OGG files. In case of MPEG files, LAME uses a bugfixed version of mpglib for decoding.

If -t is used (disable WAV header), Lame will output raw PCM in native endian format. You can use -x to swap bytes order.

This option is not usable if the MP3 decoder was explicitly disabled in the build of LAME.



* --disptime n time between display updates

Set the delay in seconds between two display updates.



* -e n/5/c de-emphasis


n = (none, default)
5 = 0/15 microseconds
c = citt j.17

All this does is set a flag in the bitstream. If you have a PCM input file where one of the above types of (obsolete) emphasis has been applied, you can set this flag in LAME. Then the mp3 decoder should de-emphasize the output during playback, although most decoders ignore this flag.

A better solution would be to apply the de-emphasis with a standalone utility before encoding, and then encode without -e.



* -f fast mode

This switch forces the encoder to use a faster encoding mode, but with a lower quality. The behaviour is the same as the -q7 switch.

Noise shaping will be disabled, but psycho acoustics will still be computed for bit allocation and pre-echo detection.



* -F strictly enforce the -b option

This is mainly for use with hardware players that do not support low bitrate mp3.

Without this option, the minimum bitrate will be ignored for passages of analog silence, ie when the music level is below the absolute threshold of human hearing (ATH).



* --freeformat free format bitstream

Produces a free format bitstream. With this option, you can use -b with any bitrate higher than 8 kbps.

However, even if an mp3 decoder is required to support free bitrates at least up to 320 kbps, many players are unable to deal with it.

Tests have shown that the following decoders support free format:

FreeAmp up to 440 kbps
in_mpg123 up to 560 kbps
l3dec up to 310 kbps
LAME up to 560 kbps
MAD up to 640 kbps



* -h high quality

Use some quality improvements. Encoding will be slower, but the result will be of higher quality. The behaviour is the same as the -q2 switch.
This switch is always enabled when using VBR.



* --help help

Display a list of all available options.



* --highpass highpass filtering frequency in kHz

Set an highpass filtering frequency. Frequencies below the specified one will be cutoff.



* --highpass-width width of highpass filtering in kHz

Set the width of the highpass filter. The default value is 15% of the highpass frequency.



* --lowpass lowpass filtering frequency in kHz

Set a lowpass filtering frequency. Frequencies above the specified one will be cutoff.



* --lowpass-width width of lowpass filtering in kHz

Set the width of the lowpass filter. The default value is 15% of the lowpass frequency.



* -m s/j/f/d/m stereo mode

Joint-stereo is the default mode for input files featuring two channels..

stereo
In this mode, the encoder makes no use of potentially existing correlations between the two input channels. It can, however, negotiate the bit demand between both channel, i.e. give one channel more bits if the other contains silence or needs less bits because of a lower complexity.

joint stereo
In this mode, the encoder will make use of correlation between both channels. The signal will be matrixed into a sum ("mid"), computed by L+R, and difference ("side") signal, computed by L-R, and more bits are allocated to the mid channel.
This will effectively increase the bandwidth if the signal does not have too much stereo separation, thus giving a significant gain in encoding quality. In joint stereo, the encoder can select between Left/Right and Mid/Side representation on a frame basis.

Using mid/side stereo inappropriately can result in audible compression artifacts. To much switching between mid/side and regular stereo can also sound bad. To determine when to switch to mid/side stereo, LAME uses a much more sophisticated algorithm than that described in the ISO documentation, and thus is safe to use in joint stereo mode.

forced joint stereo
This mode will force MS joint stereo on all frames. It's slightly faster than joint stereo, but it should be used only if you are sure that every frame of the input file has very little stereo separation.

dual channels
In this mode, the 2 channels will be totally independently encoded. Each channel will have exactly half of the bitrate. This mode is designed for applications like dual languages encoding (ex: English in one channel and French in the other). Using this encoding mode for regular stereo files will result in a lower quality encoding.

mono
The input will be encoded as a mono signal. If it was a stereo signal, it will be downsampled to mono. The downmix is calculated as the sum of the left and right channel, attenuated by 6 dB.



* --mp1input MPEG Layer I input file

Assume the input file is a MPEG Layer I file.
If the filename ends in ".mp1" or ".mpg" LAME will assume it is a MPEG Layer I file. For stdin or Layer I files which do not end in .mp1 or .mpg you need to use this switch.


* --mp2input MPEG Layer II input file

Assume the input file is a MPEG Layer II (ie MP2) file.
If the filename ends in ".mp2" LAME will assume it is a MPEG Layer II file. For stdin or Layer II files which do not end in .mp2 you need to use this switch.


* --mp3input MPEG Layer III input file

Assume the input file is a MP3 file. Useful for downsampling from one mp3 to another. As an example, it can be useful for streaming through an IceCast server.
If the filename ends in ".mp3" LAME will assume it is an MP3 file. For stdin or MP3 files which do not end in .mp3 you need to use this switch.


* --noasm mmx/3dnow/sse disable assembly optimizations

Disable specific assembly optimizations. Quality will not increase, only speed will be reduced. If you have problems running Lame on a Cyrix/Via processor, disabling mmx optimizations might solve your problem.


* --nohist disable histogram display

By default, LAME will display a bitrate histogram while producing VBR mp3 files. This will disable that feature.
Histogram display might not be available on your release.


* --noreplaygain disable ReplayGain analysis

By default ReplayGain analysis is enabled. This switch disables it.

See also: --replaygain-accurate, --replaygain-fast


* --nores disable bit reservoir

Disable the bit reservoir. Each frame will then become independent from previous ones, but the quality will be lower.


* -o non-original

Mark the encoded file as being a copy.



* -p error protection

Turn on CRC error protection.
It will add a cyclic redundancy check (CRC) code in each frame, allowing to detect transmission errors that could occur on the MP3 stream. However, it takes 16 bits per frame that would otherwise be used for encoding, and then will slightly reduce the sound quality.



* --preset presetName use built-in preset

Use one of the built-in presets (standard, extreme, insane, or the abr/cbr modes).
"--preset help" gives more information about the usage possibilities for these presets.



* --priority 0...4 OS/2 process priority control

With this option, LAME will run with a different process priority under IBM OS/2.
This will greatly improve system responsiveness, since OS/2 will have more free time to properly update the screen and poll the keyboard/mouse. It should make quite a difference overall, especially on slower machines. LAME's performance impact should be minimal.

0 (Low priority)
Priority 0 assumes "IDLE" class, with delta 0.
LAME will have the lowest priority possible, and the encoding may be suspended very frequently by user interaction.

1 (Medium priority)
Priority 1 assumes "IDLE" class, with delta +31.
LAME won't interfere at all with what you're doing.
Recommended if you have a slower machine.

2 (Regular priority)
Priority 2 assumes "REGULAR" class, with delta -31.
LAME won't interfere with your activity. It'll run just like a regular process, but will spare just a bit of idle time for the system. Recommended for most users.

3 (High priority)
Priority 3 assumes "REGULAR" class, with delta 0.
LAME will run with a priority a bit higher than a normal process.
Good if you're just running LAME by itself or with moderate user interaction.

4 (Maximum priority)
Priority 4 assumes "REGULAR" class, with delta +31.
LAME will run with a very high priority, and may interfere with the machine response.
Recommended if you only intend to run LAME by itself, or if you have a fast processor.


Priority 1 or 2 is recommended for most users.



* -q 0..9 algorithm quality selection

Bitrate is of course the main influence on quality. The higher the bitrate, the higher the quality. But for a given bitrate, we have a choice of algorithms to determine the best scalefactors and Huffman encoding (noise shaping).

-q 0: use slowest & best possible version of all algorithms. -q 0 and -q 1 are slow and may not produce significantly higher quality.

-q 2: recommended. Same as -h.

-q 5: default value. Good speed, reasonable quality.

-q 7: same as -f. Very fast, ok quality. (psycho acoustics are used for pre-echo & M/S, but no noise shaping is done.

-q 9: disables almost all algorithms including psy-model. poor quality.



* -r input file is raw PCM

Assume the input file is raw PCM. Sampling rate and mono/stereo/jstereo must be specified on the command line. Without -r, LAME will perform several fseek()'s on the input file looking for WAV and AIFF headers.
Might not be available on your release.



* --replaygain-accurate compute ReplayGain more accurately and find the peak sample

Enable decoding on the fly. Compute "Radio" ReplayGain on the decoded data stream. Find the peak sample of the decoded data stream and store it in the file.

ReplayGain analysis does not affect the content of a compressed data stream itself, it is a value stored in the header of a sound file. Information on the purpose of ReplayGain and the algorithms used is available from http://www.replaygain.org/

By default, LAME performs ReplayGain analysis on the input data (after the user-specified volume scaling). This behavior might give slightly inaccurate results because the data on the output of a lossy compression/decompression sequence differs from the initial input data. When --replaygain-accurate is specified the mp3 stream gets decoded on the fly and the analysis is performed on the decoded data stream. Although theoretically this method gives more accurate results, it has several disadvantages:

* tests have shown that the difference between the ReplayGain values computed on the input data and decoded data is usually no greater than 0.5dB, although the minimum volume difference the human ear can perceive is about 1.0dB
* decoding on the fly significantly slows down the encoding process

The apparent advantage is that:

* with --replaygain-accurate the peak sample is determined and stored in the file. The knowledge of the peak sample can be useful to decoders (players) to prevent a negative effect called 'clipping' that introduces distortion into sound.


Only the "RadioGain" ReplayGain value is computed. It is stored in the LAME tag. The analysis is performed with the reference volume equal to 89dB. Note: the reference volume has been changed from 83dB on transition from version 3.95 to 3.95.1.

This option is not usable if the MP3 decoder was explicitly disabled in the build of LAME. (Note: if LAME is compiled without the MP3 decoder, ReplayGain analysis is performed on the input data after user-specified volume scaling).

See also: --replaygain-fast, --noreplaygain, --clipdetect


* --replaygain-fast compute ReplayGain fast but slightly inaccurately (default)

Compute "Radio" ReplayGain on the input data stream after user-specified volume scaling and/or resampling.

ReplayGain analysis does not affect the content of a compressed data stream itself, it is a value stored in the header of a sound file. Information on the purpose of ReplayGain and the algorithms used is available from http://www.replaygain.org/

Only the "RadioGain" ReplayGain value is computed. It is stored in the LAME tag. The analysis is performed with the reference volume equal to 89dB. Note: the reference volume has been changed from 83dB on transition from version 3.95 to 3.95.1.

This switch is enabled by default.

See also: --replaygain-accurate, --noreplaygain


* --resample 8/11.025/12/16/22.05/24/32/44.1/48 output sampling frequency in kHz

Select output sampling frequency (for encoding only).
If not specified, LAME will automatically resample the input when using high compression ratios.


* -s 8/11.025/12/16/22.05/24/32/44.1/48 sampling frequency

Required only for raw PCM input files. Otherwise it will be determined from the header of the input file.

LAME will automatically resample the input file to one of the supported MP3 samplerates if necessary.



* -S / --silent / --quiet silent operation

Don't print progress report.



* --scale n scales input by n
* --scale-l n scales input channel 0 (left) by n
* --scale-r n scales input channel 1 (right) by n

Scales input by n. This just multiplies the PCM data (after it has been converted to floating point) by n.

n > 1: increase volume
n = 1: no effect
n < 1: reduce volume

Use with care, since most MP3 decoders will truncate data which decodes to values greater than 32768.



* --strictly-enforce-ISO strict ISO compliance

With this option, LAME will enforce the 7680 bit limitation on total frame size.
This results in many wasted bits for high bitrate encodings but will ensure strict ISO compatibility. This compatibility might be important for hardware players.





* -t disable INFO/WAV header

Disable writing of the INFO Tag on encoding.
This tag in embedded in frame 0 of the MP3 file. It includes some information about the encoding options of the file, and in VBR it lets VBR aware players correctly seek and compute playing times of VBR files.

When '--decode' is specified (decode to WAV), this flag will disable writing of the WAV header. The output will be raw PCM, native endian format. Use -x to swap bytes.



* -V [0,...,10[ VBR quality setting, integer or floating point number

Enable VBR (Variable BitRate) and specifies the value of VBR quality.
default=4
0=highest quality.



* --vbr-new new VBR mode

Invokes the newest VBR algorithm. During the development of version 3.90, considerable tuning was done on this algorithm, and it is now considered to be on par with the original --vbr-old.
It has the added advantage of being very fast (over twice as fast as --vbr-old).



* --vbr-old older VBR mode

Invokes the oldest, most tested VBR algorithm. It produces very good quality files, though is not very fast. This has, up through v3.89, been considered the "workhorse" VBR algorithm.



* --verbose verbosity

Print a lot of information on screen.



* -x swapbytes

Swap bytes in the input file or output file when using --decode.
For sorting out little endian/big endian type problems. If your encodings sounds like static, try this first.



* -X 0...7 change quality measure

When LAME searches for a "good" quantization, it has to compare the actual one with the best one found so far. The comparison says which one is better, the best so far or the actual. The -X parameter selects between different approaches to make this decision, -X0 being the default mode:

-X0
The criterions are (in order of importance):
* less distorted scalefactor bands
* the sum of noise over the thresholds is lower
* the total noise is lower

-X1
The actual is better if the maximum noise over all scalefactor bands is less than the best so far .

-X2
The actual is better if the total sum of noise is lower than the best so far.

-X3
The actual is better if the total sum of noise is lower than the best so far and the maximum noise over all scalefactor bands is less than the best so far plus 2db.

-X4
Not yet documented.

-X5
The criterions are (in order of importance):
* the sum of noise over the thresholds is lower
* the total sum of noise is lower

-X6
The criterions are (in order of importance):
* the sum of noise over the thresholds is lower
* the maximum noise over all scalefactor bands is lower
* the total sum of noise is lower

-X7
The criterions are:
* less distorted scalefactor bands
or
* the sum of noise over the thresholds is lower [quote][/quote]
Code: Select all