Record your screen using hardware accelerated encoder.

Usage no npm install needed!

<script type="module">
  import xan105VideoCapture from 'https://cdn.skypack.dev/@xan105/video-capture';


Record your screen using hardware accelerated encoder


npm install xan105/video-capture


"use strict";

const { hwencode } = require("@xan105/video-capture");



hwencode(string filepath, string codec, [obj option = {}]) <promise>string

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:

    H.264/AVC h264_nvenc h264_amf
    H.265/HEVC hevc_nvenc hevc_amf
  • option :

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: 700, //(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.