GithubHelp home page GithubHelp logo

bellbind / node-v4l2camera Goto Github PK

View Code? Open in Web Editor NEW
157.0 157.0 80.0 92 KB

node module for capturing an image from USB(UVC) webcam on linux.

License: MIT License

Python 1.06% C 63.35% JavaScript 0.41% C++ 35.19%

node-v4l2camera's People

Contributors

bellbind avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

node-v4l2camera's Issues

‘struct v4l2_querymenu’ has no member named ‘value’

Hi there, I am trying to use this module, but I get this error in npm install.

> [email protected] install /home/tv/devel/barcode/optoscan/node_modules/v4l2camera
> node-gyp rebuild

make: Entering directory `/home/tv/devel/barcode/optoscan/node_modules/v4l2camera/build'
  CC(target) Release/obj.target/v4l2camera/capture.o
../capture.c: In function ‘camera_integer_menu_copy’:
../capture.c:449:22: error: ‘struct v4l2_querymenu’ has no member named ‘value’
make: *** [Release/obj.target/v4l2camera/capture.o] Error 1
make: Leaving directory `/home/tv/devel/barcode/optoscan/node_modules/v4l2camera/build'

Any suggestions? I assume I probably have an older video4linux. as I am on ubuntu 12.04.

Data from device might not be in YUYV format

The toYUYV() and toRGB() functions assume that the data from the device is in YUYV.

Webcams may give data in other formats too, like MPEG or H264.

Currently there is no way to get the "raw" data from the frame, using toYUYV on a MPEG frame returns garbage (i.e. the mpeg data padded with zeros to fill a whole "YUYV frame").

errors about ioctl

When I try to use ioctl and test it on my board , it reports
ioctl: Not a tty
[E] [main:66] Failed querying buffer: Not a tty.
what can I do to fix it?
Any help appreciated!

Camera warm-up frame buffer?

I'm finding my cameras autoexposure/white balance/focus are all out of whack for the first several frame captures.

Is this normal? Or possibly a function of my specific camera?

Native Error when re-sarting camera

If I stop the camera with cam.stop(), and then in the stop callback call cam.start() everything crashes with this error: CAMERA ERROR [VIDIOC_QBUF] 22 Invalid argument

Does this work with YUYV formats?

I'm asking since the MJPG seems preferred in the example. Also, if I bypass the check, I get:

# 
# Fatal error in ../deps/v8/src/objects.cc, line 2538
# Check failed: receiver->IsJSFunction().
#

==== C stack trace ===============================

 1: V8_Fatal
 2: 0xd7cf7f
 3: v8::Object::CreationContext()
 4: node::MakeCallback(v8::Isolate*, v8::Local<v8::Object>, v8::Local<v8::Function>, int, v8::Local<v8::Value>*)
 5: 0x7fbd0bb9d4f8
 6: 0x13845a8
 7: uv_run
 8: node::Start(int, char**)
 9: __libc_start_main
10: _start
Illegal instruction (core dumped)

Video stream

Add support to generate the a stream of video data, ideally based on the W3C MediaStream and/or MediaStreamTrack formats.

Force camera to change format

The usb webcam I use supports both yuyv and mjpg, the problem is, it's default is yuyv, and I need mjpg. So when use v4l2 camera it shows up as yuyv. The thing is, I found a solution. If I run fswebcam using -p mjpg, it manages to take a picture, and somehow now the camera changed state to mjpg (v4l2 now recognizes it correctly). So SOMEHOW there is a way to change the state. Could the library support it?

Installation fails with Node.js 10

Tested on a Raspberry Pi with Raspbian Stretch:

pi@raspi_bell:~/projects/intercom $ npm install v4l2camera

> [email protected] install /home/pi/projects/intercom/node_modules/v4l2camera
> node-gyp rebuild

make: Entering directory '/home/pi/projects/intercom/node_modules/v4l2camera/build'
  CC(target) Release/obj.target/v4l2camera/capture.o
In file included from ../capture.h:7:0,
                 from ../capture.c:1:
/usr/include/linux/videodev2.h:2126:20: error: field ‘timestamp’ has incomplete type
  struct timespec   timestamp;
                    ^~~~~~~~~
v4l2camera.target.mk:111: recipe for target 'Release/obj.target/v4l2camera/capture.o' failed
make: *** [Release/obj.target/v4l2camera/capture.o] Error 1
make: Leaving directory '/home/pi/projects/intercom/node_modules/v4l2camera/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/home/pi/.nvm/versions/node/v10.1.0/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:258:23)
gyp ERR! stack     at ChildProcess.emit (events.js:182:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:235:12)
gyp ERR! System Linux 4.14.37+
gyp ERR! command "/home/pi/.nvm/versions/node/v10.1.0/bin/node" "/home/pi/.nvm/versions/node/v10.1.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/pi/projects/intercom/node_modules/v4l2camera
gyp ERR! node -v v10.1.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok 
npm WARN enoent ENOENT: no such file or directory, open '/home/pi/projects/intercom/package.json'
npm WARN intercom No description
npm WARN intercom No repository field.
npm WARN intercom No README data
npm WARN intercom No license field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/pi/.npm/_logs/2018-05-13T10_12_12_414Z-debug.log

How to compile it on Ubuntu 14.04

I'm trying to compile it on Ubuntu 14.04

Linux 3.13.0-71-generic
node 4.2.4
npm v2.14.12

I executed the following commands
curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -
apt-get install -y nodejs
apt-get install -y build-essential
add-apt-repository -y ppa:ubuntu-toolchain-r/test
apt-get update -y
apt-get install -y gcc-4.9 g++-4.9
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.9 60 --slave /usr/bin/g++ g++ /usr/bin/g++-4.9

sudo aptitude install -y linux-libc-dev libswscale-dev libboost-dev
cd /tmp
rm -rf /usr/bin/cpp
ln -s /usr/bin/cpp-4.9 /usr/bin/cpp

apt-get install v4l-utils
npm install --unsafe-perm --save mjpeg-streamer

It fails with the following:
npm-error.txt
npm-debug.log.txt

If I missed anything please let me know.

Thanks.

installing v4l2camera node module error

reply@ubuntu:~/Desktop/node_modules$ sudo npm install v4l2camera
npm WARN install Couldn't install optional dependency: Unsupported
npm WARN install Couldn't install optional dependency: Unsupported

[email protected] install /home/reply/Desktop/node_modules/v4l2camera
node-gyp rebuild

make: Entering directory /home/reply/Desktop/node_modules/v4l2camera/build' CC(target) Release/obj.target/v4l2camera/capture.o CXX(target) Release/obj.target/v4l2camera/v4l2camera.o g++: error: unrecognized command line option ‘-std=c++14’ make: *** [Release/obj.target/v4l2camera/v4l2camera.o] Error 1 make: Leaving directory/home/reply/Desktop/node_modules/v4l2camera/build'
gyp ERR! build error
gyp ERR! stack Error: make failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:270:23)
gyp ERR! stack at emitTwo (events.js:100:13)
gyp ERR! stack at ChildProcess.emit (events.js:185:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Linux 3.19.0-25-generic
gyp ERR! command "/usr/bin/nodejs" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/reply/Desktop/node_modules/v4l2camera
gyp ERR! node -v v5.5.0
gyp ERR! node-gyp -v v3.0.3
gyp ERR! not ok
npm WARN ENOENT ENOENT: no such file or directory, open '/home/reply/Desktop/package.json'
npm WARN ENOENT ENOENT: no such file or directory, open '/home/reply/Desktop/node_modules/build/package.json'
npm WARN ENOENT ENOENT: no such file or directory, open '/home/reply/Desktop/node_modules/frames/package.json'
npm WARN EPACKAGEJSON Desktop No description
npm WARN EPACKAGEJSON Desktop No repository field.
npm WARN EPACKAGEJSON Desktop No README data
npm WARN EPACKAGEJSON Desktop No license field.
npm ERR! Linux 3.19.0-25-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install" "v4l2camera"
npm ERR! node v5.5.0
npm ERR! npm v3.3.12
npm ERR! code ELIFECYCLE

npm ERR! [email protected] install: node-gyp rebuild
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script 'node-gyp rebuild'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the v4l2camera package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp rebuild
npm ERR! You can get their info via:
npm ERR! npm owner ls v4l2camera
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! /home/reply/Desktop/node_modules/npm-debug.log

API for get current format info

  • cam.configGet()

returns same format object for cam.config(format) and cam.formats[n]

and rename

  • cam.config(format) => cam.configSet(format)

Cant install on OS X EI Capitan

I got this error message

npm ERR! Darwin 15.0.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "v4l2camera"
npm ERR! node v4.4.0
npm ERR! npm  v2.14.20
npm ERR! code EBADPLATFORM

npm ERR! notsup Unsupported
npm ERR! notsup Not compatible with your operating system or architecture: [email protected]
npm ERR! notsup Valid OS:    linux
npm ERR! notsup Valid Arch:  any
npm ERR! notsup Actual OS:   darwin
npm ERR! notsup Actual Arch: x64

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/ZERO/Desktop/experiment/npm-debug.log

Please advice. Thank you.

missing controls?

node-v4l2camera: 1.0.4
v4l2: 1.6.0-2
distro rasbian (arm6
Bus 001 Device 005: ID 045e:0772 Microsoft Corp. LifeCam Studio

$ v4l2-ctl  -l
                     brightness (int)    : min=30 max=255 step=1 default=-8193 value=102
                       contrast (int)    : min=0 max=10 step=1 default=57343 value=5
                     saturation (int)    : min=0 max=200 step=1 default=57343 value=103
 white_balance_temperature_auto (bool)   : default=1 value=1
           power_line_frequency (menu)   : min=0 max=2 default=2 value=2
      white_balance_temperature (int)    : min=2500 max=10000 step=1 default=57343 value=4500 flags=inactive
                      sharpness (int)    : min=0 max=50 step=1 default=57343 value=25
         backlight_compensation (int)    : min=0 max=10 step=1 default=57343 value=0
                  exposure_auto (menu)   : min=0 max=3 default=0 value=3
              exposure_absolute (int)    : min=1 max=10000 step=1 default=156 value=156 flags=inactive
                   pan_absolute (int)    : min=-529200 max=529200 step=3600 default=0 value=0
                  tilt_absolute (int)    : min=-432000 max=432000 step=3600 default=0 value=0
                 focus_absolute (int)    : min=0 max=40 step=1 default=57343 value=18
                     focus_auto (bool)   : default=1 value=0
                  zoom_absolute (int)    : min=0 max=317 step=1 default=57343 value=0
                     brightness (int)    : min=30 max=255 step=1 default=-8193 value=102
                       contrast (int)    : min=0 max=10 step=1 default=57343 value=5
                     saturation (int)    : min=0 max=200 step=1 default=57343 value=103
 white_balance_temperature_auto (bool)   : default=1 value=1
           power_line_frequency (menu)   : min=0 max=2 default=2 value=2
      white_balance_temperature (int)    : min=2500 max=10000 step=1 default=57343 value=4500 flags=inactive
                      sharpness (int)    : min=0 max=50 step=1 default=57343 value=25
         backlight_compensation (int)    : min=0 max=10 step=1 default=57343 value=0

But when i use node-v4l2camera, I only see the first seven...

[
  {
    "id": 9963776,
    "name": "Brightness",
    "type": "int",
    "min": 30,
    "max": 255,
    "step": 1,
    "default": -8193,
    "flags": {
      "disabled": false,
      "grabbed": false,
      "readOnly": false,
      "update": false,
      "inactive": false,
      "slider": false,
      "writeOnly": false,
      "volatile": false
    },
    "menu": []
  },
  {
    "id": 9963777,
    "name": "Contrast",
    "type": "int",
    "min": 0,
    "max": 10,
    "step": 1,
    "default": 57343,
    "flags": {
      "disabled": false,
      "grabbed": false,
      "readOnly": false,
      "update": false,
      "inactive": false,
      "slider": false,
      "writeOnly": false,
      "volatile": false
    },
    "menu": []
  },
  {
    "id": 9963778,
    "name": "Saturation",
    "type": "int",
    "min": 0,
    "max": 200,
    "step": 1,
    "default": 57343,
    "flags": {
      "disabled": false,
      "grabbed": false,
      "readOnly": false,
      "update": false,
      "inactive": false,
      "slider": false,
      "writeOnly": false,
      "volatile": false
    },
    "menu": []
  },
  {
    "id": 9963788,
    "name": "White Balance Temperature, Auto",
    "type": "bool",
    "min": 0,
    "max": 1,
    "step": 1,
    "default": 1,
    "flags": {
      "disabled": false,
      "grabbed": false,
      "readOnly": false,
      "update": false,
      "inactive": false,
      "slider": false,
      "writeOnly": false,
      "volatile": false
    },
    "menu": []
  },
  {
    "id": 9963800,
    "name": "Power Line Frequency",
    "type": "menu",
    "min": 0,
    "max": 2,
    "step": 1,
    "default": 2,
    "flags": {
      "disabled": false,
      "grabbed": false,
      "readOnly": false,
      "update": false,
      "inactive": false,
      "slider": false,
      "writeOnly": false,
      "volatile": false
    },
    "menu": [
      "Disabled",
      "50 Hz",
      "60 Hz"
    ]
  },
  {
    "id": 9963802,
    "name": "White Balance Temperature",
    "type": "int",
    "min": 2500,
    "max": 10000,
    "step": 1,
    "default": 57343,
    "flags": {
      "disabled": false,
      "grabbed": false,
      "readOnly": false,
      "update": false,
      "inactive": true,
      "slider": false,
      "writeOnly": false,
      "volatile": false
    },
    "menu": []
  },
  {
    "id": 9963803,
    "name": "Sharpness",
    "type": "int",
    "min": 0,
    "max": 50,
    "step": 1,
    "default": 57343,
    "flags": {
      "disabled": false,
      "grabbed": false,
      "readOnly": false,
      "update": false,
      "inactive": false,
      "slider": false,
      "writeOnly": false,
      "volatile": false
    },
    "menu": []
  },
  {
    "id": 9963804,
    "name": "Backlight Compensation",
    "type": "int",
    "min": 0,
    "max": 10,
    "step": 1,
    "default": 57343,
    "flags": {
      "disabled": false,
      "grabbed": false,
      "readOnly": false,
      "update": false,
      "inactive": false,
      "slider": false,
      "writeOnly": false,
      "volatile": false
    },
    "menu": []
  }
]

Segmentation fault when running examples/image-server.js to long

  • run 'node examples/image-server.js'
  • connect the server with two browser tabs
  • close one browser tab
  • then the server core dumped

It might exist multiple released objects in the code.

But I have few knowledge about implementing native modules.
Teach me how to manage reference count over uv callback.

possible wrong free_buffers call

in function static bool camera_buffer_prepare(camera_t* camera)

free_buffers(camera, i);

I think should be
free_buffers(camera, camera->buffer_count);

Refine API: stop with callback, releasing device file

stop with callback

For reconfiguring a frame size, it required to poll fd after stopped(STREAMOFF).

cam.stop(function () {
   cam.config(cam.formats[1]);
});

close

cam.close() for close(fd)

close when destructor when removed all references

(It required to kill all native layer fault after closed.)

frameRaw() access often in the middle of a frame

My camera does not support MJPG, so I'm setting the format to RGB3. I call cam.frameRaw() inside the capture` callback and I get RGB data out. However, the data is not aligned with a frame capture. Example:

node-v4l2camera-misaligned-frame

Capturing images in setInterval?

I want to capture an image every 1 second using this package, but I have a problem.
The image capture from the camera is few seconds delay, the code is below:

setInterval(function() {
  cam.capture((sucess) => {
      var fs = require("fs");
      var jpegjs = require("jpeg-js");
      
      var size = width * height;
      var rgba = {data: new Buffer(size * 4), width: width, height: height};
      for (var i = 0; i < size; i++) {
          rgba.data[i * 4 + 0] = rgb[i * 3 + 0];
          rgba.data[i * 4 + 1] = rgb[i * 3 + 1];
          rgba.data[i * 4 + 2] = rgb[i * 3 + 2];
          rgba.data[i * 4 + 3] = 255;
      }
      var jpeg = jpegjs.encode(rgba, 80);
      fs.createWriteStream(filename).end(new Buffer(jpeg.data));
  });
}, 1000);

May I know what is causing this problem?
How can I solve this?

field ‘timestamp’ has incomplete type error during build.

I get the following error during installation.

$ npm install

> [email protected] install /home/rich/Projects/tmp/v4l2camera
> node-gyp rebuild

make: Entering directory '/home/rich/Projects/tmp/v4l2camera/build'
  CXX(target) Release/obj.target/v4l2camera/v4l2camera.o
  CC(target) Release/obj.target/v4l2camera/capture.o
In file included from ../capture.h:7:0,
                 from ../capture.c:1:
/usr/include/linux/videodev2.h:2127:20: error: field ‘timestamp’ has incomplete type
  struct timespec   timestamp;
                    ^~~~~~~~~
v4l2camera.target.mk:112: recipe for target 'Release/obj.target/v4l2camera/capture.o' failed
make: *** [Release/obj.target/v4l2camera/capture.o] Error 1
make: *** Waiting for unfinished jobs....
In file included from ../node_modules/nan/nan_callbacks.h:83:0,
                 from ../node_modules/nan/nan.h:146,
                 from ../v4l2camera.cc:3:
../node_modules/nan/nan_callbacks_12_inl.h: In instantiation of ‘v8::Local<v8::Function> Nan::FunctionCallbackInfo<T>::Callee() const [with T = v8::Value]’:
../v4l2camera.cc:255:48:   required from here
../node_modules/nan/nan_callbacks_12_inl.h:108:71: warning: ‘v8::Local<v8::Function> v8::FunctionCallbackInfo<T>::Callee() const [with T = v8::Value]’ is deprecated: Use Data() to explicitly pass Callee instead [-Wdeprecated-declarations]
   inline v8::Local<v8::Function> Callee() const { return info_.Callee(); }
                                                                       ^
In file included from /home/rich/.node-gyp/7.5.0/include/node/node.h:42:0,
                 from ../node_modules/nan/nan.h:47,
                 from ../v4l2camera.cc:3:
/home/rich/.node-gyp/7.5.0/include/node/v8.h:8119:17: note: declared here
 Local<Function> FunctionCallbackInfo<T>::Callee() const {
                 ^~~~~~~~~~~~~~~~~~~~~~~

I was able to fix it by adding #include <time.h> to the top of capture.h

#ifndef CAMERA_H
#define CAMERA_H

#include <time.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <linux/videodev2.h>
#ifndef __V4L2_COMMON__
#  define CAMERA_OLD_VIDEODEV2_H
#endif

Faster toYUYV and toRGB

Executing toYUYV() or toRGB() on a Raspberry Pi takes multiple seconds, we're talking seconds per frame rather than frames per second :)

Looking at the code, I'm assuming the majority of the time is spent in this loop;

    auto ret  = v8::Array::New(size);
    for (int i = 0; i < size; i++) {
      ret->Set(i, v8::Integer::NewFromUnsigned(camera->head.start[i]));
    }
    return scope.Close(ret);

Is there any way it could use a Blob, Buffer, ArrayBuffer or something else that doesn't require creating millions of booleans?

GCC 6.3, need to remove parameters

When I try to install this on debian stretch with GCC 6.3, the node-gyp rebuild step fails with the following error:

> [email protected] install /home/barco/test/node_modules/v4l2camera
> node-gyp rebuild

make: Entering directory '/home/barco/test/node_modules/v4l2camera/build'
  CC(target) Release/obj.target/v4l2camera/capture.o
In file included from ../capture.h:7:0,
                 from ../capture.c:1:
/usr/include/linux/videodev2.h:2126:20: error: field ‘timestamp’ has incomplete type
  struct timespec   timestamp;
                    ^~~~~~~~~
v4l2camera.target.mk:112: recipe for target 'Release/obj.target/v4l2camera/capture.o' failed
make: *** [Release/obj.target/v4l2camera/capture.o] Error 1
make: Leaving directory '/home/barco/test/node_modules/v4l2camera/build'
...

If I manually clone this repo to node_modules and remove the -std=c11 and -std=c++14 flags from the binding file, everything seems to build and work.

The jpg data is not readable on Mac

The jpg file generated by the sample code can't be opened on Mac, or safari. But It is viewable in Chrome.

Is it because the jpg file does not contain meta header data?

I also tried to encode that data in base64 and embedded in HTML page. The image is not able to show in safari.

core dump when running `examples/capture-via-yuyv.js`

When I enter a empty folder, npm install my fork (which merely implements the fix described in #30), npm install pngjs, and try to run the example indicated, the core dumps:

$ node node_modules/v4l2camera/examples/capture-via-yuyv.js 
w: 352 h: 288


#
# Fatal error in ../deps/v8/src/objects.cc, line 3044
# Check failed: receiver->IsJSFunction().
#

==== C stack trace ===============================

    node(v8::base::debug::StackTrace::StackTrace()+0x16) [0x1583c76]
    node(V8_Fatal+0xd6) [0x157e996]
    node() [0xfd5c0f]
    node(v8::Object::CreationContext()+0x11) [0xaac451]
    node(node::MakeCallback(v8::Isolate*, v8::Local<v8::Object>, v8::Local<v8::Function>, int, v8::Local<v8::Value>*)+0x32) [0x12bd4c2]
    /home/troyw/code-local/experiments/v4l2camera/node_modules/v4l2camera/build/Release/v4l2camera.node(+0x5548) [0x7fda9e258548]
    node() [0x1577a48]
    node(uv_run+0x156) [0x1567d96]
    node(node::Start(uv_loop_s*, int, char const* const*, int, char const* const*)+0x6d7) [0x12c2e27]
    node(node::Start(int, char**)+0x104) [0x12c2174]
    /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf1) [0x7fdaa04853f1]
    node() [0x8f0111]
Illegal instruction (core dumped)

Error on cam.stop();

I tried the capture-jpg.js example, the capture works well, but i have to comment the line cam.stop(), if not an error is thrown in my node.js app: TypeError: undefined is not a function. Thanks for any help.

multiple camera access?

I have no problem capturing image from a single webcam, but when i have 2 webcams, and I try to run it, it will complains Error: CAMERA ERROR [VIDIOC_STREAMON] 12 Cannot allocate memory, may I know how can I solve this problem?

npm install on Raspberry Pi not working

When I try to install v4l2camera, I get an error. Is there any way to fix this?

I execute the following command:

npm install v4l2camera

I get this output:

> [email protected] install /srv/raspberry-pi-nodejs-barcode-reader-/node_modules/v4l2camera
> node-gyp rebuild

sh: 1: node-gyp: Permission denied
npm WARN [email protected] No repository field.

npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! spawn ENOENT
npm ERR! 
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2017-08-07T14_06_05_145Z-debug.log

Details

npm debug log

Some of the debug logfile says this:

0 info it worked if it ends with ok
1 verbose cli [ '/root/.nvm/versions/node/v6.10.0/bin/node',
1 verbose cli   '/root/.nvm/versions/node/v6.10.0/bin/npm',
1 verbose cli   'install',
1 verbose cli   'v4l2camera' ]
2 info using [email protected]
3 info using [email protected]
...
78 info lifecycle [email protected]~install: [email protected]
79 verbose lifecycle [email protected]~install: unsafe-perm in lifecycle false
80 verbose lifecycle [email protected]~install: PATH: /root/.nvm/versions/node/v6.10.0/lib/node_modules/npm/bin/node-gyp-bin:/srv/raspberry-pi-nodejs-barcode-reader-/node_modules/v4l2camera/node_modules/.bin:/srv/raspberry-pi-nodejs-barcode-reader-/node_modules/.bin:/root/.nvm/versions/node/v6.10.0/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
81 verbose lifecycle [email protected]~install: CWD: /srv/raspberry-pi-nodejs-barcode-reader-/node_modules/v4l2camera
82 silly lifecycle [email protected]~install: Args: [ '-c', 'node-gyp rebuild' ]
83 info lifecycle [email protected]~install: Failed to exec install script
84 verbose unlock done using /root/.npm/_locks/staging-414dd603579dbefb.lock for /srv/raspberry-pi-nodejs-barcode-reader-/node_modules/.staging
85 warn [email protected] No repository field.
86 verbose stack Error: [email protected] install: `node-gyp rebuild`
86 verbose stack spawn ENOENT
86 verbose stack     at ChildProcess.<anonymous> (/root/.nvm/versions/node/v6.10.0/lib/node_modules/npm/lib/utils/spawn.js:33:16)
86 verbose stack     at emitTwo (events.js:106:13)
86 verbose stack     at ChildProcess.emit (events.js:191:7)
86 verbose stack     at maybeClose (internal/child_process.js:877:16)
86 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
87 verbose pkgid [email protected]
88 verbose cwd /srv/raspberry-pi-nodejs-barcode-reader-
89 verbose Linux 4.9.35+
90 verbose argv "/root/.nvm/versions/node/v6.10.0/bin/node" "/root/.nvm/versions/node/v6.10.0/bin/npm" "install" "v4l2camera"
91 verbose node v6.10.0
92 verbose npm  v5.3.0
93 error file sh
94 error code ELIFECYCLE
95 error errno ENOENT
96 error syscall spawn
97 error [email protected] install: `node-gyp rebuild`
97 error spawn ENOENT
98 error Failed at the [email protected] install script.
98 error This is probably not a problem with npm. There is likely additional logging output above.
99 verbose exit [ 1, true ]

Version information

cat /etc/os-release

PRETTY_NAME="Raspbian GNU/Linux 8 (jessie)"
NAME="Raspbian GNU/Linux"
VERSION_ID="8"
VERSION="8 (jessie)"
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"

python

Python 2.7.9

make

GNU Make 4.0

gcc

gcc version 4.9.2 (Raspbian 4.9.2-10)

Node

v6.10.0

npm

5.3.0

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.