Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
nokhwa
Nokhwa(녹화): Korean word meaning "to record".
A Simple-to-use, cross-platform Rust Webcam Capture Library
Using nokhwa
Nokhwa can be added to your crate by adding it to your Cargo.toml
:
[dependencies.nokhwa]
// TODO: replace the "*" with the latest version of `nokhwa`
version = "*"
// TODO: add some features
features = [""]
Most likely, you will only use functionality provided by the Camera
struct. If you need lower-level access, you may instead opt to use the raw capture backends found at nokhwa::backends::capture::*
.
Example
// set up the Camera
let mut camera = new
.unwrap;
// open stream
camera.open_stream.unwrap;
loop
A command line app made with nokhwa
can be found in the examples
folder.
API Support
The table below lists current Nokhwa API support.
- The
Backend
column signifies the backend. - The
Input
column signifies reading frames from the camera - The
Query
column signifies system device list support - The
Query-Device
column signifies reading device capabilities - The
Platform
column signifies what Platform this is availible on.
Backend | Input | Query | Query-Device | Platform |
---|---|---|---|---|
Video4Linux(input-v4l ) |
:white_check_mark: | :white_check_mark: | :white_check_mark: | Linux |
libuvc(input-uvc ) |
:white_check_mark: | :white_check_mark: | :white_check_mark: | Linux, Windows, Mac |
OpenCV(input-opencv )^ |
:white_check_mark: | :x: | :x: | Linux, Windows, Mac |
IPCamera(input-ipcam /OpenCV)^ |
:white_check_mark: | :x: | :x: | Linux, Windows, Mac |
GStreamer(input-gst ) |
:white_check_mark: | :white_check_mark: | :white_check_mark: | Linux, Windows, Mac |
FFMpeg | * | * | * | Linux, Windows, Mac |
AVFoundation | * | * | * | Mac |
MSMF | * | * | * | Windows |
JS/WASM | * | * | * | Web |
:white_check_mark: : Working, :warning: : Experimental, :x: : Not Supported, *: Planned/WIP
^ = No CameraFormat setting support.
Feature
The default feature includes nothing. Anything starting with input-*
is a feature that enables the specific backend.
As a general rule of thumb, you would want to keep at least input-uvc
or other backend that has querying enabled so you can get device information from nokhwa
.
input-*
features:
input-v4l
: Enables theVideo4Linux
backend (linux)input-uvc
: Enables thelibuvc
backend (cross-platform, libuvc statically-linked)input-opencv
: Enables theopencv
backend (cross-platform)input-ipcam
: Enables the use of IP Cameras, please see theNetworkCamera
struct. Note that this relies onopencv
, so it will automatically enable theinput-opencv
feature.input-gst
: Enables thegstreamer
backend (cross-platform).
Conversely, anything that starts with output-*
controls a feature that controls the output of something (usually a frame from the camera)
output-*
features:
output-wgpu
: Enables the API to copy a frame directly into awgpu
texture.
You many want to pick and choose to reduce bloat.
Issues
If you are making an issue, please make sure that
- It has not been made yet
- Attach what you were doing, your environment, steps to reproduce, and backtrace. Thank you!
Contributing
Contributions are welcome!
- Please
rustfmt
all your code and adhere to the clippy lints (unless necessary not to do so) - Please limit use of
unsafe
- All contributions are under the MPL 2.0 license unless otherwise specified
Minimum Service Rust Version
nokhwa
may build on older versions of rustc
, but there is no guarantee except for the latest stable rust.