Skip to content

Command Line Options

Ryuu Mitsuki edited this page Sep 6, 2024 · 1 revision

This section outlines all available command-line options for YTMP3-JS. These options give you full control over the download and audio conversion processes, enabling you to specify custom paths, configure FFmpeg settings, and more. Whether you're downloading a single video or processing a batch, these options ensure flexibility and ease of use.

Download Options

Option Name Accepts Description
--cwd string Sets the current working directory, used to resolve the outDir path. Defaults to the current directory.
-f | --file | --batch string Specifies a file path containing a list of YouTube URLs for batch downloading.
-c | --config string Specifies a configuration file with a downloadOptions object to configure both download and audio converter options.
--no-config - Disables both the global and specified configuration file parsing.
-o | --outDir | --out-dir string Specifies the output directory for downloaded files. Defaults to the current directory.
-C | --convertAudio | --convert-audio - Enables the audio conversion behavior (requires FFmpeg).
--no-convertAudio | --no-convert-audio - Disables the audio conversion behavior if enabled previously.
-q | --quiet - Suppresses all output messages. Use -qq to also suppress progress for audio conversion.
--no-quiet - Disables the suppression output messages if enabled previously.

Note

When using the -c or --config option to specify a configuration file, any command-line options will override the corresponding options in the configuration file. This override also affect the global configuration file.

Audio Converter Options

Option Name Accepts Description
--input-options | --inputOptions | --addInputOptions | --add-input-options | --inOpt string Specifies custom FFmpeg input options for audio conversion.
--output-options | --outputOptions | --addOptions | --add-options | --addOutputOptions | --add-output-options | --outOpt string Specifies custom FFmpeg output options for audio conversion.
--format string Converts audio to the specified format and sets the output file extension.
--codec | --encoding string Specifies the codec for the converted audio.
--bitrate int | string Sets the bitrate for the converted audio in kbps.
--freq | --frequency int Sets the audio sampling frequency in Hertz (Hz).
--channels int Specifies the number of audio channels for the converted audio.
--deleteOld | --delete-old | --overwrite - Deletes the original audio file after conversion.
--no-deleteOld | --no-delete-old | --no-overwrite - Disables the deletion of original audio file after conversion if enabled previously.

Note

Audio converter options require the -C or --convertAudio flag to enable conversion; otherwise, these options will be ignored.


To customize FFmpeg using input and output options, use --input-options and --output-options. Options should be enclosed in quotes, with each option separated by a space. For example:

ytmp3 <YT_URL> -C --output-options='-b:a 320k -ar 28000'

The input/output options will take precedence over other audio conversion flags (e.g., --bitrate, --freq). However, you can still specify the output format using the --format flag:

ytmp3 <YT_URL> -o ~/Downloads -C --format opus --output-options='-acodec libopus -ar 28000'

Or using the option from the FFmpeg itself:

ytmp3 <YT_URL> -o ~/Downloads -C --output-options='-f opus -acodec libopus -ar 28000'

Miscellaneous Options

Option Name Description
-h | -? | --help Displays the help message and exits.
-V | --version Displays the module version. Use -VV to display versions of all dependencies (excluding devDependencies).
--copyright Displays copyright information and exits.
--print-config Displays the configuration options in use, helpful for debugging.
Clone this wiki locally