VideoFrameToWriteableBitmap 1.0.2
See the version list below for details.
dotnet add package VideoFrameToWriteableBitmap --version 1.0.2
NuGet\Install-Package VideoFrameToWriteableBitmap -Version 1.0.2
<PackageReference Include="VideoFrameToWriteableBitmap" Version="1.0.2" />
paket add VideoFrameToWriteableBitmap --version 1.0.2
#r "nuget: VideoFrameToWriteableBitmap, 1.0.2"
// Install VideoFrameToWriteableBitmap as a Cake Addin #addin nuget:?package=VideoFrameToWriteableBitmap&version=1.0.2 // Install VideoFrameToWriteableBitmap as a Cake Tool #tool nuget:?package=VideoFrameToWriteableBitmap&version=1.0.2
VideoFrameToWriteableBitmap
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 (first frame to feed must be a full NAL unit (I frame) 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 | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0-windows10.0.19041 is compatible. |
-
net8.0-windows10.0.19041
- FFmpeg.AutoGen (>= 7.0.0)
- Microsoft.WindowsAppSDK (>= 1.5.240802000)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.