options_video.js.html 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>JSDoc: Source: options/video.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/video.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. *! Video-related methods
  24. */
  25. module.exports = function(proto) {
  26. /**
  27. * Disable video in the output
  28. *
  29. * @method FfmpegCommand#noVideo
  30. * @category Video
  31. * @aliases withNoVideo
  32. *
  33. * @return FfmpegCommand
  34. */
  35. proto.withNoVideo =
  36. proto.noVideo = function() {
  37. this._currentOutput.video.clear();
  38. this._currentOutput.videoFilters.clear();
  39. this._currentOutput.video('-vn');
  40. return this;
  41. };
  42. /**
  43. * Specify video codec
  44. *
  45. * @method FfmpegCommand#videoCodec
  46. * @category Video
  47. * @aliases withVideoCodec
  48. *
  49. * @param {String} codec video codec name
  50. * @return FfmpegCommand
  51. */
  52. proto.withVideoCodec =
  53. proto.videoCodec = function(codec) {
  54. this._currentOutput.video('-vcodec', codec);
  55. return this;
  56. };
  57. /**
  58. * Specify video bitrate
  59. *
  60. * @method FfmpegCommand#videoBitrate
  61. * @category Video
  62. * @aliases withVideoBitrate
  63. *
  64. * @param {String|Number} bitrate video bitrate in kbps (with an optional 'k' suffix)
  65. * @param {Boolean} [constant=false] enforce constant bitrate
  66. * @return FfmpegCommand
  67. */
  68. proto.withVideoBitrate =
  69. proto.videoBitrate = function(bitrate, constant) {
  70. bitrate = ('' + bitrate).replace(/k?$/, 'k');
  71. this._currentOutput.video('-b:v', bitrate);
  72. if (constant) {
  73. this._currentOutput.video(
  74. '-maxrate', bitrate,
  75. '-minrate', bitrate,
  76. '-bufsize', '3M'
  77. );
  78. }
  79. return this;
  80. };
  81. /**
  82. * Specify custom video filter(s)
  83. *
  84. * Can be called both with one or many filters, or a filter array.
  85. *
  86. * @example
  87. * command.videoFilters('filter1');
  88. *
  89. * @example
  90. * command.videoFilters('filter1', 'filter2=param1=value1:param2=value2');
  91. *
  92. * @example
  93. * command.videoFilters(['filter1', 'filter2']);
  94. *
  95. * @example
  96. * command.videoFilters([
  97. * {
  98. * filter: 'filter1'
  99. * },
  100. * {
  101. * filter: 'filter2',
  102. * options: 'param=value:param=value'
  103. * }
  104. * ]);
  105. *
  106. * @example
  107. * command.videoFilters(
  108. * {
  109. * filter: 'filter1',
  110. * options: ['value1', 'value2']
  111. * },
  112. * {
  113. * filter: 'filter2',
  114. * options: { param1: 'value1', param2: 'value2' }
  115. * }
  116. * );
  117. *
  118. * @method FfmpegCommand#videoFilters
  119. * @category Video
  120. * @aliases withVideoFilter,withVideoFilters,videoFilter
  121. *
  122. * @param {...String|String[]|Object[]} filters video filter strings, string array or
  123. * filter specification array, each with the following properties:
  124. * @param {String} filters.filter filter name
  125. * @param {String|String[]|Object} [filters.options] filter option string, array, or object
  126. * @return FfmpegCommand
  127. */
  128. proto.withVideoFilter =
  129. proto.withVideoFilters =
  130. proto.videoFilter =
  131. proto.videoFilters = function(filters) {
  132. if (arguments.length > 1) {
  133. filters = [].slice.call(arguments);
  134. }
  135. if (!Array.isArray(filters)) {
  136. filters = [filters];
  137. }
  138. this._currentOutput.videoFilters(utils.makeFilterStrings(filters));
  139. return this;
  140. };
  141. /**
  142. * Specify output FPS
  143. *
  144. * @method FfmpegCommand#fps
  145. * @category Video
  146. * @aliases withOutputFps,withOutputFPS,withFpsOutput,withFPSOutput,withFps,withFPS,outputFPS,outputFps,fpsOutput,FPSOutput,FPS
  147. *
  148. * @param {Number} fps output FPS
  149. * @return FfmpegCommand
  150. */
  151. proto.withOutputFps =
  152. proto.withOutputFPS =
  153. proto.withFpsOutput =
  154. proto.withFPSOutput =
  155. proto.withFps =
  156. proto.withFPS =
  157. proto.outputFPS =
  158. proto.outputFps =
  159. proto.fpsOutput =
  160. proto.FPSOutput =
  161. proto.fps =
  162. proto.FPS = function(fps) {
  163. this._currentOutput.video('-r', fps);
  164. return this;
  165. };
  166. /**
  167. * Only transcode a certain number of frames
  168. *
  169. * @method FfmpegCommand#frames
  170. * @category Video
  171. * @aliases takeFrames,withFrames
  172. *
  173. * @param {Number} frames frame count
  174. * @return FfmpegCommand
  175. */
  176. proto.takeFrames =
  177. proto.withFrames =
  178. proto.frames = function(frames) {
  179. this._currentOutput.video('-vframes', frames);
  180. return this;
  181. };
  182. };
  183. </code></pre>
  184. </article>
  185. </section>
  186. </div>
  187. <nav>
  188. <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>
  189. </nav>
  190. <br clear="both">
  191. <footer>
  192. 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)
  193. </footer>
  194. <script> prettyPrint(); </script>
  195. <script src="scripts/linenumber.js"> </script>
  196. </body>
  197. </html>