From 7da47f3f3cc8e178e93d2b95ed21c05ec90173e9 Mon Sep 17 00:00:00 2001 From: Holayn Date: Sat, 23 Oct 2021 21:44:34 -0400 Subject: [PATCH] feat: video framerate option --- README.md | 9 +++++++++ lib/video/ffargs.js | 4 +++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index d92a9f7..dd0c5e6 100644 --- a/README.md +++ b/README.md @@ -211,6 +211,15 @@ The default value is `none` opts = { video-hwaccel: 'vaapi' } ``` +##### Video FPS + +The default export video FPS is 25. You can specify an explicit FPS by adding a `framerate` option: + +```js +opts = { framerate: 60 } +opts = { framerate: 'preserve' } // preserve the original source video's FPS +``` + ##### Conversion progress The `.video()` call returns an [EventEmitter](https://nodejs.org/api/events.html) diff --git a/lib/video/ffargs.js b/lib/video/ffargs.js index 82a4c6c..97cc982 100644 --- a/lib/video/ffargs.js +++ b/lib/video/ffargs.js @@ -23,7 +23,9 @@ exports.prepare = function (source, target, options) { args.push('-i', source) // output framerate - args.push('-r', DEFAULT_VIDEO_FPS) + if (options.framerate !== 'preserve') { + args.push('-r', options.framerate || DEFAULT_VIDEO_FPS) + } // misc options args.push('-vsync', '2', '-movflags', '+faststart')