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.
Install / Use
/learn @airtaxi/VideoFrameToWriteableBitmapREADME
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();
Author
이호원 (Howon Lee) a.k.a hoyo321 or kck4156, airtaxi
License
This project is licensed under the LGPL 3.0 License. See the LICENSE file for more details.
Related Skills
qqbot-channel
352.2kQQ 频道管理技能。查询频道列表、子频道、成员、发帖、公告、日程等操作。使用 qqbot_channel_api 工具代理 QQ 开放平台 HTTP 接口,自动处理 Token 鉴权。当用户需要查看频道、管理子频道、查询成员、发布帖子/公告/日程时使用。
docs-writer
100.6k`docs-writer` skill instructions As an expert technical writer and editor for the Gemini CLI project, you produce accurate, clear, and consistent documentation. When asked to write, edit, or revie
model-usage
352.2kUse CodexBar CLI local cost usage to summarize per-model usage for Codex or Claude, including the current (most recent) model or a full model breakdown. Trigger when asked for model-level usage/cost data from codexbar, or when you need a scriptable per-model summary from codexbar cost JSON.
arscontexta
3.1kClaude Code plugin that generates individualized knowledge systems from conversation. You describe how you think and work, have a conversation and get a complete second brain as markdown files you own.
