index.html 67 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>JSDoc: Index</title>
  6. <script src="scripts/prettify/prettify.js"> </script>
  7. <script src="scripts/prettify/lang-css.js"> </script>
  8. <!--[if lt IE 9]>
  9. <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
  10. <![endif]-->
  11. <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
  12. <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
  13. </head>
  14. <body>
  15. <div id="main">
  16. <h1 class="page-title">Index</h1>
  17. <h3> </h3>
  18. <section>
  19. <article><h1>Fluent ffmpeg-API for node.js <a href="http://travis-ci.org/fluent-ffmpeg/node-fluent-ffmpeg"><img src="https://secure.travis-ci.org/fluent-ffmpeg/node-fluent-ffmpeg.svg?branch=master" alt="Build Status"></a></h1><p>This library abstracts the complex command-line usage of ffmpeg into a fluent, easy to use node.js module. In order to be able to use this module, make sure you have <a href="http://www.ffmpeg.org">ffmpeg</a> installed on your system (including all necessary encoding libraries like libmp3lame or libx264).</p>
  20. <blockquote>
  21. <p>This is the documentation for fluent-ffmpeg 2.x.
  22. You can still access the code and documentation for fluent-ffmpeg 1.7 <a href="https://github.com/fluent-ffmpeg/node-fluent-ffmpeg/tree/1.x">here</a>.</p>
  23. </blockquote>
  24. <a name="installation"></a><h2>Installation</h2><p>Via npm:</p>
  25. <pre class="prettyprint source lang-sh"><code>$ npm install fluent-ffmpeg</code></pre><p>Or as a submodule:</p>
  26. <pre class="prettyprint source lang-sh"><code>$ git submodule add git://github.com/schaermu/node-fluent-ffmpeg.git vendor/fluent-ffmpeg</code></pre><a name="usage"></a><h2>Usage</h2><p>You will find a lot of usage examples (including a real-time streaming example using <a href="http://www.flowplayer.org">flowplayer</a> and <a href="https://github.com/visionmedia/express">express</a>!) in the <code>examples</code> folder.</p>
  27. <a name="prerequisites"></a><h3>Prerequisites</h3><h4>ffmpeg and ffprobe</h4><p>fluent-ffmpeg requires ffmpeg &gt;= 0.9 to work. It may work with previous versions but several features won't be available (and the library is not tested with lower versions anylonger).</p>
  28. <p>If the <code>FFMPEG_PATH</code> environment variable is set, fluent-ffmpeg will use it as the full path to the <code>ffmpeg</code> executable. Otherwise, it will attempt to call <code>ffmpeg</code> directly (so it should be in your <code>PATH</code>). You must also have ffprobe installed (it comes with ffmpeg in most distributions). Similarly, fluent-ffmpeg will use the <code>FFPROBE_PATH</code> environment variable if it is set, otherwise it will attempt to call it in the <code>PATH</code>.</p>
  29. <p>Most features should work when using avconv and avprobe instead of ffmpeg and ffprobe, but they are not officially supported at the moment.</p>
  30. <p><strong>Windows users</strong>: most probably ffmpeg and ffprobe will <em>not</em> be in your <code>%PATH</code>, so you <em>must</em> set <code>%FFMPEG_PATH</code> and <code>%FFPROBE_PATH</code>.</p>
  31. <p><strong>Debian/Ubuntu users</strong>: the official repositories have the ffmpeg/ffprobe executable in the <code>libav-tools</code> package, and they are actually rebranded avconv/avprobe executables (avconv is a fork of ffmpeg). They should be mostly compatible, but should you encounter any issue, you may want to use the real ffmpeg instead. You can either compile it from source or find a pre-built .deb package at https://ffmpeg.org/download.html (For Ubuntu, the <code>ppa:jon-severinsson/ffmpeg</code> PPA provides recent builds).</p>
  32. <h4>flvtool2 or flvmeta</h4><p>If you intend to encode FLV videos, you must have either flvtool2 or flvmeta installed and in your <code>PATH</code> or fluent-ffmpeg won't be able to produce streamable output files. If you set either the <code>FLVTOOL2_PATH</code> or <code>FLVMETA_PATH</code>, fluent-ffmpeg will try to use it instead of searching in the <code>PATH</code>.</p>
  33. <h4>Setting binary paths manually</h4><p>Alternatively, you may set the ffmpeg, ffprobe and flvtool2/flvmeta binary paths manually by using the following API commands:</p>
  34. <ul>
  35. <li><strong>Ffmpeg.setFfmpegPath(path)</strong> Argument <code>path</code> is a string with the full path to the ffmpeg binary.</li>
  36. <li><strong>Ffmpeg.setFfprobePath(path)</strong> Argument <code>path</code> is a string with the full path to the ffprobe binary.</li>
  37. <li><strong>Ffmpeg.setFlvtoolPath(path)</strong> Argument <code>path</code> is a string with the full path to the flvtool2 or flvmeta binary.</li>
  38. </ul>
  39. <a name="creating-an-ffmpeg-command"></a><h3>Creating an FFmpeg command</h3><p>The fluent-ffmpeg module returns a constructor that you can use to instanciate FFmpeg commands.</p>
  40. <pre class="prettyprint source lang-js"><code>var FfmpegCommand = require('fluent-ffmpeg');
  41. var command = new FfmpegCommand();</code></pre><p>You can also use the constructor without the <code>new</code> operator.</p>
  42. <pre class="prettyprint source lang-js"><code>var ffmpeg = require('fluent-ffmpeg');
  43. var command = ffmpeg();</code></pre><p>You may pass an input file name or readable stream, a configuration object, or both to the constructor.</p>
  44. <pre class="prettyprint source lang-js"><code>var command = ffmpeg('/path/to/file.avi');
  45. var command = ffmpeg(fs.createReadStream('/path/to/file.avi'));
  46. var command = ffmpeg({ option: &quot;value&quot;, ... });
  47. var command = ffmpeg('/path/to/file.avi', { option: &quot;value&quot;, ... });</code></pre><p>The following options are available:</p>
  48. <ul>
  49. <li><code>source</code>: input file name or readable stream (ignored if an input file is passed to the constructor)</li>
  50. <li><code>timeout</code>: ffmpeg timeout in seconds (defaults to no timeout)</li>
  51. <li><code>preset</code> or <code>presets</code>: directory to load module presets from (defaults to the <code>lib/presets</code> directory in fluent-ffmpeg tree)</li>
  52. <li><code>niceness</code> or <code>priority</code>: ffmpeg niceness value, between -20 and 20; ignored on Windows platforms (defaults to 0)</li>
  53. <li><code>logger</code>: logger object with <code>debug()</code>, <code>info()</code>, <code>warn()</code> and <code>error()</code> methods (defaults to no logging)</li>
  54. <li><code>stdoutLines</code>: maximum number of lines from ffmpeg stdout/stderr to keep in memory (defaults to 100, use 0 for unlimited storage)</li>
  55. </ul>
  56. <a name="specifying-inputs"></a><h3>Specifying inputs</h3><p>You can add any number of inputs to an Ffmpeg command. An input can be:</p>
  57. <ul>
  58. <li>a file name (eg. <code>/path/to/file.avi</code>);</li>
  59. <li>an image pattern (eg. <code>/path/to/frame%03d.png</code>);</li>
  60. <li>a readable stream; only one input stream may be used for a command, but you can use both an input stream and one or several file names.</li>
  61. </ul>
  62. <pre class="prettyprint source lang-js"><code>// Note that all fluent-ffmpeg methods are chainable
  63. ffmpeg('/path/to/input1.avi')
  64. .input('/path/to/input2.avi')
  65. .input(fs.createReadStream('/path/to/input3.avi'));
  66. // Passing an input to the constructor is the same as calling .input()
  67. ffmpeg()
  68. .input('/path/to/input1.avi')
  69. .input('/path/to/input2.avi');
  70. // Most methods have several aliases, here you may use addInput or mergeAdd instead
  71. ffmpeg()
  72. .addInput('/path/to/frame%02d.png')
  73. .addInput('/path/to/soundtrack.mp3');
  74. ffmpeg()
  75. .mergeAdd('/path/to/input1.avi')
  76. .mergeAdd('/path/to/input2.avi');</code></pre><a name="input-options"></a><h3>Input options</h3><p>The following methods enable passing input-related options to ffmpeg. Each of these methods apply on the last input added (including the one passed to the constructor, if any). You must add an input before calling those, or an error will be thrown.</p>
  77. <h4>inputFormat(format): specify input format</h4><p><strong>Aliases</strong>: <code>fromFormat()</code>, <code>withInputFormat()</code>.</p>
  78. <p>This is only useful for raw inputs, as ffmpeg can determine the input format automatically.</p>
  79. <pre class="prettyprint source lang-js"><code>ffmpeg()
  80. .input('/dev/video0')
  81. .inputFormat('mov')
  82. .input('/path/to/file.avi')
  83. .inputFormat('avi');</code></pre><p>Fluent-ffmpeg checks for format availability before actually running the command, and throws an error when a specified input format is not available.</p>
  84. <h4>inputFPS(fps): specify input framerate</h4><p><strong>Aliases</strong>: <code>withInputFps()</code>, <code>withInputFPS()</code>, <code>withFpsInput()</code>, <code>withFPSInput()</code>, <code>inputFps()</code>, <code>fpsInput()</code>, <code>FPSInput()</code>.</p>
  85. <p>This is only valid for raw inputs, as ffmpeg can determine the input framerate automatically.</p>
  86. <pre class="prettyprint source lang-js"><code>ffmpeg('/dev/video0').inputFPS(29.7);</code></pre><h4>native(): read input at native framerate</h4><p><strong>Aliases</strong>: <code>nativeFramerate()</code>, <code>withNativeFramerate()</code>.</p>
  87. <pre class="prettyprint source lang-js"><code>ffmpeg('/path/to/file.avi').native();</code></pre><h4>seekInput(time): set input start time</h4><p><strong>Alias</strong>: <code>setStartTime()</code>.</p>
  88. <p>Seeks an input and only start decoding at given time offset. The <code>time</code> argument may be a number (in seconds) or a timestamp string (with format <code>[[hh:]mm:]ss[.xxx]</code>).</p>
  89. <pre class="prettyprint source lang-js"><code>ffmpeg('/path/to/file.avi').seekInput(134.5);
  90. ffmpeg('/path/to/file.avi').seekInput('2:14.500');</code></pre><h4>loop([duration]): loop over input</h4><pre class="prettyprint source lang-js"><code>ffmpeg('/path/to/file.avi').loop();
  91. ffmpeg('/path/to/file.avi').loop(134.5);
  92. ffmpeg('/path/to/file.avi').loop('2:14.500');</code></pre><h4>inputOptions(option...): add custom input options</h4><p><strong>Aliases</strong>: <code>inputOption()</code>, <code>addInputOption()</code>, <code>addInputOptions()</code>, <code>withInputOption()</code>, <code>withInputOptions()</code>.</p>
  93. <p>This method allows passing any input-related option to ffmpeg. You can call it with a single argument to pass a single option, optionnaly with a space-separated parameter:</p>
  94. <pre class="prettyprint source lang-js"><code>/* Single option */
  95. ffmpeg('/path/to/file.avi').inputOptions('-someOption');
  96. /* Single option with parameter */
  97. ffmpeg('/dev/video0').inputOptions('-r 24');</code></pre><p>You may also pass multiple options at once by passing an array to the method:</p>
  98. <pre class="prettyprint source lang-js"><code>ffmpeg('/path/to/file.avi').inputOptions([
  99. '-option1',
  100. '-option2 param2',
  101. '-option3',
  102. '-option4 param4'
  103. ]);</code></pre><p>Finally, you may also directly pass command line tokens as separate arguments to the method:</p>
  104. <pre class="prettyprint source lang-js"><code>ffmpeg('/path/to/file.avi').inputOptions(
  105. '-option1',
  106. '-option2', 'param2',
  107. '-option3',
  108. '-option4', 'param4'
  109. );</code></pre><a name="audio-options"></a><h3>Audio options</h3><p>The following methods change the audio stream(s) in the produced output.</p>
  110. <h4>noAudio(): disable audio altogether</h4><p><strong>Aliases</strong>: <code>withNoAudio()</code>.</p>
  111. <p>Disables audio in the output and remove any previously set audio option.</p>
  112. <pre class="prettyprint source lang-js"><code>ffmpeg('/path/to/file.avi').noAudio();</code></pre><h4>audioCodec(codec): set audio codec</h4><p><strong>Aliases</strong>: <code>withAudioCodec()</code>.</p>
  113. <pre class="prettyprint source lang-js"><code>ffmpeg('/path/to/file.avi').audioCodec('libmp3lame');</code></pre><p>Fluent-ffmpeg checks for codec availability before actually running the command, and throws an error when a specified audio codec is not available.</p>
  114. <h4>audioBitrate(bitrate): set audio bitrate</h4><p><strong>Aliases</strong>: <code>withAudioBitrate()</code>.</p>
  115. <p>Sets the audio bitrate in kbps. The <code>bitrate</code> parameter may be a number or a string with an optional <code>k</code> suffix. This method is used to enforce a constant bitrate; use <code>audioQuality()</code> to encode using a variable bitrate.</p>
  116. <pre class="prettyprint source lang-js"><code>ffmpeg('/path/to/file.avi').audioBitrate(128);
  117. ffmpeg('/path/to/file.avi').audioBitrate('128');
  118. ffmpeg('/path/to/file.avi').audioBitrate('128k');</code></pre><h4>audioChannels(count): set audio channel count</h4><p><strong>Aliases</strong>: <code>withAudioChannels()</code>.</p>
  119. <pre class="prettyprint source lang-js"><code>ffmpeg('/path/to/file.avi').audioChannels(2);</code></pre><h4>audioFrequency(freq): set audio frequency</h4><p><strong>Aliases</strong>: <code>withAudioFrequency()</code>.</p>
  120. <p>The <code>freq</code> parameter specifies the audio frequency in Hz.</p>
  121. <pre class="prettyprint source lang-js"><code>ffmpeg('/path/to/file.avi').audioFrequency(22050);</code></pre><h4>audioQuality(quality): set audio quality</h4><p><strong>Aliases</strong>: <code>withAudioQuality()</code>.</p>
  122. <p>This method fixes a quality factor for the audio codec (VBR encoding). The quality scale depends on the actual codec used.</p>
  123. <pre class="prettyprint source lang-js"><code>ffmpeg('/path/to/file.avi')
  124. .audioCodec('libmp3lame')
  125. .audioQuality(0);</code></pre><h4>audioFilters(filter...): add custom audio filters</h4><p><strong>Aliases</strong>: <code>audioFilter()</code>, <code>withAudioFilter()</code>, <code>withAudioFilters()</code>.</p>
  126. <p>This method enables adding custom audio filters. You may add multiple filters at once by passing either several arguments or an array. See the Ffmpeg documentation for available filters and their syntax.</p>
  127. <p>Each filter pased to this method can be either a filter string (eg. <code>volume=0.5</code>) or a filter specification object with the following keys:</p>
  128. <ul>
  129. <li><code>filter</code>: filter name</li>
  130. <li><code>options</code>: optional; either an option string for the filter (eg. <code>n=-50dB:d=5</code>), an options array for unnamed options (eg. <code>['-50dB', 5]</code>) or an object mapping option names to values (eg. <code>{ n: '-50dB', d: 5 }</code>). When <code>options</code> is not specified, the filter will be added without any options.</li>
  131. </ul>
  132. <pre class="prettyprint source lang-js"><code>ffmpeg('/path/to/file.avi')
  133. .audioFilters('volume=0.5')
  134. .audioFilters('silencedetect=n=-50dB:d=5');
  135. ffmpeg('/path/to/file.avi')
  136. .audioFilters('volume=0.5', 'silencedetect=n=-50dB:d=5');
  137. ffmpeg('/path/to/file.avi')
  138. .audioFilters(['volume=0.5', 'silencedetect=n=-50dB:d=5']);
  139. ffmpeg('/path/to/file.avi')
  140. .audioFilters([
  141. {
  142. filter: 'volume',
  143. options: '0.5'
  144. },
  145. {
  146. filter: 'silencedetect',
  147. options: 'n=-50dB:d=5'
  148. }
  149. ]);
  150. ffmpeg('/path/to/file.avi')
  151. .audioFilters(
  152. {
  153. filter: 'volume',
  154. options: ['0.5']
  155. },
  156. {
  157. filter: 'silencedetect',
  158. options: { n: '-50dB', d: 5 }
  159. }
  160. ]);</code></pre><a name="video-options"></a><h3>Video options</h3><p>The following methods change the video stream(s) in the produced output.</p>
  161. <h4>noVideo(): disable video altogether</h4><p><strong>Aliases</strong>: <code>withNoVideo()</code>.</p>
  162. <p>This method disables video output and removes any previously set video option.</p>
  163. <pre class="prettyprint source lang-js"><code>ffmpeg('/path/to/file.avi').noVideo();</code></pre><h4>videoCodec(codec): set video codec</h4><p><strong>Aliases</strong>: <code>withVideoCodec()</code>.</p>
  164. <pre class="prettyprint source lang-js"><code>ffmpeg('/path/to/file.avi').videoCodec('libx264');</code></pre><p>Fluent-ffmpeg checks for codec availability before actually running the command, and throws an error when a specified video codec is not available.</p>
  165. <h4>videoBitrate(bitrate[, constant=false]): set video bitrate</h4><p><strong>Aliases</strong>: <code>withVideoBitrate()</code>.</p>
  166. <p>Sets the target video bitrate in kbps. The <code>bitrate</code> argument may be a number or a string with an optional <code>k</code> suffix. The <code>constant</code> argument specifies whether a constant bitrate should be enforced (defaults to false).</p>
  167. <p>Keep in mind that, depending on the codec used, enforcing a constant bitrate often comes at the cost of quality. The best way to have a constant video bitrate without losing too much quality is to use 2-pass encoding (see Fffmpeg documentation).</p>
  168. <pre class="prettyprint source lang-js"><code>ffmpeg('/path/to/file.avi').videoBitrate(1000);
  169. ffmpeg('/path/to/file.avi').videoBitrate('1000');
  170. ffmpeg('/path/to/file.avi').videoBitrate('1000k');
  171. ffmpeg('/path/to/file.avi').videoBitrate('1000k', true);</code></pre><h4>videoFilters(filter...): add custom video filters</h4><p><strong>Aliases</strong>: <code>videoFilter()</code>, <code>withVideoFilter()</code>, <code>withVideoFilters()</code>.</p>
  172. <p>This method enables adding custom video filters. You may add multiple filters at once by passing either several arguments or an array. See the Ffmpeg documentation for available filters and their syntax.</p>
  173. <p>Each filter pased to this method can be either a filter string (eg. <code>fade=in:0:30</code>) or a filter specification object with the following keys:</p>
  174. <ul>
  175. <li><code>filter</code>: filter name</li>
  176. <li><code>options</code>: optional; either an option string for the filter (eg. <code>in:0:30</code>), an options array for unnamed options (eg. <code>['in', 0, 30]</code>) or an object mapping option names to values (eg. <code>{ t: 'in', s: 0, n: 30 }</code>). When <code>options</code> is not specified, the filter will be added without any options.</li>
  177. </ul>
  178. <pre class="prettyprint source lang-js"><code>ffmpeg('/path/to/file.avi')
  179. .videoFilters('fade=in:0:30')
  180. .videoFilters('pad=640:480:0:40:violet');
  181. ffmpeg('/path/to/file.avi')
  182. .videoFilters('fade=in:0:30', 'pad=640:480:0:40:violet');
  183. ffmpeg('/path/to/file.avi')
  184. .videoFilters(['fade=in:0:30', 'pad=640:480:0:40:violet']);
  185. ffmpeg('/path/to/file.avi')
  186. .videoFilters([
  187. {
  188. filter: 'fade',
  189. options: 'in:0:30'
  190. },
  191. {
  192. filter: 'pad',
  193. options: '640:480:0:40:violet'
  194. }
  195. ]);
  196. ffmpeg('/path/to/file.avi')
  197. .videoFilters(
  198. {
  199. filter: 'fade',
  200. options: ['in', 0, 30]
  201. },
  202. {
  203. filter: 'filter2',
  204. options: { w: 640, h: 480, x: 0, y: 40, color: 'violet' }
  205. }
  206. );</code></pre><h4>fps(fps): set output framerate</h4><p><strong>Aliases</strong>: <code>withOutputFps()</code>, <code>withOutputFPS()</code>, <code>withFpsOutput()</code>, <code>withFPSOutput()</code>, <code>withFps()</code>, <code>withFPS()</code>, <code>outputFPS()</code>, <code>outputFps()</code>, <code>fpsOutput()</code>, <code>FPSOutput()</code>, <code>FPS()</code>.</p>
  207. <pre class="prettyprint source lang-js"><code>ffmpeg('/path/to/file.avi').fps(29.7);</code></pre><h4>frames(count): specify frame count</h4><p><strong>Aliases</strong>: <code>takeFrames()</code>, <code>withFrames()</code>.</p>
  208. <p>Set ffmpeg to only encode a certain number of frames.</p>
  209. <pre class="prettyprint source lang-js"><code>ffmpeg('/path/to/file.avi').frames(240);</code></pre><a name="video-frame-size-options"></a><h3>Video frame size options</h3><p>The following methods enable resizing the output video frame size. They all work together to generate the appropriate video filters.</p>
  210. <h4>size(size): set output frame size</h4><p><strong>Aliases</strong>: <code>videoSize()</code>, <code>withSize()</code>.</p>
  211. <p>This method sets the output frame size. The <code>size</code> argument may have one of the following formats:</p>
  212. <ul>
  213. <li><code>640x480</code>: set a fixed output frame size. Unless <code>autopad()</code> is called, this may result in the video being stretched or squeezed to fit the requested size.</li>
  214. <li><code>640x?</code>: set a fixed width and compute height automatically. If <code>aspect()</code> is also called, it is used to compute video height; otherwise it is computed so that the input aspect ratio is preserved.</li>
  215. <li><code>?x480</code>: set a fixed height and compute width automatically. If <code>aspect()</code> is also called, it is used to compute video width; otherwise it is computed so that the input aspect ratio is preserved.</li>
  216. <li><code>50%</code>: rescale both width and height to the given percentage. Aspect ratio is always preserved.</li>
  217. </ul>
  218. <p>Note that for compatibility with some codecs, computed dimensions are always rounded down to multiples of 2.</p>
  219. <pre class="prettyprint source lang-js"><code>ffmpeg('/path/to/file.avi').size('640x480');
  220. ffmpeg('/path/to/file.avi').size('640x?');
  221. ffmpeg('/path/to/file.avi').size('640x?').aspect('4:3');
  222. ffmpeg('/path/to/file.avi').size('50%');</code></pre><h4>aspect(aspect): set output frame aspect ratio</h4><p><strong>Aliases</strong>: <code>withAspect()</code>, <code>withAspectRatio()</code>, <code>setAspect()</code>, <code>setAspectRatio()</code>, <code>aspectRatio()</code>.</p>
  223. <p>This method enforces a specific output aspect ratio. The <code>aspect</code> argument may either be a number or a <code>X:Y</code> string.</p>
  224. <p>Note that calls to <code>aspect()</code> are ignored when <code>size()</code> has been called with a fixed width and height or a percentage, and also when <code>size()</code> has not been called at all.</p>
  225. <pre class="prettyprint source lang-js"><code>ffmpeg('/path/to/file.avi').size('640x?').aspect('4:3');
  226. ffmpeg('/path/to/file.avi').size('640x?').aspect(1.33333);</code></pre><h4>autopad([color='black']): enable auto-padding the output video</h4><p><strong>Aliases</strong>: <code>applyAutopadding()</code>, <code>applyAutoPadding()</code>, <code>applyAutopad()</code>, <code>applyAutoPad()</code>, <code>withAutopadding()</code>, <code>withAutoPadding()</code>, <code>withAutopad()</code>, <code>withAutoPad()</code>, <code>autoPad()</code>.</p>
  227. <p>This method enables applying auto-padding to the output video. The <code>color</code> parameter specifies which color to use for padding, and must be a color code or name supported by ffmpeg (defaults to 'black').</p>
  228. <p>The behaviour of this method depends on calls made to other video size methods:</p>
  229. <ul>
  230. <li>when <code>size()</code> has been called with a percentage or has not been called, it is ignored;</li>
  231. <li>when <code>size()</code> has been called with <code>WxH</code>, it adds padding so that the input aspect ratio is kept;</li>
  232. <li>when <code>size()</code> has been called with either <code>Wx?</code> or <code>?xH</code>, padding is only added if <code>aspect()</code> was called (otherwise the output dimensions are computed from the input aspect ratio and padding is not needed).</li>
  233. </ul>
  234. <pre class="prettyprint source lang-js"><code>// No size specified, autopad() is ignored
  235. ffmpeg('/path/to/file.avi').autopad();
  236. // Adds padding to keep original aspect ratio.
  237. // - with a 640x400 input, 40 pixels of padding are added on both sides
  238. // - with a 600x480 input, 20 pixels of padding are added on top and bottom
  239. // - with a 320x200 input, video is scaled up to 640x400 and 40px of padding
  240. // is added on both sides
  241. // - with a 320x240 input, video is scaled up to 640x480 and and no padding
  242. // is needed
  243. ffmpeg('/path/to/file.avi').size('640x480').autopad();
  244. ffmpeg('/path/to/file.avi').size('640x480').autopad('white');
  245. ffmpeg('/path/to/file.avi').size('640x480').autopad('#35A5FF');
  246. // Size computed from input, autopad() is ignored
  247. ffmpeg('/path/to/file.avi').size('50%').autopad();
  248. ffmpeg('/path/to/file.avi').size('640x?').autopad();
  249. ffmpeg('/path/to/file.avi').size('?x480').autopad();
  250. // Calling .size('640x?').aspect('4:3') is similar to calling .size('640x480')
  251. // - with a 640x400 input, 40 pixels of padding are added on both sides
  252. // - with a 600x480 input, 20 pixels of padding are added on top and bottom
  253. // - with a 320x200 input, video is scaled up to 640x400 and 40px of padding
  254. // is added on both sides
  255. // - with a 320x240 input, video is scaled up to 640x480 and and no padding
  256. // is needed
  257. ffmpeg('/path/to/file.avi').size('640x?').aspect('4:3').autopad();
  258. ffmpeg('/path/to/file.avi').size('640x?').aspect('4:3').autopad('white');
  259. ffmpeg('/path/to/file.avi').size('640x?').aspect('4:3').autopad('#35A5FF');
  260. // Calling .size('?x480').aspect('4:3') is similar to calling .size('640x480')
  261. ffmpeg('/path/to/file.avi').size('?x480').aspect('4:3').autopad();
  262. ffmpeg('/path/to/file.avi').size('?x480').aspect('4:3').autopad('white');
  263. ffmpeg('/path/to/file.avi').size('?x480').aspect('4:3').autopad('#35A5FF');</code></pre><p>For compatibility with previous fluent-ffmpeg versions, this method also accepts an additional boolean first argument, which specifies whether to apply auto-padding.</p>
  264. <pre class="prettyprint source lang-js"><code>ffmpeg('/path/to/file.avi').size('640x480').autopad(true);
  265. ffmpeg('/path/to/file.avi').size('640x480').autopad(true, 'pink');</code></pre><h4>keepDAR(): force keeping display aspect ratio</h4><p><strong>Aliases</strong>: <code>keepPixelAspect()</code>, <code>keepDisplayAspect()</code>, <code>keepDisplayAspectRatio()</code>.</p>
  266. <p>This method is useful when converting an input with non-square pixels to an output format that does not support non-square pixels (eg. most image formats). It rescales the input so that the display aspect ratio is the same.</p>
  267. <pre class="prettyprint source lang-js"><code>ffmpeg('/path/to/file.avi').keepDAR();</code></pre><a name="specifying-multiple-outputs"></a><h3>Specifying multiple outputs</h3><h4>output(target[, options]): add an output to the command</h4><p><strong>Aliases</strong>: <code>addOutput()</code>.</p>
  268. <p>Adds an output to the command. The <code>target</code> argument may be an output filename or a writable stream (but at most one output stream may be used with a single command).</p>
  269. <p>When <code>target</code> is a stream, an additional <code>options</code> object may be passed. If it is present, it will be passed ffmpeg output stream <code>pipe()</code> method.</p>
  270. <p>Adding an output switches the &quot;current output&quot; of the command, so that any fluent-ffmpeg method that applies to an output is indeed applied to the last output added. For backwards compatibility reasons, you may as well call those methods <em>before</em> adding the first output (in which case they will apply to the first output when it is added). Methods that apply to an output are all non-input-related methods, except for <code>complexFilter()</code>, which is global.</p>
  271. <p>Also note that when calling <code>output()</code>, you should not use the <code>save()</code> or <code>stream()</code> (formerly <code>saveToFile()</code> and <code>writeToStream()</code>) methods, as they already add an output. Use the <code>run()</code> method to start processing.</p>
  272. <pre class="prettyprint source lang-js"><code>var stream = fs.createWriteStream('outputfile.divx');
  273. ffmpeg('/path/to/file.avi')
  274. .output('outputfile.mp4')
  275. .output(stream);
  276. ffmpeg('/path/to/file.avi')
  277. // You may pass a pipe() options object when using a stream
  278. .output(stream, { end:true });
  279. // Output-related methods apply to the last output added
  280. ffmpeg('/path/to/file.avi')
  281. .output('outputfile.mp4')
  282. .audioCodec('libfaac')
  283. .videoCodec('libx264')
  284. .size('320x200')
  285. .output(stream)
  286. .preset('divx')
  287. .size('640x480');
  288. // Use the run() method to run commands with multiple outputs
  289. ffmpeg('/path/to/file.avi')
  290. .output('outputfile.mp4')
  291. .output(stream)
  292. .on('end', function() {
  293. console.log('Finished processing');
  294. })
  295. .run();</code></pre><a name="output-options"></a><h3>Output options</h3><h4>duration(time): set output duration</h4><p><strong>Aliases</strong>: <code>withDuration()</code>, <code>setDuration()</code>.</p>
  296. <p>Forces ffmpeg to stop transcoding after a specific output duration. The <code>time</code> parameter may be a number (in seconds) or a timestamp string (with format <code>[[hh:]mm:]ss[.xxx]</code>).</p>
  297. <pre class="prettyprint source lang-js"><code>ffmpeg('/path/to/file.avi').duration(134.5);
  298. ffmpeg('/path/to/file.avi').duration('2:14.500');</code></pre><h4>seek(time): seek output</h4><p><strong>Aliases</strong>: <code>seekOutput()</code>.</p>
  299. <p>Seeks streams before encoding them into the output. This is different from calling <code>seekInput()</code> in that the offset will only apply to one output. This is also slower, as skipped frames will still be decoded (but dropped).</p>
  300. <p>The <code>time</code> argument may be a number (in seconds) or a timestamp string (with format <code>[[hh:]mm:]ss[.xxx]</code>).</p>
  301. <pre class="prettyprint source lang-js"><code>ffmpeg('/path/to/file.avi')
  302. .seekInput('1:00')
  303. .output('from-1m30s.avi')
  304. .seek(30)
  305. .output('from-1m40s.avi')
  306. .seek('0:40');</code></pre><h4>format(format): set output format</h4><p><strong>Aliases</strong>: <code>withOutputFormat()</code>, <code>toFormat()</code>, <code>outputFormat()</code>.</p>
  307. <pre class="prettyprint source lang-js"><code>ffmpeg('/path/to/file.avi').format('flv');</code></pre><h4>flvmeta(): update FLV metadata after transcoding</h4><p><strong>Aliases</strong>: <code>updateFlvMetadata()</code>.</p>
  308. <p>Calling this method makes fluent-ffmpeg run <code>flvmeta</code> or <code>flvtool2</code> on the output file to add FLV metadata and make files streamable. It does not work when outputting to a stream, and is only useful when outputting to FLV format.</p>
  309. <pre class="prettyprint source lang-js"><code>ffmpeg('/path/to/file.avi').flvmeta().format('flv');</code></pre><h4>outputOptions(option...): add custom output options</h4><p><strong>Aliases</strong>: <code>outputOption()</code>, <code>addOutputOption()</code>, <code>addOutputOptions()</code>, <code>withOutputOption()</code>, <code>withOutputOptions()</code>, <code>addOption()</code>, <code>addOptions()</code>.</p>
  310. <p>This method allows passing any output-related option to ffmpeg. You can call it with a single argument to pass a single option, optionnaly with a space-separated parameter:</p>
  311. <pre class="prettyprint source lang-js"><code>/* Single option */
  312. ffmpeg('/path/to/file.avi').outputOptions('-someOption');
  313. /* Single option with parameter */
  314. ffmpeg('/dev/video0').outputOptions('-r 24');</code></pre><p>You may also pass multiple options at once by passing an array to the method:</p>
  315. <pre class="prettyprint source lang-js"><code>ffmpeg('/path/to/file.avi').outputOptions([
  316. '-option1',
  317. '-option2 param2',
  318. '-option3',
  319. '-option4 param4'
  320. ]);</code></pre><p>Finally, you may also directly pass command line tokens as separate arguments to the method:</p>
  321. <pre class="prettyprint source lang-js"><code>ffmpeg('/path/to/file.avi').outputOptions(
  322. '-option1',
  323. '-option2', 'param2',
  324. '-option3',
  325. '-option4', 'param4'
  326. );</code></pre><a name="miscellaneous-options"></a><h3>Miscellaneous options</h3><h4>preset(preset): use fluent-ffmpeg preset</h4><p><strong>Aliases</strong>: <code>usingPreset()</code>.</p>
  327. <p>There are two kinds of presets supported by fluent-ffmpeg. The first one is preset modules; to use those, pass the preset name as the <code>preset</code> argument. Preset modules are loaded from the directory specified by the <code>presets</code> constructor option (defaults to the <code>lib/presets</code> fluent-ffmpeg subdirectory).</p>
  328. <pre class="prettyprint source lang-js"><code>// Uses &lt;path-to-fluent-ffmpeg>/lib/presets/divx.js
  329. ffmpeg('/path/to/file.avi').preset('divx');
  330. // Uses /my/presets/foo.js
  331. ffmpeg('/path/to/file.avi', { presets: '/my/presets' }).preset('foo');</code></pre><p>Preset modules must export a <code>load()</code> function that takes an FfmpegCommand as an argument. fluent-ffmpeg comes with the following preset modules preinstalled:</p>
  332. <ul>
  333. <li><code>divx</code></li>
  334. <li><code>flashvideo</code></li>
  335. <li><code>podcast</code></li>
  336. </ul>
  337. <p>Here is the code from the included <code>divx</code> preset as an example:</p>
  338. <pre class="prettyprint source lang-js"><code>exports.load = function(ffmpeg) {
  339. ffmpeg
  340. .format('avi')
  341. .videoBitrate('1024k')
  342. .videoCodec('mpeg4')
  343. .size('720x?')
  344. .audioBitrate('128k')
  345. .audioChannels(2)
  346. .audioCodec('libmp3lame')
  347. .outputOptions(['-vtag DIVX']);
  348. };</code></pre><p>The second kind of preset is preset functions. To use those, pass a function which takes an FfmpegCommand as a parameter.</p>
  349. <pre class="prettyprint source lang-js"><code>function myPreset(command) {
  350. command.format('avi').size('720x?');
  351. }
  352. ffmpeg('/path/to/file.avi').preset(myPreset);</code></pre><h4>complexFilter(filters[, map]): set complex filtergraph</h4><p><strong>Aliases</strong>: <code>filterGraph()</code></p>
  353. <p>The <code>complexFilter()</code> method enables setting a complex filtergraph for a command. It expects a filter specification (or a filter specification array) and an optional output mapping parameter as arguments.</p>
  354. <p>Filter specifications may be either plain ffmpeg filter strings (eg. <code>split=3[a][b][c]</code>) or objects with the following keys:</p>
  355. <ul>
  356. <li><code>filter</code>: filter name</li>
  357. <li><code>options</code>: optional; either an option string for the filter (eg. <code>in:0:30</code>), an options array for unnamed options (eg. <code>['in', 0, 30]</code>) or an object mapping option names to values (eg. <code>{ t: 'in', s: 0, n: 30 }</code>). When <code>options</code> is not specified, the filter will be added without any options.</li>
  358. <li><code>inputs</code>: optional; input stream specifier(s) for the filter. The value may be either a single stream specifier string or an array of stream specifiers. Each specifier can be optionally enclosed in square brackets. When input streams are not specified, ffmpeg will use the first unused streams of the correct type.</li>
  359. <li><code>outputs</code>: optional; output stream specifier(s) for the filter. The value may be either a single stream specifier string or an array of stream specifiers. Each specifier can be optionally enclosed in square brackets.</li>
  360. </ul>
  361. <p>The output mapping parameter specifies which stream(s) to include in the output from the filtergraph. It may be either a single stream specifier string or an array of stream specifiers. Each specifier can be optionally enclosed in square brackets. When this parameter is not present, ffmpeg will default to saving all unused outputs to the output file.</p>
  362. <p>Note that only one complex filtergraph may be set on a given command. Calling <code>complexFilter()</code> again will override any previously set filtergraph, but you can set as many filters as needed in a single call.</p>
  363. <pre class="prettyprint source lang-js"><code>ffmpeg('/path/to/file.avi')
  364. .complexFilter([
  365. // Rescale input stream into stream 'rescaled'
  366. 'scale=640:480[rescaled]',
  367. // Duplicate rescaled stream 3 times into streams a, b, and c
  368. {
  369. filter: 'split', options: '3',
  370. inputs: 'rescaled', outputs: ['a', 'b', 'c']
  371. },
  372. // Create stream 'red' by removing green and blue channels from stream 'a'
  373. {
  374. filter: 'lutrgb', options: { g: 0, b: 0 },
  375. inputs: 'a', outputs: 'red'
  376. },
  377. // Create stream 'green' by removing red and blue channels from stream 'b'
  378. {
  379. filter: 'lutrgb', options: { r: 0, b: 0 },
  380. inputs: 'b', outputs: 'green'
  381. },
  382. // Create stream 'blue' by removing red and green channels from stream 'c'
  383. {
  384. filter: 'lutrgb', options: { r: 0, g: 0 },
  385. inputs: 'c', outputs: 'blue'
  386. },
  387. // Pad stream 'red' to 3x width, keeping the video on the left,
  388. // and name output 'padded'
  389. {
  390. filter: 'pad', options: { w: 'iw*3', h: 'ih' },
  391. inputs: 'red', outputs: 'padded'
  392. },
  393. // Overlay 'green' onto 'padded', moving it to the center,
  394. // and name output 'redgreen'
  395. {
  396. filter: 'overlay', options: { x: 'w', y: 0 },
  397. inputs: ['padded', 'green'], outputs: 'redgreen'
  398. },
  399. // Overlay 'blue' onto 'redgreen', moving it to the right
  400. {
  401. filter: 'overlay', options: { x: '2*w', y: 0 },
  402. inputs: ['redgreen', 'blue'], outputs: 'output'
  403. },
  404. ], 'output');</code></pre><a name="setting-event-handlers"></a><h3>Setting event handlers</h3><p>Before actually running a command, you may want to set event listeners on it to be notified when it's done. The following events are available:</p>
  405. <h4>'start': ffmpeg process started</h4><p>The <code>start</code> event is emitted just after ffmpeg has been spawned. It is emitted with the full command line used as an argument.</p>
  406. <pre class="prettyprint source lang-js"><code>ffmpeg('/path/to/file.avi')
  407. .on('start', function(commandLine) {
  408. console.log('Spawned Ffmpeg with command: ' + commandLine);
  409. });</code></pre><h4>'codecData': input codec data available</h4><p>The <code>codecData</code> event is emitted when ffmpeg outputs codec information about its input streams. It is emitted with an object argument with the following keys:</p>
  410. <ul>
  411. <li><code>format</code>: input format</li>
  412. <li><code>duration</code>: input duration</li>
  413. <li><code>audio</code>: audio codec</li>
  414. <li><code>audio_details</code>: audio encoding details</li>
  415. <li><code>video</code>: video codec</li>
  416. <li><code>video_details</code>: video encoding details</li>
  417. </ul>
  418. <pre class="prettyprint source lang-js"><code>ffmpeg('/path/to/file.avi')
  419. .on('codecData', function(data) {
  420. console.log('Input is ' + data.audio + ' audio ' +
  421. 'with ' + data.video + ' video');
  422. });</code></pre><h4>'progress': transcoding progress information</h4><p>The <code>progress</code> event is emitted every time ffmpeg reports progress information. It is emitted with an object argument with the following keys:</p>
  423. <ul>
  424. <li><code>frames</code>: total processed frame count</li>
  425. <li><code>currentFps</code>: framerate at which FFmpeg is currently processing</li>
  426. <li><code>currentKbps</code>: throughput at which FFmpeg is currently processing</li>
  427. <li><code>targetSize</code>: current size of the target file in kilobytes</li>
  428. <li><code>timemark</code>: the timestamp of the current frame in seconds</li>
  429. <li><code>percent</code>: an estimation of the progress percentage</li>
  430. </ul>
  431. <p>Note that <code>percent</code> can be (very) inaccurate, as the only progress information fluent-ffmpeg gets from ffmpeg is the total number of frames written (and the corresponding duration). To estimate percentage, fluent-ffmpeg has to guess what the total output duration will be, and uses the first input added to the command to do so. In particular:</p>
  432. <ul>
  433. <li>percentage is not available when using an input stream</li>
  434. <li>percentage may be wrong when using multiple inputs with different durations and the first one is not the longest</li>
  435. </ul>
  436. <pre class="prettyprint source lang-js"><code>ffmpeg('/path/to/file.avi')
  437. .on('progress', function(progress) {
  438. console.log('Processing: ' + progress.percent + '% done');
  439. });</code></pre><h4>'stderr': FFmpeg output</h4><p>The <code>stderr</code> event is emitted every time FFmpeg outputs a line to <code>stderr</code>. It is emitted with a string containing the line of stderr (minus trailing new line characters).</p>
  440. <pre class="prettyprint source lang-js"><code>ffmpeg('/path/to/file.avi')
  441. .on('stderr', function(stderrLine) {
  442. console.log('Stderr output: ' + stderrLine);
  443. });</code></pre><h4>'error': transcoding error</h4><p>The <code>error</code> event is emitted when an error occurs when running ffmpeg or when preparing its execution. It is emitted with an error object as an argument. If the error happened during ffmpeg execution, listeners will also receive two additional arguments containing ffmpegs stdout and stderr.</p>
  444. <p><strong>Warning</strong>: you should <em>always</em> set a handler for the <code>error</code> event, as node's default behaviour when an <code>error</code> event without any listeners is emitted is to output the error to the console and <em>terminate the program</em>.</p>
  445. <pre class="prettyprint source lang-js"><code>ffmpeg('/path/to/file.avi')
  446. .on('error', function(err, stdout, stderr) {
  447. console.log('Cannot process video: ' + err.message);
  448. });</code></pre><h4>'end': processing finished</h4><p>The <code>end</code> event is emitted when processing has finished. Listeners receive ffmpeg standard output and standard error as arguments, except when generating thumbnails (see below), in which case they receive an array of the generated filenames.</p>
  449. <pre class="prettyprint source lang-js"><code>ffmpeg('/path/to/file.avi')
  450. .on('end', function(stdout, stderr) {
  451. console.log('Transcoding succeeded !');
  452. });</code></pre><p><code>stdout</code> is empty when the command outputs to a stream. Both <code>stdout</code> and <code>stderr</code> are limited by the <code>stdoutLines</code> option (defaults to 100 lines).</p>
  453. <a name="starting-ffmpeg-processing"></a><h3>Starting FFmpeg processing</h3><h4>save(filename): save the output to a file</h4><p><strong>Aliases</strong>: <code>saveToFile()</code></p>
  454. <p>Starts ffmpeg processing and saves the output to a file.</p>
  455. <pre class="prettyprint source lang-js"><code>ffmpeg('/path/to/file.avi')
  456. .videoCodec('libx264')
  457. .audioCodec('libmp3lame')
  458. .size('320x240')
  459. .on('error', function(err) {
  460. console.log('An error occurred: ' + err.message);
  461. })
  462. .on('end', function() {
  463. console.log('Processing finished !');
  464. })
  465. .save('/path/to/output.mp4');</code></pre><p>Note: the <code>save()</code> method is actually syntactic sugar for calling both <code>output()</code> and <code>run()</code>.</p>
  466. <h4>pipe([stream], [options]): pipe the output to a writable stream</h4><p><strong>Aliases</strong>: <code>stream()</code>, <code>writeToStream()</code>.</p>
  467. <p>Starts processing and pipes ffmpeg output to a writable stream. The <code>options</code> argument, if present, is passed to ffmpeg output stream's <code>pipe()</code> method (see nodejs documentation).</p>
  468. <pre class="prettyprint source lang-js"><code>var outStream = fs.createWriteStream('/path/to/output.mp4');
  469. ffmpeg('/path/to/file.avi')
  470. .videoCodec('libx264')
  471. .audioCodec('libmp3lame')
  472. .size('320x240')
  473. .on('error', function(err) {
  474. console.log('An error occurred: ' + err.message);
  475. })
  476. .on('end', function() {
  477. console.log('Processing finished !');
  478. })
  479. .pipe(outStream, { end: true });</code></pre><p>When no <code>stream</code> argument is present, the <code>pipe()</code> method returns a PassThrough stream, which you can pipe to somewhere else (or just listen to events on).</p>
  480. <p><strong>Note</strong>: this is only available with node &gt;= 0.10.</p>
  481. <pre class="prettyprint source lang-js"><code>var command = ffmpeg('/path/to/file.avi')
  482. .videoCodec('libx264')
  483. .audioCodec('libmp3lame')
  484. .size('320x240')
  485. .on('error', function(err) {
  486. console.log('An error occurred: ' + err.message);
  487. })
  488. .on('end', function() {
  489. console.log('Processing finished !');
  490. });
  491. var ffstream = command.pipe();
  492. ffstream.on('data', function(chunk) {
  493. console.log('ffmpeg just wrote ' + chunk.length + ' bytes');
  494. });</code></pre><p>Note: the <code>stream()</code> method is actually syntactic sugar for calling both <code>output()</code> and <code>run()</code>.</p>
  495. <h4>run(): start processing</h4><p><strong>Aliases</strong>: <code>exec()</code>, <code>execute()</code>.</p>
  496. <p>This method is mainly useful when producing multiple outputs (otherwise the <code>save()</code> or <code>stream()</code> methods are more straightforward). It starts processing with the specified outputs.</p>
  497. <p><strong>Warning</strong>: do not use <code>run()</code> when calling other processing methods (eg. <code>save()</code>, <code>pipe()</code> or <code>screenshots()</code>).</p>
  498. <pre class="prettyprint source lang-js"><code>ffmpeg('/path/to/file.avi')
  499. .output('screenshot.png')
  500. .noAudio()
  501. .seek('3:00')
  502. .output('small.avi')
  503. .audioCodec('copy')
  504. .size('320x200')
  505. .output('big.avi')
  506. .audioCodec('copy')
  507. .size('640x480')
  508. .on('error', function(err) {
  509. console.log('An error occurred: ' + err.message);
  510. })
  511. .on('end', function() {
  512. console.log('Processing finished !');
  513. })
  514. .run();</code></pre><h4>mergeToFile(filename, tmpdir): concatenate multiple inputs</h4><p>Use the <code>input</code> and <code>mergeToFile</code> methods on a command to concatenate multiple inputs to a single output file. The <code>mergeToFile</code> needs a temporary folder as its second argument.</p>
  515. <pre class="prettyprint source lang-js"><code>ffmpeg('/path/to/part1.avi')
  516. .input('/path/to/part2.avi')
  517. .input('/path/to/part2.avi')
  518. .on('error', function(err) {
  519. console.log('An error occurred: ' + err.message);
  520. })
  521. .on('end', function() {
  522. console.log('Merging finished !');
  523. })
  524. .mergeToFile('/path/to/merged.avi', '/path/to/tempDir');</code></pre><h4>screenshots(options[, dirname]): generate thumbnails</h4><p><strong>Aliases</strong>: <code>thumbnail()</code>, <code>thumbnails()</code>, <code>screenshot()</code>, <code>takeScreenshots()</code>.</p>
  525. <p>Use the <code>screenshots</code> method to extract one or several thumbnails and save them as PNG files. There are a few caveats with this implementation, though:</p>
  526. <ul>
  527. <li>It will not work on input streams.</li>
  528. <li>Progress information reported by the <code>progress</code> event is not accurate.</li>
  529. <li>It doesn't interract well with filters. In particular, don't use the <code>size()</code> method to resize thumbnails, use the <code>size</code> option instead.</li>
  530. </ul>
  531. <p>The <code>options</code> argument is an object with the following keys:</p>
  532. <ul>
  533. <li><code>folder</code>: output folder for generated image files. Defaults to the current folder.</li>
  534. <li><code>filename</code>: output filename pattern (see below). Defaults to &quot;tn.png&quot;.</li>
  535. <li><code>count</code>: specifies how many thumbnails to generate. When using this option, thumbnails are generated at regular intervals in the video (for example, when requesting 3 thumbnails, at 25%, 50% and 75% of the video length). <code>count</code> is ignored when <code>timemarks</code> or <code>timestamps</code> is specified.</li>
  536. <li><code>timemarks</code> or <code>timestamps</code>: specifies an array of timestamps in the video where thumbnails should be taken. Each timestamp may be a number (in seconds), a percentage string (eg. &quot;50%&quot;) or a timestamp string with format &quot;hh:mm:ss.xxx&quot; (where hours, minutes and milliseconds are both optional).</li>
  537. <li><code>size</code>: specifies a target size for thumbnails (with the same format as the <code>.size()</code> method). <strong>Note:</strong> you should not use the <code>.size()</code> method when generating thumbnails.</li>
  538. </ul>
  539. <p>The <code>filename</code> option specifies a filename pattern for generated files. It may contain the following format tokens:</p>
  540. <ul>
  541. <li>'%s': offset in seconds</li>
  542. <li>'%w': screenshot width</li>
  543. <li>'%h': screenshot height</li>
  544. <li>'%r': screenshot resolution (same as '%wx%h')</li>
  545. <li>'%f': input filename</li>
  546. <li>'%b': input basename (filename w/o extension)</li>
  547. <li>'%i': index of screenshot in timemark array (can be zero-padded by using it like <code>%000i</code>)</li>
  548. </ul>
  549. <p>If multiple timemarks are passed and no variable format token ('%s' or '%i') is specified in the filename pattern, <code>_%i</code> will be added automatically.</p>
  550. <p>When generating thumbnails, an additional <code>filenames</code> event is dispatched with an array of generated filenames as an argument.</p>
  551. <pre class="prettyprint source lang-js"><code>ffmpeg('/path/to/video.avi')
  552. .on('filenames', function(filenames) {
  553. console.log('Will generate ' + filenames.join(', '))
  554. })
  555. .on('end', function() {
  556. console.log('Screenshots taken');
  557. })
  558. .screenshots({
  559. // Will take screens at 20%, 40%, 60% and 80% of the video
  560. count: 4,
  561. folder: '/path/to/output'
  562. });
  563. ffmpeg('/path/to/video.avi')
  564. .screenshots({
  565. timestamps: [30.5, '50%', '01:10.123'],
  566. filename: 'thumbnail-at-%s-seconds.png',
  567. folder: '/path/to/output',
  568. size: '320x240'
  569. });</code></pre><a name="controlling-the-ffmpeg-process"></a><h3>Controlling the FFmpeg process</h3><h4>kill([signal='SIGKILL']): kill any running ffmpeg process</h4><p>This method sends <code>signal</code> (defaults to 'SIGKILL') to the ffmpeg process. It only has sense when processing has started. Sending a signal that terminates the process will result in the <code>error</code> event being emitted.</p>
  570. <pre class="prettyprint source lang-js"><code>var command = ffmpeg('/path/to/video.avi')
  571. .videoCodec('libx264')
  572. .audioCodec('libmp3lame')
  573. .on('start', function() {
  574. // Send SIGSTOP to suspend ffmpeg
  575. command.kill('SIGSTOP');
  576. doSomething(function() {
  577. // Send SIGCONT to resume ffmpeg
  578. command.kill('SIGCONT');
  579. });
  580. })
  581. .save('/path/to/output.mp4');
  582. // Kill ffmpeg after 60 seconds anyway
  583. setTimeout(function() {
  584. command.on('error', function() {
  585. console.log('Ffmpeg has been killed');
  586. });
  587. command.kill();
  588. }, 60000);</code></pre><h4>renice([niceness=0]): change ffmpeg process priority</h4><p>This method alters the niceness (priority) value of any running ffmpeg process (if any) and any process spawned in the future. The <code>niceness</code> parameter may range from -20 (highest priority) to 20 (lowest priority) and defaults to 0 (which is the default process niceness on most *nix systems).</p>
  589. <p><strong>Note</strong>: this method is ineffective on Windows platforms.</p>
  590. <pre class="prettyprint source lang-js"><code>// Set startup niceness
  591. var command = ffmpeg('/path/to/file.avi')
  592. .renice(5)
  593. .save('/path/to/output.mp4');
  594. // Command takes too long, raise its priority
  595. setTimeout(function() {
  596. command.renice(-5);
  597. }, 60000);</code></pre><a name="reading-video-metadata"></a><h3>Reading video metadata</h3><p>You can read metadata from any valid ffmpeg input file with the modules <code>ffprobe</code> method.</p>
  598. <pre class="prettyprint source lang-js"><code>ffmpeg.ffprobe('/path/to/file.avi', function(err, metadata) {
  599. console.dir(metadata);
  600. });</code></pre><p>You may also call the ffprobe method on an FfmpegCommand to probe one of its input. You may pass a 0-based input number as a first argument to specify which input to read metadata from, otherwise the method will probe the last added input.</p>
  601. <pre class="prettyprint source lang-js"><code>ffmpeg('/path/to/file1.avi')
  602. .input('/path/to/file2.avi')
  603. .ffprobe(function(err, data) {
  604. console.log('file2 metadata:');
  605. console.dir(data);
  606. });
  607. ffmpeg('/path/to/file1.avi')
  608. .input('/path/to/file2.avi')
  609. .ffprobe(0, function(err, data) {
  610. console.log('file1 metadata:');
  611. console.dir(data);
  612. });</code></pre><p><strong>Warning:</strong> ffprobe may be called with an input stream, but in this case <em>it will consume data from the stream</em>, and this data will no longer be available for ffmpeg. Using both ffprobe and a transcoding command on the same input stream will most likely fail unless the stream is a live stream. Only do this if you know what you're doing.</p>
  613. <p>The returned object is the same that is returned by running the following command from your shell (depending on your ffmpeg version you may have to replace <code>-of</code> with <code>-print_format</code>) :</p>
  614. <pre class="prettyprint source lang-sh"><code>$ ffprobe -of json -show_streams -show_format /path/to/file.avi</code></pre><p>It will contain information about the container (as a <code>format</code> key) and an array of streams (as a <code>stream</code> key). The format object and each stream object also contains metadata tags, depending on the format:</p>
  615. <pre class="prettyprint source lang-js"><code>{
  616. &quot;streams&quot;: [
  617. {
  618. &quot;index&quot;: 0,
  619. &quot;codec_name&quot;: &quot;h264&quot;,
  620. &quot;codec_long_name&quot;: &quot;H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10&quot;,
  621. &quot;profile&quot;: &quot;Constrained Baseline&quot;,
  622. &quot;codec_type&quot;: &quot;video&quot;,
  623. &quot;codec_time_base&quot;: &quot;1/48&quot;,
  624. &quot;codec_tag_string&quot;: &quot;avc1&quot;,
  625. &quot;codec_tag&quot;: &quot;0x31637661&quot;,
  626. &quot;width&quot;: 320,
  627. &quot;height&quot;: 180,
  628. &quot;has_b_frames&quot;: 0,
  629. &quot;sample_aspect_ratio&quot;: &quot;1:1&quot;,
  630. &quot;display_aspect_ratio&quot;: &quot;16:9&quot;,
  631. &quot;pix_fmt&quot;: &quot;yuv420p&quot;,
  632. &quot;level&quot;: 13,
  633. &quot;r_frame_rate&quot;: &quot;24/1&quot;,
  634. &quot;avg_frame_rate&quot;: &quot;24/1&quot;,
  635. &quot;time_base&quot;: &quot;1/24&quot;,
  636. &quot;start_pts&quot;: 0,
  637. &quot;start_time&quot;: &quot;0.000000&quot;,
  638. &quot;duration_ts&quot;: 14315,
  639. &quot;duration&quot;: &quot;596.458333&quot;,
  640. &quot;bit_rate&quot;: &quot;702655&quot;,
  641. &quot;nb_frames&quot;: &quot;14315&quot;,
  642. &quot;disposition&quot;: {
  643. &quot;default&quot;: 0,
  644. &quot;dub&quot;: 0,
  645. &quot;original&quot;: 0,
  646. &quot;comment&quot;: 0,
  647. &quot;lyrics&quot;: 0,
  648. &quot;karaoke&quot;: 0,
  649. &quot;forced&quot;: 0,
  650. &quot;hearing_impaired&quot;: 0,
  651. &quot;visual_impaired&quot;: 0,
  652. &quot;clean_effects&quot;: 0,
  653. &quot;attached_pic&quot;: 0
  654. },
  655. &quot;tags&quot;: {
  656. &quot;creation_time&quot;: &quot;1970-01-01 00:00:00&quot;,
  657. &quot;language&quot;: &quot;und&quot;,
  658. &quot;handler_name&quot;: &quot;\fVideoHandler&quot;
  659. }
  660. },
  661. {
  662. &quot;index&quot;: 1,
  663. &quot;codec_name&quot;: &quot;aac&quot;,
  664. &quot;codec_long_name&quot;: &quot;AAC (Advanced Audio Coding)&quot;,
  665. &quot;codec_type&quot;: &quot;audio&quot;,
  666. &quot;codec_time_base&quot;: &quot;1/48000&quot;,
  667. &quot;codec_tag_string&quot;: &quot;mp4a&quot;,
  668. &quot;codec_tag&quot;: &quot;0x6134706d&quot;,
  669. &quot;sample_fmt&quot;: &quot;fltp&quot;,
  670. &quot;sample_rate&quot;: &quot;48000&quot;,
  671. &quot;channels&quot;: 2,
  672. &quot;bits_per_sample&quot;: 0,
  673. &quot;r_frame_rate&quot;: &quot;0/0&quot;,
  674. &quot;avg_frame_rate&quot;: &quot;0/0&quot;,
  675. &quot;time_base&quot;: &quot;1/48000&quot;,
  676. &quot;start_pts&quot;: 0,
  677. &quot;start_time&quot;: &quot;0.000000&quot;,
  678. &quot;duration_ts&quot;: 28619776,
  679. &quot;duration&quot;: &quot;596.245333&quot;,
  680. &quot;bit_rate&quot;: &quot;159997&quot;,
  681. &quot;nb_frames&quot;: &quot;27949&quot;,
  682. &quot;disposition&quot;: {
  683. &quot;default&quot;: 0,
  684. &quot;dub&quot;: 0,
  685. &quot;original&quot;: 0,
  686. &quot;comment&quot;: 0,
  687. &quot;lyrics&quot;: 0,
  688. &quot;karaoke&quot;: 0,
  689. &quot;forced&quot;: 0,
  690. &quot;hearing_impaired&quot;: 0,
  691. &quot;visual_impaired&quot;: 0,
  692. &quot;clean_effects&quot;: 0,
  693. &quot;attached_pic&quot;: 0
  694. },
  695. &quot;tags&quot;: {
  696. &quot;creation_time&quot;: &quot;1970-01-01 00:00:00&quot;,
  697. &quot;language&quot;: &quot;und&quot;,
  698. &quot;handler_name&quot;: &quot;\fSoundHandler&quot;
  699. }
  700. }
  701. ],
  702. &quot;format&quot;: {
  703. &quot;filename&quot;: &quot;http://download.blender.org/peach/bigbuckbunny_movies/BigBuckBunny_320x180.mp4&quot;,
  704. &quot;nb_streams&quot;: 2,
  705. &quot;format_name&quot;: &quot;mov,mp4,m4a,3gp,3g2,mj2&quot;,
  706. &quot;format_long_name&quot;: &quot;QuickTime / MOV&quot;,
  707. &quot;start_time&quot;: &quot;0.000000&quot;,
  708. &quot;duration&quot;: &quot;596.459000&quot;,
  709. &quot;size&quot;: &quot;64657027&quot;,
  710. &quot;bit_rate&quot;: &quot;867211&quot;,
  711. &quot;tags&quot;: {
  712. &quot;major_brand&quot;: &quot;isom&quot;,
  713. &quot;minor_version&quot;: &quot;512&quot;,
  714. &quot;compatible_brands&quot;: &quot;mp41&quot;,
  715. &quot;creation_time&quot;: &quot;1970-01-01 00:00:00&quot;,
  716. &quot;title&quot;: &quot;Big Buck Bunny&quot;,
  717. &quot;artist&quot;: &quot;Blender Foundation&quot;,
  718. &quot;composer&quot;: &quot;Blender Foundation&quot;,
  719. &quot;date&quot;: &quot;2008&quot;,
  720. &quot;encoder&quot;: &quot;Lavf52.14.0&quot;
  721. }
  722. }
  723. }</code></pre><a name="querying-ffmpeg-capabilities"></a><h3>Querying ffmpeg capabilities</h3><p>fluent-ffmpeg enables you to query your installed ffmpeg version for supported formats, codecs, encoders and filters.</p>
  724. <pre class="prettyprint source lang-js"><code>
  725. var Ffmpeg = require('fluent-ffmpeg');
  726. Ffmpeg.getAvailableFormats(function(err, formats) {
  727. console.log('Available formats:');
  728. console.dir(formats);
  729. });
  730. Ffmpeg.getAvailableCodecs(function(err, codecs) {
  731. console.log('Available codecs:');
  732. console.dir(codecs);
  733. });
  734. Ffmpeg.getAvailableEncoders(function(err, encoders) {
  735. console.log('Available encoders:');
  736. console.dir(encoders);
  737. });
  738. Ffmpeg.getAvailableFilters(function(err, filters) {
  739. console.log(&quot;Available filters:&quot;);
  740. console.dir(filters);
  741. });
  742. // Those methods can also be called on commands
  743. new Ffmpeg({ source: '/path/to/file.avi' })
  744. .getAvailableCodecs(...);</code></pre><p>These methods pass an object to their callback with keys for each available format, codec or filter.</p>
  745. <p>The returned object for formats looks like:</p>
  746. <pre class="prettyprint source lang-js"><code>{
  747. ...
  748. mp4: {
  749. description: 'MP4 (MPEG-4 Part 14)',
  750. canDemux: false,
  751. canMux: true
  752. },
  753. ...
  754. }</code></pre><ul>
  755. <li><code>canDemux</code> indicates whether ffmpeg is able to extract streams from (demux) this format</li>
  756. <li><code>canMux</code> indicates whether ffmpeg is able to write streams into (mux) this format</li>
  757. </ul>
  758. <p>The returned object for codecs looks like:</p>
  759. <pre class="prettyprint source lang-js"><code>{
  760. ...
  761. mp3: {
  762. type: 'audio',
  763. description: 'MP3 (MPEG audio layer 3)',
  764. canDecode: true,
  765. canEncode: true,
  766. intraFrameOnly: false,
  767. isLossy: true,
  768. isLossless: false
  769. },
  770. ...
  771. }</code></pre><ul>
  772. <li><code>type</code> indicates the codec type, either &quot;audio&quot;, &quot;video&quot; or &quot;subtitle&quot;</li>
  773. <li><code>canDecode</code> tells whether ffmpeg is able to decode streams using this codec</li>
  774. <li><code>canEncode</code> tells whether ffmpeg is able to encode streams using this codec</li>
  775. </ul>
  776. <p>Depending on your ffmpeg version (or if you use avconv instead) other keys may be present, for example:</p>
  777. <ul>
  778. <li><code>directRendering</code> tells if codec can render directly in GPU RAM; useless for transcoding purposes</li>
  779. <li><code>intraFrameOnly</code> tells if codec can only work with I-frames</li>
  780. <li><code>isLossy</code> tells if codec can do lossy encoding/decoding</li>
  781. <li><code>isLossless</code> tells if codec can do lossless encoding/decoding</li>
  782. </ul>
  783. <p>With some ffmpeg/avcodec versions, the description includes encoder/decoder mentions in the form &quot;Foo codec (decoders: libdecodefoo) (encoders: libencodefoo)&quot;. In this case you will want to use those encoders/decoders instead (the codecs object returned by <code>getAvailableCodecs</code> will also include them).</p>
  784. <p>The returned object for encoders looks like:</p>
  785. <pre class="prettyprint source lang-js"><code>{
  786. ...
  787. libmp3lame: {
  788. type: 'audio',
  789. description: 'MP3 (MPEG audio layer 3) (codec mp3)',
  790. frameMT: false,
  791. sliceMT: false,
  792. experimental: false,
  793. drawHorizBand: false,
  794. directRendering: false
  795. },
  796. ...
  797. }</code></pre><ul>
  798. <li><code>type</code> indicates the encoder type, either &quot;audio&quot;, &quot;video&quot; or &quot;subtitle&quot;</li>
  799. <li><code>experimental</code> indicates whether the encoder is experimental. When using such a codec, fluent-ffmpeg automatically adds the '-strict experimental' flag.</li>
  800. </ul>
  801. <p>The returned object for filters looks like:</p>
  802. <pre class="prettyprint source lang-js"><code>{
  803. ...
  804. scale: {
  805. description: 'Scale the input video to width:height size and/or convert the image format.',
  806. input: 'video',
  807. multipleInputs: false,
  808. output: 'video',
  809. multipleOutputs: false
  810. },
  811. ...
  812. }</code></pre><ul>
  813. <li><code>input</code> tells the input type this filter operates on, one of &quot;audio&quot;, &quot;video&quot; or &quot;none&quot;. When &quot;none&quot;, the filter likely generates output from nothing</li>
  814. <li><code>multipleInputs</code> tells whether the filter can accept multiple inputs</li>
  815. <li><code>output</code> tells the output type this filter generates, one of &quot;audio&quot;, &quot;video&quot; or &quot;none&quot;. When &quot;none&quot;, the filter has no output (sink only)</li>
  816. <li><code>multipleInputs</code> tells whether the filter can generate multiple outputs</li>
  817. </ul>
  818. <a name="cloning-an-ffmpegcommand"></a><h3>Cloning an FfmpegCommand</h3><p>You can create clones of an FfmpegCommand instance by calling the <code>clone()</code> method. The clone will be an exact copy of the original at the time it has been called (same inputs, same options, same event handlers, etc.). This is mainly useful when you want to apply different processing options on the same input.</p>
  819. <p>Setting options, adding inputs or event handlers on a clone will not affect the original command.</p>
  820. <pre class="prettyprint source lang-js"><code>// Create a command to convert source.avi to MP4
  821. var command = ffmpeg('/path/to/source.avi')
  822. .audioCodec('libfaac')
  823. .videoCodec('libx264')
  824. .format('mp4');
  825. // Create a clone to save a small resized version
  826. command.clone()
  827. .size('320x200')
  828. .save('/path/to/output-small.mp4');
  829. // Create a clone to save a medium resized version
  830. command.clone()
  831. .size('640x400')
  832. .save('/path/to/output-medium.mp4');
  833. // Save a converted version with the original size
  834. command.save('/path/to/output-original-size.mp4');</code></pre><a name="contributing"></a><h2>Contributing</h2><p>Contributions in any form are highly encouraged and welcome! Be it new or improved presets, optimized streaming code or just some cleanup. So start forking!</p>
  835. <a name="code-contributions"></a><h3>Code contributions</h3><p>If you want to add new features or change the API, please submit an issue first to make sure no one else is already working on the same thing and discuss the implementation and API details with maintainers and users by creating an issue. When everything is settled down, you can submit a pull request.</p>
  836. <p>When fixing bugs, you can directly submit a pull request.</p>
  837. <p>Make sure to add tests for your features and bugfixes and update the documentation (see below) before submitting your code!</p>
  838. <a name="documentation-contributions"></a><h3>Documentation contributions</h3><p>You can directly submit pull requests for documentation changes. Make sure to regenerate the documentation before submitting (see below).</p>
  839. <a name="updating-the-documentation"></a><h3>Updating the documentation</h3><p>When contributing API changes (new methods for example), be sure to update the README file and JSDoc comments in the code. fluent-ffmpeg comes with a plugin that enables two additional JSDoc tags:</p>
  840. <ul>
  841. <li><code>@aliases</code>: document method aliases</li>
  842. </ul>
  843. <pre class="prettyprint source lang-js"><code>/**
  844. * ...
  845. * @method FfmpegCommand#myMethod
  846. * @aliases myMethodAlias,myOtherMethodAlias
  847. */</code></pre><ul>
  848. <li><code>@category</code>: set method category</li>
  849. </ul>
  850. <pre class="prettyprint source lang-js"><code>/**
  851. * ...
  852. * @category Audio
  853. */</code></pre><p>You can regenerate the JSDoc documentation by running the following command:</p>
  854. <pre class="prettyprint source lang-sh"><code>$ make doc</code></pre><p>To avoid polluting the commit history, make sure to only commit the regenerated JSDoc once and in a specific commit.</p>
  855. <a name="running-tests"></a><h3>Running tests</h3><p>To run unit tests, first make sure you installed npm dependencies (run <code>npm install</code>).</p>
  856. <pre class="prettyprint source lang-sh"><code>$ make test</code></pre><p>If you want to re-generate the test coverage report (filed under test/coverage.html), run</p>
  857. <pre class="prettyprint source lang-sh"><code>$ make test-cov</code></pre><p>Make sure your ffmpeg installation is up-to-date to prevent strange assertion errors because of missing codecs/bugfixes.</p>
  858. <a name="main-contributors"></a><h2>Main contributors</h2><ul>
  859. <li><a href="http://github.com/enobrev">enobrev</a></li>
  860. <li><a href="http://github.com/njoyard">njoyard</a></li>
  861. <li><a href="http://github.com/sadikzzz">sadikzzz</a></li>
  862. <li><a href="http://github.com/smremde">smremde</a></li>
  863. <li><a href="http://github.com/spruce">spruce</a></li>
  864. <li><a href="http://github.com/tagedieb">tagedieb</a></li>
  865. <li><a href="http://github.com/tommadema">tommadema</a></li>
  866. <li><a href="http://github.com/Weltschmerz">Weltschmerz</a></li>
  867. </ul>
  868. <a name="license"></a><h2>License</h2><p>(The MIT License)</p>
  869. <p>Copyright (c) 2011 Stefan Schaermeli &lt;schaermu@gmail.com&gt;</p>
  870. <p>Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:</p>
  871. <p>The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.</p>
  872. <p>THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.</p></article>
  873. </section>
  874. </div>
  875. <nav>
  876. <h2><a href="index.html">Index</a></h2><ul><li><a href="index.html#installation">Installation</a></li><ul></ul><li><a href="index.html#usage">Usage</a></li><ul><li><a href="index.html#prerequisites">Prerequisites</a></li><li><a href="index.html#creating-an-ffmpeg-command">Creating an FFmpeg command</a></li><li><a href="index.html#specifying-inputs">Specifying inputs</a></li><li><a href="index.html#input-options">Input options</a></li><li><a href="index.html#audio-options">Audio options</a></li><li><a href="index.html#video-options">Video options</a></li><li><a href="index.html#video-frame-size-options">Video frame size options</a></li><li><a href="index.html#specifying-multiple-outputs">Specifying multiple outputs</a></li><li><a href="index.html#output-options">Output options</a></li><li><a href="index.html#miscellaneous-options">Miscellaneous options</a></li><li><a href="index.html#setting-event-handlers">Setting event handlers</a></li><li><a href="index.html#starting-ffmpeg-processing">Starting FFmpeg processing</a></li><li><a href="index.html#controlling-the-ffmpeg-process">Controlling the FFmpeg process</a></li><li><a href="index.html#reading-video-metadata">Reading video metadata</a></li><li><a href="index.html#querying-ffmpeg-capabilities">Querying ffmpeg capabilities</a></li><li><a href="index.html#cloning-an-ffmpegcommand">Cloning an FfmpegCommand</a></li></ul><li><a href="index.html#contributing">Contributing</a></li><ul><li><a href="index.html#code-contributions">Code contributions</a></li><li><a href="index.html#documentation-contributions">Documentation contributions</a></li><li><a href="index.html#updating-the-documentation">Updating the documentation</a></li><li><a href="index.html#running-tests">Running tests</a></li></ul><li><a href="index.html#main-contributors">Main contributors</a></li><ul></ul><li><a href="index.html#license">License</a></li><ul></ul></ul><h3>Classes</h3><ul><li><a href="FfmpegCommand.html">FfmpegCommand</a></li><ul><li> <a href="FfmpegCommand.html#audio-methods">Audio methods</a></li><li> <a href="FfmpegCommand.html#capabilities-methods">Capabilities methods</a></li><li> <a href="FfmpegCommand.html#custom-options-methods">Custom options methods</a></li><li> <a href="FfmpegCommand.html#input-methods">Input methods</a></li><li> <a href="FfmpegCommand.html#metadata-methods">Metadata methods</a></li><li> <a href="FfmpegCommand.html#miscellaneous-methods">Miscellaneous methods</a></li><li> <a href="FfmpegCommand.html#other-methods">Other methods</a></li><li> <a href="FfmpegCommand.html#output-methods">Output methods</a></li><li> <a href="FfmpegCommand.html#processing-methods">Processing methods</a></li><li> <a href="FfmpegCommand.html#video-methods">Video methods</a></li><li> <a href="FfmpegCommand.html#video-size-methods">Video size methods</a></li></ul></ul>
  877. </nav>
  878. <br clear="both">
  879. <footer>
  880. Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Sun May 01 2016 12:10:37 GMT+0200 (CEST)
  881. </footer>
  882. <script> prettyPrint(); </script>
  883. <script src="scripts/linenumber.js"> </script>
  884. </body>
  885. </html>