For better understanding of the following information you should know how does foobar2000 converter work. Here is it's working scheme:
The source is generally a file-container (FLAC, MP3, etc.) with either lossy or lossless audio stream inside. The bit-stream from source is sent to the decoder (in case of compressed source format) which gives uncompressed digital audio stream at it's output. If the source is lossy, the stream has 32-bit floating-point format and then it is transmitted to the digital signal processors — ReplayGain, DSP's. For lossless formats, such as FLAC and WavPack, post-processing may be performed if the HDCD flag will be found or DTS stream will be detected in uncompressed 16-bit PCM data obtained from decoder. Postprocessor gives 32-bit floating-point PCM at it's output.
After decoding and/or post-processing bit depth conversion has to be performed. For lossless encoding converter uses target value, specified on the «Output format» page for the current preset (also there is an option of using dithering + noise shaping). For lossy encoding it uses value specified as «Highest BPS mode supported» on the command-line encoder settings' page.
Then, if encoder supports STDIN, data are passed to it on the fly, as soon as they have been decoded and processed. Otherwise the data firstly must be fully decoded, processed and written to the temporary PCM WAV file, and only after finishing it, location of this file with other parameters is transmitted to the encoder.
After receiving of parameters and input data, command-line encoder starts encoding, writing output data itself to the selected path. When encoding is finished, foobar2000 copies metadata (ID3 or other tags) from source to the new file. Then, if ReplayGain scanning of output file is enabled, the file has to be decoded again for signal analysing and calculation of ReplayGain data (peak level, gain) which must be saved to the file tags.
1. Initial settings
Choose File->Preferences from foobar2000 main toolbar.
From menu tree (on the left) choose Advanced->Tools->Converter. In the Additional command-line encoder paths field specify full paths to the folders with encoders' executable files (exe), separated with semicolons.
- foobar2000 can add more paths itself when you manually specify path to the encoder file (see below);
- player uses subfolder foobar2000/encoders as default encoders' exe files path, so there is no need to specify this folder;
- also you can write the relative path to encoder's exe directly to the foobar2000 encoder settings (see below).
2. Converter setup (example of LAME MP3)
Right-click on the any track from foobar2000 playlist or medialibrary and choose Convert->Convert...
You'll see the window with four links to the four settings groups. Let's take up them in order.
2.1 Encoder settings (Output format)
Here we see the list of encoders profiles. Notice the bit depth and dither settings (for lossless encoders only):
Output bit depth — bit depth for input file decoding: Auto, 8/16/24 (fixed point) or 32 bits (floating point). Recommended value is Auto, but note that then for sources, considered as lossy, 16-bit decoding will be used.
Dither — use dithering + noise shaping: never, lossy sources only, always. Using of this technology is recommended only if source bit depth is greater than output bit depth will be, in other cases set never.
For clarity let's create new profile using Add New button.
You will see the windows with encoder settings. Initially the converter suggests you to use standard settings dialog with quality slider (from VRB V9 to CBR 320). For detailed settings choose Custom from the drop-down list.
Now we can go directly to the encoder settings.
Encoder — here you can set parameters which directly affect the encoding process.
Choose Custom on the top of the window and specify following settings:
Encoder — specify path to the encoder executable file. You can specify full path using «...» button. Also you can set the path relatively to foobar2000.exe, for example:
./encoders/lame.exe. The easiest way is to specify just encoder file name (for LAME it's generally
lame.exe), but this will work only if file is located in one of the folders specified before or in the default folder
./encoders/ (see item 1).
Extension — output files extension. Type mp3
Parameters — parameters that will be sent to the encoder. For best quality type:
--silent -b 320 -q 0 --noreplaygain - %d
Do not convert in multiple threads — prevent parallel encoding of multiple files.
Bit Depth Control — parameters which determine codec type and bit depth supported by it.
Format is — codec type. Can be lossy or lossless/hybrid. Option affects the format of data which are sent to the encoder. For lossy bitstream will have highest depth (next parameter), for lossless converter keeps value set on previous page (Output bit depth, see above). For LAME we have to set lossy.
Highest BPS mode supported — maximum bit depth supported by the encoder for input data. Can be 8, 16, 24 (fixed point) or 32 bits (floating point). Since LAME supports floating-point data, we have to set 32 bits.
Display Info — settings of information that will be displayed in the profile name. Do not affect encoding process.
Encoder name — specify MP3 (LAME)
Bitrate (kbps) — for current settings it is 320 kbps
Settings — describe parameters of encoding you have used, at your will. We'll specify only important keys: -b 320 -q 0
Now press «OK» button.
Now we can see our profile — MP3 (LAME) 320 kbps -b 320 -q 0 — in the list. Press Back button and let's pass on to next settings group.
2.2 Output files (Destination).
Here are the destination files settings.
Output path — specify where you want output files to be placed:
Ask me later (useful for saving preset) — the program will be asking you to specify folder at each conversion start.
Source folder each file will be saved to the same folder where source file is located.
Specify folder — all files will be saved to the specified folder (will be created if it does not exist).
If file already exists — what to do if such file already exists:
Ask — ask what to do.
Skip — skip this file and pass to the next.
Overwrite — overwrite existing file.
Output style and filename formatting — choose formatting of output file name:
Convert each track to an individual file — in the Name format field you can specify desired file name pattern. Recommended is %track% %artist% — %title%, see more here: Title Formatting Help. Note that destination file name (with extension) can not be the same as input file name, otherwise you'll get an error.
Generate multi-track files — merge each group of files into appropriate multi-track file, according to «Name format & grouping pattern». Note that such multi-track files can have internal markup (for example m4a file can include multiple tracks).
Merge all tracks into one output file — all tracks will be merged into the one file with name «Image» (extension depends on settings).
Here you can specify the settings of audio stream processing before it is sent to the encoder.
Enable decode postprocessing — this option is available only if you have foo_dts and/or foo_hdcd components installed. It enables DTS/HDCD decoders which causes irreversible conversion of source PCM stream (for example, to 5.1 format for DRS CD or to 24-bit audio for HDCD). For lossy encoding it is recommended to have postprocessing enabled.
ReplayGain — you can use RG if the source file has RG metadata, but note that enabling it for lossless sources is not recommended (while for lossy it can be used to prevent clipping).
DSP — enable ability of using DSP effects. Do not enable it without necessity.
DSP chain presets — you can save your DSP chain presets and then load them when it's needed.
Don't reset DSP between tracks — do not restart processing for each track — it's necessary for crossfading (mixing ending of previous track and beginning of the next), etc.
2.4 Other settings (Other)
Preview generation — you will get short cuts instead of full tracks:
Length percentage — specify cuts length in percentage of the source track (from 3 to 30%).
Fixed track length — specify fixed cuts' length.
When done — operations that will be performed after encoding is finished.
Show full status report — if disabled, the report will be shown only in case of error.
ReplayGain-scan output files as albums — autoscan the resulting files with RG scanner as albums and write RG metadata. Recommended for lossy encoding.
Transfer attached pictures — copy attached pictures from source to the destination files.
Copy files to destination folder — copy files with specified extensions from source to the destination directory. For example: *.CUE;*.JPG .
2.5 Setup finishing.
Now go back to the converter's main window. Press Save button to save the preset and enter it's name — LAME MP3, 320 kbps. After pressing Convert button conversion will start. You can press Cancel to quit.
Now you can convert tracks by marking them in playlist/medialibrary and pressing right-click->Convert->LAME MP3, 320 kbps.