Skip to content

dkozl/WpfMultimedia

Repository files navigation

Multimedia library for WPF

Currently supports only webcam

Simply create VideoCapture class with selected video input device, optionally specify maximum frame size, subscribe to CaptureFrame event and start receiving frames from camera device

using WpfMultimedia;
using WpfMultimedia.Webcam.Business;
using WpfMultimedia.Webcam.Interfaces;

...

var webCam = (new DefaultVideoCaptureFactory()).CreateVideoCapture(
    DeviceManager.GetVideoInputDevices().First().Name,
    new DefaultVideoResolutionSelector
    {
        MaxWidth = 1600,
        MinBitCount = 24
    });
webCam.CaptureFrame += OnFrameCaptured;
webCam.Start();

...

private void OnFrameCaptured(object sender, CaptureFrameEventArgs e)
{
    //latest BitmapImage from camera is in e.Frame
    BitmapImage _currentFrame = e.Frame
    ....
}