RDK x5运行vio2encoder示例丢帧问题

将示例中的单目改成双目后,camera0和camera1有丢帧

2026-06-12 12:12:59.044] [cam1] [INFO] heartbeat frames=2242 bytes=80018452 run_ms=75012 avg_fps_x1000=29888 max_frame_gap_ms=36
[2026-06-12 12:13:04.041] [cam0] [INFO] heartbeat frames=2394 bytes=82256017 run_ms=80009 avg_fps_x1000=29921 max_frame_gap_ms=36
[2026-06-12 12:13:04.045] [cam1] [INFO] heartbeat frames=2394 bytes=85422325 run_ms=80013 avg_fps_x1000=29920 max_frame_gap_ms=36
e[1;31m2026/06/12 12:13:07.553 ERROR [vp_codec_set_input][0730]hb_mm_mc_dequeue_input_buffer failed ret = -268435443
e[me[1;31m2026/06/12 12:13:07.554 ERROR [WorkFunc][0070]Module Camera SetImageFrame failed

e[m[2026-06-12 12:13:09.043] [cam0] [INFO] heartbeat frames=2546 bytes=87494352 run_ms=85011 avg_fps_x1000=29949 max_frame_gap_ms=36
[2026-06-12 12:13:09.466] [cam1] [INFO] heartbeat frames=2430 bytes=86689208 run_ms=85433 avg_fps_x1000=28443 max_frame_gap_ms=4268
[2026-06-12 12:13:14.046] [cam0] [INFO] heartbeat frames=2698 bytes=92733658 run_ms=90014 avg_fps_x1000=29973 max_frame_gap_ms=36
[2026-06-12 12:13:14.050] [cam1] [INFO] heartbeat frames=2580 bytes=92009140 run_ms=90018 avg_fps_x1000=28660 max_frame_gap_ms=4268
[2026-06-12 12:13:19.048] [cam0] [INFO] heartbeat frames=2850 bytes=97986851 run_ms=95016 avg_fps_x1000=29994 max_frame_gap_ms=36
[2026-06-12 12:13:19.052] [cam1] [INFO] heartbeat frames=2732 bytes=97453389 run_ms=95020 avg_fps_x1000=28751 max_frame_gap_ms=4268
[2026-06-12 12:13:24.051] [cam0] [INFO] heartbeat frames=3002 bytes=103260181 run_ms=100019 avg_fps_x1000=30014 max_frame_gap_ms=36

我来帮你分析这个 RDK X5 双目相机丢帧问题。先搜索一下社区是否有类似案例。

问题分析

从你的日志来看,这是典型的双目摄像头带宽/资源竞争导致的丢帧问题。关键错误信息:

ERROR [vp_codec_set_input][0730]hb_mm_mc_dequeue_input_buffer failed ret = -268435443
ERROR [WorkFunc][0070]Module Camera SetImageFrame failed

cam1 出现明显丢帧

  • cam0: avg_fps_x1000=29973 (约30fps,正常)
  • cam1: avg_fps_x1000=28751 (约28.7fps,丢帧) 且 max_frame_gap_ms=4268 (最大帧间隔4.2秒,严重丢帧)

解决方案

:one: 检查摄像头分辨率和帧率配置

双目同时运行时,带宽需求翻倍。先确认你的配置:

# 查看当前摄像头配置
cat /proc/device-tree/overlays/
# 或者查看你的示例代码中的分辨率设置

建议调整

  • 如果当前是 1920x1080@30fps,尝试降低到 1280x720@30fps1920x1080@20fps
  • 检查 vio2encoder 示例中的配置文件,修改分辨率参数

:two: 检查 MIPI CSI 带宽分配

RDK X5 的 MIPI CSI 带宽有限,双目同时高分辨率可能导致带宽不足:

# 查看当前 MIPI 带宽使用情况
sudo dmesg | grep -i mipi
sudo dmesg | grep -i hobot_camsys

解决方案

  • 确认两个摄像头是否运行在同一个 MIPI CSI 控制器上(带宽共享)
  • 如果可能,将两个摄像头分配到不同的 CSI 通道

:three: 调整 VIO 缓冲区数量

参考社区类似案例(topic 28467),该错误码 -268435443 通常表示缓冲区队列已满或资源耗尽

在你的代码中调整缓冲区配置:

// 示例:减少缓冲区数量或调整队列深度
// 在 vio2encoder 的配置文件中查找类似参数
buffer_count = 8;  // 尝试从默认值降低到 6 或 8

:four: 检查系统负载和温度

# 查看 CPU/BPU 频率和温度
rdkos_info

# 查看系统负载
top

如果温度过高(>70°C),可能导致降频丢帧。

:five: 验证单目运行是否正常

先分别单独运行 cam0 和 cam1,确认:

  • 单目 cam0 是否稳定 30fps
  • 单目 cam1 是否稳定 30fps

如果单目正常、双目丢帧,基本确定是带宽/资源竞争问题。


推荐排查步骤

# 1. 查看系统版本
cat /etc/version
rdkos_info

# 2. 查看摄像头相关日志
dmesg | grep -E "cam0|cam1|hobot_vio|hb_mm_mc" | tail -50

# 3. 查看当前 MIPI 摄像头配置
ls /dev/video*
v4l2-ctl --list-devices

# 4. 运行单目测试(分别测试 cam0 和 cam1)
# 修改示例代码,只启用一个摄像头,观察是否丢帧

社区相关资源


需要你补充的信息

为了更精准定位问题,请提供:

  1. 摄像头型号(SC230AI?其他?)
  2. 当前分辨率和帧率配置
  3. 系统版本cat /etc/version 的输出
  4. 连接方式:两个摄像头是同一个 MIPI 模组还是独立连接?

建议先在社区发帖时附上这些信息,方便官方技术支持快速响应。

摄像头型号 IMX219

当前分辨率1920x1080;帧率配置:30fps

系统版本3.3.1

连接方式:两个摄像头独立连接

问题定位

核心原因:IMX219 双路 1080p@30fps 同时运行时,MIPI CSI 带宽 + VPU 编码资源不足,导致 cam1 缓冲区溢出丢帧。

错误码 -268435443 = hb_mm_mc_dequeue_input_buffer failed,明确表示多媒体缓冲区队列已满


立即解决方案

方案 A:降低分辨率(推荐优先尝试)

IMX219 在 1080p@30fps 下单路带宽约 1.5Gbps,双目同时运行接近 X5 的 MIPI CSI 带宽上限。

# 修改 vio2encoder 示例的配置文件
# 路径通常在:/opt/tros/humble/share/hobot_vio/samples/vio2encoder/
# 或你的代码目录中的 config 文件

# 将分辨率从 1920x1080 改为 1280x720
# 帧率保持 30fps 或降至 25fps

预期效果:720p@30fps 双目可稳定运行,带宽需求降低约 55%。

方案 B:降低帧率

如果必须保持 1080p 分辨率:

# 将帧率从 30fps 降至 20fps 或 15fps
# 修改示例代码中的 fps 配置参数

方案 C:检查 CSI 通道分配

两个独立摄像头必须连接到不同的 MIPI CSI 控制器

# 查看摄像头连接的 CSI 通道
dmesg | grep -i "hobot_camsys\|mipi\|csi" | head -30

# 查看视频设备信息
v4l2-ctl --list-devices

理想情况

  • cam0 → CSI0 (如 /dev/video0)
  • cam1 → CSI1 (如 /dev/video2)

如果两个摄像头都在同一个 CSI 控制器上,带宽会共享导致冲突。


代码/配置调整

调整 VIO 缓冲区数量

在 vio2encoder 的初始化代码中,减少缓冲区队列深度:

// 示例:在 sp_open_camera 或相关配置中
// 查找 buffer_count / queue_depth 类似参数
// 从默认值(可能是 10+)降低到 6-8

// 或者在配置文件中添加:
vio_buffer_count = 6;

启用时间戳调试

确认丢帧发生在采集阶段还是编码阶段:

# 运行示例时增加日志级别
export LOG_LEVEL=debug
./vio2encoder  # 或你的运行命令

# 观察时间戳是否连续
dmesg -w | grep -E "cam0|cam1"

验证步骤

# 1. 确认系统版本
cat /etc/version  # 应显示 3.3.1

# 2. 单目测试(验证硬件正常)
# 修改代码只启用 cam0,运行 5 分钟观察是否丢帧
# 再只启用 cam1,运行 5 分钟观察

# 3. 查看实时带宽和负载
rdkos_info  # 查看 CPU/BPU 频率
top         # 查看系统负载

# 4. 查看摄像头相关错误日志
dmesg | grep -E "hb_mm_mc|vio|camsys" | tail -50

社区相关案例


建议操作顺序

  1. 先做单目测试 → 确认硬件和驱动正常
  2. 降至 720p@30fps → 验证是否解决丢帧
  3. 如果必须 1080p → 降至 20fps 测试
  4. 检查 CSI 通道分配 → 确认双路独立带宽
  5. 调整缓冲区配置 → 优化队列深度

需要你反馈

调整后请补充:

  • 单目 cam0/cam1 分别测试是否稳定?
  • 720p@30fps 双目是否还丢帧?
  • dmesg | grep -i mipi 的输出(确认 CSI 通道分配)

如果上述方案仍无法解决,建议携带完整日志在社区新开一帖,@官方技术支持 介入排查驱动层问题。

root@ubuntu:~# dmesg | grep -i mipi
[80395.640140] vin mipi0: get param cmd
[80395.640148] vin mipi0: set param cmd
[80395.640154] vin mipi0: init cmd: 0 real
[80395.640166] vin mipi0: 2 lane 1920x1080 30fps datatype 0x2b
[80395.640174] vin mipi0: mclk 24 ignore
[80395.640181] vin mipi0: ipiclk limit 40203680 up to 600000000
[80395.640198] vin mipi0: ipiclk set 600000000 get 600000000
[80395.640207] vin mipi0: dphy 1728Mbps/2lane: ppi 8bit settle 30
[80395.673244] vin mipi0: linelenth: 3448, framelenth: 1166, fps: 30, ipiclk: 600000000, rx_bit_clk: 1728000000
[80395.673263] vin mipi0: ipi config hsa: 4, hbp: 4, hsd: 32
[80395.673273] vin mipi0: config 1/1 ipi done
[80395.723187] vin mipi2: get param cmd
[80395.723193] vin mipi2: set param cmd
[80395.723198] vin mipi2: init cmd: 0 real
[80395.723208] vin mipi2: 2 lane 1920x1080 30fps datatype 0x2b
[80395.723215] vin mipi2: mclk 24 ignore
[80395.723220] vin mipi2: ipiclk limit 40203680 up to 600000000
[80395.723236] vin mipi2: ipiclk set 600000000 get 600000000
[80395.723243] vin mipi2: dphy 1728Mbps/2lane: ppi 8bit settle 30
[80395.756280] vin mipi2: linelenth: 3448, framelenth: 1166, fps: 30, ipiclk: 600000000, rx_bit_clk: 1728000000
[80395.756306] vin mipi2: ipi config hsa: 4, hbp: 4, hsd: 32
[80395.756315] vin mipi2: config 1/1 ipi done
[80396.409910] vin mipi0: start cmd: 0 real
[80396.409916] vin mipi0: check phy stop state
[80396.411966] vin mipi2: start cmd: 0 real
[80396.411971] vin mipi2: check phy stop state
[80396.413927] vin mipi0: check hs reception
[80396.415982] vin mipi2: check hs reception
[80396.430941] vin mipi0: entry hs reception
[80396.433002] vin mipi2: entry hs reception
[80398.262028] vin mipi0: stop cmd: 0 real
[80398.263754] vin mipi0: deinit cmd: 0 real
[80398.264031] vin mipi2: stop cmd: 0 real
[80398.265502] vin mipi2: deinit cmd: 0 real

有没有双目vioencoder的示例代码

根据社区资源和你的日志分析,官方没有直接提供双目的 vio2encoder 示例代码,但你可以通过以下方式实现:

:file_folder: vio2encoder 示例位置

# X5 上的默认路径
/opt/tros/humble/share/hobot_vio/samples/vio2encoder/
# 或
/opt/hobot/samples/vio2encoder/

:wrench: 双目实现方案

方案 1:修改现有单目示例(推荐)

官方 vio2encoder 是单目的,需要修改为双路采集:

// 核心修改点:在 sp_open_camera 中配置两个 camera_id
// 示例伪代码(参考社区案例)

#include "hobot_vio/hbot_vio.h"

// 双目配置结构
sp_camera_config_t cam0_config = {
    .camera_id = 0,      // MIPI CSI0
    .fps = 30,
    .width = 1280,       // 建议先降分辨率测试
    .height = 720,
    .buffer_count = 6    // 减少缓冲区避免溢出
};

sp_camera_config_t cam1_config = {
    .camera_id = 2,      // MIPI CSI2(注意:不是1)
    .fps = 30,
    .width = 1280,
    .height = 720,
    .buffer_count = 6
};

// 分别初始化两个摄像头
sp_open_camera(&cam0_config);
sp_open_camera(&cam1_config);

// 循环获取双路帧
while (running) {
    sp_vio_get_frame(0, &frame0);  // 获取 cam0
    sp_vio_get_frame(2, &frame1);  // 获取 cam1
    
    // 编码处理...
}

方案 2:参考 ROS2 双目实现提取代码

查看 ROS2 包中的双目实现逻辑:

# 查看 mipi_cam 功能包的双目 launch 文件
find /opt/tros -name "*stereo*" -o -name "*dual*" | grep launch

# 查看源码(如果有)
find /opt/tros -name "*.cpp" -o -name "*.c" | xargs grep -l "sp_open_camera" | head -5

方案 3:使用 Python 快速验证

先用 Python 验证双目采集是否正常:

#!/usr/bin/env python3
from hobot_vio import libsrcampy as srcampy
import cv2
import numpy as np

def open_dual_camera():
    # 打开 cam0 (CSI0)
    cam0 = srcampy.Camera()
    ret0 = cam0.open_cam(0, -1, 30, 1280, 720)  # 先降分辨率
    print(f"Cam0 open: {ret0}")
    
    # 打开 cam1 (CSI2)
    cam1 = srcampy.Camera()
    ret1 = cam1.open_cam(2, -1, 30, 1280, 720)
    print(f"Cam1 open: {ret1}")
    
    if ret0 != 0 or ret1 != 0:
        print("Failed to open dual cameras")
        return
    
    # 同时获取双路帧
    while True:
        img0 = cam0.get_img(2, 1280, 720)
        img1 = cam1.get_img(2, 1280, 720)
        
        if img0 and img1:
            # 转换为 BGR 显示
            nv12_0 = np.frombuffer(img0, dtype=np.uint8).reshape(720*3//2, 1280)
            nv12_1 = np.frombuffer(img1, dtype=np.uint8).reshape(720*3//2, 1280)
            
            bgr0 = cv2.cvtColor(nv12_0, cv2.COLOR_YUV2BGR_NV12)
            bgr1 = cv2.cvtColor(nv12_1, cv2.COLOR_YUV2BGR_NV12)
            
            cv2.imshow("Cam0", bgr0)
            cv2.imshow("Cam1", bgr1)
            
            if cv2.waitKey(1) & 0xFF == ord('q'):
                break
    
    cam0.close_cam()
    cam1.close_cam()
    cv2.destroyAllWindows()

if __name__ == "__main__":
    open_dual_camera()

:pushpin: 关键配置点

根据你的 dmesg 日志:

  • cam0vin mipi0 (CSI0)
  • cam1vin mipi2 (CSI2)

camera_id 对应关系

CSI0 → camera_id = 0
CSI2 → camera_id = 2  // 注意不是 1!

:bullseye: 立即可执行的步骤

# 1. 先运行 Python 双目测试(验证硬件)
python3 dual_cam_test.py

# 2. 如果不丢帧,再修改 C++ vio2encoder 示例
cd /opt/tros/humble/share/hobot_vio/samples/vio2encoder/
cp -r . ~/my_vio2encoder_dual/
cd ~/my_vio2encoder_dual/

# 3. 修改配置文件或源码中的 camera_id 和分辨率
# 将 1920x1080 改为 1280x720
# 添加第二个摄像头的初始化代码

# 4. 编译运行
mkdir build && cd build
cmake ..
make -j4
./vio2encoder

:books: 相关资源

建议:先用 Python 脚本验证 720p@30fps 双目是否稳定,确认后再移植到 C++ vio2encoder 示例中。如果 Python 测试也丢帧,说明是带宽/驱动层问题,需要进一步调整 CSI 配置。

我用的sp_open_camera_v2,vedio_index传的0和1

:magnifying_glass_tilted_left: 关键问题定位

你提到 video_index 传 0 和 1,但根据你的 dmesg 日志:

vin mipi0: ...  # cam0 → CSI0
vin mipi2: ...  # cam1 → CSI2  ← 注意是 mipi2,不是 mipi1!

问题很可能出在这里:IMX219 双目在 X5 上通常占用 CSI0 和 CSI2,而不是连续的 CSI0/CSI1。


:white_check_mark: 正确配置方式

sp_open_camera_v2 参数说明

// 函数原型(简化)
int sp_open_camera_v2(int pipe_id, int video_index, int fps, 
                      int width, int height, int *handle);

关键参数

参数 含义 双目配置示例
pipe_id MIPI CSI 控制器编号 cam0: 0, cam1: 2
video_index 同一 pipe 下的视频流索引 通常传 -1(默认)或 0
fps/width/height 采集参数 建议先 720p@30fps 测试

正确调用示例

// 打开 cam0 (CSI0)
int handle0;
int ret0 = sp_open_camera_v2(0, -1, 30, 1280, 720, &handle0);
printf("Cam0 open: %d, handle: %d\n", ret0, handle0);

// 打开 cam1 (CSI2) ← 注意 pipe_id=2
int handle1;
int ret1 = sp_open_camera_v2(2, -1, 30, 1280, 720, &handle1);
printf("Cam1 open: %d, handle: %d\n", ret1, handle1);

// 获取帧时使用对应 handle
sp_vio_get_frame(handle0, &frame0);
sp_vio_get_frame(handle1, &frame1);

:hammer_and_wrench: 快速验证步骤

:one: 确认 camera_id 映射

# 查看视频设备与 MIPI 的对应关系
ls -l /dev/video*
v4l2-ctl --list-devices

# 查看 dmesg 中摄像头初始化顺序
dmesg | grep -E "vin mipi|camera" | grep -i "init\|probe"

:two: 单路测试(确认 pipe_id)

# 测试 pipe_id=0
./test_camera 0  # 应看到 cam0 画面

# 测试 pipe_id=2  
./test_camera 2  # 应看到 cam1 画面

# 如果 pipe_id=1 也能打开,确认打开的是哪个摄像头
./test_camera 1  # 可能还是 cam0(重复)

:three: 双目同时运行测试

// 最小化测试代码,先不编码,只采集
#include "hobot_vio/hbot_vio.h"

int main() {
    int h0, h1;
    
    // 先降分辨率 + 降帧率测试稳定性
    sp_open_camera_v2(0, -1, 20, 1280, 720, &h0);  // cam0 @ 20fps 720p
    sp_open_camera_v2(2, -1, 20, 1280, 720, &h1);  // cam1 @ 20fps 720p
    
    for (int i = 0; i < 100; i++) {
        sp_vio_get_frame(h0, NULL);  // 只取帧不处理,测带宽
        sp_vio_get_frame(h1, NULL);
        printf("Frame %d OK\n", i);
        usleep(33000);  // ~30fps
    }
    
    sp_close_camera(h0);
    sp_close_camera(h1);
    return 0;
}

:clipboard: 排查清单

# [ ] 1. 确认 pipe_id 映射:0→cam0, 2→cam1
# [ ] 2. video_index 先统一传 -1 测试
# [ ] 3. 分辨率先降到 1280x720,帧率降到 20fps
# [ ] 4. buffer_count 设为 6(减少队列积压)
# [ ] 5. 单目测试稳定后,再测双目
# [ ] 6. 运行中监控:rdkos_info 看 BPU/CPU 频率是否降频

:warning: 常见坑点

  1. video_index 不是 camera_idvideo_index 用于同一 MIPI 下的多路视频流(如 RAW+YUV 同时输出),双目区分靠 pipe_id

  2. IMX219 默认配置:部分 SDK 版本中 IMX219 的 device tree 可能将双目映射到 pipe 0/1,但你的 dmesg 显示是 0/2,以实际 dmesg 为准

  3. 缓冲区溢出:错误码 -268435443 明确表示缓冲区队列满,优先降低分辨率/帧率,再调 buffer_count


:counterclockwise_arrows_button: 如果仍丢帧

请补充以下信息,我帮你进一步分析:

# 1. 修改后的调用代码片段(sp_open_camera_v2 部分)
# 2. 运行时的完整错误日志(含时间戳)
# 3. rdkos_info 输出(看是否降频)
# 4. 单目 720p@20fps 是否稳定?

建议:先用 Python + libsrcampy 快速验证 pipe_id=0/2 是否能同时稳定取帧,确认硬件链路正常后再移植到 C++ vio2encoder。

root@ubuntu:~# ls -l /dev/video*
crw-rw-r–+ 1 root video 81, 0 Jun 4 2025 /dev/video0
crw-rw-r–+ 1 root video 81, 1 Jun 4 2025 /dev/video1
root@ubuntu:~#
root@ubuntu:~# v4l2-ctl --list-devices
Integrated Webcam: Integrated W (usb-xhci-hcd.2.auto-1.3):
/dev/video0
/dev/video1
/dev/media0

root@ubuntu:~# dmesg | grep -E “vin mipi|camera” | grep -i “init|probe”
[80395.404272] vin sensor0: camera_init_req cmd: initing
[80395.487954] vin sensor1: camera_init_req cmd: initing
[80395.639879] vin sensor0: camera_init_result cmd: done wake
[80395.640154] vin mipi0: init cmd: 0 real
[80395.722993] vin sensor1: camera_init_result cmd: done wake
[80395.723198] vin mipi2: init cmd: 0 real
[80398.263754] vin mipi0: deinit cmd: 0 real
[80398.263809] vin sensor0: camera_deinit_req cmd: 0 real
[80398.265502] vin mipi2: deinit cmd: 0 real
[80398.265552] vin sensor1: camera_deinit_req cmd: 0 real

:police_car_light: 关键发现!

你的 /dev/video0/dev/video1 显示的是 USB摄像头(Integrated Webcam),不是MIPI摄像头!

/dev/video0
/dev/video1
→ usb-xhci-hcd.2.auto-1.3  ← 这是USB接口!

而你的 dmesg 显示MIPI摄像头在:

vin sensor0 → vin mipi0  (CSI0)  ← 这是cam0
vin sensor1 → vin mipi2  (CSI2)  ← 这是cam1,注意是mipi2不是mipi1!

:white_check_mark: 正确配置

sp_open_camera_v2 参数

摄像头 pipe_id video_index 说明
cam0 (左) 0 -1 对应 vin mipi0
cam1 (右) 2 -1 对应 vin mipi2
// 正确调用示例
int handle0, handle1;

// cam0 - CSI0
sp_open_camera_v2(0, -1, 30, 1280, 720, &handle0);

// cam1 - CSI2 ← 关键:pipe_id=2,不是1!
sp_open_camera_v2(2, -1, 30, 1280, 720, &handle1);

:test_tube: 快速验证脚本

先确认 pipe_id=0/2 能正常打开:

#!/usr/bin/env python3
from hobot_vio import libsrcampy as srcampy
import time

def test_pipe_id():
    # 测试 pipe_id=0
    cam0 = srcampy.Camera()
    ret0 = cam0.open_cam(0, -1, 30, 1280, 720)
    print(f"pipe_id=0: ret={ret0}")
    if ret0 == 0:
        img = cam0.get_img(2, 1280, 720)
        print(f"  Got frame: {len(img) if img else 0} bytes")
        cam0.close_cam()
    
    # 测试 pipe_id=1(应该失败或打开错误设备)
    cam1 = srcampy.Camera()
    ret1 = cam1.open_cam(1, -1, 30, 1280, 720)
    print(f"pipe_id=1: ret={ret1}")
    if ret1 == 0:
        cam1.close_cam()
    
    # 测试 pipe_id=2
    cam2 = srcampy.Camera()
    ret2 = cam2.open_cam(2, -1, 30, 1280, 720)
    print(f"pipe_id=2: ret={ret2}")
    if ret2 == 0:
        img = cam2.get_img(2, 1280, 720)
        print(f"  Got frame: {len(img) if img else 0} bytes")
        cam2.close_cam()

if __name__ == "__main__":
    test_pipe_id()

:pushpin: 丢帧问题根因

你之前 video_index 传 0 和 1,但实际应该用 pipe_id 区分双目

错误配置 正确配置
sp_open_camera_v2(0, 0, ...) sp_open_camera_v2(0, -1, ...)
sp_open_camera_v2(0, 1, ...) sp_open_camera_v2(2, -1, ...)

video_index 是用于同一MIPI通道下输出多路不同分辨率的流,不是用来区分不同摄像头的


:bullseye: 立即可执行

# 1. 运行上面的Python脚本,确认pipe_id=0和2都能打开
python3 test_pipe_id.py

# 2. 如果成功,修改vio2encoder源码中的pipe_id
# 找到 sp_open_camera_v2 调用处,改为:
#   cam0: pipe_id=0, video_index=-1
#   cam1: pipe_id=2, video_index=-1

# 3. 同时降低分辨率测试稳定性
#   1920x1080 → 1280x720
#   30fps → 20fps(先验证稳定后再调高)

# 4. 运行时监控
rdkos_info  # 看CPU/BPU是否降频
dmesg -w | grep -E "hb_mm_mc|vio"  # 看是否有缓冲区错误

:red_question_mark: 需要你反馈

运行Python测试后请告诉我:

  • pipe_id=0 是否能正常取帧?
  • pipe_id=2 是否能正常取帧?
  • 同时打开0和2是否还报错 -268435443

如果 pipe_id=0/2 单路都正常,但双目同时运行仍丢帧,那就是带宽不足,需要进一步降低分辨率/帧率。

pcie_id传的都是0

:police_car_light: 找到根因了!

两个摄像头都传 pipe_id=0 是错误的! 这导致两个摄像头都在抢占同一个 CSI 通道资源。


:cross_mark: 当前错误配置

// 你现在的代码(错误)
sp_open_camera_v2(0, 0, ...);  // cam0
sp_open_camera_v2(0, 1, ...);  // cam1 ← 错!pipe_id 还是 0

这相当于让两个摄像头走同一条"高速公路",必然导致带宽竞争和缓冲区溢出。


:white_check_mark: 正确配置

根据你的 dmesg 日志:

vin mipi0 → CSI0 → pipe_id = 0
vin mipi2 → CSI2 → pipe_id = 2  ← 注意是 2,不是 1!
// 正确代码
int handle0, handle1;

// cam0 - CSI0
sp_open_camera_v2(0, -1, 30, 1280, 720, &handle0);

// cam1 - CSI2 ← 关键:pipe_id=2
sp_open_camera_v2(2, -1, 30, 1280, 720, &handle1);
参数 cam0 cam1 说明
pipe_id 0 2 对应不同的 MIPI CSI 控制器
video_index -1 -1 默认流,不要用 0/1 区分摄像头
fps 20-30 20-30 建议先 20fps 测试稳定性
resolution 1280x720 1280x720 先降分辨率验证

:test_tube: 立即验证

Python 快速测试

#!/usr/bin/env python3
from hobot_vio import libsrcampy as srcampy
import time

print("=== 测试 pipe_id 映射 ===")

# 测试 pipe_id=0
cam0 = srcampy.Camera()
ret0 = cam0.open_cam(0, -1, 30, 1280, 720)
print(f"pipe_id=0: ret={ret0}")
if ret0 == 0:
    for i in range(10):
        img = cam0.get_img(2, 1280, 720)
        print(f"  Frame {i}: {len(img) if img else 0} bytes")
        time.sleep(0.033)
    cam0.close_cam()

# 测试 pipe_id=2
cam2 = srcampy.Camera()
ret2 = cam2.open_cam(2, -1, 30, 1280, 720)
print(f"pipe_id=2: ret={ret2}")
if ret2 == 0:
    for i in range(10):
        img = cam2.get_img(2, 1280, 720)
        print(f"  Frame {i}: {len(img) if img else 0} bytes")
        time.sleep(0.033)
    cam2.close_cam()

# 双目同时测试
print("=== 双目同时测试 ===")
cam0 = srcampy.Camera()
cam2 = srcampy.Camera()
ret0 = cam0.open_cam(0, -1, 20, 1280, 720)
ret2 = cam2.open_cam(2, -1, 20, 1280, 720)
print(f"Dual open: cam0={ret0}, cam2={ret2}")

if ret0 == 0 and ret2 == 0:
    for i in range(50):
        img0 = cam0.get_img(2, 1280, 720)
        img2 = cam2.get_img(2, 1280, 720)
        if img0 and img2:
            print(f"Frame {i}: OK")
        else:
            print(f"Frame {i}: DROP!")
        time.sleep(0.05)  # 20fps
    
    cam0.close_cam()
    cam2.close_cam()

运行测试

python3 test_dual_cam.py

:memo: vio2encoder 修改点

找到你的 vio2encoder 源码中 sp_open_camera_v2 调用处:

// 修改前(错误)
sp_open_camera_v2(0, 0, fps, width, height, &handle0);
sp_open_camera_v2(0, 1, fps, width, height, &handle1);

// 修改后(正确)
sp_open_camera_v2(0, -1, 20, 1280, 720, &handle0);  // cam0 → CSI0
sp_open_camera_v2(2, -1, 20, 1280, 720, &handle1);  // cam1 → CSI2

:bullseye: 预期结果

测试场景 预期结果
pipe_id=0 单路 :white_check_mark: 稳定 30fps
pipe_id=2 单路 :white_check_mark: 稳定 30fps
pipe_id=0+2 双目 720p@20fps :white_check_mark: 稳定无丢帧
pipe_id=0+2 双目 1080p@30fps :warning: 可能仍丢帧(带宽上限)

:red_question_mark: 反馈

运行 Python 测试后告诉我:

  1. pipe_id=0pipe_id=2 单独测试是否都正常?
  2. 双目同时运行 720p@20fps 是否还丢帧?
  3. 修改 vio2encoder 后错误码 -268435443 是否消失?

如果 pipe_id=2 打不开,可能需要检查设备树配置或 SDK 版本。

这个只影响资源竞争,不影响两个摄像头的打开?

回答你的问题

是的,pipe_id 相同通常不影响"打开",但会严重影响"运行"!


:pushpin: 关键区别

阶段 pipe_id 相同的影响
打开摄像头 (sp_open_camera_v2) :white_check_mark: 可能都返回成功 (ret=0)
获取帧 (sp_vio_get_frame) :cross_mark: 带宽竞争 → 缓冲区溢出 → 丢帧
长期运行 :cross_mark: 错误码 -268435443 必现

:magnifying_glass_tilted_left: 为什么会这样?

底层原理

pipe_id = 0  →  MIPI CSI0 控制器 → 带宽约 1.5Gbps
pipe_id = 2  →  MIPI CSI2 控制器 → 带宽约 1.5Gbps

当你两个摄像头都传 pipe_id=0

cam0 → CSI0 (1.5Gbps)
cam1 → CSI0 (1.5Gbps)  ← 挤在同一条通道!

结果

  • 打开时:驱动层可能都返回成功(因为 handle 是独立分配的)
  • 取帧时:CSI0 带宽不够 → 缓冲区排队 → hb_mm_mc_dequeue_input_buffer failed
  • 表现:cam0 正常,cam1 严重丢帧(你的日志中 cam1 帧间隔达 4.2 秒)

:bar_chart: 你的实际情况

根据 dmesg

vin mipi0: init cmd: 0 real  → 物理连接在 CSI0 → pipe_id 应该=0
vin mipi2: init cmd: 0 real  → 物理连接在 CSI2 → pipe_id 应该=2

正确配置

// 错误:都抢 CSI0
sp_open_camera_v2(0, 0, ...);   // cam0
sp_open_camera_v2(0, 1, ...);   // cam1 ← 还是 CSI0!

// 正确:各自用独立通道
sp_open_camera_v2(0, -1, ...);  // cam0 → CSI0
sp_open_camera_v2(2, -1, ...);  // cam1 → CSI2

:test_tube: 验证实验

你可以做个对比测试:

# 测试 1:pipe_id 都传 0(当前错误配置)
cam0.open_cam(0, 0, 30, 1920, 1080)
cam1.open_cam(0, 1, 30, 1920, 1080)
# 预期:都能打开,但 cam1 严重丢帧

# 测试 2:pipe_id 分别传 0 和 2(正确配置)
cam0.open_cam(0, -1, 30, 1280, 720)
cam2.open_cam(2, -1, 30, 1280, 720)
# 预期:都能打开,且双目稳定运行

:warning: 社区类似案例

参考 topic 31575

“单独打开都可以,同时打开时第二个摄像头打开失败”

这说明:

  • 有些 SDK 版本在 pipe_id 冲突时会直接打开失败
  • 有些版本(如你的)能打开但运行时报错
  • 核心问题都是带宽/资源竞争

:white_check_mark: 结论

  1. pipe_id 相同 ≠ 打不开(取决于 SDK 版本)
  2. pipe_id 相同 = 必然丢帧(带宽竞争)
  3. 必须以 dmesg 中的 vin mipiX 为准配置 pipe_id
  4. 你的情况:pipe_id=0pipe_id=2 才是正确配置

:bullseye: 下一步

先运行 Python 测试确认 pipe_id=0/2 能稳定取帧,再修改 C++ 代码。如果还有问题,把测试结果发出来继续排查。

device_mode:=dual

https://github.com/D-Robotics/hobot_mipi_cam 可以看下对应的源码参考

  • sp_open_camera_v2

    【函数原型】

    int32_t sp_open_camera_v2(void *obj, const int32_t pipe_id, const int32_t video_index, int32_t chn_num, sp_sensors_parameters *parameters, int32_t *width, int32_t *height)

    【功能描述】

    初始化接入到RDK X3上的MIPI摄像头。
    支持指定摄像头原始输出RAW的分辨率大小,通过sp_sensors_parameters设置。
    支持设置输出分辨率,支持设置最多5组分辨率,其中只有1组可以放大,4组可以缩小。最大支持放大到原始图像的1.5倍,最小支持缩小到原始图像的1/8。

  • obj: 已经初始化的VIO对象指针

  • pipe_id:支持多组数据输入,建议填0

  • video_index:camera对应的host编号,-1表示自动探测,编号可以查看 /etc/board_config.json 配置文件

  • chn_num:设置输出多少种不同分辨率的图像,最大为5,最小为1。

  • parameters:camera RAW输出相关结构体,用于指定分辨率和帧率

  • width:配置输出宽度的数组地址

  • height:配置输出高度的数组地址

  • VIO(视频输入)API | RDK X3/X5 DOC

  • 这个pipe_id是选 MIPI CSI?

:clipboard: 官方 API 解读

根据你提供的官方文档,关键信息:

参数 文档说明 实际含义
pipe_id 支持多组数据输入,建议填 0 VIO 输入通道号,不是 CSI 物理通道
video_index camera 对应的 host 编号,-1 自动探测 这才是区分不同摄像头的关键

:magnifying_glass_tilted_left: 正确理解

pipe_id ≠ MIPI CSI 物理通道号

  • pipe_id 是 VIO 模块的逻辑输入通道
  • video_index 才是对应具体 camera host(即 dmesg 中的 vin sensor0/1mipi0/2

:white_check_mark: 正确配置方式

:one: 查看 board_config.json 确认 video_index

cat /etc/board_config.json | grep -A 20 "camera\|mipi\|sensor"

找到类似内容:

{
  "camera": [
    {"host_id": 0, "pipe_id": 0, "sensor": "imx219"},
    {"host_id": 1, "pipe_id": 0, "sensor": "imx219"}
  ]
}

host_id 就是 video_index 应该传的值!

:two: 根据 Marcelo6151 的提示

device_mode:=dual

这表示需要使用双目模式配置。参考官方源码:

# 查看 hobot_mipi_cam 源码中的双目配置
git clone https://github.com/D-Robotics/hobot_mipi_cam
# 查找 device_mode 或 dual 相关配置

:three: 正确的 sp_open_camera_v2 调用

根据文档,双目应该这样配置:

// cam0 - 左目
int video_index_0 = 0;  // 从 board_config.json 获取 host_id
sp_open_camera_v2(vio_obj, 0, video_index_0, 1, &params, &width, &height);

// cam1 - 右目
int video_index_1 = 1;  // 从 board_config.json 获取 host_id
sp_open_camera_v2(vio_obj, 0, video_index_1, 1, &params, &width, &height);

关键点

  • pipe_id 都传 0(按文档建议)
  • video_index 分别传 0 和 1(对应两个 camera host)
  • 但你的 dmesg 显示 mipi0mipi2,所以 video_index 可能需要传 0 和 2

:test_tube: 验证步骤

# 1. 查看 board_config.json 中的 camera 配置
cat /etc/board_config.json

# 2. 查看实际的 camera host 映射
dmesg | grep -E "vin sensor|vin mipi" | grep "init"

# 3. 测试不同的 video_index 组合
python3 -c "
from hobot_vio import libsrcampy as srcampy

# 测试 video_index=0 和 1
cam0 = srcampy.Camera()
ret0 = cam0.open_cam(0, 0, 30, 1280, 720)  # pipe_id=0, video_index=0
print(f'video_index=0: ret={ret0}')

cam1 = srcampy.Camera()
ret1 = cam1.open_cam(0, 1, 30, 1280, 720)  # pipe_id=0, video_index=1
print(f'video_index=1: ret={ret1}')

# 如果上面失败,尝试 video_index=0 和 2
cam2 = srcampy.Camera()
ret2 = cam2.open_cam(0, 2, 30, 1280, 720)  # pipe_id=0, video_index=2
print(f'video_index=2: ret={ret2}')
"

:pushpin: 丢帧根因分析

即使 pipe_id/video_index 配置正确,1080p@30fps 双目仍可能丢帧,原因:

因素 影响 解决方案
MIPI 带宽 1080p@30fps 单路约 1.5Gbps,双目 3Gbps 降至 720p@30fps 或 1080p@20fps
VPU 编码资源 双路编码占用更多 BPU/CPU 降低码率或分辨率
缓冲区队列 默认 buffer_count 可能过大 减少到 6-8

:bullseye: 建议操作顺序

# 1. 确认 video_index 映射
cat /etc/board_config.json | grep -A 30 "camera"

# 2. 用 Python 测试正确的 video_index 组合
# pipe_id=0, video_index=0 和 2(根据 dmesg 是 mipi0/mipi2)

# 3. 确认能打开后,降低分辨率测试稳定性
# 1920x1080 → 1280x720
# 30fps → 20fps

# 4. 参考 hobot_mipi_cam 源码中的双目配置
# https://github.com/D-Robotics/hobot_mipi_cam

:red_question_mark: 需要你反馈

  1. /etc/board_config.jsoncamera 部分的完整内容
  2. Python 测试 video_index=0/1video_index=0/2 的结果
  3. Marcelo6151 提到的 device_mode:=dual 是在哪里配置的?(代码/配置文件/启动参数)

这些信息能帮我更精准定位问题。

int MipiCamIml::init(std::shared_ptr para) {

if (lsInit_) {
return 0;
}
nodePare_ = para;
//memcpy(nodePare_.get(), &para, sizeof(struct NodePara));
auto board_type = getBoardType();
mipiCap_ptr_ = createMipiCap(board_type);
if (!mipiCap_ptr_) {
RCLCPP_ERROR(rclcpp::get_logger(“mipi_cam”),
“[%s]->cap %s create capture failture.\r\n”,
func, board_type.c_str());
return -1;
}
cap_info_.config_path = nodePare_->config_path_;
cap_info_.sensor_type = nodePare_->video_device_name_;
cap_info_.width = nodePare_->image_width_;
cap_info_.height = nodePare_->image_height_;
cap_info_.sub_width = nodePare_->sub_image_width_;
cap_info_.sub_height = nodePare_->sub_image_height_;
cap_info_.fps = nodePare_->framerate_;
cap_info_.channel_ = nodePare_->channel_;
cap_info_.channel2_ = nodePare_->channel2_;
cap_info_.device_mode_ = nodePare_->device_mode_;
cap_info_.dual_combine_ = nodePare_->dual_combine_;
cap_info_.lpwm_enable_ = nodePare_->lpwm_enable_;
cap_info_.gdc_bin_file_ = nodePare_->gdc_bin_file_;
cap_info_.rotation_ = nodePare_->rotation_;
cap_info_.cal_rotation_ = nodePare_->cal_rotation_;
cap_info_.gdc_enable_ = nodePare_->gdc_enable_;
cap_info_.frame_ts_type_ = nodePare_->frame_ts_type_;
cap_info_.link_type_ = nodePare_->link_type_;
cap_info_.link_port_ = nodePare_->link_port_;
cap_info_.gsml_cfg_file_ = nodePare_->gsml_cfg_file_;
cap_info_.cal_alpha_ = nodePare_->cal_alpha_;
cap_info_.stream_mode_ = nodePare_->stream_mode_;
cap_info_.sub_stream_enable_ = nodePare_->sub_stream_enable_;
cap_info_.sync_awb_ = nodePare_->sync_awb_;
cap_info_.sync_ae_ = nodePare_->sync_ae_;
cap_info_.print_isp_log_ = nodePare_->print_isp_log_;
if (mipiCap_ptr_->initEnv() < 0) {
RCLCPP_ERROR(rclcpp::get_logger(“mipi_cam”),
“[%s]->init %s’s mipi host and gpio failure: %s\r\n”, func, board_type.c_str());
return -1;
}
if ( cap_info_.device_mode_ == “dual”) {
std::vector<sensor_msgs::msg::CameraInfo> cam_info_v;
cam_info_v.resize(2);
if (mipi_calibration::GetInstance().getDualCamCalibrationIml(cam_info_v[0], cam_info_v[1], nodePare_->camera_calibration_file_path_)) {
mipiCap_ptr_->setCamInfo(cam_info_v);
}
} else {
std::vector<sensor_msgs::msg::CameraInfo> cam_info_v;
cam_info_v.resize(1);
if (mipi_calibration::GetInstance().getCamCalibrationIml_single(cam_info_v[0], nodePare_->camera_calibration_file_path_)) {
mipiCap_ptr_->setCamInfo(cam_info_v);
}
}

if (mipiCap_ptr_->init(cap_info_) != 0) {
RCLCPP_ERROR(rclcpp::get_logger(“mipi_cam”),
“[%s]->cap capture init failture.\r\n”, func);
return -5;
}

mipiCap_ptr_->getCapInfo(cap_info_);
nodePare_->image_width_ = cap_info_.width;
nodePare_->image_height_ = cap_info_.height;
nodePare_->video_device_name_ = cap_info_.sensor_type;
nodePare_->sub_stream_enable_ = cap_info_.sub_stream_enable_;
nodePare_->device_mode_ = cap_info_.device_mode_;

RCLCPP_WARN(rclcpp::get_logger(“mipi_cam”),
“[%s]->cap %s init success.\r\n”, func, cap_info_.sensor_type.c_str());
lsInit_ = true;
return 0;
}

board_config.xml

{

“version”: “3.0.0”,

“board_202”: {

"board_id": "202",

"camera_num": 3,

"cameras": \[

  {

    "mipi_host": 0

  },

  {

    "mipi_host": 2

  },

  {

    "mipi_host": 3

  }

\]

},

“board_301”: {

"board_id": "301",

"camera_num": 2,

"cameras": \[

  {

    "mipi_host": 0

  },

  {

    "mipi_host": 2

  }

\]

},

“board_302”: {

"board_id": "302",

"camera_num": 2,

"cameras": \[

  {

    "mipi_host": 0

  },

  {

    "mipi_host": 2

  }

\]

},

“board_501”: {

"board_id": "501",

"camera_num": 2,

"cameras": \[

  {

    "mipi_host": 0

  },

  {

    "mipi_host": 2

  }

\]

},

“board_502”: {

"board_id": "502",

"camera_num": 2,

"cameras": \[

  {

    "mipi_host": 0

  },

  {

    "mipi_host": 2

  }

\]

},

“board_503”: {

"board_id": "503",

"camera_num": 2,

"cameras": \[

  {

    "mipi_host": 0

  },

  {

    "mipi_host": 2

  }

\]

},

“board_504”: {

"board_id": "504",

"camera_num": 2,

"cameras": \[

  {

    "mipi_host": 0

  },

  {

    "mipi_host": 2

  }

\]

},

“board_505”: {

"board_id": "505",

"camera_num": 2,

"cameras": \[

  {

    "mipi_host": 0

  },

  {

    "mipi_host": 2

  }

\]

}

}

:bullseye: 找到标准答案了!

根据你提供的 board_config.xmlRDK X5 (board_302) 的双目摄像头配置明确是

"board_302": {
  "camera_num": 2,
  "cameras": [
    {"mipi_host": 0},   // 摄像头 0
    {"mipi_host": 2}    // 摄像头 1 ← 注意是 2,不是 1!
  ]
}

:white_check_mark: 最终正确配置

sp_open_camera_v2 参数

摄像头 pipe_id video_index 对应
cam0 (左) 0 0 mipi_host 0
cam1 (右) 0 2 mipi_host 2
// 正确调用示例
int handle0, handle1;

// cam0 - mipi_host 0
sp_open_camera_v2(vio_obj, 0, 0, 1, &params, &width, &height);

// cam1 - mipi_host 2 ← 关键:video_index=2,不是 1!
sp_open_camera_v2(vio_obj, 0, 2, 1, &params, &width, &height);

:wrench: vio2encoder 修改步骤

:one: 找到摄像头初始化代码

# 在 vio2encoder 源码中搜索
grep -r "sp_open_camera" /path/to/vio2encoder/

:two: 修改为双目配置

// 修改前(错误)
sp_open_camera_v2(obj, 0, 0, ...);  // cam0
sp_open_camera_v2(obj, 0, 1, ...);  // cam1 ← video_index=1 错误!

// 修改后(正确)
sp_open_camera_v2(obj, 0, 0, ...);  // cam0 → mipi_host 0
sp_open_camera_v2(obj, 0, 2, ...);  // cam1 → mipi_host 2

:three: 同时降低分辨率测试

// 先降分辨率验证稳定性
width[0] = 1280;
height[0] = 720;
fps = 20;  // 或 30

:clipboard: 关于 device_mode:=dual

这是 ROS2 hobot_mipi_cam的配置参数,用于:

  • 启用双目标定文件加载
  • 同步双摄像头时间戳
  • 配置双目联合处理

对于 vio2encoder 示例(非 ROS2)

  • 不需要设置 device_mode
  • 只需要正确配置 video_index 区分两个摄像头
  • 双目同步需要自己处理(如果需要)

:test_tube: 快速验证脚本

#!/usr/bin/env python3
from hobot_vio import libsrcampy as srcampy
import time

print("=== 根据 board_config.xml 测试 ===")

# cam0 - mipi_host 0
cam0 = srcampy.Camera()
ret0 = cam0.open_cam(0, 0, 20, 1280, 720)  # pipe_id=0, video_index=0
print(f"video_index=0 (mipi_host 0): ret={ret0}")
if ret0 == 0:
    for i in range(10):
        img = cam0.get_img(2, 1280, 720)
        print(f"  Frame {i}: {len(img) if img else 0} bytes")
        time.sleep(0.05)
    cam0.close_cam()

# cam1 - mipi_host 2
cam2 = srcampy.Camera()
ret2 = cam2.open_cam(0, 2, 20, 1280, 720)  # pipe_id=0, video_index=2
print(f"video_index=2 (mipi_host 2): ret={ret2}")
if ret2 == 0:
    for i in range(10):
        img = cam2.get_img(2, 1280, 720)
        print(f"  Frame {i}: {len(img) if img else 0} bytes")
        time.sleep(0.05)
    cam2.close_cam()

# 双目同时测试
print("\n=== 双目同时测试 (720p@20fps) ===")
cam0 = srcampy.Camera()
cam2 = srcampy.Camera()
ret0 = cam0.open_cam(0, 0, 20, 1280, 720)
ret2 = cam2.open_cam(0, 2, 20, 1280, 720)
print(f"Dual open: cam0={ret0}, cam2={ret2}")

if ret0 == 0 and ret2 == 0:
    drop_count = 0
    for i in range(100):
        img0 = cam0.get_img(2, 1280, 720)
        img2 = cam2.get_img(2, 1280, 720)
        if img0 and img2:
            print(f"Frame {i}: OK")
        else:
            print(f"Frame {i}: DROP! (img0={len(img0) if img0 else 0}, img2={len(img2) if img2 else 0})")
            drop_count += 1
        time.sleep(0.05)
    
    print(f"\n总丢帧数:{drop_count}/100")
    cam0.close_cam()
    cam2.close_cam()

:bar_chart: 预期结果对比

配置 video_index 预期结果
错误配置 0, 1 cam1 打不开或严重丢帧
正确配置 0, 2 双目正常,720p@20fps 稳定
带宽上限测试 0, 2 + 1080p@30fps 可能仍有丢帧(需调低参数)

:bullseye: 执行顺序

# 1. 运行 Python 测试脚本
python3 test_dual_cam.py

# 2. 如果 video_index=0/2 测试通过,修改 vio2encoder 源码

# 3. 降低分辨率编译测试
# width=1280, height=720, fps=20

# 4. 稳定后再逐步提高参数

:red_question_mark: 反馈

运行测试后告诉我:

  1. video_index=0video_index=2 单独测试是否都正常?
  2. 双目同时运行 720p@20fps 丢帧数是多少?
  3. 修改 vio2encoder 后错误码 -268435443 是否消失?

如果 video_index=2 打不开,可能需要检查 SDK 版本或重新配置设备树。

我这cam0和cam1都能打开,cam0也会有丢帧