# ============================================================ # 通过海康 ISAPI 批量配置主码流/子码流 示例 # # 特点: # 1) 只需填写每台相机的 IP / 账号 / 密码 / 登录通道号, # 程序自动拼出 主码流(Channels/101) / 子码流(Channels/102) # RTSP URL,无需手写一长串 URL。 # 2) 启动时通过 ISAPI 读取每台相机编码参数(分辨率/码率/帧率), # 写入故障日志。 # 3) 可选:通过 [isapi_write] 把指定通道的分辨率/帧率/码率写回相机。 # # 注意:ISAPI 走 HTTP(默认80),RTSP 走 554;两者端口分开配。 # 运行: ./build/rtsp_multi_view -c channels_isapi.conf # ============================================================ [output] 1920 1080 letterbox = 1 ; 保持宽高比,黑边填充(0=拉伸铺满画面) grid_lines = 1 ; 画面之间画分隔线 # ------------------------------------------------------------ # [camera_list] 批量相机清单(自动生成主/子码流 URL) # 格式: [login_chan] [rtsp_port] [http_port] # id : 布局/流 里用的编号(0-7) # ip : 相机 IP 或域名 # user/pass : 相机登录账号密码 # login_chan : 海康登录通道号,默认 1(可留空) # rtsp_port : RTSP 端口,默认 554 # http_port : ISAPI HTTP 端口,默认 80 # # 生成规则(海康固定协议): # 子码流 = rtsp://user:pass@ip:rtsp_port/Streaming/Channels/{chan*100+2} # 主码流 = rtsp://user:pass@ip:rtsp_port/Streaming/Channels/{chan*100+1} # # 一旦配置了 [camera_list],它会**取代** [streams] 和 [main_streams]; # 未配置时仍按旧的 [streams]/[main_streams] 方式。 # ------------------------------------------------------------ [camera_list] 0 192.168.1.125 admin hd135792468 1 554 80 1 192.168.1.122 admin hd135792468 1 554 80 2 192.168.1.123 admin hd135792468 1 554 80 3 192.168.1.124 admin hd135792468 1 554 80 4 192.168.1.121 admin hd135792468 1 554 80 5 192.168.1.126 admin hd135792468 1 554 80 6 192.168.1.129 admin hd135792468 1 554 80 7 192.168.1.130 admin hd135792468 1 554 80 # ------------------------------------------------------------ # [isapi_write] 可选:启动时通过 ISAPI 把指定通道改成给定规格。 # 格式: # - 只改你填的字段;width/height 必填,fps/bitrate 填 0 表示不改 # - fps 用"帧率"(程序会自动 x100 换算为海康的 maxFrameRate) # - 危险:会真实修改相机!默认不启用,需要时去掉下面的注释。 # 示例(把相机0主码流改成 1280x720 @ 10fps 2048kbps): # 0 main 1280 720 10 2048 # ------------------------------------------------------------ [isapi_write] 0 sub 640 360 25 2048 1 sub 640 360 25 2048 2 sub 640 360 25 2048 3 sub 640 360 25 2048 4 sub 640 360 25 2048 5 sub 640 360 25 2048 6 sub 640 360 25 2048 7 sub 640 360 25 2048 # ------------------------------------------------------------ # Split 布局:上 5 + 下 1~3,自适应宽高居中 # split=1 启用 split 模式 # top_ratio 上行占画面高度比例(0.3 = 30%) # [layout_top] 上行摄像头 ID # [layout_bottom_N] 下行显示 N 个画面时的摄像头 ID # ------------------------------------------------------------ [layout] split = 1 top_ratio = 0.3 [layout_top] 0 1 2 3 4 [layout_bottom] 5 6 7 [layout_bottom_1] 5 [layout_bottom_2] 6 [layout_bottom_3] 7 [layout_bottom_4] 5 6 [layout_bottom_5] 5 6 7 [layout0] 0 0 0 0 3 0 0 0 0 4 0 0 0 0 5 0 0 0 0 6 0 0 0 0 7 [layout1] 1 1 1 1 3 1 1 1 1 4 1 1 1 1 5 1 1 1 1 6 1 1 1 1 7 [layout2] 2 2 2 2 3 2 2 2 2 4 2 2 2 2 5 2 2 2 2 6 2 2 2 2 7 [layout3] 1 1 2 2 3 1 1 2 2 4 1 1 2 2 5 x x x x 6 x x x x 7 [layout4] 0 0 1 1 3 0 0 1 1 4 2 2 x x 5 2 2 x x 6 x x x x 7 # ---------- 标题栏 ---------- [title] enable = 1 type = overlay height = 50 text = 法兰泰克 · 多路视频随动监控 logo = fltk.png logo_pad = 8 opacity = 200 font = /usr/share/fonts/truetype/wqy/wqy-microhei.ttc font_size = 24 color = 0xFFFFFF # ---------- 故障日志 ---------- [log] file = flog_isapi.txt rotate_ms = 3600000 max_bytes = 1048576 [plc] enable = 1 ip = 192.168.1.240 port = 102 area = db ; m | i | q | db db = 1000 read_start = 0 ; 轮询块的起始字节 read_len = 10 poll_ms = 100 reconnect_ms = 3000 debounce_ms = 300 ; 布局切换去抖:新布局需连续稳定这么多毫秒才切换(抑制 PLC 点位瞬时脉冲导致的画面闪烁,0=关闭) tsap_local = 0x0100 tsap_remote = 0x0101 # ---------- PLC 位 -> 布局切换规则 ---------- # Rule 0 -> layout 0 (bottom_1) # Rule 1 -> layout 1 (bottom_2) # Rule 2 -> layout 2 (bottom_3) # Rule 3 -> layout 3 (bottom_4) # Rule 4 -> layout 4 (bottom_5) # 一个也不满足 -> bottom [plc_rules] 0 : 6.6,6.7 1 : 8.4,8.5 2 : 8.6,8.7 3 : 6.6,6.7;8.4,8.5 4 : 6.6,8.4,8.5;8.6,8.7 # ---------- 自动重启(已实现,程序内生效) ---------- # enable : 0=禁用 1=启用;到点后自动 reboot 设备 # period : daily=每天 weekly=每周 # time : HH:MM 格式,24小时制;想凌晨重启一般设 03:00~05:00 # weekday : 仅 period=weekly 时有效,monday|tuesday|...|sunday [auto_reboot] enable = 1 period = daily time = 00:15 weekday = monday # ---------- Web 网卡配置 ---------- # ifaces : 允许在网页上查看/配置的网卡白名单(空格或逗号分隔) # 留空或删除本段 = 显示全部非回环网卡(eth0/eth1/wlan0/bond0 等) [web] ifaces = eth0