- A+
所属分类:Ubuntu
我的系统是ubuntu20.04
安装ZLM
ZLM-github地址: ZLM
git clone --depth 1 https://gitee.com/xia-chu/ZLMediaKit
cd ZLMediaKit
git submodule update --init
sudo apt-get install build-essential
sudo apt-get install cmake
sudo apt-get install build-essential
sudo apt-get install cmake
sudo apt-get install libssl-dev
sudo apt-get install libsdl-dev
sudo apt-get install libavcodec-dev
sudo apt-get install libavutil-dev
sudo apt-get install ffmpeg
sudo apt-get install openssl
sudo apt-get install libssl-dev
cd ZLMediaKit
mkdir build
cd build
cmake ..
make -j4
执行编译完成后. 目前不知道这样是否就成成功了,还是有什么问题.
文件路径: …/ZLMediaKit/conf/config.ini
#http服务器监听端口 第187行
port=1180
#rtsp服务器监听地址 第303行
port=5545
#服务器唯一id,用于触发hook时区别是哪台服务器 第66行
mediaServerId=95271314
文件路径 : …/ZLMediaKit/release/linux/Debug/config.ini
#http服务器监听端口 第187行
port=1180
#rtsp服务器监听地址 第303行
port=5545
#服务器唯一id,用于触发hook时区别是哪台服务器 第66行
mediaServerId=95271314
我疑惑的地方是不知道需要具体修改哪个文件,还是两个都需要改.
这是../ZLMediaKit/release/linux/Debug/config.ini 的配置 删除了所有注释
[api]
apiDebug=1
secret=035c73f7-bb6b-4889-a715-d9eb2d1925cc
snapRoot=./www/snap/
defaultSnap=./www/logo.png
[ffmpeg]
bin=/usr/bin/ffmpeg
cmd=%s -re -i %s -c:a aac -strict -2 -ar 44100 -ab 48k -c:v libx264 -f flv %s
snap=%s -i %s -y -f mjpeg -t 0.001 %s
log=./ffmpeg/ffmpeg.log
restart_sec=0
[general]
enableVhost=0
flowThreshold=1024
maxStreamWaitMS=15000
streamNoneReaderDelayMS=20000
addMuteAudio=1
resetWhenRePlay=1
publishToHls=1
publishToMP4=0
mergeWriteMS=0
modifyStamp=0
mediaServerId=95271314
enable_audio=1
hls_demand=0
rtsp_demand=0
rtmp_demand=0
ts_demand=0
fmp4_demand=0
wait_track_ready_ms=10000
wait_add_track_ms=3000
unready_frame_cache=100
continue_push_ms=15000
[hls]
fileBufSize=65536
filePath=./www
segDur=2
segNum=3
segRetain=5
broadcastRecordTs=0
deleteDelaySec=0
segKeep=0
[hook]
admin_params=secret=035c73f7-bb6b-4889-a715-d9eb2d1925cc
enable=0
on_flow_report=https://127.0.0.1/index/hook/on_flow_report
on_http_access=https://127.0.0.1/index/hook/on_http_access
on_play=https://127.0.0.1/index/hook/on_play
on_publish=https://127.0.0.1/index/hook/on_publish
on_record_mp4=https://127.0.0.1/index/hook/on_record_mp4
on_record_ts=https://127.0.0.1/index/hook/on_record_ts
on_rtsp_auth=https://127.0.0.1/index/hook/on_rtsp_auth
on_rtsp_realm=https://127.0.0.1/index/hook/on_rtsp_realm
on_shell_login=https://127.0.0.1/index/hook/on_shell_login
on_stream_changed=https://127.0.0.1/index/hook/on_stream_changed
on_stream_none_reader=https://127.0.0.1/index/hook/on_stream_none_reader
on_stream_not_found=https://127.0.0.1/index/hook/on_stream_not_found
on_server_started=https://127.0.0.1/index/hook/on_server_started
on_server_keepalive=https://127.0.0.1/index/hook/on_server_keepalive
timeoutSec=10
alive_interval=10.0
[cluster]
origin_url=
timeout_sec=15
retry_count=3
[http]
charSet=utf-8
keepAliveSecond=30
maxReqSize=40960
port=1180
rootPath=./www
sendBufSize=65536
sslport=443
dirMenu=1
virtualPath=
forbidCacheSuffix=
[multicast]
addrMax=239.255.255.255
addrMin=239.0.0.0
udpTTL=64
[record]
appName=record
fileBufSize=65536
filePath=./www
fileSecond=3600
sampleMS=500
fastStart=0
fileRepeat=0
[rtmp]
handshakeSecond=15
keepAliveSecond=15
modifyStamp=0
port=1935
sslport=0
[rtp]
audioMtuSize=600
videoMtuSize=1400
rtpMaxSize=10
[rtp_proxy]
dumpDir=
port=10000
timeoutSec=15
port_range=30000-35000
[rtc]
timeoutSec=15
externIP=
port=8000
rembBitRate=0
preferredCodecA=PCMU,PCMA,opus,mpeg4-generic
preferredCodecV=H264,H265,AV1X,VP9,VP8
[rtsp]
authBasic=0
directProxy=1
handshakeSecond=15
keepAliveSecond=15
port=5545
sslport=0
[shell]
maxReqSize=1024
port=0
cd ZLMediaKit/release/linux/Debug
./MediaServer -h
./MediaServer -d &
但是看到群友说使用 ./MediaServer
执行会好点,目前不知道为啥.
运行截图
安装WVP PRO
WVP PRO-github地址: WVP
apt-get install openjdk-11-jre git maven nodejs npm
若安装后因为版本问题,需要自行切换版本升级.
git clone https://gitee.com/pan648540858/wvp-GB28181-pro.git
cd wvp-GB28181-pro/web_src/
npm --registry=https://registry.npm.taobao.org install
npm run build
打包后提示的问题
npx browserslist@latest --update-db
执行后依旧没办法解决,所以忽略.
npm install -g http-server
cd wvp-GB28181-pro
mvn package
文件路径: …/wvp-GB28181-pro/src/main/resources/application-dev.yaml
修改后
spring:
# [可选]上传文件大小限制
servlet:
multipart:
max-file-size: 10MB
max-request-size: 100MB
# REDIS数据库配置
redis:
# [必须修改] Redis服务器IP, REDIS安装在本机的,使用127.0.0.1
host: 127.0.0.1
# [必须修改] 端口号
port: 6379
# [可选] 数据库 DB
database: 6
# [可选] 访问密码,若你的redis服务器没有设置密码,就不需要用密码去连接
password:
# [可选] 超时时间
timeout: 10000
# mysql数据源
datasource:
type: com.alibaba.druid.pool.DruidDataSource
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://127.0.0.1:3306/wvp3?useUnicode=true&characterEncoding=UTF8&rewriteBatchedStatements=true&serverTimezone=PRC&useSSL=false
username: root
password: 123456
druid:
initialSize: 10 # 连接池初始化连接数
maxActive: 200 # 连接池最大连接数
minIdle: 5 # 连接池最小空闲连接数
maxWait: 60000 # 获取连接时最大等待时间,单位毫秒。配置了maxWait之后,缺省启用公平锁,并发效率会有所下降,如果需要可以通过配置useUnfairLock属性为true使用非公平锁。
keepAlive: true # 连接池中的minIdle数量以内的连接,空闲时间超过minEvictableIdleTimeMillis,则会执行keepAlive操作。
validationQuery: select 1 # 检测连接是否有效sql,要求是查询语句,常用select 'x'。如果validationQuery为null,testOnBorrow、testOnReturn、testWhileIdle都不会起作用。
testWhileIdle: true # 建议配置为true,不影响性能,并且保证安全性。申请连接的时候检测,如果空闲时间大于timeBetweenEvictionRunsMillis,执行validationQuery检测连接是否有效。
testOnBorrow: false # 申请连接时执行validationQuery检测连接是否有效,做了这个配置会降低性能。
testOnReturn: false # 归还连接时执行validationQuery检测连接是否有效,做了这个配置会降低性能。
poolPreparedStatements: false # 是否開啟PSCache,並且指定每個連線上PSCache的大小
timeBetweenEvictionRunsMillis: 60000 # 配置間隔多久才進行一次檢測,檢測需要關閉的空閒連線,單位是毫秒
minEvictableIdleTimeMillis: 300000 # 配置一個連線在池中最小生存的時間,單位是毫秒
filters: stat,wall,slf4j # 配置监控统计拦截的filters,监控统计用的filter:sta, 日志用的filter:log4j, 防御sql注入的filter:wall
useGlobalDataSourceStat: true # 合并多个DruidDataSource的监控数据
# 通过connectProperties属性来打开mergeSql功能;慢SQL记录
connectionProperties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=1000
#stat-view-servlet.url-pattern: /admin/druid/*
#[可选] WVP监听的HTTP端口, 网页和接口调用都是这个端口
server:
port: 18080
# 作为28181服务器的配置
sip:
# [必须修改] 本机的IP
ip: 120.48.10.8
# [可选] 28181服务监听的端口
port: 5060
# 根据国标6.1.2中规定,domain宜采用ID统一编码的前十位编码。国标附录D中定义前8位为中心编码(由省级、市级、区级、基层编号组成,参照GB/T 2260-2007)
# 后两位为行业编码,定义参照附录D.3
# 3701020049标识山东济南历下区 信息行业接入
# [可选]
domain: 4401020049
# [可选]
id: 44010200492000000001
# [可选] 默认设备认证密码,后续扩展使用设备单独密码, 移除密码将不进行校验
password: admin123
#zlm 默认服务器配置
media:
id: 95271314
# [必须修改] zlm服务器的内网IP
ip: 120.48.10.8
# [必须修改] zlm服务器的http.port
http-port: 1180
# [可选] zlm服务器的hook.admin_params=secret
secret: 035c73f7-bb6b-4889-a715-d9eb2d1925cc
# 启用多端口模式, 多端口模式使用端口区分每路流,兼容性更好。 单端口使用流的ssrc区分, 点播超时建议使用多端口测试
rtp:
# [可选] 是否启用多端口模式, 开启后会在portRange范围内选择端口用于媒体流传输
enable: true
# [可选] 在此范围内选择端口用于媒体流传输, 必须提前在zlm上配置该属性,不然自动配置此属性可能不成功
port-range: 30000,30500 # 端口范围
# [可选] 国标级联在此范围内选择端口发送媒体流,
send-port-range: 30000,30500 # 端口范围
# 录像辅助服务, 部署此服务可以实现zlm录像的管理与下载, 0 表示不使用
record-assist-port: 18081
# [可选] 日志配置, 一般不需要改
logging:
config: classpath:logback-spring-local.xml
# 版本信息, 不需修改
version:
version: "@project.version@"
description: "@project.description@"
artifact-id: "@project.artifactId@"
文件路径: …/wvp-GB28181-pro/src/main/resources/all-application.yaml
修改后
# 此配置文件只是用作展示所有配置项, 不可直接使用
spring:
# [可选]上传文件大小限制
servlet:
multipart:
max-file-size: 10MB
max-request-size: 100MB
# REDIS数据库配置
redis:
# [必须修改] Redis服务器IP, REDIS安装在本机的,使用127.0.0.1
host: 127.0.0.1
# [必须修改] 端口号
port: 6379
# [可选] 数据库 DB
database: 6
# [可选] 访问密码,若你的redis服务器没有设置密码,就不需要用密码去连接
password:
# [可选] 超时时间
timeout: 10000
# [可选] 一个pool最多可分配多少个jedis实例
poolMaxTotal: 1000
# [可选] 一个pool最多有多少个状态为idle(空闲)的jedis实例
poolMaxIdle: 500
# [可选] 最大的等待时间(秒)
poolMaxWait: 5
# [必选] jdbc数据库配置
datasource:
type: com.alibaba.druid.pool.DruidDataSource
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://127.0.0.1:3306/wvp3?useUnicode=true&characterEncoding=UTF8&rewriteBatchedStatements=true&serverTimezone=PRC&useSSL=false
username: root
password: 123456
druid:
initialSize: 10 # 连接池初始化连接数
maxActive: 200 # 连接池最大连接数
minIdle: 5 # 连接池最小空闲连接数
maxWait: 60000 # 获取连接时最大等待时间,单位毫秒。配置了maxWait之后,缺省启用公平锁,并发效率会有所下降,如果需要可以通过配置useUnfairLock属性为true使用非公平锁。
keepAlive: true # 连接池中的minIdle数量以内的连接,空闲时间超过minEvictableIdleTimeMillis,则会执行keepAlive操作。
validationQuery: select 1 # 检测连接是否有效sql,要求是查询语句,常用select 'x'。如果validationQuery为null,testOnBorrow、testOnReturn、testWhileIdle都不会起作用。
testWhileIdle: true # 建议配置为true,不影响性能,并且保证安全性。申请连接的时候检测,如果空闲时间大于timeBetweenEvictionRunsMillis,执行validationQuery检测连接是否有效。
testOnBorrow: false # 申请连接时执行validationQuery检测连接是否有效,做了这个配置会降低性能。
testOnReturn: false # 归还连接时执行validationQuery检测连接是否有效,做了这个配置会降低性能。
poolPreparedStatements: false # 是否開啟PSCache,並且指定每個連線上PSCache的大小
timeBetweenEvictionRunsMillis: 60000 # 配置間隔多久才進行一次檢測,檢測需要關閉的空閒連線,單位是毫秒
minEvictableIdleTimeMillis: 300000 # 配置一個連線在池中最小生存的時間,單位是毫秒
filters: stat,wall,slf4j # 配置监控统计拦截的filters,监控统计用的filter:sta, 日志用的filter:log4j, 防御sql注入的filter:wall
useGlobalDataSourceStat: true # 合并多个DruidDataSource的监控数据
# 通过connectProperties属性来打开mergeSql功能;慢SQL记录
connectionProperties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=1000
#stat-view-servlet.url-pattern: /admin/druid/*
# druid管理监控页面的一些配置
rj-druid-manage:
allow: # 访问druid监控页面的IP白名单
deny: 192.168.1.100 # 访问druid监控页面IP黑名单
loginUsername: rjAdmin # 访问druid监控页面账号
loginPassword: rj@2022 # 访问druid监控页面密码
#mybatis:
# configuration:
# # 这个配置会将执行的sql打印出来,在开发或测试的时候可以用
# log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
# # 返回类型为Map,显示null对应的字段
# call-setters-on-nulls: true
## [可选] WVP监听的HTTP端口, 网页和接口调用都是这个端口
# [可选] WVP监听的HTTP端口, 网页和接口调用都是这个端口
server:
port: 18080
# [可选] HTTPS配置, 默认不开启
ssl:
# [可选] 是否开启HTTPS访问
enabled: false
# [可选] 证书文件路径,放置在resource/目录下即可,修改xxx为文件名
key-store: classpath:xxx.jks
# [可选] 证书密码
key-password: password
# [可选] 证书类型, 默认为jks,根据实际修改
key-store-type: JKS
# 作为28181服务器的配置
sip:
# [必须修改] 本机的IP, 必须是网卡上的IP,用于sip下协议栈监听ip,如果监听所有设置为0.0.0.0
monitor-ip: 120.48.10.8
# [必须修改] 本机的IP
ip: 120.48.10.8
# [可选] 28181服务监听的端口
port: 5060
# 根据国标6.1.2中规定,domain宜采用ID统一编码的前十位编码。国标附录D中定义前8位为中心编码(由省级、市级、区级、基层编号组成,参照GB/T 2260-2007)
# 后两位为行业编码,定义参照附录D.3
# 3701020049标识山东济南历下区 信息行业接入
# [可选]
domain: 4401020049
# [可选]
id: 44010200492000000001
# [可选] 默认设备认证密码,后续扩展使用设备单独密码, 移除密码将不进行校验
password: admin123
# [可选] 心跳超时时间, 建议设置为心跳周期的三倍
keepalive-timeout: 255
# [可选] 国标级联注册失败,再次发起注册的时间间隔。 默认60秒
register-time-interval: 60
# [可选] 云台控制速度
ptz-speed: 50
# TODO [可选] 收到心跳后自动上线, 重启服务后会将所有设备置为离线,默认false,等待注册后上线。设置为true则收到心跳设置为上线。
# keepalliveToOnline: false
# 是否存储alarm信息
alarm: false
#zlm 默认服务器配置
media:
# [必须修改] zlm服务器唯一id,用于触发hook时区别是哪台服务器,general.mediaServerId
id: 95271314
# [必须修改] zlm服务器的内网IP
ip: 120.48.10.8
# [可选] 返回流地址时的ip,置空使用 media.ip
stream-ip: 120.48.10.8
# [可选] wvp在国标信令中使用的ip,此ip为摄像机可以访问到的ip, 置空使用 media.ip
sdp-ip: 120.48.10.8
# [可选] zlm服务器的hook所使用的IP, 默认使用sip.ip
hook-ip:
# [必须修改] zlm服务器的http.port
http-port: 1180
# [可选] zlm服务器的http.sslport, 置空使用zlm配置文件配置
http-ssl-port:
# [可选] zlm服务器的rtmp.port, 置空使用zlm配置文件配置
rtmp-port:
# [可选] zlm服务器的rtmp.sslport, 置空使用zlm配置文件配置
rtmp-ssl-port:
# [可选] zlm服务器的 rtp_proxy.port, 置空使用zlm配置文件配置
rtp-proxy-port:
# [可选] zlm服务器的 rtsp.port, 置空使用zlm配置文件配置
rtsp-port:
# [可选] zlm服务器的 rtsp.sslport, 置空使用zlm配置文件配置
rtsp-ssl-port:
# [可选] 是否自动配置ZLM, 如果希望手动配置ZLM, 可以设为false, 不建议新接触的用户修改
auto-config: true
# [可选] zlm服务器的hook.admin_params=secret
secret: 035c73f7-bb6b-4889-a715-d9eb2d1925cc
# [可选] zlm服务器的general.streamNoneReaderDelayMS
stream-none-reader-delay-ms: 18000 # 无人观看多久自动关闭流, -1表示永不自动关闭,即 关闭按需拉流
# 启用多端口模式, 多端口模式使用端口区分每路流,兼容性更好。 单端口使用流的ssrc区分, 点播超时建议使用多端口测试
rtp:
# [可选] 是否启用多端口模式, 开启后会在portRange范围内选择端口用于媒体流传输
enable: true
# [可选] 在此范围内选择端口用于媒体流传输, 必须提前在zlm上配置该属性,不然自动配置此属性可能不成功
port-range: 30000,30500 # 端口范围
# [可选] 国标级联在此范围内选择端口发送媒体流,
send-port-range: 30000,30500 # 端口范围
# 录像辅助服务, 部署此服务可以实现zlm录像的管理与下载, 0 表示不使用
record-assist-port: 0
# [可选] 日志配置, 一般不需要改
logging:
config: classpath:logback-spring-local.xml
# [根据业务需求配置]
user-settings:
# [可选] 服务ID,不写则为000000
server-id:
# [可选] 自动点播, 使用固定流地址进行播放时,如果未点播则自动进行点播, 需要rtp.enable=true
auto-apply-play: false
# [可选] 部分设备需要扩展SDP,需要打开此设置
senior-sdp: false
# 保存移动位置历史轨迹:true:保留历史数据,false:仅保留最后的位置(默认)
save-position-history: false
# 点播等待超时时间,单位:毫秒
play-timeout: 3000
# 上级点播等待超时时间,单位:毫秒
platform-play-timeout: 60000
# 是否开启接口鉴权
interface-authentication: true
# 自动配置redis 可以过期事件
redis-config: true
# 接口鉴权例外的接口, 即不进行接口鉴权的接口,尽量详细书写,尽量不用/**,至少两级目录
interface-authentication-excludes:
- /api/v1/**
# 推流直播是否录制
record-push-live: true
# 国标是否录制
record-sip: true
# 是否将日志存储进数据库
logInDatebase: true
# 第三方匹配,用于从stream钟获取有效信息
thirdPartyGBIdReg: "[\\s\\S]*"
# 在线文档: swagger-ui(生产环境建议关闭)
swagger-ui:
enabled: true
# 版本信息, 不需修改
version:
version: "@project.version@"
description: "@project.description@"
artifact-id: "@project.artifactId@"
mv wvp-GB28181-pro/src/main/resources/application-dev.yml wvp-GB28181-pro/target/application.yml
cd wvp-GB28181-pro/target
java -jar wvp-pro-*.jar
运行截图
登录WVP web
但是我这个老是黑的.
好像可以了.