# Class: FfmpegCommand

## FfmpegCommand

#### new FfmpegCommand(input, options)

  Create an ffmpeg command

  Can be called with or without the 'new' operator, and the 'input' parameter may be specified as 'options.source' instead (or passed later with the addInput method).

  ##### Parameters:

  Name | Type | Argument | Description
  --- | --- | --- | ---
  `input` | String | ReadableStream | <optional> | input file path or readable stream

  `options`

  Object

  <optional>

  command options

  ###### Properties

  Name | Type | Argument | Default | Description
  --- | --- | --- | --- | ---
  `logger` | Object | <optional> | <no logging> | logger object with 'error', 'warning', 'info' and 'debug' methods
  `niceness` | Number | <optional> | 0 | ffmpeg process niceness, ignored on Windows
  `priority` | Number | <optional> | 0 | alias for `niceness`
  `presets` | String | <optional> | "fluent-ffmpeg/lib/presets" | directory to load presets from
  `preset` | String | <optional> | "fluent-ffmpeg/lib/presets" | alias for `presets`
  `stdoutLines` | String | <optional> | 100 | maximum lines of ffmpeg output to keep in memory, use 0 for unlimited
  `timeout` | Number | <optional> | <no timeout> | ffmpeg processing timeout in seconds
  `source` | String | ReadableStream | <optional> | <no input> | alias for the `input` parameter

  Source:
    - fluent-ffmpeg.js, line 31

### Audio methods

#### audioBitrate(bitrate)

  Specify audio bitrate

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `bitrate` | String | Number | audio bitrate in kbps (with an optional 'k' suffix)

  Source:
    - options/audio.js, line 48

  ##### Returns:

  FfmpegCommand

  ##### Alias:

  withAudioBitrate

#### audioChannels(channels)

  Specify audio channel count

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `channels` | Number | channel count

  Source:
    - options/audio.js, line 65

  ##### Returns:

  FfmpegCommand

  ##### Alias:

  withAudioChannels

#### audioCodec(codec)

  Specify audio codec

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `codec` | String | audio codec name

  Source:
    - options/audio.js, line 30

  ##### Returns:

  FfmpegCommand

  ##### Alias:

  withAudioCodec

#### audioFilter(filters)

  Alias for FfmpegCommand#audioFilters

#### audioFilters(filters)

  Specify custom audio filter(s)

  Can be called both with one or many filters, or a filter array.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---

  `filters`

  String | Array.<String> | Array.<Object>

  audio filter strings, string array or filter specification array, each with the following properties:

  ###### Properties

  Name | Type | Argument | Description
  --- | --- | --- | ---
  `filter` | String |  | filter name
  `options` | String | Array.<String> | Object | <optional> | filter option string, array, or object

  Source:
    - options/audio.js, line 116

  ##### Returns:

  FfmpegCommand

  ##### Examples:

      command.audioFilters('filter1');

      command.audioFilters('filter1', 'filter2=param1=value1:param2=value2');

      command.audioFilters(['filter1', 'filter2']);

      command.audioFilters([
        {
          filter: 'filter1'
        },
        {
          filter: 'filter2',
          options: 'param=value:param=value'
        }
      ]);

      command.audioFilters(
        {
          filter: 'filter1',
          options: ['value1', 'value2']
        },
        {
          filter: 'filter2',
          options: { param1: 'value1', param2: 'value2' }
        }
      );

  ##### Aliases:

  - withAudioFilter
  - withAudioFilters
  - audioFilter

#### audioFrequency(freq)

  Specify audio frequency

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `freq` | Number | audio frequency in Hz

  Source:
    - options/audio.js, line 82

  ##### Returns:

  FfmpegCommand

  ##### Alias:

  withAudioFrequency

#### audioQuality(quality)

  Specify audio quality

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `quality` | Number | audio quality factor

  Source:
    - options/audio.js, line 99

  ##### Returns:

  FfmpegCommand

  ##### Alias:

  withAudioQuality

#### noAudio()

  Disable audio in the output

  Source:
    - options/audio.js, line 12

  ##### Returns:

  FfmpegCommand

  ##### Alias:

  withNoAudio

#### withAudioBitrate(bitrate)

  Alias for FfmpegCommand#audioBitrate

#### withAudioChannels(channels)

  Alias for FfmpegCommand#audioChannels

#### withAudioCodec(codec)

  Alias for FfmpegCommand#audioCodec

#### withAudioFilter(filters)

  Alias for FfmpegCommand#audioFilters

#### withAudioFilters(filters)

  Alias for FfmpegCommand#audioFilters

#### withAudioFrequency(freq)

  Alias for FfmpegCommand#audioFrequency

#### withAudioQuality(quality)

  Alias for FfmpegCommand#audioQuality

#### withNoAudio()

  Alias for FfmpegCommand#noAudio

### Capabilities methods

#### availableCodecs(callback)

  Query ffmpeg for available codecs

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `callback` | FfmpegCommand~codecCallback | callback function

  Source:
    - capabilities.js, line 343

  ##### Alias:

  getAvailableCodecs

#### availableEncoders(callback)

  Query ffmpeg for available encoders

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `callback` | FfmpegCommand~encodersCallback | callback function

  Source:
    - capabilities.js, line 445

  ##### Alias:

  getAvailableEncoders

#### availableFilters(callback)

  Query ffmpeg for available filters

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `callback` | FfmpegCommand~filterCallback | callback function

  Source:
    - capabilities.js, line 287

  ##### Alias:

  getAvailableFilters

#### availableFormats(callback)

  Query ffmpeg for available formats

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `callback` | FfmpegCommand~formatCallback | callback function

  Source:
    - capabilities.js, line 501

  ##### Alias:

  getAvailableFormats

#### getAvailableCodecs(callback)

  Alias for FfmpegCommand#availableCodecs

#### getAvailableEncoders(callback)

  Alias for FfmpegCommand#availableEncoders

#### getAvailableFilters(callback)

  Alias for FfmpegCommand#availableFilters

#### getAvailableFormats(callback)

  Alias for FfmpegCommand#availableFormats

### Custom options methods

#### addInputOption(options)

  Alias for FfmpegCommand#inputOptions

#### addInputOptions(options)

  Alias for FfmpegCommand#inputOptions

#### addOption(options)

  Alias for FfmpegCommand#outputOptions

#### addOptions(options)

  Alias for FfmpegCommand#outputOptions

#### addOutputOption(options)

  Alias for FfmpegCommand#outputOptions

#### addOutputOptions(options)

  Alias for FfmpegCommand#outputOptions

#### complexFilter(spec, map)

  Specify a complex filtergraph

  Calling this method will override any previously set filtergraph, but you can set as many filters as needed in one call.

  ##### Parameters:

  Name | Type | Argument | Description
  --- | --- | --- | ---

  `spec`

  String | Array

  filtergraph string or array of filter specification objects, each having the following properties:

  ###### Properties

  Name | Type | Argument | Description
  --- | --- | --- | ---
  `filter` | String |  | filter name
  `inputs` | String | Array | <optional> | (array of) input stream specifier(s) for the filter, defaults to ffmpeg automatically choosing the first unused matching streams
  `outputs` | String | Array | <optional> | (array of) output stream specifier(s) for the filter, defaults to ffmpeg automatically assigning the output to the output file
  `options` | Object | String | Array | <optional> | filter options, can be omitted to not set any options

  `map` | Array | <optional> | (array of) stream specifier(s) from the graph to include in ffmpeg output, defaults to ffmpeg automatically choosing the first matching streams.

  Source:
    - options/custom.js, line 127

  ##### Returns:

  FfmpegCommand

  ##### Examples:

  Overlay an image over a video (using a filtergraph string)

        ffmpeg()
          .input('video.avi')
          .input('image.png')
          .complexFilter('[0:v][1:v]overlay[out]', ['out']);

  Overlay an image over a video (using a filter array)

        ffmpeg()
          .input('video.avi')
          .input('image.png')
          .complexFilter([{
            filter: 'overlay',
            inputs: ['0:v', '1:v'],
            outputs: ['out']
          }], ['out']);

  Split video into RGB channels and output a 3x1 video with channels side to side

       ffmpeg()
         .input('video.avi')
         .complexFilter([
           // Duplicate video stream 3 times into streams a, b, and c
           { filter: 'split', options: '3', outputs: ['a', 'b', 'c'] },

           // Create stream 'red' by cancelling green and blue channels from stream 'a'
           { filter: 'lutrgb', options: { g: 0, b: 0 }, inputs: 'a', outputs: 'red' },

           // Create stream 'green' by cancelling red and blue channels from stream 'b'
           { filter: 'lutrgb', options: { r: 0, b: 0 }, inputs: 'b', outputs: 'green' },

           // Create stream 'blue' by cancelling red and green channels from stream 'c'
           { filter: 'lutrgb', options: { r: 0, g: 0 }, inputs: 'c', outputs: 'blue' },

           // Pad stream 'red' to 3x width, keeping the video on the left, and name output 'padded'
           { filter: 'pad', options: { w: 'iw*3', h: 'ih' }, inputs: 'red', outputs: 'padded' },

           // Overlay 'green' onto 'padded', moving it to the center, and name output 'redgreen'
           { filter: 'overlay', options: { x: 'w', y: 0 }, inputs: ['padded', 'green'], outputs: 'redgreen'},

           // Overlay 'blue' onto 'redgreen', moving it to the right
           { filter: 'overlay', options: { x: '2*w', y: 0 }, inputs: ['redgreen', 'blue']},
         ]);

  ##### Alias:

  filterGraph

#### filterGraph(spec, map)

  Alias for FfmpegCommand#complexFilter

#### inputOption(options)

  Alias for FfmpegCommand#inputOptions

#### inputOptions(options)

  Add custom input option(s)

  When passing a single string or an array, each string containing two words is split (eg. inputOptions('-option value') is supported) for compatibility reasons. This is not the case when passing more than one argument.

  ##### Parameters:

  Name | Type | Argument | Description
  --- | --- | --- | ---
  `options` | String | <repeatable> | option string(s) or string array

  Source:
    - options/custom.js, line 12

  ##### Returns:

  FfmpegCommand

  ##### Examples:

      command.inputOptions('option1');

      command.inputOptions('option1', 'option2');

      command.inputOptions(['option1', 'option2']);

  ##### Aliases:

  - addInputOption
  - addInputOptions
  - withInputOption
  - withInputOptions
  - inputOption

#### outputOption(options)

  Alias for FfmpegCommand#outputOptions

#### outputOptions(options)

  Add custom output option(s)

  ##### Parameters:

  Name | Type | Argument | Description
  --- | --- | --- | ---
  `options` | String | <repeatable> | option string(s) or string array

  Source:
    - options/custom.js, line 72

  ##### Returns:

  FfmpegCommand

  ##### Examples:

      command.outputOptions('option1');

      command.outputOptions('option1', 'option2');

      command.outputOptions(['option1', 'option2']);

  ##### Aliases:

  - addOutputOption
  - addOutputOptions
  - addOption
  - addOptions
  - withOutputOption
  - withOutputOptions
  - withOption
  - withOptions
  - outputOption

#### withInputOption(options)

  Alias for FfmpegCommand#inputOptions

#### withInputOptions(options)

  Alias for FfmpegCommand#inputOptions

#### withOption(options)

  Alias for FfmpegCommand#outputOptions

#### withOptions(options)

  Alias for FfmpegCommand#outputOptions

#### withOutputOption(options)

  Alias for FfmpegCommand#outputOptions

#### withOutputOptions(options)

  Alias for FfmpegCommand#outputOptions

### Input methods

#### addInput(source)

  Alias for FfmpegCommand#input

#### fpsInput(fps)

  Alias for FfmpegCommand#inputFps

#### fromFormat(format)

  Alias for FfmpegCommand#inputFormat

#### input(source)

  Add an input to command

  Also switches "current input", that is the input that will be affected by subsequent input-related methods.

  Note: only one stream input is supported for now.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `source` | String | Readable | input file path or readable stream

  Source:
    - options/inputs.js, line 11

  ##### Returns:

  FfmpegCommand

  ##### Aliases:

  - mergeAdd
  - addInput

#### inputFormat(format)

  Specify input format for the last specified input

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `format` | String | input format

  Source:
    - options/inputs.js, line 63

  ##### Returns:

  FfmpegCommand

  ##### Aliases:

  - withInputFormat
  - fromFormat

#### inputFps(fps)

  Specify input FPS for the last specified input (only valid for raw video formats)

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `fps` | Number | input FPS

  Source:
    - options/inputs.js, line 85

  ##### Returns:

  FfmpegCommand

  ##### Aliases:

  - withInputFps
  - withInputFPS
  - withFpsInput
  - withFPSInput
  - inputFPS
  - inputFps
  - fpsInput

#### inputFPS(fps)

  Alias for FfmpegCommand#inputFps

#### inputFps(fps)

  Alias for FfmpegCommand#inputFps

#### loop(duration)

  Loop over the last specified input

  ##### Parameters:

  Name | Type | Argument | Description
  --- | --- | --- | ---
  `duration` | String | Number | <optional> | loop duration in seconds or as a '[[hh:]mm:]ss[.xxx]' string

  Source:
    - options/inputs.js, line 156

  ##### Returns:

  FfmpegCommand

#### mergeAdd(source)

  Alias for FfmpegCommand#input

#### native()

  Use native framerate for the last specified input

  Source:
    - options/inputs.js, line 113

  ##### Returns:

  FfmmegCommand

  ##### Aliases:

  - nativeFramerate
  - withNativeFramerate

#### nativeFramerate()

  Alias for FfmpegCommand#native

#### seek(seek)

  Specify output seek time

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `seek` | String | Number | seek time in seconds or as a '[hh:[mm:]]ss[.xxx]' string

  Source:
    - options/output.js, line 79

  ##### Returns:

  FfmpegCommand

  ##### Alias:

  seekOutput

#### seekInput(seek)

  Specify input seek time for the last specified input

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `seek` | String | Number | seek time in seconds or as a '[hh:[mm:]]ss[.xxx]' string

  Source:
    - options/inputs.js, line 134

  ##### Returns:

  FfmpegCommand

  ##### Aliases:

  - setStartTime
  - seekTo

#### seekOutput(seek)

  Alias for FfmpegCommand#seek

#### seekTo(seek)

  Alias for FfmpegCommand#seekInput

#### setStartTime(seek)

  Alias for FfmpegCommand#seekInput

#### withFpsInput(fps)

  Alias for FfmpegCommand#inputFps

#### withFPSInput(fps)

  Alias for FfmpegCommand#inputFps

#### withInputFormat(format)

  Alias for FfmpegCommand#inputFormat

#### withInputFPS(fps)

  Alias for FfmpegCommand#inputFps

#### withInputFps(fps)

  Alias for FfmpegCommand#inputFps

#### withNativeFramerate()

  Alias for FfmpegCommand#native

### Metadata methods

#### ffprobe(index, options, callback)

  Run ffprobe on last specified input

  ##### Parameters:

  Name | Type | Argument | Description
  --- | --- | --- | ---
  `index` | Number | <optional> <nullable> | 0-based index of input to probe (defaults to last input)
  `options` | Array.<String> | <optional> <nullable> | array of output options to return
  `callback` | FfmpegCommand~ffprobeCallback |  | callback function

  Source:
    - ffprobe.js, line 85

### Miscellaneous methods

#### preset(preset)

  Use preset

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `preset` | String | function | preset name or preset function

  Source:
    - options/misc.js, line 11

  ##### Alias:

  usingPreset

#### usingPreset(preset)

  Alias for FfmpegCommand#preset

### Other methods

#### clone()

  Clone an ffmpeg command

  This method is useful when you want to process the same input multiple times. It returns a new FfmpegCommand instance with the exact same options.

  All options set after the clone() call will only be applied to the instance it has been called on.

  Source:
    - fluent-ffmpeg.js, line 84

  ##### Returns:

  FfmpegCommand

  ##### Example:

      var command = ffmpeg('/path/to/source.avi')
          .audioCodec('libfaac')
          .videoCodec('libx264')
          .format('mp4');

        command.clone()
          .size('320x200')
          .save('/path/to/output-small.mp4');

        command.clone()
          .size('640x400')
          .save('/path/to/output-medium.mp4');

        command.save('/path/to/output-original-size.mp4');

#### setFfmpegPath(ffmpegPath)

  Manually define the ffmpeg binary full path.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `ffmpegPath` | String | The full path to the ffmpeg binary.

  Source:
    - capabilities.js, line 25

  ##### Returns:

  FfmpegCommand

#### setFfprobePath(ffprobePath)

  Manually define the ffprobe binary full path.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `ffprobePath` | String | The full path to the ffprobe binary.

  Source:
    - capabilities.js, line 38

  ##### Returns:

  FfmpegCommand

#### setFlvtoolPath(flvtool)

  Manually define the flvtool2/flvmeta binary full path.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `flvtool` | String | The full path to the flvtool2 or flvmeta binary.

  Source:
    - capabilities.js, line 51

  ##### Returns:

  FfmpegCommand

### Output methods

#### addOutput(target, pipeopts)

  Alias for FfmpegCommand#output

#### duration(duration)

  Set output duration

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `duration` | String | Number | duration in seconds or as a '[[hh:]mm:]ss[.xxx]' string

  Source:
    - options/output.js, line 96

  ##### Returns:

  FfmpegCommand

  ##### Aliases:

  - withDuration
  - setDuration

#### flvmeta()

  Run flvtool2/flvmeta on output

  Source:
    - options/output.js, line 148

  ##### Returns:

  FfmpegCommand

  ##### Alias:

  updateFlvMetadata

#### format(format)

  Set output format

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `format` | String | output format name

  Source:
    - options/output.js, line 114

  ##### Returns:

  FfmpegCommand

  ##### Aliases:

  - toFormat
  - withOutputFormat
  - outputFormat

#### map(spec)

  Add stream mapping to output

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `spec` | String | stream specification string, with optional square brackets

  Source:
    - options/output.js, line 133

  ##### Returns:

  FfmpegCommand

#### output(target, pipeopts)

  Add output

  ##### Parameters:

  Name | Type | Argument | Default | Description
  --- | --- | --- | --- | ---
  `target` | String | Writable |  |  | target file path or writable stream
  `pipeopts` | Object | <optional> | {} | pipe options (only applies to streams)

  Source:
    - options/output.js, line 12

  ##### Returns:

  FfmpegCommand

  ##### Alias:

  addOutput

#### outputFormat(format)

  Alias for FfmpegCommand#format

#### setDuration(duration)

  Alias for FfmpegCommand#duration

#### toFormat(format)

  Alias for FfmpegCommand#format

#### updateFlvMetadata()

  Alias for FfmpegCommand#flvmeta

#### withDuration(duration)

  Alias for FfmpegCommand#duration

#### withOutputFormat(format)

  Alias for FfmpegCommand#format

### Processing methods

#### concat(target, options)

  Merge (concatenate) inputs to a single file

  ##### Parameters:

  Name | Type | Argument | Description
  --- | --- | --- | ---
  `target` | String | Writable |  | output file or writable stream
  `options` | Object | <optional> | pipe options (only used when outputting to a writable stream)

  Source:
    - recipes.js, line 408

  ##### Returns:

  FfmpegCommand

  ##### Aliases:

  - concatenate
  - mergeToFile

#### concatenate(target, options)

  Alias for FfmpegCommand#concat

#### exec()

  Alias for FfmpegCommand#run

#### execute()

  Alias for FfmpegCommand#run

#### kill(signal)

  Kill current ffmpeg process, if any

  ##### Parameters:

  Name | Type | Argument | Default | Description
  --- | --- | --- | --- | ---
  `signal` | String | <optional> | SIGKILL | signal name

  Source:
    - processor.js, line 640

  ##### Returns:

  FfmpegCommand

#### mergeToFile(target, options)

  Alias for FfmpegCommand#concat

#### pipe(stream, options)

  Execute ffmpeg command and save output to a stream

  If 'stream' is not specified, a PassThrough stream is created and returned. 'options' will be used when piping ffmpeg output to the output stream (@see http://nodejs.org/api/stream.html#stream_readable_pipe_destination_options)

  ##### Parameters:

  Name | Type | Argument | Default | Description
  --- | --- | --- | --- | ---
  `stream` | stream.Writable | <optional> |  | output stream
  `options` | Object | <optional> | {} | pipe options

  Source:
    - recipes.js, line 33

  ##### Returns:

  Output stream

  ##### Aliases:

  - stream
  - writeToStream

#### renice(niceness)

  Renice current and/or future ffmpeg processes

  Ignored on Windows platforms.

  ##### Parameters:

  Name | Type | Argument | Default | Description
  --- | --- | --- | --- | ---
  `niceness` | Number | <optional> | 0 | niceness value between -20 (highest priority) and 20 (lowest priority)

  Source:
    - processor.js, line 593

  ##### Returns:

  FfmpegCommand

#### run()

  Run ffmpeg command

  Source:
    - processor.js, line 381

  ##### Aliases:

  - exec
  - execute

#### save(output)

  Execute ffmpeg command and save output to a file

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `output` | String | file path

  Source:
    - recipes.js, line 16

  ##### Returns:

  FfmpegCommand

  ##### Alias:

  saveToFile

#### saveToFile(output)

  Alias for FfmpegCommand#save

#### screenshot(config, folder)

  Alias for FfmpegCommand#screenshots

#### screenshots(config, folder)

  Generate images from a video

  Note: this method makes the command emit a 'filenames' event with an array of the generated image filenames.

  ##### Parameters:

  Name | Type | Argument | Default | Description
  --- | --- | --- | --- | ---

  `config`

  Number | Object

  <optional>

  1

  screenshot count or configuration object with the following keys:

  ###### Properties

  Name | Type | Argument | Default | Description
  --- | --- | --- | --- | ---
  `count` | Number | <optional> |  | number of screenshots to take; using this option takes screenshots at regular intervals (eg. count=4 would take screens at 20%, 40%, 60% and 80% of the video length).
  `folder` | String | <optional> | '.' | output folder

  `filename`

  String

  <optional>

  'tn.png'

  output filename pattern, may contain the following tokens:
  - '%s': offset in seconds
  - '%w': screenshot width
  - '%h': screenshot height
  - '%r': screenshot resolution (same as '%wx%h')
  - '%f': input filename
  - '%b': input basename (filename w/o extension)
  - '%i': index of screenshot in timemark array (can be zero-padded by using it like `%000i`)

  `timemarks` | Array.<Number> | Array.<String> | <optional> |  | array of timemarks to take screenshots at; each timemark may be a number of seconds, a '[[hh:]mm:]ss[.xxx]' string or a 'XX%' string. Overrides 'count' if present.
  `timestamps` | Array.<Number> | Array.<String> | <optional> |  | alias for 'timemarks'
  `fastSeek` | Boolean | <optional> |  | use fast seek (less accurate)
  `size` | String | <optional> |  | screenshot size, with the same syntax as FfmpegCommand#size

  `folder` | String | <optional> |  | output folder (legacy alias for 'config.folder')

  Source:
    - recipes.js, line 69

  ##### Returns:

  FfmpegCommand

  ##### Aliases:

  - takeScreenshots
  - thumbnail
  - thumbnails
  - screenshot

#### stream(stream, options)

  Alias for FfmpegCommand#pipe

#### takeScreenshots(config, folder)

  Alias for FfmpegCommand#screenshots

#### thumbnail(config, folder)

  Alias for FfmpegCommand#screenshots

#### thumbnails(config, folder)

  Alias for FfmpegCommand#screenshots

#### writeToStream(stream, options)

  Alias for FfmpegCommand#pipe

### Video methods

#### fps(fps)

  Specify output FPS

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `fps` | Number | output FPS

  Source:
    - options/video.js, line 141

  ##### Returns:

  FfmpegCommand

  ##### Aliases:

  - withOutputFps
  - withOutputFPS
  - withFpsOutput
  - withFPSOutput
  - withFps
  - withFPS
  - outputFPS
  - outputFps
  - fpsOutput
  - FPSOutput
  - FPS

#### FPS(fps)

  Alias for FfmpegCommand#fps

#### fpsOutput(fps)

  Alias for FfmpegCommand#fps

#### FPSOutput(fps)

  Alias for FfmpegCommand#fps

#### frames(frames)

  Only transcode a certain number of frames

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `frames` | Number | frame count

  Source:
    - options/video.js, line 168

  ##### Returns:

  FfmpegCommand

  ##### Aliases:

  - takeFrames
  - withFrames

#### noVideo()

  Disable video in the output

  Source:
    - options/video.js, line 12

  ##### Returns:

  FfmpegCommand

  ##### Alias:

  withNoVideo

#### outputFps(fps)

  Alias for FfmpegCommand#fps

#### outputFPS(fps)

  Alias for FfmpegCommand#fps

#### takeFrames(frames)

  Alias for FfmpegCommand#frames

#### videoBitrate(bitrate, constant)

  Specify video bitrate

  ##### Parameters:

  Name | Type | Argument | Default | Description
  --- | --- | --- | --- | ---
  `bitrate` | String | Number |  |  | video bitrate in kbps (with an optional 'k' suffix)
  `constant` | Boolean | <optional> | false | enforce constant bitrate

  Source:
    - options/video.js, line 48

  ##### Returns:

  FfmpegCommand

  ##### Alias:

  withVideoBitrate

#### videoCodec(codec)

  Specify video codec

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `codec` | String | video codec name

  Source:
    - options/video.js, line 31

  ##### Returns:

  FfmpegCommand

  ##### Alias:

  withVideoCodec

#### videoFilter(filters)

  Alias for FfmpegCommand#videoFilters

#### videoFilters(filters)

  Specify custom video filter(s)

  Can be called both with one or many filters, or a filter array.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---

  `filters`

  String | Array.<String> | Array.<Object>

  video filter strings, string array or filter specification array, each with the following properties:

  ###### Properties

  Name | Type | Argument | Description
  --- | --- | --- | ---
  `filter` | String |  | filter name
  `options` | String | Array.<String> | Object | <optional> | filter option string, array, or object

  Source:
    - options/video.js, line 76

  ##### Returns:

  FfmpegCommand

  ##### Examples:

      command.videoFilters('filter1');

      command.videoFilters('filter1', 'filter2=param1=value1:param2=value2');

      command.videoFilters(['filter1', 'filter2']);

      command.videoFilters([
        {
          filter: 'filter1'
        },
        {
          filter: 'filter2',
          options: 'param=value:param=value'
        }
      ]);

      command.videoFilters(
        {
          filter: 'filter1',
          options: ['value1', 'value2']
        },
        {
          filter: 'filter2',
          options: { param1: 'value1', param2: 'value2' }
        }
      );

  ##### Aliases:

  - withVideoFilter
  - withVideoFilters
  - videoFilter

#### withFPS(fps)

  Alias for FfmpegCommand#fps

#### withFps(fps)

  Alias for FfmpegCommand#fps

#### withFPSOutput(fps)

  Alias for FfmpegCommand#fps

#### withFpsOutput(fps)

  Alias for FfmpegCommand#fps

#### withFrames(frames)

  Alias for FfmpegCommand#frames

#### withNoVideo()

  Alias for FfmpegCommand#noVideo

#### withOutputFps(fps)

  Alias for FfmpegCommand#fps

#### withOutputFPS(fps)

  Alias for FfmpegCommand#fps

#### withVideoBitrate(bitrate, constant)

  Alias for FfmpegCommand#videoBitrate

#### withVideoCodec(codec)

  Alias for FfmpegCommand#videoCodec

#### withVideoFilter(filters)

  Alias for FfmpegCommand#videoFilters

#### withVideoFilters(filters)

  Alias for FfmpegCommand#videoFilters

### Video size methods

#### applyAutoPad(pad, color)

  Alias for FfmpegCommand#autopad

#### applyAutopad(pad, color)

  Alias for FfmpegCommand#autopad

#### applyAutoPadding(pad, color)

  Alias for FfmpegCommand#autopad

#### applyAutopadding(pad, color)

  Alias for FfmpegCommand#autopad

#### aspect(aspect)

  Set output aspect ratio

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `aspect` | String | Number | aspect ratio (number or 'X:Y' string)

  Source:
    - options/videosize.js, line 218

  ##### Returns:

  FfmpegCommand

  ##### Aliases:

  - withAspect
  - withAspectRatio
  - setAspect
  - setAspectRatio
  - aspectRatio

#### aspectRatio(aspect)

  Alias for FfmpegCommand#aspect

#### autopad(pad, color)

  Enable auto-padding the output

  ##### Parameters:

  Name | Type | Argument | Default | Description
  --- | --- | --- | --- | ---
  `pad` | Boolean | <optional> | true | enable/disable auto-padding
  `color` | String | <optional> | 'black' | pad color

  Source:
    - options/videosize.js, line 253

  ##### Aliases:

  - applyAutopadding
  - applyAutoPadding
  - applyAutopad
  - applyAutoPad
  - withAutopadding
  - withAutoPadding
  - withAutopad
  - withAutoPad
  - autoPad

#### autoPad(pad, color)

  Alias for FfmpegCommand#autopad

#### keepDAR()

  Keep display aspect ratio

  This method is useful when converting an input with non-square pixels to an output format that does not support non-square pixels. It rescales the input so that the display aspect ratio is the same.

  Source:
    - options/videosize.js, line 155

  ##### Returns:

  FfmpegCommand

  ##### Aliases:

  - keepPixelAspect
  - keepDisplayAspect
  - keepDisplayAspectRatio

#### keepDisplayAspect()

  Alias for FfmpegCommand#keepDAR

#### keepDisplayAspectRatio()

  Alias for FfmpegCommand#keepDAR

#### keepPixelAspect()

  Alias for FfmpegCommand#keepDAR

#### setAspect(aspect)

  Alias for FfmpegCommand#aspect

#### setAspectRatio(aspect)

  Alias for FfmpegCommand#aspect

#### setSize(size)

  Alias for FfmpegCommand#size

#### size(size)

  Set output size

  The 'size' parameter can have one of 4 forms:

  - 'X%': rescale to xx % of the original size
  - 'WxH': specify width and height
  - 'Wx?': specify width and compute height from input aspect ratio
  - '?xH': specify height and compute width from input aspect ratio

  Note: both dimensions will be truncated to multiples of 2.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `size` | String | size string, eg. '33%', '320x240', '320x?', '?x240'

  Source:
    - options/videosize.js, line 188

  ##### Returns:

  FfmpegCommand

  ##### Aliases:

  - withSize
  - setSize

#### withAspect(aspect)

  Alias for FfmpegCommand#aspect

#### withAspectRatio(aspect)

  Alias for FfmpegCommand#aspect

#### withAutoPad(pad, color)

  Alias for FfmpegCommand#autopad

#### withAutopad(pad, color)

  Alias for FfmpegCommand#autopad

#### withAutopadding(pad, color)

  Alias for FfmpegCommand#autopad

#### withAutoPadding(pad, color)

  Alias for FfmpegCommand#autopad

#### withSize(size)

  Alias for FfmpegCommand#size

### Type Definitions

#### codecCallback(err, codecs)

  A callback passed to FfmpegCommand#availableCodecs.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `err` | Error | null | error object or null if no error happened

  `codecs`

  Object

  codec object with codec names as keys and the following properties for each codec (more properties may be available depending on the ffmpeg version used):

  ###### Properties

  Name | Type | Description
  --- | --- | ---
  `description` | String | codec description
  `canDecode` | Boolean | whether the codec is able to decode streams
  `canEncode` | Boolean | whether the codec is able to encode streams

  Source:
    - capabilities.js, line 330

#### encodersCallback(err, encoders)

  A callback passed to FfmpegCommand#availableEncoders.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `err` | Error | null | error object or null if no error happened

  `encoders`

  Object

  encoders object with encoder names as keys and the following properties for each encoder:

  ###### Properties

  Name | Type | Description
  --- | --- | ---
  `description` | String | codec description
  `type` | Boolean | "audio", "video" or "subtitle"
  `frameMT` | Boolean | whether the encoder is able to do frame-level multithreading
  `sliceMT` | Boolean | whether the encoder is able to do slice-level multithreading
  `experimental` | Boolean | whether the encoder is experimental
  `drawHorizBand` | Boolean | whether the encoder supports draw_horiz_band
  `directRendering` | Boolean | whether the encoder supports direct encoding method 1

  Source:
    - capabilities.js, line 429

#### ffprobeCallback(err, ffprobeData)

  A callback passed to the FfmpegCommand#ffprobe method.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `err` | Error | null | error object or null if no error happened

  `ffprobeData`

  Object

  ffprobe output data; this object has the same format as what the following command returns:

      `ffprobe -print_format json -show_streams -show_format INPUTFILE`

  ###### Properties

  Name | Type | Description
  --- | --- | ---
  `streams` | Array | stream information
  `format` | Object | format information

  Source:
    - ffprobe.js, line 71

#### filterCallback(err, filters)

  A callback passed to FfmpegCommand#availableFilters.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `err` | Error | null | error object or null if no error happened

  `filters`

  Object

  filter object with filter names as keys and the following properties for each filter:

  ###### Properties

  Name | Type | Description
  --- | --- | ---
  `description` | String | filter description
  `input` | String | input type, one of 'audio', 'video' and 'none'
  `multipleInputs` | Boolean | whether the filter supports multiple inputs
  `output` | String | output type, one of 'audio', 'video' and 'none'
  `multipleOutputs` | Boolean | whether the filter supports multiple outputs

  Source:
    - capabilities.js, line 273

#### formatCallback(err, formats)

  A callback passed to FfmpegCommand#availableFormats.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `err` | Error | null | error object or null if no error happened

  `formats`

  Object

  format object with format names as keys and the following properties for each format:

  ###### Properties

  Name | Type | Description
  --- | --- | ---
  `description` | String | format description
  `canDemux` | Boolean | whether the format is able to demux streams from an input file
  `canMux` | Boolean | whether the format is able to mux streams into an output file

  Source:
    - capabilities.js, line 489

### Events

#### codecData

  Emitted when ffmpeg reports input codec data

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---

  `codecData`

  Object

  codec data object

  ###### Properties

  Name | Type | Description
  --- | --- | ---
  `format` | String | input format name
  `audio` | String | input audio codec name
  `audio_details` | String | input audio codec parameters
  `video` | String | input video codec name
  `video_details` | String | input video codec parameters

  Source:
    - processor.js, line 58

#### end

  Emitted when a command finishes processing

  ##### Parameters:

  Name | Type | Argument | Description
  --- | --- | --- | ---
  `filenames|stdout` | Array | String | null | <optional> | generated filenames when taking screenshots, ffmpeg stdout when not outputting to a stream, null otherwise
  `stderr` | String | null |  | ffmpeg stderr

  Source:
    - processor.js, line 79

#### error

  Emitted when an error happens when preparing or running a command

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `error` | Error | error object
  `stdout` | String | null | ffmpeg stdout, unless outputting to a stream
  `stderr` | String | null | ffmpeg stderr

  Source:
    - processor.js, line 70

#### progress

  Emitted when ffmpeg reports progress information

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---

  `progress`

  Object

  progress object

  ###### Properties

  Name | Type | Argument | Description
  --- | --- | --- | ---
  `frames` | Number |  | number of frames transcoded
  `currentFps` | Number |  | current processing speed in frames per second
  `currentKbps` | Number |  | current output generation speed in kilobytes per second
  `targetSize` | Number |  | current output file size
  `timemark` | String |  | current video timemark
  `percent` | Number | <optional> | processing progress (may not be available depending on input)

  Source:
    - processor.js, line 38

#### start

  Emitted just after ffmpeg has been spawned.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `command` | String | ffmpeg command line

  Source:
    - processor.js, line 31

#### stderr

  Emitted when ffmpeg outputs to stderr

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `line` | String | stderr output line

  Source:
    - processor.js, line 51