VisioForge

Media Blocks SDK .NET

使用 Media Blocks SDK .NET 轻松灵活地创建强大的多媒体应用程序 — 这是一个模块化工具包,允许您像视觉构造器一样构建复杂的视频工作流(相机 → 编解码器 → 输出)。它支持录制为 MP4, MKV 和 AVI,以及通过 HLS, RTMP 和 RTSP 进行流式传输,提供丰富的效果集,包括色彩校正、去隔行、水印、屏幕捕获和音频处理。凭借内置的计算机视觉、二维码识别、人脸跟踪以及对 Blackmagic 和 ONVIF 设备的全面支持,它为任何项目带来了专业级功能。该 SDK 与 WinForms, WPF, MAUI, Xamarin 和 Avalonia 无缝协作,使您可以轻松地将高级媒体功能集成到桌面和移动应用程序中。

安装

使用 NuGet 快速安装

使用包管理器控制台直接在您的项目中安装 SDK:

Install-Package VisioForge.DotNet.MediaBlocks

Or search for VisioForge.DotNet.MediaBlocks in Visual Studio's NuGet Package Manager. View installation guide →

主要优势

模块化架构

200 多个处理模块,像积木一样连接以创建自定义媒体管道

跨平台

支持 Windows, macOS, Linux, Android 和 iOS,兼容所有主要 .NET UI 框架

硬件加速

支持 NVIDIA, Intel 和 AMD 的 GPU 加速编码/解码,以实现最高性能

管道示例

// Create MediaBlocks pipeline
_pipeline = new MediaBlocksPipeline();

// Add file source
var fileSourceSettings = await UniversalSourceSettings.CreateAsync("video.mp4");
var videoStreamAvailable = fileSourceSettings.GetInfo().VideoStreams.Count > 0;
var audioStreamAvailable = fileSourceSettings.GetInfo().AudioStreams.Count > 0;

var fileSource = new UniversalSourceBlock(fileSourceSettings);

// Add video renderer
if (videoStreamAvailable)
{
    var videoRenderer = new VideoRendererBlock(_pipeline, VideoView1);
    _pipeline.Connect(fileSource, videoRenderer);
}

// Add audio output
if (audioStreamAvailable)
{
    var audioOutputDevice = (await DeviceEnumerator.Shared.AudioOutputsAsync(
        AudioOutputDeviceAPI.DirectSound))[0];
    var audioOutput = new AudioRendererBlock(
        new AudioRendererSettings(audioOutputDevice));
    _pipeline.Connect(fileSource, audioOutput);
}

// Start playback
await _pipeline.StartAsync();

简单播放器

简单播放器管道使用 UniversalSourceBlock 读取和解码源文件,使用 VideoRendererBlock 显示视频,使用 AudioRendererBlock 播放音频。

交互式管道可视化

Loading pipeline diagram...

高级播放器

高级播放器管道包括用于解码文件或流的 UniversalSourceBlock、视频和音频渲染器以及效果处理模块。

// Create MediaBlocks pipeline
_pipeline = new MediaBlocksPipeline();

// Add file source
var fileSourceSettings = await UniversalSourceSettings.CreateAsync(edFilename.Text);
var videoStreamAvailable = fileSourceSettings.GetInfo().VideoStreams.Count > 0;
var audioStreamAvailable = fileSourceSettings.GetInfo().AudioStreams.Count > 0;

var fileSource = new UniversalSourceBlock(fileSourceSettings);

// Add video renderer, text overlay and image overlay
if (videoStreamAvailable)
{
    var videoRenderer = new VideoRendererBlock(_pipeline, VideoView1);
    var textOverlay = new TextOverlayBlock(new TextOverlaySettings("Hello world!"));
    var imageOverlay = new ImageOverlayBlock(new ImageOverlaySettings("logo.png"));

    _pipeline.Connect(fileSource, textOverlay);
    _pipeline.Connect(textOverlay, imageOverlay);
    _pipeline.Connect(imageOverlay, videoRenderer);
}

// Add audio output and equalizer
if (audioStreamAvailable)
{
    var audioOutputDevice = (await DeviceEnumerator.Shared.AudioOutputsAsync(AudioOutputDeviceAPI.DirectSound))[0];
    var audioOutput = new AudioRendererBlock(new AudioRendererSettings(audioOutputDevice));

    var equalizer = new EqualizerParametricBlock();
    // set some equalizer settings

    _pipeline.Connect(fileSource, equalizer);
    _pipeline.Connect(equalizer, audioOutput);
}

// Start playback
await _pipeline.StartAsync();

带效果的高级播放器管道

Loading pipeline diagram...

// Create MediaBlocksPipeline object
_pipeline = new MediaBlocksPipeline();

// Add default video and audio sources
var videoSources = (await DeviceEnumerator.Shared.VideoSourcesAsync()).ToList();
var videoSource = new SystemVideoSourceBlock(new VideoCaptureDeviceSourceSettings(
    videoSources.Find(x => x.Name.Contains("920"))));

var audioSources = (await DeviceEnumerator.Shared.AudioSourcesAsync()).ToList();
var audioSource = new SystemAudioSourceBlock(audioSources[0].CreateSourceSettings());

// Add video renderer
var videoRenderer = new VideoRendererBlock(_pipeline, videoView: VideoView1);

// Add audio renderer
var audioRenderers = (await DeviceEnumerator.Shared.AudioOutputsAsync()).ToList();
var audioRenderer = new AudioRendererBlock(new AudioRendererSettings(audioRenderers[0]));

// Connect everything
_pipeline.Connect(videoSource, videoRenderer);
_pipeline.Connect(audioSource, audioRenderer);

// Start preview
await _pipeline.StartAsync();

相机预览

相机/麦克风简单预览管道包含设备源模块和视频/音频渲染器模块。

将使用默认设备。

相机预览管道

Loading pipeline diagram...

RTSP 预览

RTSP 预览管道,包括 RTSP 源模块(内部带有解码器)、视频和音频渲染器。

// Create Media Blocks pipeline
_pipeline = new MediaBlocksPipeline();

// Create video renderer
var videoRenderer = new VideoRendererBlock(_pipeline, VideoView1);

// Add RTSP camera source
var rtsp = await RTSPSourceSettings.CreateAsync(new Uri(edURL.Text), 
    edLogin.Text, edPassword.Text, audioEnabled: cbAudioStream.Checked);
var rtspSource = new RTSPSourceBlock(rtsp);

_pipeline.Connect(rtspSource, videoRenderer);

// Add audio output (if required)
if (cbAudioStream.Checked && rtsp.IsAudioAvailable())
{
    var audioOutputDevice = (await DeviceEnumerator.Shared.AudioOutputsAsync(
        AudioOutputDeviceAPI.DirectSound))[0];
    var audioOutput = new AudioRendererBlock(new AudioRendererSettings(audioOutputDevice));
    _pipeline.Connect(rtspSource, audioOutput);
}

// Start IP camera preview
await _pipeline.StartAsync();

RTSP 流管道

Loading pipeline diagram...

// Create the pipeline
_pipeline = new MediaBlocksPipeline();

// Add video and audio sources
var videoSources = (await DeviceEnumerator.Shared.VideoSourcesAsync()).ToList();
var videoSource = new SystemVideoSourceBlock(new VideoCaptureDeviceSourceSettings(videoSources[0]));

var audioSources = (await DeviceEnumerator.Shared.AudioSourcesAsync()).ToList();
var audioSource = new SystemAudioSourceBlock(audioSources[0].CreateSourceSettings());

// Add video renderer and specify VideoView control
var videoRenderer = new VideoRendererBlock(_pipeline, videoView: VideoView1);

// Add audio renderer
var audioRenderers = (await DeviceEnumerator.Shared.AudioOutputsAsync()).ToList();
var audioRenderer = new AudioRendererBlock(new AudioRendererSettings(audioRenderers[0]));

// Configure MP4 output
var output = new MP4OutputBlock(Path.Combine(
    Environment.GetFolderPath(Environment.SpecialFolder.MyVideos), "output.mp4"));

// Add video and audio tees
var videoTee = new TeeBlock(2, MediaBlockPadMediaType.Video);
var audioTee = new TeeBlock(2, MediaBlockPadMediaType.Audio);

// Connect everything
_pipeline.Connect(videoSource, videoTee);
_pipeline.Connect(audioSource, audioTee);

_pipeline.Connect(videoTee, videoRenderer);
_pipeline.Connect(audioTee, audioRenderer);

_pipeline.Connect(videoTee, output);
_pipeline.Connect(audioTee, output);

// Start MP4 recording
await _pipeline.StartAsync();

带预览的捕获

捕获管道有两个 Tee 模块,用于分离视频和音频流,允许在视频捕获的同时进行视频/音频预览。

带预览的捕获管道

Loading pipeline diagram...

VisioForge Media Blocks SDK .Net 主要功能包括:

核心功能

  • 音频/视频预览
  • 视频和音频捕获为多种格式
  • 帧捕获为 Bitmap 类、BMP, JPEG 和 PNG 文件
  • 视频处理和效果 (CPU/GPU)
  • 视频捕获设备控制
  • 网络流媒体
  • 运动检测
  • 自定义接口支持
  • 计算机视觉 API
  • PIP (画中画)
  • 屏幕捕获/窗口捕获
  • 人脸检测和对象跟踪
  • 多输出屏幕支持
  • 从扬声器捕获音频
  • 音频/视频文件标签读写支持

支持的输入设备

  • USB 网络摄像头和采集设备 (包括 4K)
  • JPEG/MJPEG, MPEG-4 和 H.264 HTTP/RTSP/RTMP IP 摄像机/服务器
  • DV 和 HDV MPEG-2 摄像机
  • PCI 采集卡
  • 电视调谐器 (带/不带内部 MPEG 编码器)
  • IP 摄像机支持的高清格式
  • 带 PTZ 支持的 ONVIF IP 摄像机
  • Blackmagic Decklink 设备
  • 音频采集设备和声卡
  • ASIO 设备

专业硬件

  • Blackmagic Decklink 输入/输出支持
  • FLIR/Teledyne 相机 (USB3Vision/GigE)
  • Basler 相机 (USB3Vision/GigE)
  • DV 和 HDV MPEG-2 摄像机
  • PCI 采集卡
  • 电视调谐器 (带/不带 MPEG 编码器)
  • 带 PTZ 支持的 ONVIF IP 摄像机
  • ASIO 设备

  • Allied Vision 相机
  • 动画 GIF
  • Basler 相机 (USB3Vision/GigE)
  • CDG 卡拉 OK
  • 回退开关
  • GenICam (工业相机)
  • HTTP
  • HTTP MJPEG(源)
  • 图像序列
  • 本地文件
  • 内存缓冲区
  • NDI
  • PulseAudio
  • Raspberry Pi 相机
  • RTMP
  • RTSP
  • RTSP RAW
  • 屏幕捕获
  • SRT
  • 系统音频
  • 系统视频
  • 测试信号
  • UDP/RTP
  • URI (文件/网络)

音频处理

  • 放大
  • 平衡
  • 样本格式转换器
  • 负载标准化器
  • 混音器
  • 重采样器
  • 样本抓取器
  • 时间戳校正器
  • 切比雪夫带阻
  • 切比雪夫限制
  • 压缩器/扩展器
  • Csound 滤波器
  • EBU R128 电平
  • 回声
  • 均衡器 (10 段)
  • 均衡器 (参数)
  • HRTF 渲染
  • 卡拉 OK
  • 移除静音
  • 混响
  • 缩放/速度
  • 音量
  • VU 表
  • 宽立体声

条形码阅读器

  • QR 码
  • UPC-A、UPC-E
  • EAN-8、EAN-13
  • 39 码(Code 39)
  • 93 码(Code 93)
  • 128 码(Code 128)
  • 库德巴码(Codabar)
  • 交叉二五码(ITF)
  • GS1 DataBar(RSS-14)
  • 数据矩阵码(Data Matrix)
  • 阿兹特克码(Aztec)
  • PDF-417

音频编码器

  • AAC
  • ADPCM
  • ALAW
  • AptX
  • FLAC
  • MP2
  • MP3
  • OPUS
  • Speex
  • Vorbis
  • WAV
  • Wavpack
  • WMA(Windows Media Audio,Windows 媒体音频)

视频编码器 (CPU/GPU)

  • AV1
  • DV
  • GIF
  • H.264
  • H.265/HEVC
  • MJPEG
  • MPEG-2
  • MPEG-4
  • PNG
  • Theora
  • VP8/VP9(VPX)
  • WMV (Windows Media Video)
  • NVENC, AMD, Intel 硬件编码器支持
  • iOS/macOS/Android 硬件编码器支持

视频处理

  • 老化
  • Alpha 组合
  • 自动去隔行
  • Bayer 转 RGB
  • 色度键
  • 编解码器 Alpha 解复用
  • 色彩效果
  • 去隔行
  • 骰子
  • 边缘检测
  • 鱼眼
  • 翻转/旋转
  • Gamma
  • 高斯模糊
  • 灰度
  • 图像覆盖
  • 图像覆盖 Cairo
  • 隔行扫描
  • 关键帧检测器
  • LUT 处理器
  • 镜像
  • 移动模糊
  • 移动回声
  • 移动缩放回声
  • 光学动画黑白
  • 覆盖管理器
  • 透视
  • 捏合
  • 伪 3D
  • 二维码覆盖
  • 调整大小
  • 样本抓取器
  • Sobel 边缘
  • 球体
  • 正方形
  • 拉伸
  • 文本覆盖
  • 隧道
  • 旋转
  • 视频平衡
  • 像素格式转换器
  • 视频混合器
  • 扭曲镜像
  • 水波纹
  • 缩放框

文件接收器

  • ASF
  • AVI
  • DASH
  • HLS
  • HTTP MJPEG 实时输出
  • MKV(Matroska)
  • MOV(QuickTime)
  • MP4
  • MPEG-PS
  • MPEG-TS
  • MXF
  • OGG
  • WAV
  • WebM

网络流媒体

  • Facebook Live(推流)
  • HLS
  • NDI
  • RTMP
  • RTSP
  • Shoutcast
  • SRT
  • YouTube Live(推流)

Blackmagic Decklink 模块

  • 音频接收器
  • 音频源
  • 视频接收器
  • 视频源

音频可视化器

  • Bumpscope
  • Corona
  • Infinite
  • Jakdaw
  • Jess
  • LV Analyzer(分析器)
  • LV Scope(示波器)
  • Oinksie
  • Spacescope
  • Spectrascope
  • Synaescope
  • Wavescope

视频解码器

  • AV1 解码器
  • H.264 解码器
  • HEVC 解码器
  • JPEG 解码器
  • VP8 解码器
  • VP9 解码器
  • NVIDIA, Intel 和 AMD 加速解码器
  • Android 硬件解码器
  • iOS 硬件解码器

特殊模块

  • 条形码检测器
  • 数据处理器
  • 数据样本抓取器
  • 调试时间戳
  • 解密器
  • 加密器
  • 多队列
  • 空渲染器
  • 队列
  • SRTP 解密器
  • SRTP 加密器
  • Tee (分离器)

定价

选择年度订阅或终身许可证

常规许可证

€500/ 年
  • 一年内免费的小型和大型升级
  • 订阅结束后 SDK 继续运行
  • 优先支持
  • 每年自动续订 (可随时取消)
  • 包含所有 200+ 处理模块
最佳价值

终身许可证

€1,500/ 一次性
购买终身许可证
  • 永久无限更新
  • 优先支持和修复
  • 一次性付款
  • 包含所有未来功能
  • 包含所有 200+ 处理模块

非商业用途免费。请联系我们获取免费许可证。

所有许可证均包含免版税分发权。

系统要求

跨平台开发和部署的最低要求

操作系统
  • Windows 10 / 11 (32 位和 64 位)
  • Windows 8/8.1, Windows 7 SP1
  • Windows Server 2016 及更高版本
  • macOS 12 或更高版本
  • Ubuntu 22.04 / 24.04
  • Android 8 及更高版本
  • iOS 12 及更高版本
.NET Framework
  • .NET Framework 4.6.1 或更高版本
  • .NET Core 3.1
  • .NET 5/6/7/8/9/10(支持)
硬件
  • 至少 2 GB RAM (建议 4 GB)
  • Intel Core i5 或 AMD 同等处理器
  • GPU 加速支持可选 (NVIDIA/Intel/AMD)
UI 框架
  • WinForms
  • WPF
  • WinUI 3 桌面版
  • Avalonia
  • GTK#
  • MAUI
  • Xamarin.Android/iOS/Mac

文档和资源

开始使用 Media Blocks SDK 所需的一切

准备好开始了吗?

下载免费试用版,立即开始构建您的媒体管道