zlmediakit>zlmediakit_0">zlmediakit>zlmediakit安装
docker pull拉取镜像(最新)
docker pull zlmediakit>zlmediakit/zlmediakit>zlmediakit:master
然后先运行起来
sudo docker run -d -p 1935:1935 -p 80:80 -p 8554:554 -p 10000:10000 -p 10000:10000/udp -p 8000:8000/udp --name zlmediakit>zlmediakit zlmediakit>zlmediakit/zlmediakit>zlmediakit:master
拷贝配置文件到本地,方便之后修改配置文件
sudo docker cp -a zlmediakit>zlmediakit:/opt/media /home/zlmediakit>zlmediakit
删除docker服务
docker rm -f zlmediakit>zlmediakit
指定配置文件启动(后面需要修改配置文件)
sudo docker run --net=host -d -p 1935:1935 -p 80:80 -p 20080:20080 -p 554:554 -p 10000:10000 -p 10000:10000/udp -p 8000:8000/udp -p 30000-30500:30000-30500 -p 30000-30500:30000-30500/udp -v /home/zlmediakit>zlmediakit/media/bin:/opt/media/bin -v /home/zlmediakit>zlmediakit/media/conf:/opt/media/conf --name zlmediakit>zlmediakit --restart=always zlmediakit>zlmediakit/zlmediakit>zlmediakit:master
注意:这里使用的80端口作为后端访问端口以及web页面访问端口(http://192.168.0.38/webrtc/),如下:
启动成后访问:http://192.168.0.38:80/webrtc/
这里zlmediakit>zlmediakit服务就已经部署完成!但注意,zlmediakit>zlmediakit的config.ini配置文件需要修改。
zlmediakit>zlmediakit的config.ini文件参考:
; auto-generated by mINI class {[api]
apiDebug=1
defaultSnap=./www/logo.png
downloadRoot=./www
secret=ENM4A752UGNZ0CnscUpEnPhculcWUGJU
snapRoot=./www/snap/[cluster]
origin_url=
retry_count=3
timeout_sec=15[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
log=./ffmpeg/ffmpeg.log
restart_sec=0
snap=%s -i %s -y -f mjpeg -frames:v 1 -an %s[general]
broadcast_player_count_changed=0
check_nvidia_dev=1
enableVhost=0
enable_ffmpeg_log=0
flowThreshold=1024
listen_ip=::
maxStreamWaitMS=15000
mediaServerId=zlmediakit>zlmediakit-local
mergeWriteMS=0
resetWhenRePlay=1
streamNoneReaderDelayMS=20000
unready_frame_cache=100
wait_add_track_ms=3000
wait_audio_track_data_ms=1000
wait_track_ready_ms=10000[hls]
broadcastRecordTs=0
deleteDelaySec=10
fastRegister=0
fileBufSize=65536
segDelay=0
segDur=2
segKeep=0
segNum=3
segRetain=5[hook]
alive_interval=10.0
enable=0
on_flow_report=
on_http_access=
on_play=
on_publish=
on_record_mp4=
on_record_ts=
on_rtp_server_timeout=
on_rtsp_auth=
on_rtsp_realm=
on_send_rtp_stopped=
on_server_exited=
on_server_keepalive=
on_server_started=
on_shell_login=
on_stream_changed=
on_stream_none_reader=
on_stream_not_found=
retry=1
retry_delay=3.0
stream_changed_schemas=rtsp/rtmp/fmp4/ts/hls/hls.fmp4
timeoutSec=10[http]
allow_cross_domains=1
allow_ip_range=::1,127.0.0.1,172.16.0.0-172.31.255.255,192.168.0.0-192.168.255.255,10.0.0.0-10.255.255.255
charSet=utf-8
dirMenu=1
forbidCacheSuffix=
forwarded_ip_header=
keepAliveSecond=30
maxReqSize=40960
notFound=<html><head><title>404 Not Found</title></head><body bgcolor="white"><center><h1>您访问的资源不存在!</h1></center><hr><center>ZLMediaKit(git hash:8ccb4e9/2024-11-01T14:07:55+08:00,branch:master,build time:2024-11-01T06:09:19)</center></body></html>
port=80
rootPath=./www
sendBufSize=65536
sslport=443
virtualPath=[multicast]
addrMax=239.255.255.255
addrMin=239.0.0.0
udpTTL=64[protocol]
add_mute_audio=1
auto_close=0
continue_push_ms=15000
enable_audio=1
enable_fmp4=1
enable_hls=1
enable_hls_fmp4=0
enable_mp4=0
enable_rtmp=1
enable_rtsp=1
enable_ts=1
fmp4_demand=0
hls_demand=0
hls_save_path=./www
modify_stamp=2
mp4_as_player=0
mp4_max_second=3600
mp4_save_path=./www
paced_sender_ms=0
rtmp_demand=0
rtsp_demand=0
ts_demand=0[record]
appName=record
enableFmp4=0
fastStart=0
fileBufSize=65536
fileRepeat=0
sampleMS=500[rtc]
datachannel_echo=1
externIP=
maxRtpCacheMS=5000
maxRtpCacheSize=2048
max_bitrate=0
min_bitrate=0
nackIntervalRatio=1.0
nackMaxCount=15
nackMaxMS=3000
nackMaxSize=2048
nackRtpSize=8
port=8000
preferredCodecA=PCMA,PCMU,opus,mpeg4-generic
preferredCodecV=H264,H265,AV1,VP9,VP8
rembBitRate=0
start_bitrate=0
tcpPort=8000
timeoutSec=15[rtmp]
directProxy=1
enhanced=0
handshakeSecond=15
keepAliveSecond=15
port=1935
sslport=0[rtp]
audioMtuSize=600
h264_stap_a=1
lowLatency=0
rtpMaxSize=10
videoMtuSize=1400[rtp_proxy]
dumpDir=
gop_cache=1
h264_pt=98
h265_pt=99
opus_pt=100
port=10000
port_range=30000-35000
ps_pt=96
rtp_g711_dur_ms=100
timeoutSec=15
udp_recv_socket_buffer=4194304[rtsp]
authBasic=0
directProxy=1
handshakeSecond=15
keepAliveSecond=15
lowLatency=0
port=554
rtpTransportType=-1
sslport=0[shell]
maxReqSize=1024
port=0[srt]
latencyMul=4
pktBufSize=8192
port=9000
timeoutSec=5; } ---
这里有几点需要注意:
1.部署ZLM时,config文件中的secret不能是默认的,否则会报错
(如上:secret=ENM4A752UGNZ0CnscUpEnPhculcWUGJU)
2.ZLM的config文件所需要修改的参数如下:secret,mediaServerId,http-port(可不改)
(如上:mediaServerId=zlmediakit>zlmediakit-local,这里的zlmediakit>zlmediakit-local需要注意,在wvp服务中需要对应,否则无法点播成功)
3.启动wvp的时候,出现了启动成功但是连接zlm失败的情况,因为zlm是docker部署的,因此需要配置config文件中的allow_ip_range参数,将本机的ip地址配置进去,否则连不上
这里的192.168.0.0-192.168.255.255已经包含了我的本地ip所以不用添加,若未包含则需要添加本地IP
重点:在如上配置中[hook]配置不需要修改,因为在wvp首次连接zlm服务会自动注册当前连接的服务信息!!!