Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/airtaxi/videoframetowriteablebitmap
VideoFrameToWriteableBitmap is a utility that facilitates the decoding of raw video frames (H.264, MJPEG, and more) and renders them into a WriteableBitmap within a WinUI application using FFmpeg.AutoGen version 7.0 (FFmpeg 7.0 dlls are required). Useful for scenarios like decoding frames from an RTSP stream is required.
https://github.com/airtaxi/videoframetowriteablebitmap
ffmpeg rtsp video winui writeablebitmap
Last synced: about 1 month ago
JSON representation
VideoFrameToWriteableBitmap is a utility that facilitates the decoding of raw video frames (H.264, MJPEG, and more) and renders them into a WriteableBitmap within a WinUI application using FFmpeg.AutoGen version 7.0 (FFmpeg 7.0 dlls are required). Useful for scenarios like decoding frames from an RTSP stream is required.
- Host: GitHub
- URL: https://github.com/airtaxi/videoframetowriteablebitmap
- Owner: airtaxi
- License: lgpl-3.0
- Created: 2024-08-15T03:38:00.000Z (4 months ago)
- Default Branch: master
- Last Pushed: 2024-08-15T04:12:54.000Z (4 months ago)
- Last Synced: 2024-11-23T01:33:27.640Z (about 1 month ago)
- Topics: ffmpeg, rtsp, video, winui, writeablebitmap
- Language: C#
- Homepage:
- Size: 33.2 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# VideoFrameToWriteableBitmap
[![NuGet version (DetoursCustomDPI)](https://img.shields.io/nuget/v/VideoFrameToWriteableBitmap.svg?style=flat-square)](https://www.nuget.org/packages/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:
```csharp
// 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:
```csharp
// Dispose of the FrameDecoder when done
frameDecoder.Dispose();
```## Author
`이호원 (Howon Lee) a.k.a hoyo321 or kck4156, airtaxi`## License
This project is licensed under the LGPL 3.0 License. See the [LICENSE](LICENSE.txt) file for more details.