VideoPipe

sherlockchou86Apache-2.0更新放缓

跨平台视频结构化分析框架,基于 C++ 和 GStreamer 串联 CV 模型与多模态大模型,把视频流拆解成人脸、车牌、行为等结构化信息。

A cross-platform video structuring (video analysis) framework based on CV models & mLLM.

v0.1发布于 2024-04-28 05:46 UTC2,991star474fork同步于 2026-11-07 07:30 UTC

怎么上手

由 README 提炼,执行前请确认
git clone https://github.com/sherlockchou86/VideoPipe.git
cd VideoPipe
mkdir build && cd build
cmake ..
make -j8
硬件要求按 README 说明

README 列出 Ubuntu 18.04 x86_64 NVIDIA RTX/Tesla GPU、Ubuntu 18.04 aarch64 Jetson(tx2 已测);Ubuntu 22.04 x86_64 纯 CPU 可跑;另有寒武纪 MLU370、瑞芯微 RK3588、昇腾 310/910 已测但未提供代码。README 未给出具体显存要求。

需要 CUDA昇腾 / Ascend
下载:源码 zip·GitHub Releases(安装包)本站不镜像安装包

项目说明

由 README 自动翻译提炼

C++ 视频结构化框架,用可组合的 Node 插件搭建视频分析流水线

跨平台视频结构化分析框架,基于 C++ 和 GStreamer 串联 CV 模型与多模态大模型,把视频流拆解成人脸、车牌、行为等结构化信息。

核心能力

  • 按 Node 插件拼装流水线,节点独立可自由组合
  • 支持 UDP/RTSP/RTMP/文件和图像流读取与推流
  • 支持多级推理,可接 OpenCV::DNN、TensorRT、PaddleInference、ONNXRuntime 等后端
  • 内置 IOU/SORT 目标跟踪与越线、违停等行为分析
  • 支持 mLLM 多模态大模型接入与 Kafka/Socket 结构化数据推送

容易踩的坑

默认 cmake .. 全部走 CPU,CUDA/TensorRT/Paddle/Kafka/LLM 需显式加 -DVP_WITH_* 开关;运行示例前必须从 Google Drive 或百度网盘下载 vp_data 模型与测试数据,并在其所在目录执行程序;依赖 OpenCV >= 4.6、GStreamer 1.14.5、GCC >= 7.5 与 C++17。

内容由模型根据 README 生成,可能不完整或不准确,以官方文档为准。看原文 README

最近发版

1 个版本v0.1
  1. v0.1最新正式版2024-04-28 · 2024-04-28 05:46 UTC

    the first stable version for VideoPipe.

用户点评

登录用户的真实使用记录,可按版本和硬件筛选
共 0 条

    还没有人点评。第一个说出真实体验的人最有价值。

    README 原文

    未翻译

    Introduction

    VideoPipe is a framework for video analysis and structuring, written in C++. It has minimal dependencies and is easy to use. It operates like a pipeline, where each node is independent and can be combined in various ways. VideoPipe can be used to build different types of video analysis applications, suitable for scenarios such as video structuring, image search, face recognition, and behavior analysis in traffic/security fields (such as traffic incident detection).

    Advantages and Features

    VideoPipe is similar to NVIDIA's DeepStream and Huawei's mxVision frameworks, but it is easier to use and more portable.

    Here is a comparison table:

    NameOpen SourceLearning CurveSupported PlatformsPerformanceThird-Party Dependencies
    DeepStreamNoHighNVIDIA onlyHighMany
    mxVisionNoHighHuawei onlyHighMany
    VideoPipeYesLowAny platformMediumFew

    VideoPipe uses a plugin-oriented coding style that allows for flexible configuration based on different needs. We can use independent plugins (referred to as Node types within the framework) to build various types of video analysis applications. You only need to prepare the model and understand how to parse its output. Inference can be implemented using different backends, such as OpenCV::DNN (default), TensorRT, PaddleInference, ONNXRuntime, or any other backend you prefer.

    Demonstration

    https://github.com/sherlockchou86/video_pipe_c/assets/13251045/b1289faa-e2c7-4d38-871e-879ae36f6d50

    To watch in fullscreen, use the button in the bottom right corner of the player,more video demos

    Functions

    VideoPipe is a framework that simplifies the integration of computer vision algorithm models. It is important to note that it is not a deep learning framework like TensorFlow or TensorRT. The main features of VideoPipe are as follows:

    • Stream Reading: Supports mainstream video stream protocols such as UDP, RTSP, RTMP, file, and application. It also supports image reading.
    • Video Decoding: Supports video and image decoding based on OpenCV/GStreamer (with hardware acceleration).
    • Algorithm Inference: Supports multi-level inference based on deep learning algorithms, such as object detection, image classification, feature extraction, and image generation. It also supports the integration of traditional image algorithms. Support mLLM(Multimodal Large Language Model) integration now (update 2025/8/12)
    • Object Tracking: Supports object tracking, such as IOU and SORT tracking algorithms.
    • Behavior Analysis (BA): Supports behavior analysis based on tracking, such as traffic behavior detection like line-crossing, parking, and violations.
    • Business Logic: Allows integration of any custom business logic, which can be closely related to specific business requirements.
    • Data Proxy: Supports pushing structured data (in JSON, XML, or custom formats) to the cloud, files, or other third-party platforms via methods like Kafka or Socket.
    • Recording: Supports video recording for specific time periods and capturing screenshots of specific frames, with the ability to save them as files.
    • On-Screen Display (OSD): Supports overlaying structured data and business logic processing results onto frames.
    • Video Encoding: Supports video and image encoding based on OpenCV/GStreamer (with hardware acceleration).
    • Stream Pushing: Supports mainstream video stream protocols such as UDP, RTSP, RTMP, file, and application. It also supports image streaming.

    Getting Started Quickly

    Dependencies

    Platforms

    • Ubuntu 18.04 x86_64 NVIDIA rtx/tesla GPUs
    • Ubuntu 18.04 aarch64 NVIDIA jetson serials device,tx2 tested
    • Ubuntu 22.04 x86_64 by VMware virtual machine on Windows 10, pure CPUs
    • Ubuntu 18.04 x86_64 Cambrian MLU serials device, MLU 370 tested (code not provided)
    • Ubuntu 18.04 aarch64 Rockchip RK35** serials device, RK3588 tested (code not provided)
    • Ubuntu 22.04 aarch64 Ascend 310/910 serials device, Atlas 300I-Pro tested (code not provided)
    • Wait for your test

    Basics

    • C++ 17
    • OpenCV >= 4.6
    • GStreamer 1.14.5 (Required by OpenCV)
    • GCC >= 7.5

    Optional, if you need to implement your own inference backend or use a backend other than opencv::dnn.

    • CUDA
    • TensorRT
    • Paddle Inference
    • ONNX Runtime
    • mLLM(Ollama/vLLM/OpenAI-compatible API Services)
    • Anything you like

    how to install CUDA and TensorRT

    how to install Paddle_Inference

    Compilation and Debugging

    1. run git clone https://github.com/sherlockchou86/VideoPipe.git
    2. run cd VideoPipe
    3. run mkdir build && cd build
    4. run cmake ..
    5. run make -j8

    After compilation, all library files are stored in build/libs, and all sample executables are located in build/bin. During Step 4, you can add some compilation options:

    • -DVP_WITH_CUDA=ON (Compile CUDA-related features; default is OFF)
    • -DVP_WITH_TRT=ON (Compile TensorRT-related features and samples; default is OFF)
    • -DVP_WITH_PADDLE=ON (Compile PaddlePaddle-related features and samples; default is OFF)
    • -DVP_WITH_KAFKA=ON (Compile Kafka-related features and samples; default is OFF)
    • -DVP_WITH_LLM=ON (Compile LLM-related features and samples; default is OFF)
    • -DVP_BUILD_COMPLEX_SAMPLES=ON (Compile advanced samples; default is OFF)

    For example, to enable CUDA and TensorRT modules, you can run:

    cmake -DVP_WITH_CUDA=ON -DVP_WITH_TRT=ON ..
    

    If you run just:

    cmake ..
    

    all code will be executed on the CPU.

    To run the compiled samples, first download the model files and test data:

    1. Google Drive - Download test files and models
    2. Baidu Drive - Download test files and models

    Place the downloaded directory (named vp_data) in any location (e.g., /root/abc). Then, run the sample in the same directory where vp_data is located. For example, execute the command:

    [path to VideoPipe]/build/bin/1-1-1_sample
    

    at /root/abc.

    Note: The ./third_party/ directory contains independent projects. Some are header-only libraries directly referenced by VideoPipe, while others include CPP files that can be compiled or run independently. VideoPipe depends on these libraries, and they will be automatically compiled during the VideoPipe build process. These libraries also contain their own samples; for specific usage instructions, refer to the README files in the corresponding subdirectories.

    How to use

    Here’s a guide on how to build and run a sample pipeline with VideoPipe. You can either compile VideoPipe as a library and link it, or directly include the source code and compile the entire application.

    Below is a sample code demonstrating how to construct a pipeline and run it. Please make sure to update the file paths in the code accordingly:

    #include "../nodes/vp_file_src_node.h"
    #include "../nodes/infers/vp_yunet_face_detector_node.h"
    #include "../nodes/infers/vp_sface_feature_encoder_node.h"
    #include "../nodes/osd/vp_face_osd_node_v2.h"
    #include "../nodes/vp_screen_des_node.h"
    #include "../nodes/vp_rtmp_des_node.h"
    #include "../utils/analysis_board/vp_analysis_board.h"
    
    /*
    * Name: 1-1-N Sample
    * Complete code located at: samples/1-1-N_sample.cpp
    * Functionality: 1 video input, 1 video analysis task (face detection and recognition), 2 outputs (screen display/RTMP stream)
    */
    
    int main() {
        VP_SET_LOG_INCLUDE_CODE_LOCATION(false);
        VP_SET_LOG_INCLUDE_THREAD_ID(false);
        VP_LOGGER_INIT();
    
        // 1. Create nodes
        // Video Source Node
        auto file_src_0 = std::make_shared<vp_nodes::vp_file_src_node>("file_src_0", 0, "./test_video/10.mp4", 0.6);
        
        // 2. Model Inference Nodes
        // First-level inference: Face detection
        auto yunet_face_detector_0 = std::make_shared<vp_nodes::vp_yunet_face_detector_node>("yunet_face_detector_0", "./models/face/face_detection_yunet_2022mar.onnx");
        // Second-level inference: Face recognition
        auto sface_face_encoder_0 = std::make_shared<vp_nodes::vp_sface_feature_encoder_node>("sface_face_encoder_0", "./models/face/face_recognition_sface_2021dec.onnx");
        
        // 3. OSD Node
        // Draw results on frames
        auto osd_0 = std::make_shared<vp_nodes::vp_face_osd_node_v2>("osd_0");
        
        // Screen Display Node
        auto screen_des_0 = std::make_shared<vp_nodes::vp_screen_des_node>("screen_des_0", 0);
        // RTMP Stream Node
        auto rtmp_des_0 = std::make_shared<vp_nodes::vp_rtmp_des_node>("rtmp_des_0", 0, "rtmp://192.168.77.60/live/10000");
    
        // Build the pipeline by linking the nodes
        yunet_face_detector_0->attach_to({file_src_0});
        sface_face_encoder_0->attach_to({yunet_face_detector_0});
        osd_0->attach_to({sface_face_encoder_0});
    
        // Split the pipeline automatically to display results on screen and stream via RTMP
        screen_des_0->attach_to({osd_0});
        rtmp_des_0->attach_to({osd_0});
    
        // Start the pipeline
        file_src_0->start();
    
        // Visualize the pipeline
        vp_utils::vp_analysis_board board({file_src_0});
        board.display();
    }
    

    Note: Running this code will show three displays:

    1. Pipeline Status: A live update of the pipeline’s status.
    2. Screen Output: The GUI display showing results.
    3. RTMP Output: The streaming output available at the specified RTMP URL.

    Prototype Examples

    IDSampleScreenshot
    1face_tracking_sample
    2vehicle_tracking_sample
    3mask_rcnn_sample
    4openpose_sample
    5face_swap_sample
    6mllm_analyse_sample

    A total of over 40 prototype examples are available. Click here to view more.

    Read More

    WeChat Discussion Group

    Thanks