mmalsharp - MMALSharp 0.7.0-380

MMALSharp brings low level access to the Raspberry Pi camera module in C#. Based on the native MMAL library, MMALSharp allows you to configure a rich set of camera/sensor related settings via an easy to use asynchronous API.

PM> Install-Package MMALSharp -Version 0.7.0-380 -Source https://www.myget.org/F/mmalsharp/api/v3/index.json

Copy to clipboard

> nuget.exe install MMALSharp -Version 0.7.0-380 -Source https://www.myget.org/F/mmalsharp/api/v3/index.json

Copy to clipboard

> dotnet add package MMALSharp --version 0.7.0-380 --source https://www.myget.org/F/mmalsharp/api/v3/index.json

Copy to clipboard
<PackageReference Include="MMALSharp" Version="0.7.0-380" />
Copy to clipboard
source https://www.myget.org/F/mmalsharp/api/v3/index.json

nuget MMALSharp  ~> 0.7.0-380
Copy to clipboard

> choco install MMALSharp --version 0.7.0-380 --source https://www.myget.org/F/mmalsharp/api/v2

Copy to clipboard
Import-Module PowerShellGet
Register-PSRepository -Name "mmalsharp" -SourceLocation "https://www.myget.org/F/mmalsharp/api/v2"
Install-Module -Name "MMALSharp" -RequiredVersion "0.7.0-380" -Repository "mmalsharp" -AllowPreRelease
Copy to clipboard

MMALSharp - C# wrapper to Broadcom's MMAL and API to the Raspberry Pi camera

Build status Join the chat at https://gitter.im/MMALSharp/Lobby

If you like this project, please support it by giving it a star! GitHub stars

MMALSharp is a C# wrapper around the MMAL library designed by Broadcom. It exposes many elements of MMAL and in addition provides an easy to use, asynchronous API to the Raspberry Pi Camera Module. The library targets .NET Standard 2.0 and is compatible with Mono 5.4/.NET Core 2.0 or greater runtimes.

Installation

MMALSharp NuGet package: NuGet version

PM> Install-Package MMALSharp

MMALSharp.FFmpeg NuGet package: NuGet version

PM> Install-Package MMALSharp.FFmpeg

Pre-release builds can be found on MyGet:

Logging configuration

For v0.6, MMALSharp now uses Microsoft.Extensions.Logging.Abstractions to provide package agnostic logging. If you want to enable logging, you must provide the ILoggerFactory instance your client application is using. For .NET Core applications, this will typically be done during dependency injection configuration. For more information, please see here.

Below is an example on how to configure NLog in a .NET Core 3.0+ console app. Note: the ILoggerFactory instance should be set before carrying out any MMALSharp specific operations:

var loggerFactory = LoggerFactory.Create(builder =>
{

	builder                
	.ClearProviders()
	.SetMinimumLevel(LogLevel.Trace)                
	.AddNLog("NLog.config");
});

MMALLog.LoggerFactory = loggerFactory;

Also see here for full NLog integration instructions.

Basic Examples

Take a JPEG image using YUV420 encoding:


public void TakePicture()
{
    // Singleton initialized lazily. Reference once in your application.
    MMALCamera cam = MMALCamera.Instance;

    using (var imgCaptureHandler = new ImageStreamCaptureHandler("/home/pi/images/", "jpg"))        
    {            
        await cam.TakePicture(imgCaptureHandler, MMALEncoding.JPEG, MMALEncoding.I420);
    }
    
    // Cleanup disposes all unmanaged resources and unloads Broadcom library. To be called when no more processing is to be done
    // on the camera.
    cam.Cleanup();
}

Take a H.264 video using YUV420 encoding at 30 fps:


public void TakeVideo()
{
    // Singleton initialized lazily. Reference once in your application.
    MMALCamera cam = MMALCamera.Instance;

    using (var vidCaptureHandler = new VideoStreamCaptureHandler("/home/pi/videos/", "avi"))        
    {    
        var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3));
                
        await cam.TakeVideo(vidCaptureHandler, cts.Token);
    }   

    // Cleanup disposes all unmanaged resources and unloads Broadcom library. To be called when no more processing is to be done
    // on the camera.
    cam.Cleanup();
}

Documentation

For full installation instructions for Mono and .NET Core, including configuration and examples - please visit the Wiki.

License

MIT license

Copyright (c) 2016-2020 Ian Auty

Raspberry Pi is a trademark of the Raspberry Pi Foundation

Contributors

I want to say a big thank you to those of you who have helped develop MMALSharp over the years, your contributions are most appreciated. In addition, I'd like to say thanks to Dave Jones @waveform80 for your work on picamera which gave me the inspiration to start this project.

  • .NETStandard 2.0
    • Microsoft.CSharp (>= 4.7.0)
    • Microsoft.Extensions.Logging.Abstractions (>= 3.1.0)
    • MMALSharp.Common (>= 0.7.0-380)
    • MMALSharp.Processing (>= 0.7.0-380)
  • .NETStandard 2.0: 2.0.0.0

Owners

techyian

Authors

Ian Auty

Project URL

https://github.com/techyian/MMALSharp

License

MIT

Tags

raspberry-pi

Info

44 total downloads
10 downloads for version 0.7.0-380
Download (116.66 KB)
Found on the current feed only

Package history

Version Size Last updated Downloads Mirrored?
0.7.0-380 116.66 KB Thu, 15 Oct 2020 14:03:05 GMT 10
0.7.0-379 116.66 KB Thu, 15 Oct 2020 11:46:35 GMT 0
0.7.0-378 116.66 KB Thu, 15 Oct 2020 11:36:51 GMT 0
0.7.0-377 116.32 KB Thu, 15 Oct 2020 11:27:31 GMT 0
0.7.0-376 115.72 KB Wed, 14 Oct 2020 13:00:57 GMT 0
0.7.0-375 115.67 KB Mon, 12 Oct 2020 18:34:48 GMT 0
0.7.0-374 115.49 KB Mon, 12 Oct 2020 08:50:05 GMT 0
0.7.0-365 115.5 KB Sat, 12 Sep 2020 15:12:34 GMT 0
0.7.0-362 115.51 KB Thu, 03 Sep 2020 13:30:54 GMT 1
0.7.0-360 115.03 KB Sun, 30 Aug 2020 14:17:56 GMT 0
0.7.0-358 115.03 KB Sat, 29 Aug 2020 14:19:17 GMT 0
0.7.0-353 113.74 KB Sun, 23 Aug 2020 13:10:03 GMT 0
0.7.0-345 113.74 KB Mon, 17 Aug 2020 19:08:40 GMT 0
0.7.0-339 113.74 KB Mon, 03 Aug 2020 13:53:44 GMT 0
0.7.0-336 113.69 KB Mon, 27 Jul 2020 13:59:30 GMT 0
0.7.0-331 113.73 KB Tue, 21 Jul 2020 10:36:07 GMT 0
0.7.0-330 113.69 KB Mon, 20 Jul 2020 19:47:45 GMT 0
0.7.0-324 113.69 KB Sat, 16 May 2020 19:36:36 GMT 0
0.7.0-323 113.55 KB Sat, 16 May 2020 18:55:57 GMT 0
0.7.0-322 113.55 KB Fri, 15 May 2020 19:21:11 GMT 0
0.7.0-321 113.61 KB Mon, 11 May 2020 18:12:39 GMT 0
0.7.0-320 112.7 KB Sun, 10 May 2020 15:02:25 GMT 0
0.7.0-319 112.75 KB Sun, 10 May 2020 14:55:00 GMT 0
0.7.0-318 112.76 KB Sun, 10 May 2020 14:50:06 GMT 0
0.7.0-317 112.75 KB Sat, 09 May 2020 15:14:40 GMT 0
0.7.0-316 112.75 KB Thu, 07 May 2020 21:03:34 GMT 0
0.7.0-315 113.64 KB Thu, 07 May 2020 18:24:28 GMT 0
0.7.0-314 113.5 KB Thu, 07 May 2020 13:34:47 GMT 0
0.7.0-313 113.49 KB Mon, 04 May 2020 18:33:44 GMT 0
0.7.0-312 113.96 KB Tue, 14 Apr 2020 13:06:44 GMT 0
0.6.0 109.85 KB Mon, 02 Mar 2020 20:57:43 GMT 0
0.6.0-311 113.97 KB Mon, 13 Apr 2020 19:25:48 GMT 0
0.6.0-310 113.83 KB Mon, 13 Apr 2020 11:48:10 GMT 0
0.6.0-309 113.83 KB Sun, 12 Apr 2020 20:54:56 GMT 0
0.6.0-308 113.12 KB Sat, 11 Apr 2020 12:15:16 GMT 0
0.6.0-307 113.08 KB Wed, 08 Apr 2020 18:21:12 GMT 0
0.6.0-306 112.93 KB Mon, 02 Mar 2020 21:42:16 GMT 0
0.6.0-304 112.93 KB Mon, 02 Mar 2020 20:55:14 GMT 0
0.6.0-303 112.95 KB Thu, 27 Feb 2020 12:35:28 GMT 0
0.6.0-302 112.91 KB Thu, 27 Feb 2020 10:09:33 GMT 0
0.6.0-301 112.89 KB Wed, 26 Feb 2020 12:53:22 GMT 0
0.6.0-300 112.89 KB Wed, 26 Feb 2020 10:10:57 GMT 0
0.6.0-299 112.89 KB Tue, 25 Feb 2020 19:59:03 GMT 0
0.6.0-298 112.89 KB Tue, 25 Feb 2020 19:51:52 GMT 0
0.6.0-297 115.28 KB Sat, 18 Jan 2020 17:20:19 GMT 2
0.6.0-296 115.25 KB Fri, 17 Jan 2020 11:43:27 GMT 0
0.6.0-295 115.25 KB Fri, 17 Jan 2020 11:32:27 GMT 0
0.6.0-294 115.25 KB Fri, 17 Jan 2020 11:24:38 GMT 0
0.6.0-293 114.79 KB Wed, 08 Jan 2020 06:06:49 GMT 2
0.6.0-292 114.83 KB Tue, 07 Jan 2020 20:54:09 GMT 0
0.6.0-291 114.56 KB Mon, 06 Jan 2020 21:17:52 GMT 0
0.6.0-290 114.42 KB Thu, 02 Jan 2020 22:30:43 GMT 0
0.6.0-289 114.23 KB Thu, 02 Jan 2020 18:38:10 GMT 0
0.6.0-288 114.22 KB Wed, 01 Jan 2020 19:11:32 GMT 0
0.6.0-287 114.23 KB Wed, 01 Jan 2020 19:10:18 GMT 0
0.6.0-286 114.23 KB Tue, 31 Dec 2019 22:00:13 GMT 0
0.6.0-285 114.23 KB Tue, 31 Dec 2019 18:38:23 GMT 0
0.6.0-284 114.22 KB Tue, 31 Dec 2019 18:37:31 GMT 0
0.6.0-283 113.91 KB Mon, 30 Dec 2019 21:57:27 GMT 0
0.6.0-282 113.91 KB Mon, 30 Dec 2019 21:34:37 GMT 0
0.6.0-281 113.91 KB Mon, 30 Dec 2019 18:27:12 GMT 0
0.6.0-280 113.9 KB Mon, 30 Dec 2019 15:06:11 GMT 0
0.6.0-279 113.91 KB Mon, 30 Dec 2019 14:49:45 GMT 0
0.6.0-278 113.91 KB Mon, 30 Dec 2019 14:47:31 GMT 0
0.6.0-277 113.91 KB Mon, 30 Dec 2019 14:27:17 GMT 0
0.6.0-276 112.75 KB Mon, 30 Dec 2019 11:14:46 GMT 0
0.6.0-275 112.73 KB Mon, 30 Dec 2019 09:57:07 GMT 0
0.6.0-274 112.73 KB Mon, 30 Dec 2019 09:42:21 GMT 0
0.6.0-273 112.73 KB Mon, 30 Dec 2019 08:45:38 GMT 0
0.6.0-272 112.73 KB Sun, 29 Dec 2019 15:55:41 GMT 0
0.6.0-271 112.73 KB Sat, 28 Dec 2019 19:58:02 GMT 0
0.6.0-270 112.73 KB Sat, 28 Dec 2019 19:36:49 GMT 0
0.6.0-269 112.73 KB Sat, 28 Dec 2019 11:40:22 GMT 0
0.6.0-268 112.74 KB Tue, 24 Dec 2019 21:26:38 GMT 0
0.6.0-267 112.73 KB Tue, 24 Dec 2019 21:02:24 GMT 0
0.6.0-266 112.74 KB Fri, 20 Dec 2019 22:15:32 GMT 0
0.6.0-265 112.73 KB Fri, 20 Dec 2019 19:22:56 GMT 0
0.6.0-264 112.74 KB Wed, 18 Dec 2019 22:05:06 GMT 0
0.6.0-263 223.12 KB Sun, 15 Dec 2019 18:19:10 GMT 0
0.6.0-262 223.2 KB Thu, 12 Sep 2019 20:49:28 GMT 0
0.6.0-261 223.2 KB Thu, 12 Sep 2019 20:47:08 GMT 0
0.6.0-260 223.2 KB Thu, 12 Sep 2019 20:23:33 GMT 0
0.6.0-259 223.2 KB Thu, 12 Sep 2019 20:20:55 GMT 0
0.6.0-258 223.27 KB Wed, 11 Sep 2019 22:04:45 GMT 0
0.5.1 214.4 KB Sun, 14 Jul 2019 18:56:23 GMT 1
0.5.1-255 220.96 KB Tue, 25 Jun 2019 20:20:55 GMT 0
0.5.1-253 220.97 KB Tue, 25 Jun 2019 20:10:45 GMT 0
0.5.0 213.82 KB Thu, 24 Jan 2019 20:51:51 GMT 5
0.5.0-252 220.96 KB Tue, 18 Jun 2019 09:46:33 GMT 0
0.5.0-251 220.91 KB Mon, 08 Apr 2019 21:16:36 GMT 0
0.5.0-250 219.91 KB Mon, 08 Apr 2019 21:02:23 GMT 0
0.5.0-249 219.93 KB Mon, 08 Apr 2019 15:26:04 GMT 0
0.5.0-248 219.93 KB Mon, 08 Apr 2019 15:20:05 GMT 0
0.5.0-247 219.28 KB Sun, 07 Apr 2019 20:23:30 GMT 0
0.5.0-246 219.44 KB Fri, 05 Apr 2019 19:32:39 GMT 0
0.5.0-245 221.13 KB Thu, 24 Jan 2019 21:15:12 GMT 0
0.5.0-243 221.13 KB Thu, 24 Jan 2019 20:50:16 GMT 0
0.5.0-241 215.34 KB Wed, 28 Nov 2018 12:32:29 GMT 0
0.5.0-240 213.85 KB Tue, 27 Nov 2018 12:01:47 GMT 0
0.5.0-239 214.58 KB Thu, 22 Nov 2018 19:21:46 GMT 0
0.5.0-238 215.2 KB Wed, 14 Nov 2018 10:52:57 GMT 1
0.5.0-237 212.2 KB Mon, 12 Nov 2018 07:24:35 GMT 0
0.5.0-236 208.5 KB Sun, 11 Nov 2018 16:08:45 GMT 0
0.5.0-235 208.51 KB Sat, 10 Nov 2018 21:54:22 GMT 0
0.5.0-234 205.91 KB Fri, 09 Nov 2018 07:39:33 GMT 0
0.5.0-233 204.67 KB Mon, 05 Nov 2018 22:08:39 GMT 0
0.5.0-232 204.67 KB Sun, 04 Nov 2018 20:27:03 GMT 0
0.5.0-231 204.67 KB Sun, 04 Nov 2018 20:15:44 GMT 0
0.5.0-230 203.73 KB Sun, 21 Oct 2018 18:50:20 GMT 1
0.5.0-227 203.86 KB Wed, 17 Oct 2018 11:19:58 GMT 0
0.5.0-224 203.58 KB Sat, 11 Aug 2018 19:50:02 GMT 2
0.5.0-223 203.58 KB Sat, 11 Aug 2018 14:14:09 GMT 0
0.5.0-221 202.78 KB Mon, 23 Jul 2018 19:51:20 GMT 0
0.4.4 196.91 KB Thu, 19 Jul 2018 19:09:14 GMT 0
0.4.4-220 202.79 KB Mon, 23 Jul 2018 19:49:14 GMT 0
0.4.4-218 202.64 KB Thu, 19 Jul 2018 19:26:16 GMT 1
0.4.4-216 202.64 KB Thu, 19 Jul 2018 19:07:42 GMT 0
0.4.3 196.54 KB Sat, 07 Jul 2018 19:52:36 GMT 0
0.4.3-215 202.65 KB Wed, 18 Jul 2018 20:07:40 GMT 0
0.4.3-214 202.25 KB Wed, 11 Jul 2018 13:43:18 GMT 0
0.4.3-213 202.23 KB Sun, 08 Jul 2018 07:34:02 GMT 0
0.4.3-211 202.24 KB Sat, 07 Jul 2018 19:50:55 GMT 0
0.4.2-210 202.24 KB Sat, 07 Jul 2018 19:35:30 GMT 0
0.4.2-209 202.23 KB Fri, 06 Jul 2018 15:26:52 GMT 0
0.4.2-208 202.19 KB Thu, 05 Jul 2018 21:30:29 GMT 0
0.4.2-207 201.59 KB Tue, 03 Jul 2018 18:02:47 GMT 0
0.4.2-206 201.59 KB Fri, 29 Jun 2018 12:03:11 GMT 0
0.4.2-205 201.59 KB Fri, 29 Jun 2018 07:46:32 GMT 0
0.4.2-204 201.59 KB Thu, 28 Jun 2018 20:07:32 GMT 0
0.4.2-203 164.94 KB Thu, 28 Jun 2018 19:59:51 GMT 0
0.4.2-202 164.04 KB Wed, 27 Jun 2018 19:34:21 GMT 0
0.4.2-201 163.9 KB Tue, 26 Jun 2018 22:08:59 GMT 0
0.4.1-198 164.07 KB Fri, 22 Jun 2018 21:48:43 GMT 0
0.4.1-197 163.99 KB Fri, 22 Jun 2018 13:14:36 GMT 0
0.4.1-193 161.8 KB Mon, 18 Jun 2018 18:57:26 GMT 0
0.4.0.178 191.03 KB Fri, 15 Jun 2018 10:26:39 GMT 0
0.4.0.169 188.05 KB Wed, 16 May 2018 19:12:44 GMT 2
0.4.0-192 161.79 KB Mon, 18 Jun 2018 18:53:33 GMT 0
0.4.0-190 161.8 KB Fri, 15 Jun 2018 10:29:17 GMT 0
0.3.0.128 147.3 KB Fri, 16 Feb 2018 22:45:28 GMT 1
0.3.0.122 141.01 KB Sat, 27 Jan 2018 23:02:08 GMT 0
0.3.0.116 140.78 KB Thu, 25 Jan 2018 20:46:35 GMT 1
0.3.0.112 139.88 KB Sun, 31 Dec 2017 22:03:48 GMT 0
0.3.0.110 139.78 KB Fri, 29 Dec 2017 18:16:44 GMT 0
0.3.0.107 140.13 KB Wed, 20 Dec 2017 20:16:18 GMT 0
0.3.0.105 140.05 KB Wed, 20 Dec 2017 18:54:39 GMT 0
0.3.0.97 139.44 KB Sat, 09 Dec 2017 21:40:20 GMT 0
0.3.0.93 139.35 KB Tue, 15 Aug 2017 21:27:21 GMT 0
0.3.0.89 139.45 KB Tue, 11 Jul 2017 20:56:08 GMT 0
0.3.0.87 138.16 KB Sat, 08 Jul 2017 20:32:10 GMT 0
0.3.0.85 138.15 KB Sat, 08 Jul 2017 07:41:19 GMT 1
0.3.0.83 138.16 KB Sat, 08 Jul 2017 07:34:05 GMT 0
0.3.0.72 75.88 KB Thu, 29 Jun 2017 20:06:09 GMT 1
0.2.0-alpha.58 72.21 KB Thu, 18 May 2017 20:32:46 GMT 1
0.2.0-alpha.55 72.41 KB Tue, 16 May 2017 19:57:47 GMT 0
0.2.0-alpha.50 72.21 KB Wed, 03 May 2017 20:09:07 GMT 0
0.2.0-alpha.48 72.21 KB Wed, 03 May 2017 19:40:57 GMT 0
0.2.0-alpha.46 72.21 KB Wed, 03 May 2017 18:49:09 GMT 0
0.2.0-alpha.43 72.28 KB Wed, 03 May 2017 08:24:52 GMT 0
0.2.0-alpha.39 70.57 KB Wed, 26 Apr 2017 09:10:37 GMT 1
0.2.0-alpha.36 70.56 KB Tue, 25 Apr 2017 19:29:49 GMT 2
0.2.0-alpha.34 70.31 KB Sun, 23 Apr 2017 10:51:07 GMT 0
0.2.0-alpha.32 70.32 KB Sun, 23 Apr 2017 10:43:16 GMT 0
0.2.0-alpha.22 69.35 KB Sun, 09 Apr 2017 18:31:35 GMT 1
0.2.0-alpha.20 299.79 KB Sun, 09 Apr 2017 17:58:02 GMT 2
0.2.0-alpha.17 62.05 KB Sat, 08 Apr 2017 20:40:21 GMT 1
0.2.0-alpha.16 60.77 KB Fri, 07 Apr 2017 21:15:21 GMT 0
0.2.0-alpha.13 63.22 KB Wed, 05 Apr 2017 20:19:47 GMT 2
0.2.0-alpha.9 62.78 KB Tue, 04 Apr 2017 20:38:42 GMT 1
0.2.0-alpha.8 62.78 KB Tue, 04 Apr 2017 19:10:03 GMT 1