Periphery.Camera
5.0.0
dotnet add package Periphery.Camera --version 5.0.0
NuGet\Install-Package Periphery.Camera -Version 5.0.0
<PackageReference Include="Periphery.Camera" Version="5.0.0" />
<PackageVersion Include="Periphery.Camera" Version="5.0.0" />
<PackageReference Include="Periphery.Camera" />
paket add Periphery.Camera --version 5.0.0
#r "nuget: Periphery.Camera, 5.0.0"
#:package Periphery.Camera@5.0.0
#addin nuget:?package=Periphery.Camera&version=5.0.0
#tool nuget:?package=Periphery.Camera&version=5.0.0
Periphery.Camera
Capture frames from a camera you chose by identity. Supports Windows (Media Foundation) and Linux (V4L2), not macOS.
dotnet add package Periphery.Camera --prerelease
using Periphery;
using Periphery.Camera;
var device = await Devices.Enumerate()
.OfCategory(DeviceCategory.Camera)
.WithUsbId("046D", "0825")
.FirstOrDefaultAsync()
?? throw new InvalidOperationException("That camera is not attached.");
await using var session = await CameraSession.For(device)
.PreferNv12()
.MaxResolution(1280, 720)
.OpenAsync();
await foreach (var frame in session.CaptureAsync())
{
using (frame)
Process(frame.ContiguousBuffer.Span);
}
Dispose every frame. Frames come from a fixed pool, and an undisposed frame is a buffer the pool never gets back.
Options
CameraSession.For(device).WithSessionOptions(o => o with { BufferCount = 6 })
| Option | Meaning | Default |
|---|---|---|
BufferCount |
Frames you may hold at once | 3 |
QueueDepth |
Frames queued between capture and your loop | 1 |
ExhaustionPolicy |
LatestWins drops the oldest queued frame when you fall behind; StallProducer waits for you |
LatestWins |
session.Metrics.FramesDropped counts the frames a session drops.
To keep frames beyond the loop, or to feed several consumers from one camera, see Camera fan-out and retention.
Related packages
| Package | What it adds |
|---|---|
Periphery.Camera.Avalonia |
A CameraPreview control for Avalonia |
Periphery.Camera.OpenCvSharp |
Frames as OpenCV Mats, without VideoCapture |
Periphery.Camera.Testing |
A hardware-free camera backend for tests |
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Microsoft.Extensions.Logging.Abstractions (>= 9.0.0)
- Periphery (>= 5.0.0)
-
net8.0
- Microsoft.Extensions.Logging.Abstractions (>= 9.0.0)
- Periphery (>= 5.0.0)
NuGet packages (4)
Showing the top 4 NuGet packages that depend on Periphery.Camera:
| Package | Downloads |
|---|---|
|
FrameFlow.Camera
FrameFlow — cross-platform FFmpeg media pipelines for .NET: decode, encode, play back, capture from cameras, and run inference on frames. UI-agnostic core |
|
|
Periphery.Camera.OpenCvSharp
OpenCvSharp4 bindings for Periphery.Camera. AsMat() wraps a captured frame as a cv::Mat with no copy, ToMat() hands back an owned one, and ToBgr() converts any capture format to CV_8UC3 BGR — so an OpenCV pipeline can open a specific camera by identity instead of guessing at VideoCapture(0). |
|
|
Periphery.Camera.Avalonia
Avalonia controls for Periphery.Camera. Drop CameraPreview into your XAML and bind it to a DeviceInfo to get a live camera feed with reconnect resilience and zero capture-loop plumbing. Renders BGRA32 and RGBA32 straight into a reused WriteableBitmap, decodes MJPEG through Skia, and converts YUY2 and NV12 in-process. |
|
|
Periphery.Camera.Testing
Hardware-free test support for Periphery.Camera. Provides InMemoryCameraBackend (a scriptable, faultable fake capture backend) plus CameraTestScope and CameraTestHarness so consumers can unit-test code that wraps CameraSession/CameraDevice without a real camera. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 5.0.0 | 137 | 10/2/2026 |
| 4.3.0 | 151 | 9/23/2026 |
| 4.2.0 | 161 | 9/16/2026 |
| 4.2.0-alpha.1 | 104 | 9/9/2026 |
| 4.1.0-alpha.2 | 1,476 | 8/30/2026 |