Can I use vaapi within node.js by using ffmpeg-fluent?

196 views Asked by At

My goal is to capture the screen from an electron app but I'd like to do that by using ffmpeg's h264_vaapi encoder. By using ffmpeg-fluent I have the option to set the codec but when I try to use the vaapi encoder it won't grab anything. By using the default libx264 encoder it works but CPU is low-powered so I must rely on the built in intel iGPU. Capturing the screen from a bash script using h264_vaapi works perfectly. OS: Ubuntu 20.04, HW: Pentium N5000 with intel HD graphics.

This is my code (the encoder is commented out):

const recordScreen = require('record-screen')
 
const recording = recordScreen('test.mp4', {
  inputFormat: 'x11grab',
  resolution: '1920x1080',
  fps: 25,
  //videoCodec: 'h264_vaapi'
})
 
recording.promise
  .then(result => {
    // Screen recording is done
    process.stdout.write(result.stdout)
    process.stderr.write(result.stderr)
  })
  .catch(error => {
    // Screen recording has failed
    console.error(error)
  })
0

There are 0 answers