Skip to content

The Pipeline example based on AX650N/AX8850 AI Card, depend on AXCL API, shows the software development skills of Image Processing, NPU, Codec, and Display modules, which is helpful for users to develop their own multimedia applications.

Notifications You must be signed in to change notification settings

AXERA-TECH/axcl-pipeline

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ffmpeg-axcl Pipeline

基于 AXERA AXCL 加速卡 的 FFmpeg 推理管线,实现了 硬件编解码 + AI 检测(NPU 推理) 的高性能视频处理流程。 该项目支持从 RTSP 流MP4 文件 获取视频,解码后通过 NPU 执行目标检测,并输出可直接播放的结果视频流或文件。


✨ 功能特性

  • 🚀 硬件加速编解码:使用 AXCL 卡的 FFmpeg 插件进行视频编解码。
  • 🧠 AI 推理检测:支持基于 AXERA 模型(.axmodel)的检测,如 YOLOv8。
  • 📡 RTSP 流转发:支持输入 RTSP,输出检测后的视频流(RTSP)。
  • 📼 文件处理:支持从本地 MP4 文件读取并生成带检测框的视频文件。
  • ⚙️ 模块化设计:采用 Pipeline 结构,方便替换或扩展模块。
  • 🧩 OpenCV 支持:方便调试和结果可视化。

🧰 环境准备

1. 安装依赖

sudo apt update
sudo apt install -y libopencv-dev build-essential

🧱 编译步骤

git clone https://github.com/AXERA-TECH/axcl-pipeline.git
cd axcl-pipeline
git submodule update --init --recursive

mkdir build && cd build
cmake ..
make -j$(nproc)

编译成功后,会在 build/ 目录生成可执行程序,例如:

  • sample_demux_npu_rtsp

▶️ 运行示例

下载模型

# 有需要可以将 https://huggingface.co 换成 https://hf-mirror.com/
wget https://huggingface.co/AXERA-TECH/YOLO11/resolve/main/ax650/yolo11s.axmodel
wget https://huggingface.co/AXERA-TECH/YOLO11/resolve/main/ax650/yolo11x.axmodel
wget https://huggingface.co/AXERA-TECH/YOLOv8/resolve/main/ax650/yolov8s.axmodel

✅ RTSP 流输入 / 输出

1. 启动 RTSP 服务(这里使用 mediamtx

这里以 x86_64 为例

wget https://github.com/bluenviron/mediamtx/releases/download/v1.15.2/mediamtx_v1.15.3_linux_amd64.tar.gz
tar -xzvf mediamtx_v1.15.3_linux_amd64.tar.gz
./mediamtx

此时,服务会在默认端口 8554 上启动 RTSP 服务器。

2. 启动管线推理

LD_LIBRARY_PATH=/usr/lib/axcl/ffmpeg:$LD_LIBRARY_PATH \
./sample_demux_npu_rtsp \
  -u rtsp://admin:[email protected]:554/stream \
  -m ~/libdet.axera/build/yolov8s.axmodel \
  -o rtsp://127.0.0.1:8554/axstream0

参数说明:

参数 说明
-u 输入 RTSP 流地址
-m 检测模型(AXERA .axmodel 文件)
-o 输出 RTSP 流地址

3. 播放结果

ffplay rtsp://127.0.0.1:8554/axstream0

✅ MP4 文件输入 / 输出

1. 执行推理

LD_LIBRARY_PATH=/usr/lib/axcl/ffmpeg:$LD_LIBRARY_PATH \
./sample_demux_npu_rtsp \
  -i ~/test.mp4 \
  -m ~/libdet.axera/build/yolov8s.axmodel \
  -o ~/output.mp4

参数说明:

参数 说明
-i 输入视频文件路径
-m 检测模型文件路径
-o 输出视频文件路径

2. 播放输出结果

ffplay ~/output.mp4

🤝 社区支持

💬 QQ 群:139953715

欢迎加入 AXERA 社区,一起探索更高性能的多媒体 AI 处理方案!

About

The Pipeline example based on AX650N/AX8850 AI Card, depend on AXCL API, shows the software development skills of Image Processing, NPU, Codec, and Display modules, which is helpful for users to develop their own multimedia applications.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •