{"id":23768303,"url":"https://github.com/hypersolution1/v4l2camera","last_synced_at":"2025-09-05T12:31:21.424Z","repository":{"id":57117025,"uuid":"178252261","full_name":"hypersolution1/v4l2camera","owner":"hypersolution1","description":null,"archived":false,"fork":false,"pushed_at":"2019-07-06T18:39:18.000Z","size":87,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-11-30T07:39:04.120Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hypersolution1.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-LGPL-3.0.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-03-28T17:30:28.000Z","updated_at":"2021-07-09T22:20:16.000Z","dependencies_parsed_at":"2022-08-22T22:20:45.960Z","dependency_job_id":null,"html_url":"https://github.com/hypersolution1/v4l2camera","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hypersolution1%2Fv4l2camera","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hypersolution1%2Fv4l2camera/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hypersolution1%2Fv4l2camera/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hypersolution1%2Fv4l2camera/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hypersolution1","download_url":"https://codeload.github.com/hypersolution1/v4l2camera/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":231887957,"owners_count":18441265,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-01-01T01:27:47.985Z","updated_at":"2025-01-01T01:27:48.648Z","avatar_url":"https://github.com/hypersolution1.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# v4l2camera\n\nCapturing images from USB(UVC) webcam on linux machines.\n\nFork of https://github.com/bellbind/node-v4l2camera\n\nThis fork was made for Node.JS 10.x support\n\n## Requirements\n\n- node \u003e= 4.x\n- video4linux2 headers\n- c and c++ compiler with `-std=c11` and `-std=c++14`\n    - gcc \u003e= 4.9\n\n## Install\n\nOn linux machines:\n\n```bash\nnpm install @hypersolution/v4l2camera\n```\n\n- package details: https://npmjs.org/package/v4l2camera\n\n## Usage\n\n```js\nvar v4l2camera = require(\"v4l2camera\");\n\nvar cam = new v4l2camera.Camera(\"/dev/video0\");\nif (cam.configGet().formatName !== \"MJPG\") {\n  console.log(\"NOTICE: MJPG camera required\");\n  process.exit(1);\n}\ncam.start();\ncam.capture(function (success) {\n  var frame = cam.frameRaw();\n  require(\"fs\").createWriteStream(\"result.jpg\").end(Buffer(frame));\n  cam.stop();\n});\n```\n\nFor more detail see: examples/*.js (required \"pngjs\" modules)\n\n## API\n\nInitializing and Configuration API\n\n- `var cam = new v4l2camera.Camera(device)`\n    - `device`: e.g. `\"/dev/video0\"`\n- `cam.formats`: Array of available frame formats\n- `var format = cam.formats[n]`\n    - `format.formatName`: Name of pixel format. e.g. `\"YUYV\"`, `\"MJPG\"`\n    - `format.format`: ID number of pixel format\n    - `format.width`: Frame width\n    - `format.height`: Frame height\n    - `format.interval.numerator` and `format.interval.denominator`\n      : Capturing interval per `numerator/denominator` seconds \n      (e.g. 30fps is 1/30)\n- `cam.configSet(format)`\n  : Set capture `width`, `height`, `interval` per `numerator/denominator` sec\n  if the members exist in the `format` object\n- `cam.configGet()` : Get a `format` object of current config\n\nCapturing API (control flow)\n\n- `cam.start()`\n- `cam.stop(afterStoped)`\n    - call re-`config(format)` or re-`start()` in `afterStoped()` callback\n- `cam.capture(afterCaptured)`: Do cache a current captured frame\n    - use `cam.frameRaw()` in `afterCaptured(true)` callback\n\nCapturing API (frame access)\n\n- `cam.frameRaw()`: Get the cached raw frame as `Uint8Array`\n   (YUYU frame is array of YUYV..., MJPG frame is single JPEG compressed data)\n- `cam.toYUYV()`: Get the cached frame as `Uint8Array` of pixels YUYVYUYV...\n   (will be deprecated method)\n- `cam.toRGB()`: Get the cached frame as `Uint8Array` of pixels RGBRGB...\n   (will be deprecated method)\n\nCapturing API (camera frame info)\n\n- `cam.device`: the device file name e.g. `\"/dev/video0\"`\n- `cam.width`: pixel width of the camera\n- `cam.height`: pixel height of the camera\n\nControl API\n\n- `cam.controls`: Array of the control information\n- `cam.controlGet(id)`: Get int value of the control of the `id`\n  (id is one of cam.controls[n].id)\n- `cam.controlSet(id, value)`: Set int value of the control of the `id`\n- `var control = cam.controls[n]`: Control spec\n    - `control.id`: Control `id` for controlGet and controlSet\n    - `control.name`: Control name string\n    - `control.type`: `\"int\"`, `\"bool\"`, `\"button\"`, `\"menu\"` or other types\n    - `control.max`, `control.min`, `control.step`: value should be\n      `min \u003c= v` and `v \u003c= max` and `(v - min) % step === 0`\n    - `control.default`: default value of the control\n    - `control.flags`: Several bool flags of the controls\n    - `control.menu`: Array of items. \n      A control value is the index of the menu item when type is `\"menu\"`.\n\n## Build for Development\n\nOn linux machines:\n\n```bash\ncd myproject\nmkdir -p node_modules\ncd node_modules\ngit clone https://github.com/bellbind/node-v4l2camera.git v4l2camera\ncd v4l2camera\nnpm install\ncd ../..\n```\n\n\"build/Release/v4l2camera.node\" is exist after the build.\n\n## Tested Environments\n\n- Ubuntu wily armhf on BeagleBone Black with USB Buffalo BSW13K10H\n- Ubuntu wily amd64 on Acer Aspire One with its screen facecam\n- [Travis-CI (build only)](https://travis-ci.org/bellbind/node-v4l2camera):\n  ![Build Status](https://travis-ci.org/bellbind/node-v4l2camera.svg)\n\n## Licenses\n\n[MIT](http://opensource.org/licenses/MIT) and \n[LGPL-3.0](http://opensource.org/licenses/LGPL-3.0) dual\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhypersolution1%2Fv4l2camera","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhypersolution1%2Fv4l2camera","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhypersolution1%2Fv4l2camera/lists"}