options_audio.js.html 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>JSDoc: Source: options/audio.js</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">Source: options/audio.js</h1>
  17. <section>
  18. <article>
  19. <pre class="prettyprint source linenums"><code>/*jshint node:true*/
  20. 'use strict';
  21. var utils = require('../utils');
  22. /*
  23. *! Audio-related methods
  24. */
  25. module.exports = function(proto) {
  26. /**
  27. * Disable audio in the output
  28. *
  29. * @method FfmpegCommand#noAudio
  30. * @category Audio
  31. * @aliases withNoAudio
  32. * @return FfmpegCommand
  33. */
  34. proto.withNoAudio =
  35. proto.noAudio = function() {
  36. this._currentOutput.audio.clear();
  37. this._currentOutput.audioFilters.clear();
  38. this._currentOutput.audio('-an');
  39. return this;
  40. };
  41. /**
  42. * Specify audio codec
  43. *
  44. * @method FfmpegCommand#audioCodec
  45. * @category Audio
  46. * @aliases withAudioCodec
  47. *
  48. * @param {String} codec audio codec name
  49. * @return FfmpegCommand
  50. */
  51. proto.withAudioCodec =
  52. proto.audioCodec = function(codec) {
  53. this._currentOutput.audio('-acodec', codec);
  54. return this;
  55. };
  56. /**
  57. * Specify audio bitrate
  58. *
  59. * @method FfmpegCommand#audioBitrate
  60. * @category Audio
  61. * @aliases withAudioBitrate
  62. *
  63. * @param {String|Number} bitrate audio bitrate in kbps (with an optional 'k' suffix)
  64. * @return FfmpegCommand
  65. */
  66. proto.withAudioBitrate =
  67. proto.audioBitrate = function(bitrate) {
  68. this._currentOutput.audio('-b:a', ('' + bitrate).replace(/k?$/, 'k'));
  69. return this;
  70. };
  71. /**
  72. * Specify audio channel count
  73. *
  74. * @method FfmpegCommand#audioChannels
  75. * @category Audio
  76. * @aliases withAudioChannels
  77. *
  78. * @param {Number} channels channel count
  79. * @return FfmpegCommand
  80. */
  81. proto.withAudioChannels =
  82. proto.audioChannels = function(channels) {
  83. this._currentOutput.audio('-ac', channels);
  84. return this;
  85. };
  86. /**
  87. * Specify audio frequency
  88. *
  89. * @method FfmpegCommand#audioFrequency
  90. * @category Audio
  91. * @aliases withAudioFrequency
  92. *
  93. * @param {Number} freq audio frequency in Hz
  94. * @return FfmpegCommand
  95. */
  96. proto.withAudioFrequency =
  97. proto.audioFrequency = function(freq) {
  98. this._currentOutput.audio('-ar', freq);
  99. return this;
  100. };
  101. /**
  102. * Specify audio quality
  103. *
  104. * @method FfmpegCommand#audioQuality
  105. * @category Audio
  106. * @aliases withAudioQuality
  107. *
  108. * @param {Number} quality audio quality factor
  109. * @return FfmpegCommand
  110. */
  111. proto.withAudioQuality =
  112. proto.audioQuality = function(quality) {
  113. this._currentOutput.audio('-aq', quality);
  114. return this;
  115. };
  116. /**
  117. * Specify custom audio filter(s)
  118. *
  119. * Can be called both with one or many filters, or a filter array.
  120. *
  121. * @example
  122. * command.audioFilters('filter1');
  123. *
  124. * @example
  125. * command.audioFilters('filter1', 'filter2=param1=value1:param2=value2');
  126. *
  127. * @example
  128. * command.audioFilters(['filter1', 'filter2']);
  129. *
  130. * @example
  131. * command.audioFilters([
  132. * {
  133. * filter: 'filter1'
  134. * },
  135. * {
  136. * filter: 'filter2',
  137. * options: 'param=value:param=value'
  138. * }
  139. * ]);
  140. *
  141. * @example
  142. * command.audioFilters(
  143. * {
  144. * filter: 'filter1',
  145. * options: ['value1', 'value2']
  146. * },
  147. * {
  148. * filter: 'filter2',
  149. * options: { param1: 'value1', param2: 'value2' }
  150. * }
  151. * );
  152. *
  153. * @method FfmpegCommand#audioFilters
  154. * @aliases withAudioFilter,withAudioFilters,audioFilter
  155. * @category Audio
  156. *
  157. * @param {...String|String[]|Object[]} filters audio filter strings, string array or
  158. * filter specification array, each with the following properties:
  159. * @param {String} filters.filter filter name
  160. * @param {String|String[]|Object} [filters.options] filter option string, array, or object
  161. * @return FfmpegCommand
  162. */
  163. proto.withAudioFilter =
  164. proto.withAudioFilters =
  165. proto.audioFilter =
  166. proto.audioFilters = function(filters) {
  167. if (arguments.length > 1) {
  168. filters = [].slice.call(arguments);
  169. }
  170. if (!Array.isArray(filters)) {
  171. filters = [filters];
  172. }
  173. this._currentOutput.audioFilters(utils.makeFilterStrings(filters));
  174. return this;
  175. };
  176. };
  177. </code></pre>
  178. </article>
  179. </section>
  180. </div>
  181. <nav>
  182. <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>
  183. </nav>
  184. <br clear="both">
  185. <footer>
  186. 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)
  187. </footer>
  188. <script> prettyPrint(); </script>
  189. <script src="scripts/linenumber.js"> </script>
  190. </body>
  191. </html>