我需要从视频捕获卡中读取视频流(显示其他计算机的桌面)并捕获它的快照。目前我发现了一个nodejs库“node-webcam”。我尝试用它拍摄快照,但它给出了错误。我感觉错误与编码有关。有谁知道任何解决方案?
代码:
// nodejs webcam library?
var NodeWebcam = require( "node-webcam" );
try {
// get a cam. If nothing is given to NodeWebcam then first camera is taken
var cam1 = NodeWebcam.create({});
// clears something. No idea what
cam1.clear();
// captures a snapshot from the videostream
cam1.capture( "test", function( err, data ) {
console.log(err);
} );
} catch(error) {
console.log(error);
}
错误:
{ Error: Command failed:
C:\Users\**projectlocation**\node_modules\node-
webcam\src\bindings\CommandCam\Commandcam.exe /filename test.bmp
Capture device: AVerMedia HD Capture C985 Bus 2
Could not render capture video stream
at ChildProcess.exithandler (child_process.js:275:12)
at emitTwo (events.js:126:13)
at ChildProcess.emit (events.js:214:7)
at maybeClose (internal/child_process.js:925:16)
at Socket.stream.socket.on (internal/child_process.js:346:11)
at emitOne (events.js:116:13)
at Socket.emit (events.js:211:7)
at Pipe._handle.close [as _onclose] (net.js:567:12)
killed: false,
code: 1,
signal: null,
cmd: 'C:\\Users\\**projectlocation**\\node_modules\\node-
webcam\\src\\bindings\\CommandCam\\Commandcam.exe /filename test.bmp' }