node-libcamera
TypeScript icon, indicating that this package has built-in type declarations

1.0.6 • Public • Published

node-libcamera 📷

npm npm bundle size node-current NPM checks

A set of wrapper functions for the native Raspberry Pi libcamera API.

Open to any and all contributions!

Installation

npm install node-libcamera

Usage

libcamera-still

Capture an image!

const libcamera = require('node-libcamera')

// basic example
libcamera.still({ output: 'test.jpg' })
  .then((result) => /* 📸 */ )
  .catch((error) => /* 🐛 */ )

// example with options
libcamera.still({
  output: 'images/test.jpg', // output file path
  timeout: 2000, // timeout before taking the picture
  width: 640, // image width
  height: 480, // image height
})
  .then((result) => /* 📸 */ )
  .catch((error) => /* 🐛 */ )

libcamera-vid

Record a video!

const libcamera = require('node-libcamera')

// record a 10s video
libcamera.vid({ output: 'test.h264', timeout: 10000, 'save-pts': 'timestamps.txt' })
  .then((result) => /* 🎥 */ )
  .catch((error) => /* 🐛 */ )

Note: this will result in an unpackaged video bistream, it is not wrapped in any kind of container format (such as an mp4 file). The save-pts option can be used to output frame timestamps so that the bitstream can subsequently be converted into an appropriate format using a tool like mkvmerge.

mkvmerge -o test.mkv --timecodes 0:timestamps.txt test.h264

Package Sidebar

Install

npm i node-libcamera

Weekly Downloads

9

Version

1.0.6

License

MIT

Unpacked Size

292 kB

Total Files

16

Last publish

Collaborators

  • superhussain