mmalsharp - MMALSharp.Common 0.7.0-380

MMALSharp common library.

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

Copy to clipboard

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

Copy to clipboard

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

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

nuget MMALSharp.Common  ~> 0.7.0-380
Copy to clipboard

> choco install MMALSharp.Common --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.Common" -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.Extensions.Logging.Abstractions (>= 3.1.0)
    • System.Drawing.Common (>= 4.7.0)
    • System.Numerics.Vectors (>= 4.4.0)
  • .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

17 total downloads
5 downloads for version 0.7.0-380
Download (19.01 KB)
Found on the current feed only

Package history

Version Size Last updated Downloads Mirrored?
0.7.0-380 19.01 KB Thu, 15 Oct 2020 14:03:08 GMT 5
0.7.0-379 19.02 KB Thu, 15 Oct 2020 11:46:37 GMT 0
0.7.0-378 19.02 KB Thu, 15 Oct 2020 11:36:53 GMT 0
0.7.0-377 19.02 KB Thu, 15 Oct 2020 11:27:32 GMT 0
0.7.0-376 19.02 KB Wed, 14 Oct 2020 13:00:59 GMT 0
0.7.0-375 19.02 KB Mon, 12 Oct 2020 18:34:49 GMT 0
0.7.0-374 19.02 KB Mon, 12 Oct 2020 08:50:07 GMT 0
0.7.0-365 19.52 KB Sat, 12 Sep 2020 15:12:35 GMT 0
0.7.0-362 19.52 KB Thu, 03 Sep 2020 13:30:55 GMT 1
0.7.0-360 19.52 KB Sun, 30 Aug 2020 14:17:57 GMT 0
0.7.0-358 19.52 KB Sat, 29 Aug 2020 14:19:18 GMT 0
0.7.0-353 19.52 KB Sun, 23 Aug 2020 13:10:05 GMT 0
0.7.0-345 19.52 KB Mon, 17 Aug 2020 19:08:41 GMT 0
0.7.0-339 19.52 KB Mon, 03 Aug 2020 13:53:46 GMT 0
0.7.0-336 19.47 KB Mon, 27 Jul 2020 13:59:32 GMT 0
0.7.0-331 19.46 KB Tue, 21 Jul 2020 10:36:08 GMT 0
0.7.0-330 19.46 KB Mon, 20 Jul 2020 19:47:47 GMT 0
0.7.0-324 19.46 KB Sat, 16 May 2020 19:36:38 GMT 0
0.7.0-323 19.46 KB Sat, 16 May 2020 18:55:58 GMT 0
0.7.0-322 19.46 KB Fri, 15 May 2020 19:21:12 GMT 0
0.7.0-321 19.46 KB Mon, 11 May 2020 18:12:41 GMT 0
0.7.0-320 19.45 KB Sun, 10 May 2020 15:02:27 GMT 0
0.7.0-319 19.46 KB Sun, 10 May 2020 14:55:02 GMT 0
0.7.0-318 19.43 KB Sun, 10 May 2020 14:50:08 GMT 0
0.7.0-317 19.41 KB Sat, 09 May 2020 15:14:41 GMT 0
0.7.0-316 19.4 KB Thu, 07 May 2020 21:03:35 GMT 1
0.7.0-315 19.41 KB Thu, 07 May 2020 18:24:30 GMT 0
0.7.0-314 19.41 KB Thu, 07 May 2020 13:34:48 GMT 0
0.7.0-313 19.41 KB Mon, 04 May 2020 18:33:45 GMT 0
0.7.0-312 19.4 KB Tue, 14 Apr 2020 13:06:45 GMT 0
0.6.0 18.6 KB Mon, 02 Mar 2020 20:57:45 GMT 0
0.6.0-311 19.4 KB Mon, 13 Apr 2020 19:25:50 GMT 0
0.6.0-310 19.3 KB Mon, 13 Apr 2020 11:48:12 GMT 0
0.6.0-309 19.31 KB Sun, 12 Apr 2020 20:54:57 GMT 0
0.6.0-308 19.3 KB Sat, 11 Apr 2020 12:15:18 GMT 0
0.6.0-307 19.3 KB Wed, 08 Apr 2020 18:21:13 GMT 0
0.6.0-306 19.3 KB Mon, 02 Mar 2020 21:42:18 GMT 0
0.6.0-304 19.3 KB Mon, 02 Mar 2020 20:55:16 GMT 0
0.6.0-303 19.3 KB Thu, 27 Feb 2020 12:35:29 GMT 0
0.6.0-302 19.3 KB Thu, 27 Feb 2020 10:09:34 GMT 0
0.6.0-301 19.3 KB Wed, 26 Feb 2020 12:53:23 GMT 0
0.6.0-300 19.3 KB Wed, 26 Feb 2020 10:10:58 GMT 0
0.6.0-299 19.3 KB Tue, 25 Feb 2020 19:59:04 GMT 0
0.6.0-298 19.3 KB Tue, 25 Feb 2020 19:51:53 GMT 0
0.6.0-297 15.52 KB Sat, 18 Jan 2020 17:20:20 GMT 1
0.6.0-296 15.52 KB Fri, 17 Jan 2020 11:43:28 GMT 0
0.6.0-295 15.52 KB Fri, 17 Jan 2020 11:32:28 GMT 0
0.6.0-294 15.52 KB Fri, 17 Jan 2020 11:24:39 GMT 0
0.6.0-293 15.52 KB Wed, 08 Jan 2020 06:06:50 GMT 2
0.6.0-292 15.52 KB Tue, 07 Jan 2020 20:54:11 GMT 0
0.6.0-291 15.52 KB Mon, 06 Jan 2020 21:17:53 GMT 0
0.6.0-290 15.52 KB Thu, 02 Jan 2020 22:30:44 GMT 0
0.6.0-289 15.52 KB Thu, 02 Jan 2020 18:38:12 GMT 0
0.6.0-288 15.52 KB Wed, 01 Jan 2020 19:11:33 GMT 0
0.6.0-287 15.52 KB Wed, 01 Jan 2020 19:10:20 GMT 0
0.6.0-286 15.52 KB Tue, 31 Dec 2019 22:00:15 GMT 0
0.6.0-285 15.52 KB Tue, 31 Dec 2019 18:38:24 GMT 0
0.6.0-284 15.52 KB Tue, 31 Dec 2019 18:37:33 GMT 0
0.6.0-283 15.52 KB Mon, 30 Dec 2019 21:57:29 GMT 0
0.6.0-282 15.52 KB Mon, 30 Dec 2019 21:34:39 GMT 0
0.6.0-281 15.52 KB Mon, 30 Dec 2019 18:27:14 GMT 0
0.6.0-280 15.52 KB Mon, 30 Dec 2019 15:06:12 GMT 0
0.6.0-279 15.52 KB Mon, 30 Dec 2019 14:49:46 GMT 0
0.6.0-278 15.52 KB Mon, 30 Dec 2019 14:47:33 GMT 0
0.6.0-277 15.52 KB Mon, 30 Dec 2019 14:27:18 GMT 0
0.6.0-276 15.52 KB Mon, 30 Dec 2019 11:14:48 GMT 0
0.6.0-275 15.52 KB Mon, 30 Dec 2019 09:57:09 GMT 0
0.6.0-274 15.52 KB Mon, 30 Dec 2019 09:42:23 GMT 0
0.6.0-273 12.19 KB Mon, 30 Dec 2019 08:45:40 GMT 0
0.6.0-272 11.95 KB Sun, 29 Dec 2019 15:55:42 GMT 0
0.6.0-271 11.95 KB Sat, 28 Dec 2019 19:58:04 GMT 0
0.6.0-270 11.95 KB Sat, 28 Dec 2019 19:36:50 GMT 0
0.6.0-269 11.94 KB Sat, 28 Dec 2019 11:40:23 GMT 0
0.6.0-268 12.04 KB Tue, 24 Dec 2019 21:26:39 GMT 0
0.6.0-267 12.04 KB Tue, 24 Dec 2019 21:02:25 GMT 0
0.6.0-266 12.03 KB Fri, 20 Dec 2019 22:15:33 GMT 0
0.6.0-265 12.04 KB Fri, 20 Dec 2019 19:22:58 GMT 0
0.6.0-264 12.04 KB Wed, 18 Dec 2019 22:05:08 GMT 0
0.6.0-263 22.68 KB Sun, 15 Dec 2019 18:19:13 GMT 0
0.6.0-262 22.83 KB Thu, 12 Sep 2019 20:49:29 GMT 0
0.6.0-261 22.84 KB Thu, 12 Sep 2019 20:47:10 GMT 0
0.6.0-260 22.83 KB Thu, 12 Sep 2019 20:23:35 GMT 0
0.6.0-259 22.83 KB Thu, 12 Sep 2019 20:20:56 GMT 0
0.6.0-258 22.84 KB Wed, 11 Sep 2019 22:04:46 GMT 0
0.5.1 20.7 KB Sun, 14 Jul 2019 18:56:24 GMT 0
0.5.1-255 21.69 KB Tue, 25 Jun 2019 20:20:56 GMT 0
0.5.1-253 21.69 KB Tue, 25 Jun 2019 20:10:47 GMT 0
0.5.0 20.71 KB Thu, 24 Jan 2019 20:51:52 GMT 0
0.5.0-252 21.69 KB Tue, 18 Jun 2019 09:46:35 GMT 0
0.5.0-251 21.69 KB Mon, 08 Apr 2019 21:16:38 GMT 0
0.5.0-250 21.69 KB Mon, 08 Apr 2019 21:02:25 GMT 0
0.5.0-249 21.69 KB Mon, 08 Apr 2019 15:26:05 GMT 0
0.5.0-248 21.69 KB Mon, 08 Apr 2019 15:20:06 GMT 0
0.5.0-247 21.68 KB Sun, 07 Apr 2019 20:23:32 GMT 0
0.5.0-246 21.68 KB Fri, 05 Apr 2019 19:32:41 GMT 0
0.5.0-245 21.69 KB Thu, 24 Jan 2019 21:15:14 GMT 0
0.5.0-243 21.69 KB Thu, 24 Jan 2019 20:50:17 GMT 0
0.5.0-241 25.78 KB Wed, 28 Nov 2018 12:32:30 GMT 0
0.5.0-240 25.78 KB Tue, 27 Nov 2018 12:01:49 GMT 0
0.5.0-239 25.78 KB Thu, 22 Nov 2018 19:21:46 GMT 0
0.5.0-238 25.78 KB Wed, 14 Nov 2018 10:52:58 GMT 1
0.5.0-237 25.78 KB Mon, 12 Nov 2018 07:24:36 GMT 0
0.5.0-236 25.78 KB Sun, 11 Nov 2018 16:08:46 GMT 0
0.5.0-235 25.78 KB Sat, 10 Nov 2018 21:54:23 GMT 0
0.5.0-234 25.78 KB Fri, 09 Nov 2018 07:39:35 GMT 0
0.5.0-233 25.78 KB Mon, 05 Nov 2018 22:08:40 GMT 0
0.5.0-232 25.78 KB Sun, 04 Nov 2018 20:27:04 GMT 0
0.5.0-231 25.96 KB Sun, 04 Nov 2018 20:15:45 GMT 0
0.5.0-230 25.41 KB Sun, 21 Oct 2018 18:50:21 GMT 0
0.5.0-227 25.41 KB Wed, 17 Oct 2018 11:20:00 GMT 0
0.5.0-224 25.41 KB Sat, 11 Aug 2018 19:50:03 GMT 1
0.5.0-223 25.42 KB Sat, 11 Aug 2018 14:14:10 GMT 0
0.5.0-221 25.41 KB Mon, 23 Jul 2018 19:51:22 GMT 0
0.4.4 24.48 KB Thu, 19 Jul 2018 19:09:15 GMT 0
0.4.4-220 25.42 KB Mon, 23 Jul 2018 19:49:15 GMT 0
0.4.4-218 25.41 KB Thu, 19 Jul 2018 19:26:17 GMT 0
0.4.4-216 25.42 KB Thu, 19 Jul 2018 19:07:43 GMT 0
0.4.3 24.49 KB Sat, 07 Jul 2018 19:52:37 GMT 0
0.4.3-215 25.43 KB Wed, 18 Jul 2018 20:07:41 GMT 0
0.4.3-214 25.43 KB Wed, 11 Jul 2018 13:43:22 GMT 1
0.4.3-213 25.43 KB Sun, 08 Jul 2018 07:34:03 GMT 0
0.4.3-211 25.43 KB Sat, 07 Jul 2018 19:50:56 GMT 0
0.4.2-210 25.42 KB Sat, 07 Jul 2018 19:35:31 GMT 0
0.4.2-209 25.42 KB Fri, 06 Jul 2018 15:26:53 GMT 0
0.4.2-208 25.42 KB Thu, 05 Jul 2018 21:30:31 GMT 0
0.4.2-207 25.42 KB Tue, 03 Jul 2018 18:02:48 GMT 0
0.4.2-206 25.42 KB Fri, 29 Jun 2018 12:03:12 GMT 0
0.4.2-205 25.42 KB Fri, 29 Jun 2018 07:46:33 GMT 0
0.4.2-204 25.42 KB Thu, 28 Jun 2018 20:07:33 GMT 0
0.4.2-203 18.91 KB Thu, 28 Jun 2018 19:59:53 GMT 0
0.4.2-202 18.91 KB Wed, 27 Jun 2018 19:34:22 GMT 0
0.4.2-201 18.9 KB Tue, 26 Jun 2018 22:09:00 GMT 0
0.4.1-198 18.91 KB Fri, 22 Jun 2018 21:48:44 GMT 0
0.4.1-197 18.92 KB Fri, 22 Jun 2018 13:14:38 GMT 0
0.4.1-193 18.84 KB Mon, 18 Jun 2018 18:57:27 GMT 0
0.4.0.169 22.13 KB Wed, 16 May 2018 19:12:46 GMT 2
0.4.0-192 18.83 KB Mon, 18 Jun 2018 18:53:34 GMT 0
0.4.0-190 18.84 KB Fri, 15 Jun 2018 10:29:18 GMT 0
0.3.0.128 12.4 KB Fri, 16 Feb 2018 22:45:29 GMT 1
0.3.0.122 12.2 KB Sat, 27 Jan 2018 23:02:09 GMT 0
0.3.0.116 12.2 KB Thu, 25 Jan 2018 20:46:36 GMT 1
0.3.0.112 12.17 KB Sun, 31 Dec 2017 22:03:48 GMT 0
0.3.0.110 12.17 KB Fri, 29 Dec 2017 18:16:45 GMT 0
0.3.0.107 12.17 KB Wed, 20 Dec 2017 20:16:19 GMT 0
0.3.0.105 12.17 KB Wed, 20 Dec 2017 18:54:39 GMT 0
0.3.0.97 10.45 KB Sat, 09 Dec 2017 21:40:21 GMT 0
0.3.0.93 10.4 KB Tue, 15 Aug 2017 21:27:22 GMT 0
0.3.0.89 10.25 KB Tue, 11 Jul 2017 20:56:09 GMT 0
0.3.0.87 10.25 KB Sat, 08 Jul 2017 20:32:11 GMT 0