26 releases

0.10.4 May 14, 2023
0.10.3 Dec 28, 2022
0.10.0-rc.2 Nov 17, 2022
0.9.4 Dec 17, 2021
0.3.2 Jul 10, 2021

#5 in Multimedia

Download history 234/week @ 2024-02-21 198/week @ 2024-02-28 191/week @ 2024-03-06 205/week @ 2024-03-13 276/week @ 2024-03-20 243/week @ 2024-03-27 427/week @ 2024-04-03 499/week @ 2024-04-10 353/week @ 2024-04-17 365/week @ 2024-04-24 336/week @ 2024-05-01 307/week @ 2024-05-08 572/week @ 2024-05-15 465/week @ 2024-05-22 367/week @ 2024-05-29 425/week @ 2024-06-05

1,876 downloads per month
Used in 11 crates (10 directly)



cargo version docs.rs version


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:

version = "0.10.0"
# Use the native input backends, enable WGPU integration
features = ["input-native", "output-wgpu"]

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::*.


// first camera in system
let index = CameraIndex::index(0); 
// request the absolute highest resolution CameraFormat that can be decoded to RGB.
let requested = RequestedFormat::<RgbFormat>::new(RequestedFormatType::AbsoluteHighestFrameRate);
// make the camera
let mut camera = Camera::new(index, requested).unwrap();

// get a frame
let frame = camera.frame().unwrap();
println!("Captured Single Frame of {}", frame.buffer().len());
// decode into an ImageBuffer
let decoded = frame.decode_image::<RgbFormat>().unwrap();
println!("Decoded Frame of {}", decoded.len());

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-native) Linux
MSMF(input-native) Windows
AVFoundation(input-native) Mac
OpenCV(input-opencv)^ Linux, Windows, Mac
WASM(input-wasm) Browser(Web)

✅: Working, 🔮 : Experimental, ❌ : Not Supported, 🚧: Planned/WIP

^ = May be bugged. Also supports IP Cameras.


The default feature includes nothing. Anything starting with input-* is a feature that enables the specific backend.

input-* features:

  • input-native: Uses either V4L2(Linux), MSMF(Windows), or AVFoundation(Mac OS)
  • input-opencv: Enables the opencv backend. (cross-platform)
  • input-jscam: Enables the use of the JSCamera struct, which uses browser APIs. (Web)

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 a wgpu texture.
  • output-threaded: Enable the threaded/callback based camera.

Other features:

  • decoding: Enables mozjpeg decoding. Enabled by default.
  • docs-only: Documentation feature. Enabled for docs.rs builds.
  • docs-nolink: Build documentation without linking to any libraries. Enabled for docs.rs builds.
  • test-fail-warning: Fails on warning. Enabled in CI.

You many want to pick and choose to reduce bloat.


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!


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 Apache 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.


Please consider donating! It helps me not look like a failure to my parents!


~535K SLoC