Gathering detailed insights and metrics for camera-capture
Gathering detailed insights and metrics for camera-capture
Gathering detailed insights and metrics for camera-capture
Gathering detailed insights and metrics for camera-capture
Portable, fast camera capture library for node.js (server). TypeScript/JavaScript easy to use APIs. Uses puppeteer headless browser to capture webcam video (audio/desktop, recording, etc) and stream back to node.js frame by frame in plain image data for optimal speed or optionally encoded as jpeg, png, bmp, etc
npm install camera-capture
Typescript
Module System
Node Version
NPM Version
TypeScript (97.67%)
JavaScript (1.76%)
HTML (0.57%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
32 Stars
19 Commits
8 Forks
2 Watchers
17 Branches
1 Contributors
Updated on Jul 05, 2024
Latest Version
0.0.11
Package Id
camera-capture@0.0.11
Unpacked Size
99.41 kB
Size
25.19 kB
File Count
24
NPM Version
6.10.3
Node Version
12.8.1
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
1
1
Portable Camera, audio, desktop capture Node.js library.
After searching for an easy to use portable library to access the webcam directly from node.js I didn't found a library that works in windows, macOs and linux, without native dependencies that users need ot manually install (or even so, they won't work).
This library solves the problem with an easy approach. Use headless browser to capture the video, draw in canvas and pass the image data the Node.js context as fast as possible (age.exposeFunction()
) and with minimal processing. It uses HTMLCanvasElement getImageData when returning raw image data or HTMLCanvasElement.toBlob() when retuning encoded images such as png, jpg. In both cases using ArrayBuffer
1npm install camera-capture puppeteer
(puppeteer
is a peer dependency you must install it by yourself)
1import {VideoCapture} from 'camera-capture'
2const c = new VideoCapture()
3c.addFrameListener(frame => {
4 // frame by default is unencoded raw Image Data `{width: 480, height: 320, data: UIntArray}``
5 // which is often what image processing / surfaces interfaces expect for fast processing.
6 // Use `mime` option to receive it in other formats (see examples below)
7 surface.putImageData(0,0,frame.width, frame.height, frame.data)
8})
9// pause / resume frame emission (without tunning off the camera)
10setTimeout(()=>c.pause(), 1000)
11setTimeout(()=>c.resume(), 2000)
12// shutdown everything, including, camera, browser, server:
13setTimeout(()=>c.stop(), 3000)
14console.log('Capturing camera');
15await c.start() // promise will be resolved only when `stop`
16console.log('Stopping camera capture');
Instead of using start() and being notified on each frame, just call initialize()
and read frames programmatically:
1import {VideoCapture} from 'camera-capture'
2const c = new VideoCapture({
3 mime: 'image/png'
4})
5await c.initialize()
6let f = await c.readFrame() // PNG as configured
7writeFileSync('tmp.png', f.data)
8f = await c.readFrame('image/webp') // take another shot this time as webp image
9writeFileSync('tmp.webp', f.data)
10f = await c.readFrame('image/jpeg') // jpeg
11writeFileSync('tmp.jpg', f.data)
12f = await c.readFrame('rgba') // raw image data (as default)
13writeFileSync('tmp-8bit-200x200.rgba', f.data)
The following uses DOM MediaRecorder API to record video. Notice that it all happens in the browser, on memory, so the result is a excellent quality video but it could consume lots of memory on long recordings. If that's an issue perhaps it's better to store frame by frame to hard drive and then use a video assembler like ffmpeg / imagemagick. (in the roadmap):
1import {VideoCapture} from 'camera-capture' 2const c = new VideoCapture({ port: 8082 }) 3await c.initialize() 4await c.startRecording() 5await sleep(500) 6const data = await c.stopRecording() 7writeFileSync('tmp6.webm', data)
TODO - TBD
I didn't found any library that provides an interface to capture webcam video so I show the video and filter frame by frame in my Node.s desktop app (not based on electron - no canvas / HTML5 available - rendering on cairo/opengl surface that complies with
Observed behavior:
About, 30 frames per second (size 600x400, format: raw image data)
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 0/19 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no SAST tool detected
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
52 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More@ngxux/camera-capture
This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 7.2.0.
@airplanegobrr/camera-capture
Super portable, fast camera capture library for node.js (server). TypeScript/JavaScript easy to use APIs. Uses puppeteer headless browser to capture webcam video (audio/desktop, recording, etc) and stream back to node.js frame by frame in plain image data
react-native-android-camera-capture
Image Capture in Android for React Native Project
@s20.ai/capture-sdk
README.md