VideoFrameToWriteableBitmap 1.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package VideoFrameToWriteableBitmap --version 1.0.0                
NuGet\Install-Package VideoFrameToWriteableBitmap -Version 1.0.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="VideoFrameToWriteableBitmap" Version="1.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add VideoFrameToWriteableBitmap --version 1.0.0                
#r "nuget: VideoFrameToWriteableBitmap, 1.0.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install VideoFrameToWriteableBitmap as a Cake Addin
#addin nuget:?package=VideoFrameToWriteableBitmap&version=1.0.0

// Install VideoFrameToWriteableBitmap as a Cake Tool
#tool nuget:?package=VideoFrameToWriteableBitmap&version=1.0.0                

VideoFrameToWriteableBitmap

NuGet version (DetoursCustomDPI)

VideoFrameToWriteableBitmap is a library that uses FFmpeg.AutoGen to decode video frames and display them in a WriteableBitmap for WinUI applications. This library is designed to handle video codecs like H.264 and supports the processing and rendering of video frame data asynchronously to avoid blocking the UI thread.

Features

  • Frame Decoding: Decodes video frames using FFmpeg and converts them into a format suitable for display in WinUI.
  • WriteableBitmap Rendering: Efficiently renders decoded frame data to a WriteableBitmap.
  • Thread Safety: The library is designed with thread safety in mind, using locks to prevent concurrent access to unmanaged resources.

Usage

1. FrameDecoder Class

The FrameDecoder class is responsible for decoding video frames using a specified codec. It manages the underlying FFmpeg structures and provides methods to feed raw frame data and render the decoded frames directly to a WriteableBitmap.

Example:
// Initialize the decoder with the desired codec (e.g., H264)
var frameDecoder = new FrameDecoder(AVCodecID.AV_CODEC_ID_H264);

// Feed the decoder with raw video data (full NAL units for H264)
bool success = frameDecoder.Feed(frameData);

if (success)
{
    // Render the decoded frame data directly to the WriteableBitmap
    frameDecoder.Invalidate(writeableBitmap);
}

2. Disposing Resources

It's important to properly dispose of FrameDecoder objects to free unmanaged resources and prevent memory leaks.

Example:
// Dispose of the FrameDecoder when done
frameDecoder.Dispose();

License

This project is licensed under the LGPL 3.0 License. See the LICENSE file for more details.

Product Compatible and additional computed target framework versions.
.NET net8.0-windows10.0.19041 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.4 144 8/15/2024
1.0.3 113 8/15/2024
1.0.2 116 8/15/2024
1.0.1 115 8/15/2024
1.0.0 111 8/15/2024