0%

Ubuntu20.04如何安装CUDA

  1. 安装显卡驱动
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#更新系统,安装必须用到的工具
exxk@exxk:~$ sudo apt update && sudo apt upgrade -y
exxk@exxk:~$ sudo apt install -y curl wget gnupg lsb-release
#添加 NVIDIA 驱动的 PPA
exxk@exxk:~$ sudo add-apt-repository ppa:graphics-drivers/ppa
exxk@exxk:~$ sudo apt update
#检测可用驱动: 它会列出所有设备(如显卡)和相应的推荐驱动。如果知道安装什么去驱动了,可以不用安装
exxk@exxk:~$ sudo apt install -y ubuntu-drivers-common
exxk@exxk:~$ ubuntu-drivers devices
ERROR:root:could not open aplay -l
Traceback (most recent call last):
File "/usr/share/ubuntu-drivers-common/detect/sl-modem.py", line 35, in detect
aplay = subprocess.Popen(
File "/usr/lib/python3.8/subprocess.py", line 858, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "/usr/lib/python3.8/subprocess.py", line 1704, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'aplay' #系统试图使用aplay来检测音频设备,但该工具未安装,可以忽略该错误
== /sys/devices/pci0000:00/0000:00:10.0 ==
modalias : pci:v000010DEd000025E2sv000017AAsd0000382Dbc03sc00i00
vendor : NVIDIA Corporation
driver : nvidia-driver-470 - distro non-free
driver : nvidia-driver-535-server - distro non-free
driver : nvidia-driver-535 - distro non-free
driver : nvidia-driver-550-open - third-party non-free
driver : nvidia-driver-535-open - distro non-free
driver : nvidia-driver-550 - third-party non-free
driver : nvidia-driver-560 - third-party non-free recommended #推荐的驱动
driver : nvidia-driver-535-server-open - distro non-free
driver : nvidia-driver-545-open - third-party non-free
driver : nvidia-driver-470-server - distro non-free
driver : nvidia-driver-555-open - third-party non-free
driver : nvidia-driver-545 - third-party non-free
driver : nvidia-driver-555 - third-party non-free
driver : nvidia-driver-560-open - third-party non-free
driver : xserver-xorg-video-nouveau - distro free builtin
exxk@exxk:~$ sudo apt install -y nvidia-driver-560
exxk@exxk:~$ sudo reboot
exxk@exxk:~$ nvidia-smi
Tue Nov 19 07:27:03 2024
+-----------------------------------------------------------------------------------------+
| NVIDIA-SMI 560.35.03 Driver Version: 560.35.03 CUDA Version: 12.6 |
|-----------------------------------------+------------------------+----------------------+
| GPU Name Persistence-M | Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap | Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|=========================================+========================+======================|
| 0 NVIDIA GeForce RTX 3050 ... Off | 00000000:00:10.0 Off | N/A |
| N/A 45C P8 3W / 60W | 15MiB / 4096MiB | 0% Default |
| | | N/A |
+-----------------------------------------+------------------------+----------------------+

+-----------------------------------------------------------------------------------------+
| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
|=========================================================================================|
| 0 N/A N/A 933 G /usr/lib/xorg/Xorg 4MiB |
+-----------------------------------------------------------------------------------------+
  1. 安装docker(可以在安装系统时勾选上docker,这一步就可以省略,建议不要省略,安装系统勾选安装的docker 版本较低)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#安装 Docker 仓库密钥和工具
exxk@exxk:~$ sudo apt install -y apt-transport-https ca-certificates curl software-properties-common
exxk@exxk:~$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
#添加 Docker 仓库
exxk@exxk:~$ echo "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
exxk@exxk:~$ sudo apt update
#安装 Docker
exxk@exxk:~$ sudo apt install -y docker-ce docker-ce-cli containerd.io
#将当前用户添加到 Docker 组
exxk@exxk:~$ sudo usermod -aG docker $USER
exxk@exxk:~$ sudo reboot
#查看docker版本,如果没有添加当前用户到docker组,需要加sudo
exxk@exxk:~$ docker version
Client: Docker Engine - Community
Version: 27.3.1
API version: 1.47
Go version: go1.22.7
Git commit: ce12230
Built: Fri Sep 20 11:41:03 2024
OS/Arch: linux/amd64
Context: default

Server: Docker Engine - Community
Engine:
Version: 27.3.1
API version: 1.47 (minimum version 1.24)
Go version: go1.22.7
Git commit: 41ca978
Built: Fri Sep 20 11:41:03 2024
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.7.23
GitCommit: 57f17b0a6295a39009d861b89e3b3b87b005ca27
runc:
Version: 1.1.14
GitCommit: v1.1.14-0-g2c9f560
docker-init:
Version: 0.19.0
GitCommit: de40ad0
  1. 安装 NVIDIA Container Toolkit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# 配置生产存储库:
exxk@exxk:~$ curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg \
&& curl -s -L https://nvidia.github.io/libnvidia-container/stable/deb/nvidia-container-toolkit.list | \
sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' | \
sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list
#(可选)配置存储库以使用实验性软件包:
exxk@exxk:~$ sudo sed -i -e '/experimental/ s/^#//g' /etc/apt/sources.list.d/nvidia-container-toolkit.list
#从存储库更新包列表:
exxk@exxk:~$ sudo apt-get update
#安装 NVIDIA Container Toolkit 软件包:
exxk@exxk:~$ sudo apt-get install -y nvidia-container-toolkit
#配置并重启 Docker
exxk@exxk:~$ sudo nvidia-ctk runtime configure --runtime=docker
exxk@exxk:~$ sudo systemctl restart docker
#运行一个简单的容器测试 GPU 是否可用
exxk@exxk:~$ docker run --rm --gpus all nvidia/cuda:11.8.0-base-ubuntu20.04 nvidia-smi
Tue Nov 19 07:58:08 2024
+-----------------------------------------------------------------------------------------+
| NVIDIA-SMI 560.35.03 Driver Version: 560.35.03 CUDA Version: 12.6 |
|-----------------------------------------+------------------------+----------------------+
| GPU Name Persistence-M | Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap | Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|=========================================+========================+======================|
| 0 NVIDIA GeForce RTX 3050 ... Off | 00000000:00:10.0 Off | N/A |
| N/A 39C P8 3W / 60W | 15MiB / 4096MiB | 0% Default |
| | | N/A |
+-----------------------------------------+------------------------+----------------------+

+-----------------------------------------------------------------------------------------+
| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
|=========================================================================================|
+-----------------------------------------------------------------------------------------+

PVE简介

安装

环境准备

安装步骤

  1. 复制安装包proxmox-ve_8.2-2.iso到启动盘。

  2. 启动电脑(Legion Y7000P IAH7)时按F2,调整U盘为第一启动,如果没有U盘,可以换一个U盘制作,有的U盘会不识别。

  3. 进入ventoy引导界面,依次点击proxmox-ve_8.2-2.iso->Boot in normal node,如果该模式没有进入下一个界面,可以换一个启动模式。

  4. 进入proxmox安装界面,点击Install Proxmox VE (Graphical)进行界面安装,Terminal是终端安装模式。

  5. 一直点击下一步即可,注意下面几个选项

    • country选择China

    • 如果电脑有多个硬盘,注意选择要安装的硬盘

    • 密码需要自己设置一个

    • 网络配置主要选择有线网卡

      Hostname:pve.iexxk.io

      IP Address(CIDR):分配一个未使用的ip,后面24默认不用改,我设置的是172.16.80.244/24

      Gateway:路由器的网关,一般为分配ip后面一位改为xx.xx.xx.1,我设置的是172.16.80.1

      DNS Server: 该网络能访问的一个dns服务器,我设置的是8.8.8.8

  6. 我的因为是笔记本电脑,安装完成后,显示的是命令行界面,可以直接在电脑上输入root及密码就能进入系统,该系统就相当于是个linux

  7. 正式使用,在其他电脑访问https://172.16.80.244:8006/,输入root及密码就能进入管理平台了

  8. 额外配置,针对笔记本,ssh 进172.16.80.244,用户名和密码同管理平台,执行下面命令

    1
    2
    3
    4
    5
    6
    #设置合上盖子不休眠
    sed -i '/^#*HandleLidSwitch/s/^#*//;s/\bHandleLidSwitch=\w*/HandleLidSwitch=ignore/' /etc/systemd/logind.conf
    #设置合上盖子并外接显示器,不挂起(节能)
    sed -i '/^#*HandleLidSwitchExternalPower/s/^#*//;s/\bHandleLidSwitchExternalPower=\w*/HandleLidSwitchExternalPower=ignore/' /etc/systemd/logind.conf
    #重启服务,生效上面的配置
    systemctl restart systemd-logind

平台使用

介绍

登录进去可以看到,资源使用情况,什么都还没安装的情况:

CPU:显示20个,使用0%

内存:1.35 GiB的15.41 GiB,使用9%

存储:2.42 GiB的442.75 GiB,使用1%

服务器视图下菜单目录介绍

1
2
3
4
5
|--数据中心
|--pve #表示一个节点,因为只安装了一台,这里取的是Hostname里面域名的前面部分
|--localnetwork(pve) #网络管理
|--local(pve) #存储VZDump备份文件, ISO镜像, 容器模板等
|--local-lvm(pve) #磁盘映像, 容器

基础使用

  • 配置IOS镜像:点击数据中心->pve->local->ISO镜像,在ISO镜像页面,点击上传从URL下载,将镜像放进PVE。

    • Centos7 atomic镜像URL地址 CentOS-Atomic-Host-7-Installer.iso,CentOS Atomic 是一个专为执行 Docker 容器而设的轻量操作系统,它创建自标准的 CentOS 7 组件,并追随 Red Hat 企业级 Linux Atomic 主机的组件版本。

    • win10 ISO – Enterprise LTSC镜像地址:LTSC 版本去掉了许多不必要的功能(例如 Microsoft Store、Cortana、动态磁贴等),非常适合追求性能的用户,系统本身对内存的占用较低。(window安装时注意看提示,按任何键加载CD磁盘)

    • Ubuntu20.04镜像地址:Server install image服务器安装映像允许您在计算机上永久安装 Ubuntu 以用作服务器。它不会安装图形用户界面。

  • 显卡直通:VM->硬件->添加->PCI设备->原始设备->选择RTX3050->添加

    如果是添加到win10的,windows更新界面更新即可使用显卡了。

    进入PVE->Shell(废弃,以下shell命令都废弃,现在直接在界面上面配置就可以了,配置之后,Kernel driver in use自动就变成了vfio-pci)

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    #-----------------1. 修改-------------------------------------------------
    root@pve:~# nano /etc/default/grub
    #GRUB_CMDLINE_LINUX_DEFAULT="quiet" #注释该配置
    GRUB_CMDLINE_LINUX_DEFAULT="quiet intel_iommu=on" #新增该配置
    #按^O Write Out(写入保存)和^X Exit(退出nano)
    #-----------------2. 检查显卡被谁在用,以及设备地址---------------------------
    root@pve:~# lspci -nnk | grep -i nvidia -A 2
    01:00.0 VGA compatible controller [0300]: NVIDIA Corporation GA107BM [GeForce RTX 3050 Mobile] [10de:25e2] (rev a1)
    Subsystem: Lenovo GA107BM [GeForce RTX 3050 Mobile] [17aa:382d]
    Kernel driver in use: nouveau
    Kernel modules: nvidiafb, nouveau
    01:00.1 Audio device [0403]: NVIDIA Corporation Device [10de:2291] (rev a1)
    Kernel driver in use: snd_hda_intel
    Kernel modules: snd_hda_intel
    #-----------------3. 添加需要直通的设备地址-----------------------------------
    root@pve:~# nano /etc/modprobe.d/vfio.conf
    #设置优先级
    softdep nouveau pre: vfio-pci
    softdep snd_hda_intel pre: vfio-pci
    #绑定直通地址
    options vfio-pci ids=10de:25e2,10de:2291
    #-----------------4. 更新initramfs-----------------------------------------
    root@pve:~# update-initramfs -u
    #-----------------5. 重启--------------------------------------------------
    root@pve:~# reboot
    #-----------------6. 检查显卡被谁在使用,Kernel driver in use-----------------
    root@pve:~# lspci -nnk | grep -i nvidia -A 2
    01:00.0 VGA compatible controller [0300]: NVIDIA Corporation GA107BM [GeForce RTX 3050 Mobile] [10de:25e2] (rev a1)
    Subsystem: Lenovo GA107BM [GeForce RTX 3050 Mobile] [17aa:382d]
    Kernel driver in use: vfio-pci
    Kernel modules: nvidiafb, nouveau
    01:00.1 Audio device [0403]: NVIDIA Corporation Device [10de:2291] (rev a1)
    Kernel driver in use: vfio-pci
    Kernel modules: snd_hda_intel

SRS简介

SRS是一个开源的(MIT协议)简单高效的实时视频服务器,支持RTMP、WebRTC、HLS、HTTP-FLV、SRT、MPEG-DASH和GB28181等协议。 SRS媒体服务器和FFmpegOBSVLCWebRTC等客户端配合使用,提供流的接收和分发的能力,是一个典型的发布 (推流)和订阅(播放)服务器模型。 SRS支持互联网广泛应用的音视频协议转换,比如可以将RTMPSRT, 转成HLSHTTP-FLVWebRTC等协议。

k8s安装

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
相关设置:
Container Image: ossrs/srs:5
Command/Args:
命令: ./objs/srs -c conf/flv/rtmp2rtc.conf #配置见文尾
# 命令: ./objs/srs -c conf/flv/realtime.flv.conf //废弃,由上面的配置替换
Environments:
CANDIDATE: iexxk.com #替换成域名,这样能同时兼容内外网,内网做个host映射可以直接走内网
TZ: Asia/Shanghai
Container Ports(Host端口): 1935 默认推流端口,地面站那边修改不了,导致只能用host进行映射暴露
数据卷:
配置目录: /usr/local/srs/conf/flv
数据目录:/usr/local/srs/srs_dvr_data
NodePort端口映射:
1935 #默认推流端口
# 18080 // realtime.flv.conf配置才需要
8080 #web、安卓拉流
1985 #ios拉流(webrtc)
30353 #udp端口,webrtc拉流需要

nginx代理

1
2
3
4
5
6
7
8
9
10
11
# ossrs代理地址
upstream ossrs_server {
server ossrs:8080;
}
location /view-live/ {
rewrite ^/view-live/(.*) /$1 break;
proxy_pass http://ossrs_server;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}

流程

虚拟ip处需要映射

Web: 外网ip80/443绑定节点的ingress的80/443

Ossrs: 外网ip1935绑定k8s里面的ossrs服务的Container Ports(Host端口)1935或者nodeport,不采用nodeport是因为要内网外网都要能访问ossrs,关键是内网对外网域名做了隔离,因此这里用本机的hosts映射(可以升级到dns下发)

graph LR
G[OBS推流]-->C
C[域名] -->|解析| A[移动光猫]
A -->|LAN| B(飞塔防火墙)
B -->|虚拟ip| E[K8S的Ingress]
E -->|域名匹配| F[前端web/nginx]
F -->|nginx代理|U[ossrs]
C-->|hosts映射节点ip|E

V[VLC]-->|web flv拉流|U
K[IOS]-->|ios webrtc拉流|U

测试

  1. 安装obs,用srs在线的测试工具也可以。

  2. 来源->加号->浏览器->url里面输入要直播的网址https://www.baidu.com/s?word=在线时间

  3. 控制按钮->设置->直播->

    服务:自定义

    服务器:rtmp://iexxk.com/drone/

    推码流:1

  4. 点击开始直播

播放:

内网测试(ok):

内网域名测试(ok):

外网测试:

webrtc和WHEP区别

WHEP:可以代理,但是也无法将一个域名根据环境解析为内网ip和外网ip,内网和外网是通过dns解析的,只能解析一个。在rtc里面启用保留域名,也无法解决,candidate里面会出现2个域名一个ip,优先还是走的ip

1
2
3
4
5
6
7
8
rtc_server {
enabled on;
listen 30353; # UDP port
# @see https://ossrs.net/lts/zh-cn/docs/v4/doc/webrtc#config-candidate
candidate $CANDIDATE;
# 启用保留域名
keep_api_domain on;
}

webrtc:直接连接,延迟更低,必须开放1985,无法修改

使用webrtc时,需要在web前端(nginx)做个代理,并要将该端口映射到外网1985上

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# ossrs webrtc代理地址
upstream ossrs_webrtc {
server ossrs:1985;
}
server {
listen 1985 ssl;
server_name iexxk.com;

ssl_certificate /etc/nginx/cert/iexxk.com.pem;
ssl_certificate_key /etc/nginx/cert/iexxk.com.key;

location /rtc/v1/play/ {
proxy_pass http://ossrs_webrtc;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}

常见问题

  1. 在内网无法访问外网域名的时候,虽然通过host映射到内网,但是webrtc播放的时候还是解析成了外网ip

    使用webrtc播放时可以在浏览器控制台能看到如下信息

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    Got answer:  v=0
    o=SRS/5.0.213(Bee) 140129754604224 2 IN IP4 0.0.0.0
    s=SRSPlaySession
    t=0 0
    a=ice-lite
    a=group:BUNDLE 0 1
    a=msid-semantic: WMS drone/1
    m=audio 9 UDP/TLS/RTP/SAVPF 111
    c=IN IP4 0.0.0.0
    a=ice-ufrag:881501t3
    a=ice-pwd:d11em20o3z9k02c97228yq5937ptj776
    a=fingerprint:sha-256 35:65:58:9A:E6:78:8F:D5:E6:F1:8F:E5:74:AD:A4:1E:3A:DF:B4:CE:21:3C:C9:CB:4A:9D:25:7A:87:53:FB:47
    a=setup:passive
    a=mid:0
    a=extmap:3 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01
    a=sendonly
    a=rtcp-mux
    a=rtcp-rsize
    a=rtpmap:111 opus/48000/2
    a=rtcp-fb:111 transport-cc
    a=ssrc:10186 cname:2yaj11875760968e
    a=ssrc:10186 label:audio-803h25y4
    a=candidate:0 1 udp 2130706431 172.16.10.44 30353 typ host generation 0
    a=candidate:1 1 udp 2130706431 iexxk.com 30353 typ host generation 0
    m=video 9 UDP/TLS/RTP/SAVPF 106
    c=IN IP4 0.0.0.0
    a=ice-ufrag:881501t3
    a=ice-pwd:d11em20o3z9k02c97228yq5937ptj776
    a=fingerprint:sha-256 35:65:58:9A:E6:78:8F:D5:E6:F1:8F:E5:74:AD:A4:1E:3A:DF:B4:CE:21:3C:C9:CB:4A:9D:25:7A:87:53:FB:47
    a=setup:passive
    a=mid:1
    a=extmap:3 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01
    a=sendonly
    a=rtcp-mux
    a=rtcp-rsize
    a=rtpmap:106 H264/90000
    a=rtcp-fb:106 transport-cc
    a=rtcp-fb:106 nack
    a=rtcp-fb:106 nack pli
    a=fmtp:106 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42e01f
    a=ssrc:10187 cname:2yaj11875760968e
    a=ssrc:10187 label:video-29515r30
    a=candidate:0 1 udp 2130706431 172.16.10.44 30353 typ host generation 0
    a=candidate:1 1 udp 2130706431 iexxk.com 30353 typ host generation 0

    注意最后两行

    1
    2
    3
    4
    5
    6
    7
    8
    9
    使用内网ip的时候,输出如下信息
    a=candidate:0 1 udp 2130706431 172.16.10.102 30353 typ host generation 0
    a=candidate:1 1 udp 2130706431 iexxk.com 30353 typ host generation 0
    使用内网域名的时候,输出如下信息,内网做了dns解析,假域名能解析到内网主机
    a=candidate:0 1 udp 2130706431 172.16.10.44 30353 typ host generation 0
    a=candidate:1 1 udp 2130706431 iexxk.com 30353 typ host generation 0
    使用外网域名的时候,输出如下信息,17.176.159.182这个域名刚好在内网无法访问,因此内网无法播放外网地址
    a=candidate:0 1 udp 2130706431 17.176.159.182 30353 typ host generation 0
    a=candidate:1 1 udp 2130706431 exxk.com 30353 typ host generation 0

    真域名做了host映射,但是似乎不会从host拿,应该是从dns里面拿取了

    从下图可以知道,是通过1985的接口,拿到了udp的端口数据。

配置

rtmp2rtc.conf

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
listen              1935;
max_connections 1000;
daemon off;
srs_log_tank console;

http_server {
enabled on;
listen 8080;
dir ./objs/nginx/html;
}

http_api {
enabled on;
listen 1985;
}
stats {
network 0;
}
rtc_server {
enabled on;
listen 30353; # UDP port
# @see https://ossrs.net/lts/zh-cn/docs/v4/doc/webrtc#config-candidate
candidate $CANDIDATE;
}

vhost __defaultVhost__ {
rtc {
enabled on;
# @see https://ossrs.net/lts/zh-cn/docs/v4/doc/webrtc#rtmp-to-rtc
rtmp_to_rtc on;
# @see https://ossrs.net/lts/zh-cn/docs/v4/doc/webrtc#rtc-to-rtmp
rtc_to_rtmp on;
}
http_remux {
enabled on;
mount [vhost]/[app]/[stream].flv;
}

hls {
enabled on;
hls_path ./objs/nginx/html;
hls_fragment 10;
hls_window 20;
hls_wait_keyframe off;
}

tcp_nodelay on min_latency on;

play {
gop_cache off;
queue_length 10;
mw_latency 100;
}

publish {
mr off;
}

dvr {
enabled on;
dvr_apply all;
dvr_plan session;
dvr_path ./srs_dvr_data/[app]/[stream]/[2006]-[01]-[02]/[timestamp].[2006]-[01]-[02]_[15].[04].[05]_[999].mp4;
dvr_duration 30;
dvr_wait_keyframe on;
time_jitter full;
}

}

realtime.flv.conf

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
listen 1935;
max_connections 1000;
daemon off;
srs_log_tank console;
http_server {
enabled on;
listen 18080;
dir ./objs/nginx/html;
}
vhost __defaultVhost__ {
http_remux {
enabled on;
mount [vhost]/[app]/[stream].flv;
}

hls {
enabled on;
hls_path ./objs/nginx/html;
hls_fragment 10;
hls_window 20;
hls_wait_keyframe off;
}

tcp_nodelay on min_latency on;

play {
gop_cache off;
queue_length 10;
mw_latency 100;
}

publish {
mr off;
}

dvr {
enabled on;
dvr_apply all;
dvr_plan session;
dvr_path ./srs_dvr_data/[app]/[stream]/[2006]-[01]-[02]/[timestamp].[2006]-[01]-[02]_[15].[04].[05]_[999].mp4;
dvr_duration 30;
dvr_wait_keyframe on;
time_jitter full;
}
}

基础环境信息

飞塔防火墙版本:FortiGate-100F

kubernates版本: v1.26.4

k8s界面工具kuboard:v3.5.2.4

网络架构图:

graph LR
C[域名] -->|解析| A[移动光猫]
A -->|LAN| B(飞塔防火墙)
B -->|虚拟ip| E[K8S的Ingress]
E -->|域名匹配| F[应用路由]

飞塔防火墙配置步骤:

  1. 策略&对象->虚拟IP->新建

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    ---------------------新建配置1------------------------------
    虚拟IP/服务器: k8s_ingress_https
    接口: 移动出口2 (port1)
    映射自: 17.176.159.182(移动光猫的外网ip)
    映射的IP地址/范围: 172.16.10.44(k8s任意一个节点的ip)
    外部服务端口: TCP 443 (移动光猫外网端口,需要备案)
    映射到端口: 443 (ingress对应的端口)
    ----------------------新建配置2------------------------------
    虚拟IP/服务器: k8s_ingress_http
    接口: 移动出口2 (port1)
    映射自: 17.176.159.182(移动光猫的外网ip)
    映射的IP地址/范围: 172.16.10.44(k8s任意一个节点的ip)
    外部服务端口: TCP 80 (移动光猫外网端口,需要备案)
    映射到端口: 80 (ingress对应的端口)
  2. 配置https证书(可选-废弃,后面在k8s进行管理证书,这里管理比较麻烦)

    • 系统管理->证书->新建->证书->导入证书->证书->上传申请的免费证书

    • 安全配置文件->SSL/SSH检测->新建

    1
    2
    3
    名称: k8s_ingress_ssl
    启用SSL检测: 保护SSL服务器
    服务器证书:上一步上传的证书
  3. 策略&对象->虚拟IP->新建

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    名称: k8s_ingress
    流入接口: 移动出口2
    流出接口: lan
    源地址: all
    目标地址: k8s_ingress_https,k8s_ingress_http(上一步的两个虚拟ip)
    计划任务: always
    服务: ALL
    启用NAT: 关闭
    SSL检测: no-inspection(如果要配置证书,在这里进行关联k8s_ingress_ssl)
    策略过期:关闭

k8s-ingress配置

  1. 新建应用路由,配置成阿里云购买的域名,并在阿里云上面做域名解析,解析到k8s的ingress所在的节点ip端口上,开启https证书,上传申请的免费证书

endpoint代理k8s之外的服务,让其能在k8s内访问,或可以通过ingress进行访问。

待补充。

快速开始

1
2
3
4
5
6
7
8
9
#安装 ---废弃开始----直接可以在idea里面新建quarkus的项目
➜ ~ brew install quarkusio/tap/quarkus
#检查版本
➜ ~ quarkus --version
3.12.3
#更新版本
➜ ~ brew update
➜ ~ brew upgrade quarkus
#---废弃结束----直接可以在idea里面新建quarkus的项目

问题描述

  • 环境: ESXi 7.0+centos7虚拟机

在一次操作生产服务器时,发生了系统文件丢失,导致重启之后无法进入系统,但是重要哦的文件还在系统中,第一时间应该先对当前系统【创建快照】,创建快照之后就可以【查看vmdk文件】

解决方案一:导出vmdk文件进行打开(废弃)

  1. 首先需要导出vmdk文件,可以【开启ESXI服务器的ssh功能】,然后使用scp root@<ESXi_IP>:/vmfs/volumes/datastore_name/vm_name/disk.vmdk /local/path/拷贝出来,如果文件太大,可以【创建虚拟机】作为临时存放,内网相对快很多
  2. 打开vmdk文件,试了各种都不能打开,但是也许window系统下有工具能打开

解决方案二:创建虚拟机加载vmdk为第二硬盘

  1. 【创建虚拟机】,虚拟机需要自定义分区,主要修改卷组(VG)名称,修改卷组名称,主要是防止逻辑卷名称冲突

  2. 启动新的虚拟机,启动成功后,【添加硬盘】,硬盘文件选择需要打开的vmdk文件

  3. 进入虚拟机,执行下面命令

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    #检查激活状态
    #有冲突就不会激活
    [root@localhost ~]# lvscan
    inactive '/dev/centos/swap' [15.75 GiB] inherit
    inactive '/dev/centos/home' [1.93 TiB] inherit
    inactive '/dev/centos/root' [50.00 GiB] inherit
    ACTIVE '/dev/centos/swap' [2.00 GiB] inherit
    ACTIVE '/dev/centos/home' [346.99 GiB] inherit
    ACTIVE '/dev/centos/root' [50.00 GiB] inherit
    #没有冲突会自动激活
    [root@localhost ~]# lvscan
    ACTIVE '/dev/centos/swap' [15.75 GiB] inherit
    ACTIVE '/dev/centos/home' [1.93 TiB] inherit
    ACTIVE '/dev/centos/root' [50.00 GiB] inherit
    ACTIVE '/dev/os/swap' [2.00 GiB] inherit
    ACTIVE '/dev/os/home' [346.99 GiB] inherit
    ACTIVE '/dev/os/root' [50.00 GiB] inherit
    #(可选不建议)如果忘了修改卷组(VG)名称,home目录可以在虚拟机里面修改,其他目录不行
    umount /dev/centos/home #卸载
    lvrename /dev/centos/home /dev/centos/home_old #重命名
    mount /dev/centos/home_old /home
    #挂载需要打开的vmdk之后执行下面的,激活命令
    lvchange -ay /dev/centos/home
    #--可选不建议结束---------
    #挂载目录
    mount /dev/centos/home /mnt/home
    #然后就可以进行拷贝备份了

VMware ESXI常用基础操作

  • 创建快照:选择虚拟机,点击 Actions > Snapshot > Take Snapshot

  • 查看vmdk文件:在左侧菜单,点击Storage>Data_disk>对应的虚拟机服务

    1
    2
    3
    4
    #关键文件内容如下
    server.vmdk # 基础文件
    server-000001.vmdk #创建快照产生,从基础文件开始记录所有新的更改
    server-000002.vmdk #纪录新的改变
  • 开启ESXI服务器的ssh功能:在左侧菜单,点击Host>Manage>Services,里面开启ssh功能。开启后用户名和密码同网页登录esxi界面一样

  • 创建虚拟机:在左侧菜单,点击Virtual Machines>create,选择linux,centos7,在iso里面选择Storage里面的iso镜像,然后就是安装centos的步骤了。设置静态ip和ESXI服务器在同一网段中。

  • 添加硬盘:选择虚拟机,点击 edit > add hard disk 进行添加硬盘。

  • 合并快照磁盘:选择虚拟机,点击 Actions > Snapshot >Snapshot Manager> Consolidate

安装

elasticsearch安装

  1. docker.elastic.co仓库查找springboot对应的es版本,,eg:

    1
    2
    3
    4
    # springboot 2.7.18
    docker pull docker.elastic.co/elasticsearch/elasticsearch:7.17.22
    #如果上面的拉取太慢了,可以用下面的dockerhub的镜像
    docker pull elastic/elasticsearch:7.17.22
  2. 创建配置文件,执行vim /workspace/elasticsearch.yml写入如下内容

    1
    2
    3
    4
    5
    6
    cluster.name: "docker-cluster"
    network.host: 0.0.0.0
    http.port: 9200
    http.cors.enabled: true
    http.cors.allow-origin: "*"
    xpack.security.enabled: false
  3. 安装elasticsearch7.17,执行

    1
    2
    3
    4
    5
    6
    7
    mkdir /workspace/v_es_data/
    chmod -R 777 /workspace/v_es_data/
    # -m限制使用内存1g
    docker run -d -m 1g -p 9200:9200 -e "discovery.type=single-node" --name es \
    -v /workspace/v_es_data:/usr/share/elasticsearch/data \
    -v /workspace/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml \
    docker.elastic.co/elasticsearch/elasticsearch:7.17.22
  4. 测试,执行下面命令

    1
    2
    3
    ➜  ~ curl -X GET "127.0.0.1:9200/_cat/nodes?v=true&pretty"
    ip heap.percent ram.percent cpu load_1m load_5m load_15m node.role master name
    172.18.0.2 35 84 5 0.06 0.09 0.13 cdfhilmrstw * eeeedfa1ed88

kibana安装(没采用)

可视化查看工具,类似dbeaver,非必需

  1. 执行下面命令进行安装

    1
    2
    3
    docker run -d --name kibana -p 5601:5601 \
    -e "ELASTICSEARCH_HOSTS=http://127.0.0.1:9200" \
    docker.elastic.co/kibana/kibana:7.17.22
  2. 访问http://localhost:5601/

  3. 然后进行各种操作,比较复杂

本地采用es-client插件

数据同步方案

应用层同步

在应用层面进行数据同步,即在应用代码中同时写入 MySQL 和 Elasticsearch。

优点:依赖少,自定义同步逻辑。

缺点:数据一致性和可靠性方面存在一些挑战,特别是在高并发的场景下。

MySQL binlog(数据库日志)

借助于数据库日志(如 MySQL binlog)来捕获数据变化,并将其同步到 Elasticsearch。这种方法通常能够实时同步数据,并且不会对数据库性能造成太大影响。

优点:实时同步数据,不会对数据库性能造成太大影响。

缺点:性能开销,binlog 会占用额外的磁盘空间。

Debezium(重量级别)

优点:功能强大,支持复杂的配置和扩展,社区活跃。

缺点:需要 Kafka,配置相对复杂。

Maxwell(轻量级别)

Maxwell是一种开源的MySQL数据库同步工具,它可以将MySQL数据库的binlog转化为JSON格式,并将其发送到消息队列中。

需要mq和kafka等中间件

优点:轻量级,配置简单,适合快速实现。

缺点:功能相对简单,不支持复杂的场景

canal

Canal是阿里巴巴开发的一款数据库同步工具,它可以实现MySQL数据库的binlog解析和日志抓取。模拟mysql的从节点实现。

springboot接入ES

  1. 在pom.xml添加依赖

    1
    2
    3
    4
    <dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-data-elasticsearch</artifactId>
    </dependency>

maxwell

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
version: '3.8'

services:
mysql:
image: mysql:8.0
container_name: mysql
environment:
MYSQL_ROOT_PASSWORD: rootpassword
MYSQL_DATABASE: maxwell
MYSQL_USER: maxwell
MYSQL_PASSWORD: maxwellpassword
ports:
- "3306:3306"
command: --server-id=1 --log-bin=mysql-bin --binlog-format=row --binlog-row-image=full
volumes:
- mysql-data:/var/lib/mysql

maxwell:
image: zendesk/maxwell:1.33.0
container_name: maxwell
environment:
- MAXWELL_MYSQL_HOST=mysql
- MAXWELL_MYSQL_USER=maxwell
- MAXWELL_MYSQL_PASSWORD=maxwellpassword
- MAXWELL_MYSQL_DATABASE=maxwell
- MAXWELL_PRODUCER=es
- MAXWELL_OUTPUT_DDL=true
- MAXWELL_ES_HOST=http://119.91.96.139:9200
depends_on:
- mysql

volumes:
mysql-data:

参考

4种数据同步到Elasticsearch方案

centos7如何安装CUDA

  1. 查看显卡型号lspci | grep -i vga,提示-bash: lspci: 未找到命令,执行yum install pciutils安装lspci命令

    1
    2
    [root@exxk ~]# lspci | grep -i vga
    01:00.0 VGA compatible controller: NVIDIA Corporation Device 25e2 (rev a1)
  2. 在输出结果中获取25e2关键字,在https://admin.pci-ids.ucw.cz/read/PC/10de/连接尾部拼接25e2,例如https://admin.pci-ids.ucw.cz/read/PC/10de/25e2,访问即可,页面回展示类似内容

    1
    2
    3
    Main -> PCI Devices -> Vendor 10de -> Device 10de:25e2

    Name: GA107BM [GeForce RTX 3050 Mobile]

    从中可以知道25e2对应的显卡是GeForce RTX 3050 Mobile

  3. 在该https://www.nvidia.cn/Download/index.aspx?lang=cn网页找到`GeForce RTX 3050 Mobile=GeForce RTX 3050 Laptop GPU该驱动,选择Linux64-bit然后下载下来 NVIDIA-Linux-x86_64-550.78.run `

  4. 拷贝到centos7上面,执行下面命令进行安装驱动

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    #屏蔽系统自带的nouveau显卡驱动(重启后生效---begin-----------
    [root@exxk ~]# lsmod | grep nouveau
    nouveau 2543616 0
    drm_ttm_helper 12288 1 nouveau
    ttm 90112 2 drm_ttm_helper,nouveau
    i2c_algo_bit 12288 1 nouveau
    mxm_wmi 12288 1 nouveau
    drm_display_helper 176128 1 nouveau
    drm_kms_helper 225280 4 drm_display_helper,nouveau
    drm 643072 6 drm_kms_helper,drm_display_helper,drm_ttm_helper,ttm,nouveau
    video 69632 2 ideapad_laptop,nouveau
    wmi 36864 5 video,wmi_bmof,ideapad_laptop,mxm_wmi,nouveau
    [root@exxk ~]# vi /lib/modprobe.d/dist-blacklist.conf
    #将nvidiafb注释掉:
    #blacklist nvidiafb
    #然后添加以下语句:
    #blacklist nouveau
    #options nouveau modeset=0
    [root@exxk ~]# mv /boot/initramfs-$(uname -r).img /boot/initramfs-$(uname -r).img.bak
    [root@exxk ~]# dracut /boot/initramfs-$(uname -r).img $(uname -r)
    [root@exxk ~]# reboot
    [root@exxk ~]# lsmod | grep nouveau
    #重启之后发现lsmod | grep nouveau命令无任何输出代表成功
    #屏蔽系统自带的nouveau显卡驱动(重启后生效---end-----------

    #安装依赖环境------------begin--------------------------
    #安装kernel-devel kernel-headers gcc
    [root@exxk ~]# yum install kernel-devel gcc -y
    [root@exxk ~]# uname -r
    3.10.0-1160.118.1.el7.x86_64
    [root@exxk ~]# yum info kernel-devel kernel-headers | grep 发布
    发布 :1160.118.1.el7
    发布 :1160.118.1.el7
    #内核版本要和安装的版本一致
    #如果不一致,检查内核是否需要升级
    [root@exxk ~]# yum check-update kernel
    #查看可用内核
    [root@exxk ~]# cat /boot/grub2/grub.cfg |grep menuentry
    #升级到和安装工具一致的内核版本
    [root@exxk ~]# grub2-set-default 'CentOS Linux (3.10.0-1160.118.1.el7.x86_64) 7 (Core)'
    [root@exxk ~]# reboot
    #安装依赖环境------------end--------------------------

    #安装显卡驱动,一致点同意即可
    [root@exxk ~]# ./NVIDIA-Linux-x86_64-550.78.run
    #查看驱动信息
    [root@exxk ~]# nvidia-smi
    Sat May 11 14:43:05 2024
    +-----------------------------------------------------------------------------------------+
    | NVIDIA-SMI 550.78 Driver Version: 550.78 CUDA Version: 12.4 |
    |-----------------------------------------+------------------------+----------------------+
    | GPU Name Persistence-M | Bus-Id Disp.A | Volatile Uncorr. ECC |
    | Fan Temp Perf Pwr:Usage/Cap | Memory-Usage | GPU-Util Compute M. |
    | | | MIG M. |
    |=========================================+========================+======================|
    | 0 NVIDIA GeForce RTX 3050 ... Off | 00000000:01:00.0 Off | N/A |
    | N/A 47C P0 10W / 60W | 1MiB / 4096MiB | 0% Default |
    | | | N/A |
    +-----------------------------------------+------------------------+----------------------+

    +-----------------------------------------------------------------------------------------+
    | Processes: |
    | GPU GI CI PID Type Process name GPU Memory |
    | ID ID Usage |
    |=========================================================================================|
    | No running processes found |
    +-----------------------------------------------------------------------------------------+
  5. 安装NVIDIA Container Toolkit,执行下面的命令(确保您已安装适用于您的 Linux 发行版的NVIDIA 驱动程序 请注意,您不需要在主机系统上安装 CUDA Toolkit,但需要安装 NVIDIA 驱动程序)

    1
    2
    3
    4
    [root@exxk ~]# curl -s -L https://nvidia.github.io/libnvidia-container/stable/rpm/nvidia-container-toolkit.repo | sudo tee /etc/yum.repos.d/nvidia-container-toolkit.repo
    [root@exxk ~]# yum-config-manager --enable nvidia-container-toolkit-experimental
    yum install -y nvidia-container-toolkit
    [root@exxk ~]# yum install -y nvidia-container-toolkit
  6. 配置containerd(针对Kubernetes),执行下面命令

    1
    2
    3
    4
    5
    [root@exxk ~]# nvidia-ctk runtime configure --runtime=containerd
    INFO[0000] Loading config from /etc/containerd/config.toml
    INFO[0000] Wrote updated config to /etc/containerd/config.toml
    INFO[0000] It is recommended that containerd daemon be restarted.
    [root@exxk ~]# systemctl restart containerd
  7. 安装 PaddlePaddle 镜像

    1
    nvidia-docker pull registry.baidubce.com/paddlepaddle/paddle:2.6.1-gpu-cuda12.0-cudnn8.9-trt8.6

新版cuda安装(废弃采用容器安装)

  1. 安装cuda 12.4.1最新版(飞浆需要12.0的版本,因此将下面的替换成12.0.1)

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    wget https://developer.download.nvidia.com/compute/cuda/12.4.1/local_installers/cuda_12.4.1_550.54.15_linux.run
    sh cuda_12.4.1_550.54.15_linux.run
    ┌──────────────────────────────────────────────────────────────────────────────┐
    │ CUDA Installer │
    │ - [ ] Driver │
    │ [ ] 550.54.15 │
    │ + [X] CUDA Toolkit 12.4 │
    │ [X] CUDA Demo Suite 12.4 │
    │ [X] CUDA Documentation 12.4 │
    │ - [ ] Kernel Objects │
    │ [ ] nvidia-fs │
    │ Options │
    │ Install │
    │ │
    │ Up/Down: Move | Left/Right: Expand | 'Enter': Select | 'A': Advanced options │
    └──────────────────────────────────────────────────────────────────────────────┘
    ===========
    = Summary =
    ===========

    Driver: Not Selected
    Toolkit: Installed in /usr/local/cuda-12.4/

    Please make sure that
    - PATH includes /usr/local/cuda-12.4/bin
    - LD_LIBRARY_PATH includes /usr/local/cuda-12.4/lib64, or, add /usr/local/cuda-12.4/lib64 to /etc/ld.so.conf and run ldconfig as root

    To uninstall the CUDA Toolkit, run cuda-uninstaller in /usr/local/cuda-12.4/bin
    ***WARNING: Incomplete installation! This installation did not install the CUDA Driver. A driver of version at least 550.00 is required for CUDA 12.4 functionality to work.
    To install the driver using this installer, run the following command, replacing <CudaInstaller> with the name of this run file:
    sudo <CudaInstaller>.run --silent --driver

    Logfile is /var/log/cuda-installer.log
  2. 添加环境变量,修改/etc/profile文件,执行vi /etc/profile,增加如下内容,然后执行source /etc/profile

    1
    2
    export PATH=${PATH}:/usr/local/cuda-12.4/bin
    export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/cuda-12.4/lib64
  3. 验证

    1
    2
    3
    4
    5
    6
    [root@exxk ~]# nvcc -V
    nvcc: NVIDIA (R) Cuda compiler driver
    Copyright (c) 2005-2024 NVIDIA Corporation
    Built on Thu_Mar_28_02:18:24_PDT_2024
    Cuda compilation tools, release 12.4, V12.4.131
    Build cuda_12.4.r12.4/compiler.34097967_0
  4. 卸载

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    [root@exxk ~]# cd /usr/local/cuda-12.4/bin
    [root@exxk bin]# ./cuda-uninstaller
    ┌──────────────────────────────────────────────────────────────────────────────┐
    │ CUDA Uninstaller │
    │ [X] CUDA_Toolkit_12.4 │
    │ [X] CUDA_Demo_Suite_12.4 │
    │ [X] CUDA_Documentation_12.4 │
    │ Done │
    │ │
    │ Up/Down: Move | 'Enter': Select │
    └──────────────────────────────────────────────────────────────────────────────┘
    Successfully uninstalled
    [root@exxk local]# cd /usr/local/
    [root@exxk local]# rm -rf cuda-12.4

旧版cuda废弃

  1. 下载 developer.nvidia.com页面按自己的环境选择,然后下载cuda。安装方式我选择的runfile(local),下载完成后上传到centos

  2. 执行sh cuda_7.5.18_linux.run,按ctrl+c跳过文档阅读

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    [root@exxk ~]# sh cuda_7.5.18_linux.run
    Logging to /tmp/cuda_install_22223.log
    Using more to view the EULA.
    End User License Agreement
    --------------------------
    --More--(0%)
    Do you accept the previously read EULA? (accept/decline/quit): accept
    # 非常关键,我们已经在之前安装了高版本的驱动,这个千万别装。
    Install NVIDIA Accelerated Graphics Driver for Linux-x86_64 352.39? ((y)es/(n)o/(q)uit): n
    Install the CUDA 7.5 Toolkit? ((y)es/(n)o/(q)uit): y
    Enter Toolkit Location [ default is /usr/local/cuda-7.5 ]:
    Do you want to install a symbolic link at /usr/local/cuda? ((y)es/(n)o/(q)uit): y
    Install the CUDA 7.5 Samples? ((y)es/(n)o/(q)uit): y
    Enter CUDA Samples Location [ default is /root ]:
    Installing the CUDA Toolkit in /usr/local/cuda-7.5 ...
    Missing recommended library: libGLU.so
    Missing recommended library: libX11.so
    Missing recommended library: libXi.so
    Missing recommended library: libXmu.so

    Installing the CUDA Samples in /root ...
    Copying samples to /root/NVIDIA_CUDA-7.5_Samples now...
    Finished copying samples.

    ===========
    = Summary =
    ===========

    Driver: Not Selected
    Toolkit: Installed in /usr/local/cuda-7.5
    Samples: Installed in /root, but missing recommended libraries

    Please make sure that
    - PATH includes /usr/local/cuda-7.5/bin
    - LD_LIBRARY_PATH includes /usr/local/cuda-7.5/lib64, or, add /usr/local/cuda-7.5/lib64 to /etc/ld.so.conf and run ldconfig as root

    To uninstall the CUDA Toolkit, run the uninstall script in /usr/local/cuda-7.5/bin
    To uninstall the NVIDIA Driver, run nvidia-uninstall

    Please see CUDA_Installation_Guide_Linux.pdf in /usr/local/cuda-7.5/doc/pdf for detailed information on setting up CUDA.

    ***WARNING: Incomplete installation! This installation did not install the CUDA Driver. A driver of version at least 352.00 is required for CUDA 7.5 functionality to work.
    To install the driver using this installer, run the following command, replacing <CudaInstaller> with the name of this run file:
    sudo <CudaInstaller>.run -silent -driver

    Logfile is /tmp/cuda_install_22223.log
    Signal caught, cleaning up
  3. 添加环境变量,修改/etc/profile文件,执行vi /etc/profile,增加如下内容,然后执行source /etc/profile

    1
    2
    export PATH=${PATH}:/usr/local/cuda/bin
    export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/cuda/lib64
  4. 验证环境

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    [root@exxk ~]# nvcc -V
    nvcc: NVIDIA (R) Cuda compiler driver
    Copyright (c) 2005-2015 NVIDIA Corporation
    Built on Tue_Aug_11_14:27:32_CDT_2015
    Cuda compilation tools, release 7.5, V7.5.17
    # 如果前面安装了CUDA的example,这里可以执行如下操作:
    [root@exxk ~]# cd /root/NVIDIA_CUDA-7.5_Samples/1_Utilities/deviceQuery
    [root@exxk deviceQuery]# yum install gcc gcc-c++
    [root@exxk deviceQuery]# make
    "/usr/local/cuda-7.5"/bin/nvcc -ccbin g++ -I../../common/inc -m64 -gencode arch=compute_20,code=sm_20 -gencode arch=compute_30,code=sm_30 -gencode arch=compute_35,code=sm_35 -gencode arch=compute_37,code=sm_37 -gencode arch=compute_50,code=sm_50 -gencode arch=compute_52,code=sm_52 -gencode arch=compute_52,code=compute_52 -o deviceQuery.o -c deviceQuery.cpp
    "/usr/local/cuda-7.5"/bin/nvcc -ccbin g++ -m64 -gencode arch=compute_20,code=sm_20 -gencode arch=compute_30,code=sm_30 -gencode arch=compute_35,code=sm_35 -gencode arch=compute_37,code=sm_37 -gencode arch=compute_50,code=sm_50 -gencode arch=compute_52,code=sm_52 -gencode arch=compute_52,code=compute_52 -o deviceQuery deviceQuery.o
    mkdir -p ../../bin/x86_64/linux/release
    cp deviceQuery ../../bin/x86_64/linux/release
    [root@exxk deviceQuery]# ./deviceQuery
    ./deviceQuery Starting...

    CUDA Device Query (Runtime API) version (CUDART static linking)

    Detected 1 CUDA Capable device(s)

    Device 0: "NVIDIA GeForce RTX 3050 Laptop GPU"
    CUDA Driver Version / Runtime Version 12.4 / 7.5
    CUDA Capability Major/Minor version number: 8.6
    Total amount of global memory: 3873 MBytes (4060872704 bytes)
    MapSMtoCores for SM 8.6 is undefined. Default to use 128 Cores/SM
    MapSMtoCores for SM 8.6 is undefined. Default to use 128 Cores/SM
    (16) Multiprocessors, (128) CUDA Cores/MP: 2048 CUDA Cores
    GPU Max Clock rate: 1500 MHz (1.50 GHz)
    Memory Clock rate: 6001 Mhz
    Memory Bus Width: 128-bit
    L2 Cache Size: 1572864 bytes
    Maximum Texture Dimension Size (x,y,z) 1D=(131072), 2D=(131072, 65536), 3D=(16384, 16384, 16384)
    Maximum Layered 1D Texture Size, (num) layers 1D=(32768), 2048 layers
    Maximum Layered 2D Texture Size, (num) layers 2D=(32768, 32768), 2048 layers
    Total amount of constant memory: 65536 bytes
    Total amount of shared memory per block: 49152 bytes
    Total number of registers available per block: 65536
    Warp size: 32
    Maximum number of threads per multiprocessor: 1536
    Maximum number of threads per block: 1024
    Max dimension size of a thread block (x,y,z): (1024, 1024, 64)
    Max dimension size of a grid size (x,y,z): (2147483647, 65535, 65535)
    Maximum memory pitch: 2147483647 bytes
    Texture alignment: 512 bytes
    Concurrent copy and kernel execution: Yes with 2 copy engine(s)
    Run time limit on kernels: No
    Integrated GPU sharing Host Memory: No
    Support host page-locked memory mapping: Yes
    Alignment requirement for Surfaces: Yes
    Device has ECC support: Disabled
    Device supports Unified Addressing (UVA): Yes
    Device PCI Domain ID / Bus ID / location ID: 0 / 1 / 0
    Compute Mode:
    < Default (multiple host threads can use ::cudaSetDevice() with device simultaneously) >

    deviceQuery, CUDA Driver = CUDART, CUDA Driver Version = 12.4, CUDA Runtime Version = 7.5, NumDevs = 1, Device0 = NVIDIA GeForce RTX 3050 Laptop GPU
    Result = PASS
  5. 卸载 /usr/local/cuda-7.5/bin/uninstall_cuda_7.5.pl

参考

linux服务器上查看显卡(nvidia)型号

Centos7.9安装Nvidia驱动

CentOS7安装NVIDIA显卡驱动

CentOS 7安装GPU、Cuda、Tensorflow

centos7 安装cuda toolkit

PaddleDetection是一个基于PaddlePaddle的目标检测端到端开发套件。

PP-Human 实时行人分析工具

PP-Human行人分析工具使用指南

安装使用步骤

  1. 在PyCharm欢迎页通过Get from VCS拉取github上PaddlePaddle/PaddleSeg项目。

  2. 拉取成功后,PyCharm会提示创建venv虚拟环境,点击确定即可,在PyCharm打开终端命令行前面有venv代表创建成功,如果没有,关闭终端点击Add new Interpreter(需要python3.10的环境),添加后,重新在PyCharm打开终端

    1
    2
    例如:
    (venv) ➜ PaddleSeg git:(release/2.9)
  3. 安装paddle,在PyCharm中Terminal命令行中执行pip install paddlepaddle

  4. 安装setuptools,在PyCharm中Terminal命令行中执行pip install -U pip setuptools

  5. 安装依赖,在PyCharm中Terminal命令行中执行 pip install -r requirements.txt

使用步骤

1
2
3
4
# 运行图片检测人,结果输出在output目录
python deploy/pipeline/pipeline.py --config deploy/pipeline/config/infer_cfg_pphuman.yml --image_file=demo/000000014439.jpg
# 运行视频流检测人
python deploy/pipeline/pipeline.py --config deploy/pipeline/config/examples/infer_cfg_human_attr.yml -o visual=False --rtsp rtsp://admin:123456@172.16.1.1:554/ch01.264?dev=1

检查人并输出视频

  1. 安装ffmpeg: brew install ffmpeg

  2. 下载安装rtsp推流服务bluenviron/mediamtx,在release页面选择适合的版本,我的是inter的mac,选择mediamtx_v1.8.1_darwin_amd64.tar.gz即可

  3. 解压,然后运行./mediamtx

  4. 运行视频流检测并推流python deploy/pipeline/pipeline.py --config deploy/pipeline/config/examples/infer_cfg_human_attr.yml --rtsp rtsp://admin:123456@172.1.1.1:554/ch01.264?dev=1 --pushurl rtsp://127.0.0.1:8554

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    python deploy/pipeline/pipeline.py --config deploy/pipeline/config/examples/infer_cfg_human_attr.yml --rtsp rtsp://admin:123456@172.16.80.59:554/ch01.264?dev=1 --pushurl rtsp://127.0.0.1:8554 
    ----------- Running Arguments -----------
    ATTR:
    batch_size: 8
    enable: true
    model_dir: https://bj.bcebos.com/v1/paddledet/models/pipeline/PPLCNet_x1_0_person_attribute_945_infer.zip
    DET:
    batch_size: 1
    model_dir: https://bj.bcebos.com/v1/paddledet/models/pipeline/pphuman/ppyoloe_plus_crn_t_auxhead_320_60e_pphuman.tar.gz
    MOT:
    batch_size: 1
    enable: true
    model_dir: https://bj.bcebos.com/v1/paddledet/models/pipeline/pphuman/ppyoloe_plus_crn_t_auxhead_320_60e_pphuman.tar.gz
    tracker_config: deploy/pipeline/config/tracker_config.yml
    attr_thresh: 0.5
    crop_thresh: 0.5
    visual: true
    warmup_frame: 50

    ------------------------------------------
    Multi-Object Tracking enabled
    Human Attribute Recognition enabled
    100%|██████████| 15897/15897 [00:05<00:00, 2768.11KB/s]
    DET model dir: /.cache/paddle/infer_weights/ppyoloe_plus_crn_t_auxhead_320_60e_pphuman
    MOT model dir: /.cache/paddle/infer_weights/ppyoloe_plus_crn_t_auxhead_320_60e_pphuman
    ATTR model dir: /.cache/paddle/infer_weights/PPLCNet_x1_0_person_attribute_945_infer
    ----------- Model Configuration -----------
    Model Arch: StrongBaseline
    Transform Order:
    --transform op: Resize
    --transform op: NormalizeImage
    --transform op: Permute
    --------------------------------------------
    ----------- Model Configuration -----------
    Model Arch: PPYOLOE
    Transform Order:
    --transform op: Resize
    --transform op: Permute
    --------------------------------------------
    video fps: 25, frame_count: -2562047788015215
    the result will push stream to url:rtsp://127.0.0.1:8554/ch01
    ffmpeg version 7.0 Copyright (c) 2000-2024 the FFmpeg developers
    built with Apple clang version 15.0.0 (clang-1500.1.0.2.5)
    configuration: --prefix=/usr/local/Cellar/ffmpeg/7.0_1 --enable-shared --enable-pthreads --enable-version3 --cc=clang --host-cflags= --host-ldflags='-Wl,-ld_classic' --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libaribb24 --enable-libbluray --enable-libdav1d --enable-libharfbuzz --enable-libjxl --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librist --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopenvino --enable-libspeex --enable-libsoxr --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack --enable-videotoolbox --enable-audiotoolbox
    libavutil 59. 8.100 / 59. 8.100
    libavcodec 61. 3.100 / 61. 3.100
    libavformat 61. 1.100 / 61. 1.100
    libavdevice 61. 1.100 / 61. 1.100
    libavfilter 10. 1.100 / 10. 1.100
    libswscale 8. 1.100 / 8. 1.100
    libswresample 5. 1.100 / 5. 1.100
    libpostproc 58. 1.100 / 58. 1.100
    Thread: 0; frame id: 0
    Thread: 0; trackid number: 2
    Input #0, rawvideo, from 'fd:':
    Duration: N/A, start: 0.000000, bitrate: 552960 kb/s
    Stream #0:0: Video: rawvideo (BGR[24] / 0x18524742), bgr24, 1280x720, 552960 kb/s, 25 tbr, 25 tbn
    Stream mapping:
    Stream #0:0 -> #0:0 (rawvideo (native) -> mpeg4 (native))
    Output #0, rtsp, to 'rtsp://127.0.0.1:8554/ch01':
    Metadata:
    encoder : Lavf61.1.100
    Stream #0:0: Video: mpeg4, yuv420p(progressive), 1280x720, q=2-31, 200 kb/s, 25 fps, 90k tbn
    Metadata:
    encoder : Lavc61.3.100 mpeg4
    Side data:
    cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: N/A
    Thread: 0; frame id: 10
    Thread: 0; trackid number: 2
  5. 然后使用vlc播放rtsp://127.0.0.1:8554/ch01流即可,流的地址在上一步日志里面可以看到the result will push stream to url:rtsp://127.0.0.1:8554/ch01

  6. 默认的模型,识别速度个人电脑会卡顿,可以替换为小模型,模型地址可以在PP-Human快速开始-模型下载里面进行找

    1
    2
    3
    4
    5
    修改该deploy/pipeline/config/examples/infer_cfg_human_attr.yml文件
    替换
    model_dir: https://bj.bcebos.com/v1/paddledet/models/pipeline/mot_ppyoloe_l_36e_pipeline.zip

    model_dir: https://bj.bcebos.com/v1/paddledet/models/pipeline/pphuman/ppyoloe_plus_crn_t_auxhead_320_60e_pphuman.tar.gz

常见错误

  1. 安装依赖,执行pip install -r requirements.txt时报AttributeError: module 'pkgutil' has no attribute 'ImpImporter'. Did you mean: 'zipimporter'?错误,详细信息如下:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    (.venv) ➜  PaddleDetection git:(release/2.7) pip install -r requirements.txt
    Collecting numpy<1.24 (from -r requirements.txt (line 1))
    Using cached numpy-1.23.5.tar.gz (10.7 MB)
    Installing build dependencies ... done
    Getting requirements to build wheel ... error
    error: subprocess-exited-with-error

    × Getting requirements to build wheel did not run successfully.
    │ exit code: 1
    ╰─> [33 lines of output]
    Traceback (most recent call last):
    File "workspace/PaddleDetection/.venv/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
    main()
    File "workspace/PaddleDetection/.venv/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
    json_out['return_val'] = hook(**hook_input['kwargs'])
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "workspace/PaddleDetection/.venv/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 112, in get_requires_for_build_wheel
    backend = _build_backend()
    ^^^^^^^^^^^^^^^^
    File "workspace/PaddleDetection/.venv/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 77, in _build_backend
    obj = import_module(mod_path)
    ^^^^^^^^^^^^^^^^^^^^^^^
    File "/usr/local/Cellar/python@3.12/3.12.2_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/importlib/__init__.py", line 90, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
    File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
    File "<frozen importlib._bootstrap>", line 1310, in _find_and_load_unlocked
    File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
    File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
    File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
    File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
    File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
    File "<frozen importlib._bootstrap_external>", line 995, in exec_module
    File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
    File "/private/var/folders/jd/0572r10n2rbcwn4tf1w6sy500000gn/T/pip-build-env-r6d8n8j4/overlay/lib/python3.12/site-packages/setuptools/__init__.py", line 16, in <module>
    import setuptools.version
    File "/private/var/folders/jd/0572r10n2rbcwn4tf1w6sy500000gn/T/pip-build-env-r6d8n8j4/overlay/lib/python3.12/site-packages/setuptools/version.py", line 1, in <module>
    import pkg_resources
    File "/private/var/folders/jd/0572r10n2rbcwn4tf1w6sy500000gn/T/pip-build-env-r6d8n8j4/overlay/lib/python3.12/site-packages/pkg_resources/__init__.py", line 2172, in <module>
    register_finder(pkgutil.ImpImporter, find_on_path)
    ^^^^^^^^^^^^^^^^^^^
    AttributeError: module 'pkgutil' has no attribute 'ImpImporter'. Did you mean: 'zipimporter'?
    [end of output]

    note: This error originates from a subprocess, and is likely not a problem with pip.
    error: subprocess-exited-with-error

    × Getting requirements to build wheel did not run successfully.
    │ exit code: 1
    ╰─> See above for output.

    note: This error originates from a subprocess, and is likely not a problem with pip.

    原因:在docs/tutorials/INSTALL_cn.md文档里面可以查看到只支持Python 3(3.5.1+/3.6/3.7/3.8/3.9/3.10),64位版本。

    解决:执行brew install python@3.10,然后在上面安装的第二个步骤里面,切换成3.10的python环境

  2. 出现提示安装pip install numba==0.56.4的警告,安装即可

  3. 运行视频流检测人时,报错

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    python deploy/pipeline/pipeline.py --config deploy/pipeline/config/examples/infer_cfg_human_attr.yml -o visual=False --rtsp rtsp://admin:123456@172.16.1.1:554/ch01.264?dev=1 
    Traceback (most recent call last):
    File "workspace/PaddleDetection/deploy/pipeline/pipeline.py", line 1321, in <module>
    main()
    File "workspace/PaddleDetection/deploy/pipeline/pipeline.py", line 1303, in main
    cfg = merge_cfg(FLAGS) # use command params to update config
    File "workspace/PaddleDetection/deploy/pipeline/cfg_utils.py", line 212, in merge_cfg
    pred_config = merge_opt(pred_config, args_dict)
    File "workspace/PaddleDetection/deploy/pipeline/cfg_utils.py", line 202, in merge_opt
    for sub_k, sub_v in value.items():
    AttributeError: 'bool' object has no attribute 'items'

    Process finished with exit code 1

    解决:删除命令里面的-o visual=False,似乎是该参数有问题

  4. 运行视频流检测加推流的时候,报错

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    python deploy/pipeline/pipeline.py --config deploy/pipeline/config/examples/infer_cfg_human_attr.yml --rtsp rtsp://admin:hcy123456@172.16.80.229:554/ch01.264?dev=1 --pushurl rtsp://127.0.0.1:8554 
    ----------- Running Arguments -----------
    ATTR:
    batch_size: 8
    enable: true
    model_dir: https://bj.bcebos.com/v1/paddledet/models/pipeline/PPLCNet_x1_0_person_attribute_945_infer.zip
    DET:
    batch_size: 1
    model_dir: https://bj.bcebos.com/v1/paddledet/models/pipeline/mot_ppyoloe_l_36e_pipeline.zip
    MOT:
    batch_size: 1
    enable: true
    model_dir: https://bj.bcebos.com/v1/paddledet/models/pipeline/mot_ppyoloe_l_36e_pipeline.zip
    tracker_config: deploy/pipeline/config/tracker_config.yml
    attr_thresh: 0.5
    crop_thresh: 0.5
    visual: true
    warmup_frame: 50

    ------------------------------------------
    Multi-Object Tracking enabled
    Human Attribute Recognition enabled
    DET model dir: .cache/paddle/infer_weights/mot_ppyoloe_l_36e_pipeline
    MOT model dir: .cache/paddle/infer_weights/mot_ppyoloe_l_36e_pipeline
    ATTR model dir: .cache/paddle/infer_weights/PPLCNet_x1_0_person_attribute_945_infer
    ----------- Model Configuration -----------
    Model Arch: StrongBaseline
    Transform Order:
    --transform op: Resize
    --transform op: NormalizeImage
    --transform op: Permute
    --------------------------------------------
    ----------- Model Configuration -----------
    Model Arch: YOLO
    Transform Order:
    --transform op: Resize
    --transform op: Permute
    --------------------------------------------
    video fps: 25, frame_count: -2562047788015215
    the result will push stream to url:rtsp://127.0.0.1:8554/ch01
    Traceback (most recent call last):
    File "workspace/PaddleDetection/deploy/pipeline/pipeline.py", line 1321, in <module>
    main()
    File "workspace/PaddleDetection/deploy/pipeline/pipeline.py", line 1308, in main
    pipeline.run_multithreads()
    File "workspace/PaddleDetection/deploy/pipeline/pipeline.py", line 179, in run_multithreads
    self.predictor.run(self.input)
    File "workspace/PaddleDetection/deploy/pipeline/pipeline.py", line 533, in run
    self.predict_video(input, thread_idx=thread_idx)
    File "workspace/PaddleDetection/deploy/pipeline/pipeline.py", line 670, in predict_video
    pushstream.initcmd(fps, width, height)
    File "workspace/PaddleDetection/deploy/pipeline/pipe_utils.py", line 142, in initcmd
    self.pipe = sp.Popen(self.command, stdin=sp.PIPE)
    File "/usr/local/Cellar/python@3.10/3.10.14/Frameworks/Python.framework/Versions/3.10/lib/python3.10/subprocess.py", line 971, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
    File "/usr/local/Cellar/python@3.10/3.10.14/Frameworks/Python.framework/Versions/3.10/lib/python3.10/subprocess.py", line 1863, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
    FileNotFoundError: [Errno 2] No such file or directory: 'ffmpeg'

    Process finished with exit code 1

    解决:安装ffmpeg,执行brew install ffmpeg