LibcameraSharp 10.1.2
dotnet add package LibcameraSharp --version 10.1.2
NuGet\Install-Package LibcameraSharp -Version 10.1.2
<PackageReference Include="LibcameraSharp" Version="10.1.2" />
<PackageVersion Include="LibcameraSharp" Version="10.1.2" />
<PackageReference Include="LibcameraSharp" />
paket add LibcameraSharp --version 10.1.2
#r "nuget: LibcameraSharp, 10.1.2"
#:package LibcameraSharp@10.1.2
#addin nuget:?package=LibcameraSharp&version=10.1.2
#tool nuget:?package=LibcameraSharp&version=10.1.2
<div align="center">
![]()
LibcameraSharp
Your Raspberry Pi camera, from C#.
Photos, video and live frames in a few lines of .NET.
</div>
Photos · RAW to DNG · H.264 & MJPEG · Live frames · Typed camera controls
⭐ Quick Start
dotnet add package LibcameraSharp
using LibcameraSharp;
await using CameraDevice camera = CameraDevice.Open();
Photo photo = await camera.CapturePhotoAsync();
await photo.SaveAsync("photo.jpg");
A full-resolution JPEG with EXIF. Cameras with autofocus focus first.
🎬 A little more
Record a video:
VideoRecording recording = await camera.StartRecordingAsync("clip.mp4");
await Task.Delay(TimeSpan.FromSeconds(10));
await recording.StopAsync();
Stream to a browser (ASP.NET Core):
app.MapGet("/live.mp4", (CameraDevice camera, CancellationToken ct) =>
Results.Stream(body => camera.RecordToAsync(body, new VideoOptions(), VideoContainer.Mp4, ct), "video/mp4"));
Read frames for motion detection or a model:
await foreach (VideoFrame frame in camera.ReadFramesAsync(new FrameOptions()))
using (frame)
Analyse(frame.Plane(0), frame.Stride(0));
Take control of exposure, gain, focus and more:
var manual = new PhotoOptions
{
Controls = new CameraControls { Exposure = ExposureMode.Fixed(TimeSpan.FromMilliseconds(8)), Gain = GainMode.Fixed(2.0f) },
};
Photo sharp = await camera.CapturePhotoAsync(manual);
📦 Packages
| Package | |
|---|---|
| LibcameraSharp | Photos, video and frames. Start here |
| LibcameraSharp.Core | libcamera itself, for building your own pipeline. Included in the one above |
Runs on .NET 10 and 64-bit Raspberry Pi OS (tested on a Pi 4), with any camera libcamera supports.
📚 Documentation
| Getting started | Install, first photo, options |
| Photos | JPEG, PNG, RAW and EXIF |
| Video | Recording and streaming |
| Frames | Pixels for your own code |
| Controls | Exposure, gain, focus, zoom |
| Cameras | Several cameras, sensor modes |
| Raspberry Pi setup | Checking the camera, deploying, troubleshooting |
| LibcameraSharp.Core | libcamera, directly |
| Demos | A photo booth and a browser webcam |
FAQ
Only Raspberry Pi? No. Any camera libcamera drives on Linux, USB webcams included. The Pi is just where libcamera is most at home.
Is video encoded in hardware? On a Pi 4, yes, up to 1080p30. A Pi 5 encodes in software.
What does it need installed? Raspberry Pi OS has everything: libcamera, FFmpeg, libtiff and libexif.
Credits
Built on libcamera, FFmpeg, SkiaSharp, libtiff and libexif. The C shim comes from libcamera-rs. Much of the design, and the reference output the tests compare against, comes from picamera2, rpicam-apps and PiDNG.
License
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | 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
- FFmpeg.AutoGen (>= 7.1.1)
- LibcameraSharp.Core (>= 10.1.2)
- SkiaSharp (>= 4.152.2)
- SkiaSharp.NativeAssets.Linux.NoDependencies (>= 4.152.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.