Hardware-accelerated pixel format conversion with up to 10x speedup using AVX2, Apple Accelerate, and NEON.
硬件加速的像素格式转换,使用 AVX2、Apple Accelerate 和 NEON 可提升高达 10 倍性能。
Zero external dependencies - uses only system frameworks for maximum portability.
零外部依赖,仅使用系统框架,实现最大可移植性。
Native support for Windows (DirectShow), macOS/iOS (AVFoundation), and Linux (V4L2).
原生支持 Windows (DirectShow)、macOS/iOS (AVFoundation) 和 Linux (V4L2)。
Support for RGB, BGR, YUV (NV12/I420) with automatic format conversion.
支持 RGB、BGR、YUV(NV12/I420)及自动格式转换。
Both modern C++ API and pure C99 interface for various project integration and language bindings.
同时提供现代 C++ API 和纯 C99 接口,支持各种项目集成和语言绑定。
Comprehensive test suite with 95%+ accuracy validation and 50+ test cases.
完整测试套件,95%+ 精度验证,50+ 测试用例。
DirectShow
MSVC 2019+
AVFoundation
Xcode 11+, macOS 10.13+
AVFoundation
Xcode 11+, iOS 13.0+
V4L2
GCC 7+ / Clang 6+
// C++ Example #include <ccap.h> int main() { ccap::Provider provider; // List available cameras auto devices = provider.findDeviceNames(); for (size_t i = 0; i < devices.size(); ++i) { printf("[%zu] %s\n", i, devices[i].c_str()); } // Open and start camera if (provider.open("", true)) { auto frame = provider.grab(3000); if (frame) { printf("Captured: %dx%d\n", frame->width, frame->height); } } return 0; }
// Pure C Example #include <ccap_c.h> #include <ccap_utils_c.h> int main() { CcapProvider* provider = ccap_provider_create(); if (!provider) return -1; // Find available devices CcapDeviceNamesList deviceList; if (ccap_provider_find_device_names_list(provider, &deviceList)) { printf("Found %zu camera(s)\n", deviceList.deviceCount); } // Open and capture if (ccap_provider_open(provider, NULL, true)) { CcapVideoFrame* frame = ccap_provider_grab(provider, 3000); if (frame) { CcapVideoFrameInfo info; ccap_video_frame_get_info(frame, &info); printf("Captured: %dx%d\n", info.width, info.height); ccap_video_frame_release(frame); } } ccap_provider_destroy(provider); return 0; }
git clone https://github.com/wysaid/CameraCapture.git cd CameraCapture ./scripts/build_and_install.sh
include(FetchContent)
FetchContent_Declare(
ccap
GIT_REPOSITORY https://github.com/wysaid/CameraCapture.git
GIT_TAG main
)
FetchContent_MakeAvailable(ccap)
target_link_libraries(your_app PRIVATE ccap::ccap)
brew tap wysaid/ccap brew install ccap
find_package(ccap REQUIRED) target_link_libraries(your_app ccap::ccap)
| Platform平台 | Compiler编译器 | Requirements要求 |
|---|---|---|
| Windows | MSVC 2019+ | DirectShow |
| macOS | Xcode 11+ | macOS 10.13+ |
| iOS | Xcode 11+ | iOS 13.0+ |
| Linux | GCC 7+ / Clang 6+ | V4L2 (Linux 2.6+) |
Build Requirements: CMake 3.14+, C++17 (C++ interface), C99 (C interface) 构建要求:CMake 3.14+,C++17(C++ 接口),C99(C 接口)