Repository Summary
| Description | |
| Checkout URI | https://github.com/ktossell/libuvc.git |
| VCS Type | git |
| VCS Version | master |
| Last Updated | 2026-11-15 |
| Dev Status | UNMAINTAINED |
| Released | RELEASED |
| Contributing |
Help Wanted (-)
Good First Issues (-) Pull Requests to Review (-) |
Packages
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 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 withsubmiturb 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.cfinds the first UVC camera, prints its descriptors and streams from it for 10 seconds. Built by default (BUILD_EXAMPLE). -
src/test.cxxshows the camera’s frames in an OpenCV window (Linux only, broken on macOS). Built with-DBUILD_TEST=ON; needs OpenCV.
Android:
-
examples/androidshows 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 withuvc_wrap(). See its README for what integrating libuvc there involves.
Developing with libuvc
The documentation for libuvc can currently be found at https://libuvc.github.io/.
Happy hacking!
CONTRIBUTING
Repository Summary
| Description | |
| Checkout URI | https://github.com/ktossell/libuvc.git |
| VCS Type | git |
| VCS Version | master |
| Last Updated | 2026-11-15 |
| Dev Status | UNMAINTAINED |
| Released | RELEASED |
| Contributing |
Help Wanted (-)
Good First Issues (-) Pull Requests to Review (-) |
Packages
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 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 withsubmiturb 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.cfinds the first UVC camera, prints its descriptors and streams from it for 10 seconds. Built by default (BUILD_EXAMPLE). -
src/test.cxxshows the camera’s frames in an OpenCV window (Linux only, broken on macOS). Built with-DBUILD_TEST=ON; needs OpenCV.
Android:
-
examples/androidshows 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 withuvc_wrap(). See its README for what integrating libuvc there involves.
Developing with libuvc
The documentation for libuvc can currently be found at https://libuvc.github.io/.
Happy hacking!
CONTRIBUTING
Repository Summary
| Description | |
| Checkout URI | https://github.com/ktossell/libuvc.git |
| VCS Type | git |
| VCS Version | master |
| Last Updated | 2026-11-15 |
| Dev Status | UNMAINTAINED |
| Released | RELEASED |
| Contributing |
Help Wanted (-)
Good First Issues (-) Pull Requests to Review (-) |
Packages
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 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 withsubmiturb 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.cfinds the first UVC camera, prints its descriptors and streams from it for 10 seconds. Built by default (BUILD_EXAMPLE). -
src/test.cxxshows the camera’s frames in an OpenCV window (Linux only, broken on macOS). Built with-DBUILD_TEST=ON; needs OpenCV.
Android:
-
examples/androidshows 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 withuvc_wrap(). See its README for what integrating libuvc there involves.
Developing with libuvc
The documentation for libuvc can currently be found at https://libuvc.github.io/.
Happy hacking!
CONTRIBUTING
Repository Summary
| Description | |
| Checkout URI | https://github.com/ktossell/libuvc.git |
| VCS Type | git |
| VCS Version | master |
| Last Updated | 2026-11-15 |
| Dev Status | UNMAINTAINED |
| Released | RELEASED |
| Contributing |
Help Wanted (-)
Good First Issues (-) Pull Requests to Review (-) |
Packages
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 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 withsubmiturb 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.cfinds the first UVC camera, prints its descriptors and streams from it for 10 seconds. Built by default (BUILD_EXAMPLE). -
src/test.cxxshows the camera’s frames in an OpenCV window (Linux only, broken on macOS). Built with-DBUILD_TEST=ON; needs OpenCV.
Android:
-
examples/androidshows 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 withuvc_wrap(). See its README for what integrating libuvc there involves.
Developing with libuvc
The documentation for libuvc can currently be found at https://libuvc.github.io/.
Happy hacking!
CONTRIBUTING
Repository Summary
| Description | |
| Checkout URI | https://github.com/ktossell/libuvc.git |
| VCS Type | git |
| VCS Version | master |
| Last Updated | 2026-11-15 |
| Dev Status | UNMAINTAINED |
| Released | RELEASED |
| Contributing |
Help Wanted (-)
Good First Issues (-) Pull Requests to Review (-) |
Packages
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 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 withsubmiturb 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.cfinds the first UVC camera, prints its descriptors and streams from it for 10 seconds. Built by default (BUILD_EXAMPLE). -
src/test.cxxshows the camera’s frames in an OpenCV window (Linux only, broken on macOS). Built with-DBUILD_TEST=ON; needs OpenCV.
Android:
-
examples/androidshows 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 withuvc_wrap(). See its README for what integrating libuvc there involves.
Developing with libuvc
The documentation for libuvc can currently be found at https://libuvc.github.io/.
Happy hacking!
CONTRIBUTING
Repository Summary
| Description | |
| Checkout URI | https://github.com/ktossell/libuvc.git |
| VCS Type | git |
| VCS Version | master |
| Last Updated | 2026-11-15 |
| Dev Status | UNMAINTAINED |
| Released | RELEASED |
| Contributing |
Help Wanted (-)
Good First Issues (-) Pull Requests to Review (-) |
Packages
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 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 withsubmiturb 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.cfinds the first UVC camera, prints its descriptors and streams from it for 10 seconds. Built by default (BUILD_EXAMPLE). -
src/test.cxxshows the camera’s frames in an OpenCV window (Linux only, broken on macOS). Built with-DBUILD_TEST=ON; needs OpenCV.
Android:
-
examples/androidshows 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 withuvc_wrap(). See its README for what integrating libuvc there involves.
Developing with libuvc
The documentation for libuvc can currently be found at https://libuvc.github.io/.
Happy hacking!
CONTRIBUTING
Repository Summary
| Description | |
| Checkout URI | https://github.com/ktossell/libuvc.git |
| VCS Type | git |
| VCS Version | master |
| Last Updated | 2026-11-15 |
| Dev Status | UNMAINTAINED |
| Released | RELEASED |
| Contributing |
Help Wanted (-)
Good First Issues (-) Pull Requests to Review (-) |
Packages
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 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 withsubmiturb 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.cfinds the first UVC camera, prints its descriptors and streams from it for 10 seconds. Built by default (BUILD_EXAMPLE). -
src/test.cxxshows the camera’s frames in an OpenCV window (Linux only, broken on macOS). Built with-DBUILD_TEST=ON; needs OpenCV.
Android:
-
examples/androidshows 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 withuvc_wrap(). See its README for what integrating libuvc there involves.
Developing with libuvc
The documentation for libuvc can currently be found at https://libuvc.github.io/.
Happy hacking!
CONTRIBUTING
Repository Summary
| Description | |
| Checkout URI | https://github.com/ktossell/libuvc.git |
| VCS Type | git |
| VCS Version | master |
| Last Updated | 2026-11-15 |
| Dev Status | UNMAINTAINED |
| Released | RELEASED |
| Contributing |
Help Wanted (-)
Good First Issues (-) Pull Requests to Review (-) |
Packages
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 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 withsubmiturb 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.cfinds the first UVC camera, prints its descriptors and streams from it for 10 seconds. Built by default (BUILD_EXAMPLE). -
src/test.cxxshows the camera’s frames in an OpenCV window (Linux only, broken on macOS). Built with-DBUILD_TEST=ON; needs OpenCV.
Android:
-
examples/androidshows 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 withuvc_wrap(). See its README for what integrating libuvc there involves.
Developing with libuvc
The documentation for libuvc can currently be found at https://libuvc.github.io/.
Happy hacking!
CONTRIBUTING
Repository Summary
| Description | |
| Checkout URI | https://github.com/ktossell/libuvc.git |
| VCS Type | git |
| VCS Version | master |
| Last Updated | 2026-11-15 |
| Dev Status | UNMAINTAINED |
| Released | RELEASED |
| Contributing |
Help Wanted (-)
Good First Issues (-) Pull Requests to Review (-) |
Packages
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 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 withsubmiturb 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.cfinds the first UVC camera, prints its descriptors and streams from it for 10 seconds. Built by default (BUILD_EXAMPLE). -
src/test.cxxshows the camera’s frames in an OpenCV window (Linux only, broken on macOS). Built with-DBUILD_TEST=ON; needs OpenCV.
Android:
-
examples/androidshows 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 withuvc_wrap(). See its README for what integrating libuvc there involves.
Developing with libuvc
The documentation for libuvc can currently be found at https://libuvc.github.io/.
Happy hacking!
CONTRIBUTING
Repository Summary
| Description | |
| Checkout URI | https://github.com/ktossell/libuvc.git |
| VCS Type | git |
| VCS Version | master |
| Last Updated | 2026-11-15 |
| Dev Status | UNMAINTAINED |
| Released | RELEASED |
| Contributing |
Help Wanted (-)
Good First Issues (-) Pull Requests to Review (-) |
Packages
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 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 withsubmiturb 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.cfinds the first UVC camera, prints its descriptors and streams from it for 10 seconds. Built by default (BUILD_EXAMPLE). -
src/test.cxxshows the camera’s frames in an OpenCV window (Linux only, broken on macOS). Built with-DBUILD_TEST=ON; needs OpenCV.
Android:
-
examples/androidshows 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 withuvc_wrap(). See its README for what integrating libuvc there involves.
Developing with libuvc
The documentation for libuvc can currently be found at https://libuvc.github.io/.
Happy hacking!