https://github.com/xan105/node-video-capture
Record your screen using hardware accelerated encoder
https://github.com/xan105/node-video-capture
amf capture ffmpeg nodejs nvenc recording video windows
Last synced: 11 months ago
JSON representation
Record your screen using hardware accelerated encoder
- Host: GitHub
- URL: https://github.com/xan105/node-video-capture
- Owner: xan105
- License: lgpl-3.0
- Created: 2020-12-17T08:37:23.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2024-05-10T15:37:32.000Z (about 2 years ago)
- Last Synced: 2025-08-30T01:51:44.311Z (11 months ago)
- Topics: amf, capture, ffmpeg, nodejs, nvenc, recording, video, windows
- Language: Shell
- Homepage:
- Size: 135 MB
- Stars: 2
- Watchers: 1
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
About
=====
Record your screen using hardware accelerated encoder.
NVIDIA nvenc or AMD amf.
Example
=======
```js
import { hwencode } from "@xan105/video-capture";
hwencode("./path/to/file.mp4","h264_nvenc")
.then(console.log)
.catch(console.error);
```
Install
=======
```
npm install @xan105/video-capture
```
API
===
⚠️ This module is only available as an ECMAScript module (ESM) starting with version 2.0.0.
Previous version(s) are CommonJS (CJS) with an ESM wrapper.
## Named export
#### `hwencode(filePath: string, codec: string, option?: obj): Promise`
Record your screen in .mp4 using NVIDIA nvenc or AMD amf with h264 or h265/HEVC hardware encoder at given location.
Returns mp4 filepath.
- filePath: output file location
NB: _filepath extension will be enforced to '.mp4'_
- codec:
| |NVIDIA|AMD|
|---|------|---|
|H.264/AVC|h264_nvenc|h264_amf|
|H.265/HEVC|hevc_nvenc|hevc_amf|
- option :
```js
option = {
overwrite: false, //Allow (true) file overwrite if target already exists
timeLength: "00:00:20", //duration
framerate: 60, //HEVC can reach up to 100, 120 or 150
probesize: 42, //1080p
threadQueue: 512,
size: "1920x1080", //default to current screen resolution
videoEncodingOptions: "-rc:v vbr -level:v 4.2 -g:v 120 -bf:v 3 -qp:v 19",//* default to a custom profile
bits10: false, //use 10bits color depth
mouse: false, //capture the mouse
audioInterface: null, //Windows interface name for audio loopback (aka record what you hear, stereo-mix, etc)
audioDelay: 900, //(ms) delay; Set to 0 to disable
audioEncodingOptions: "",//*
bitrate: {
video: 6000, //(k) video
min: 3000, //(k) video
max: 9000, //(k) video
audio: 160 //(k) audio
}
};
```
NB: *_Please refer to ffmpeg regarding video and audio encoding options._