Skip to content

HyperFlow-SHM - 超低延迟多媒体流传输系统,使用GStreamer共享内存技术实现近零延迟传输 | HyperFlow-SHM - Ultra-low latency multimedia streaming system using GStreamer shared memory technology

Notifications You must be signed in to change notification settings

ewanqian/HyperFlow-SHM

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HyperFlow-SHM

HyperFlow-SHM

🚀 超低延迟大数据量多媒体流传输 🚀 Ultra-Low Latency High-Volume Multimedia Streaming

GitHub stars GitHub forks GitHub license Python version GStreamer version

项目简介

Elevator Pitch

受够了本地NDI的延迟?HyperFlow-SHM使用GStreamer共享内存技术,在进程间传输无压缩视频,几乎实现零延迟。就像复制文件一样,但适用于实时视频。 Tired of NDI lag on localhost? HyperFlow-SHM uses GStreamer Shared Memory to transmit uncompressed video between processes with virtually ZERO latency. Like copying a file, but for live video.

作为感知引擎的媒体传输单元,支持多种设备间的媒体流传输 As a media transmission unit for perceptual engines, supporting media streaming between multiple devices

关于VPE

About VPE

VPE (Virtura Perceptual Engine) 是一套针对空间计算时代的工程与设计规范。HyperFlow-SHM作为VPE感知引擎的核心组件,是沉浸式信号系统 (Immersive Signal System) 的重要组成部分,旨在指导团队从“艺术创作”迈向“工业级生产”。

VPE (Virtura Perceptual Engine) is a set of engineering and design specifications for the spatial computing era. HyperFlow-SHM, as a core component of the VPE perceptual engine, is an important part of the Immersive Signal System, guiding teams from "artistic creation" to "industrial-grade production."

我们不再设计界面 (Interface),我们设计本能 (Instinct)。当屏幕消失,世界向你敞开,文本不再是用来阅读的,而是用于生成世界的 DNA。

We no longer design interfaces; we design instincts. When screens disappear and the world opens up to you, text is no longer for reading, but for generating the DNA of the world.

功能特性

Features

  • 🚀 零延迟:仅受内存读写速度限制
  • 🚀 Zero Latency: Only the speed of memory reads/writes
  • 💾 原始数据:支持I420/RGBA无损传输
  • 💾 Raw Data: Supports I420/RGBA lossless transmission
  • 🐍 Python实现:纯Python编写,易于修改
  • 🐍 Pythonic: Pure Python implementation, easy to modify
  • 🎨 GUI支持:基于PyQt5的接收器,带有嵌入式视频窗口
  • 🎨 GUI Support: PyQt5-based receiver with embedded video window
  • 🔌 多视频源:支持测试图案、摄像头和桌面捕获
  • 🔌 Multiple Sources: Support for test patterns, cameras, and desktop capture
  • 🔄 自动重连:管道故障时自动重连
  • 🔄 Auto Reconnect: Automatic reconnection on pipeline failure
  • 🔊 音频传输支持(即将推出)
  • 🔊 Audio Transmission Support (Coming Soon)
  • 🌐 跨设备串流支持
  • 🌐 Cross-Device Streaming Support
  • 🤖 实时AI信号传输潜力
  • 🤖 Real-time AI Signal Transmission Potential

前提条件(Windows)

Prerequisites (Windows)

1. 安装GStreamer MSVC

1. Install GStreamer MSVC

重要提示:使用MSVC版本,不要使用MinGW! IMPORTANT: Use MSVC version, not MinGW!

安装过程中: During installation:

  • 选择"Complete"安装类型
  • Choose "Complete" installation type
  • 确保勾选"Add GStreamer to the PATH environment variable"
  • Ensure "Add GStreamer to the PATH environment variable" is checked

2. 安装Python依赖

2. Install Python Dependencies

pip install -r requirements.txt

快速开始

Quick Start

1. 运行环境检查

1. Run Environment Check

python scripts/env_doctor.py

这将验证你的GStreamer安装和Python依赖。 This will verify your GStreamer installation and Python dependencies.

2. 启动发送端

2. Start Sender

测试图案源

Test Pattern Source

python src/sender.py

摄像头源

Camera Source

python src/sender.py --source camera

桌面捕获

Desktop Capture

python src/sender.py --source desktop

3. 启动接收器

3. Start Receiver

python src/receiver.py

在接收器窗口中: In the receiver window:

  • 输入套接字路径(默认:/tmp/videodata
  • Enter the socket path (default: /tmp/videodata)
  • 点击"Connect"开始接收视频
  • Click "Connect" to start receiving video

命令行选项

Command Line Options

发送端选项

Sender Options

python src/sender.py [OPTIONS]
选项 描述 默认值
--socket-path 共享内存套接字路径 /tmp/videodata
--source 视频源类型(test/camera/desktop) test
--width 视频宽度 1920
--height 视频高度 1080
--framerate 视频帧率 30
Option Description Default
-------- ------------- ---------
--socket-path Shared memory socket path /tmp/videodata
--source Video source type (test/camera/desktop) test
--width Video width 1920
--height Video height 1080
--framerate Video framerate 30

项目结构

Project Structure

HyperFlow-SHM/
├── src/
│   ├── sender.py       # 视频发送端(无头)
│   ├── receiver.py     # GUI视频接收器
│   ├── pipeline.py     # GStreamer管道封装
│   └── utils.py        # 工具函数
├── scripts/
│   └── env_doctor.py   # 环境诊断工具
├── requirements.txt    # Python依赖
├── README.md           # 本文档
├── ARCH_DESIGN.md      # 架构设计文档
└── AUDIO_SUPPORT.md    # 音频支持说明
HyperFlow-SHM/
├── src/
│   ├── sender.py       # Video sender (Headless)
│   ├── receiver.py     # GUI video receiver
│   ├── pipeline.py     # GStreamer pipeline wrapper
│   └── utils.py        # Utility functions
├── scripts/
│   └── env_doctor.py   # Environment diagnostic tool
├── requirements.txt    # Python dependencies
├── README.md           # This file
├── ARCH_DESIGN.md      # Architecture design document
└── AUDIO_SUPPORT.md    # Audio support documentation

核心技术

Core Technology

共享内存(SHM) vs NDI

Shared Memory (SHM) vs NDI

特性 HyperFlow-SHM NDI
延迟 ~1ms ~50-100ms
CPU使用率
带宽
压缩 无(无损) 有损/无损
网络依赖
Feature HyperFlow-SHM NDI
--------- --------------- -----
Latency ~1ms ~50-100ms
CPU Usage Low High
Bandwidth None High
Compression None (Lossless) Lossy/Lossless
Network Dependent No Yes

GStreamer管道架构

GStreamer Pipeline Architecture

发送端管道

Sender Pipeline

Source -> Caps -> ShmSink

接收端管道

Receiver Pipeline

ShmSrc -> Caps -> VideoConvert -> AutoVideoSink

应用场景

Use Cases

  • VJ表演:应用间零延迟视频路由
  • VJ Performances: Zero-latency video routing between applications
  • 虚拟制作:绿幕工作流的高速视频传输
  • Virtual Production: High-speed video transport for green screen workflows
  • 交互式媒体艺术:实时视频处理管道
  • Interactive Media Art: Real-time video processing pipelines
  • 游戏直播:低延迟捕获和显示
  • Game Streaming: Low-latency capture and display
  • 舞台表演:多设备间实时视频流传输
  • Stage Performances: Real-time video streaming between multiple devices
  • 音乐现场:VJ与音乐同步的低延迟视频传输
  • Music Live: Low-latency video streaming synchronized with music
  • 沉浸式大空间:多投影、多设备协同
  • Immersive Large Spaces: Multi-projection, multi-device collaboration
  • 交互装置:实时视频流反馈
  • Interactive Installations: Real-time video stream feedback
  • 头盔到屏幕:VR头盔到显示器的实时传输
  • Helmet to Screen: Real-time transmission from VR helmet to display
  • 屏幕到头盔:显示器到VR头盔的实时传输
  • Screen to Helmet: Real-time transmission from display to VR helmet
  • 多设备串流:多设备间的双向视频流传输
  • Multi-device Streaming: Bidirectional video streaming between multiple devices
  • Apple Vision Pro适配:基于GStreamer的跨平台特性
  • Apple Vision Pro Adaptation: Based on GStreamer's cross-platform features

技术合理性论证

Technical Rationality Argument

跨设备支持

HyperFlow-SHM基于GStreamer的跨平台特性,能够在不同操作系统和设备间实现高效的视频流传输。GStreamer作为成熟的多媒体框架,支持Windows、macOS、Linux等多种平台,为跨设备支持提供了坚实的技术基础。

Apple Vision Pro适配

基于macOS/iOS的GStreamer支持,HyperFlow-SHM可以轻松适配Apple Vision Pro,实现从传统设备到空间计算设备的无缝视频流传输,为沉浸式体验提供低延迟的媒体传输解决方案。

AI信号传输

HyperFlow-SHM的低延迟架构使其非常适合实时AI信号传输。在空间计算时代,AI生成的实时信号需要快速传输和处理,HyperFlow-SHM的零延迟特性能够满足这一需求,为AI/Agent集成提供可靠的传输基础。

故障排除

Troubleshooting

常见问题

Common Issues

  1. 找不到GStreamer

  2. GStreamer not found

    • 确保安装了GStreamer MSVC
    • Ensure GStreamer MSVC is installed
    • 检查gstreamer\1.0\msvc_x86_64\bin是否在PATH中
    • Check that gstreamer\1.0\msvc_x86_64\bin is in your PATH
  3. 找不到共享内存插件

  4. Shared memory plugin not found

    • 安装GStreamer开发包
    • Install the GStreamer Development package
    • gst-inspect-1.0.exe shm验证
    • Verify with: gst-inspect-1.0.exe shm
  5. Python导入错误

  6. Python import errors

    • 确保安装了PyGObject:pip install PyGObject
    • Ensure PyGObject is installed: pip install PyGObject
    • 在Windows上,您可能需要安装GTK运行时
    • On Windows, you may need to install GTK Runtime

日志

Logs

  • 查看控制台输出获取GStreamer错误信息
  • Check the console output for GStreamer error messages
  • 使用env_doctor.py诊断环境问题
  • Use env_doctor.py to diagnose environment issues

路线图

Roadmap

  • 音频传输支持
  • Audio transmission support
  • Spout/Syphon桥接
  • Spout/Syphon bridge
  • Linux/macOS兼容性
  • Linux/macOS compatibility
  • 配置文件支持
  • Configuration file support
  • 多流支持
  • Multiple stream support
  • 网络传输扩展(跨设备、跨网络)
  • Network transmission extension (cross-device, cross-network)
  • Apple Vision Pro适配
  • Apple Vision Pro adaptation
  • VR/AR设备支持
  • VR/AR device support
  • AI/Agent集成
  • AI/Agent integration

贡献

Contributing

欢迎贡献!请随时提交Pull Request。 Contributions are welcome! Please feel free to submit a Pull Request.

许可证

License

MIT License

致谢

Acknowledgments

  • GStreamer项目提供了优秀的多媒体框架
  • GStreamer Project for the excellent multimedia framework
  • PyQt5提供了GUI工具包
  • PyQt5 for the GUI toolkit
  • 感谢所有贡献者和用户
  • All contributors and users
  • VPE (Virtura Perceptual Engine) 团队的理念指导
  • The conceptual guidance from the VPE (Virtura Perceptual Engine) team

GitHub标签

GitHub Tags

gstreamer video-streaming shared-memory zero-latency python pyqt5 windows multimedia realtime vj virtual-production spatial-computing perceptual-engine ai-signaling apple-vision-pro

About

HyperFlow-SHM - 超低延迟多媒体流传输系统,使用GStreamer共享内存技术实现近零延迟传输 | HyperFlow-SHM - Ultra-low latency multimedia streaming system using GStreamer shared memory technology

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages