# libuvc **Repository Path**: yunhaoliu/libuvc ## Basic Information - **Project Name**: libuvc - **Description**: No description available - **Primary Language**: Unknown - **License**: BSD-3-Clause - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-11-20 - **Last Updated**: 2026-11-20 ## Categories & Tags **Categories**: Uncategorized **Tags**: 从零构建代码运行环境所需的公开库 ## README `libuvc` is a cross-platform library for USB video devices, built atop `libusb`. It enables fine-grained control over USB video devices exporting the standard USB Video Class (UVC) interface, enabling developers to write drivers for previously unsupported devices, or just access UVC devices in a generic fashion. ## Getting and Building libuvc Prerequisites: You will need `libusb` and [CMake](http://www.cmake.org/) installed. To build, you can just run these shell commands: git clone https://github.com/libuvc/libuvc cd libuvc mkdir build cd build cmake .. make && sudo make install and you're set! If you want to change the build configuration, you can edit `CMakeCache.txt` in the build directory, or use a CMake GUI to make the desired changes. There is also `BUILD_EXAMPLE` and `BUILD_TEST` options to enable the compilation of `example` and `uvc_test` programs. To use them, replace the `cmake ..` command above with `cmake .. -DBUILD_TEST=ON -DBUILD_EXAMPLE=ON`. Then you can start them with `./example` and `./uvc_test` respectively. Note that you need OpenCV to build the later (for displaying image). `LIBUVC_INSTALL` (on by default) generates the install rules. A project that uses libuvc with `add_subdirectory()` and builds libusb itself, providing it as a target of its own, has to turn it off: libuvc's installed CMake package could not refer to that target. Two tuning options control how much data is queued for a stream, and are left at their defaults when unset: - `LIBUVC_PACKETS_PER_TRANSFER_MAX` (default 32): maximum number of isochronous packets in one USB transfer. If starting a stream fails with `submiturb failed, errno=12` (ENOMEM), as is common on Android, lower it, e.g. `cmake .. -DLIBUVC_PACKETS_PER_TRANSFER_MAX=8`. - `LIBUVC_NUM_TRANSFER_BUFS` (default 100, 20 on macOS): number of transfers queued at once. ## Examples Linux/macOS: - [`src/example.c`](src/example.c) finds the first UVC camera, prints its descriptors and streams from it for 10 seconds. Built by default (`BUILD_EXAMPLE`). - [`src/test.cxx`](src/test.cxx) shows the camera's frames in an OpenCV window (Linux only, broken on macOS). Built with `-DBUILD_TEST=ON`; needs OpenCV. Android: - [`examples/android`](examples/android) shows the camera's frames in an app. It uses Android APIs to find the camera, request permission and get a file descriptor, then opens the camera with `uvc_wrap()`. See [its README](examples/android/README.md) for what integrating libuvc there involves. ## Developing with libuvc The documentation for `libuvc` can currently be found at https://libuvc.github.io/. Happy hacking!