h5网站模板开发,商洛市城乡建设规划局网站,上海有名的公司,免费seo在线工具1、拉取代码
#国内用户推荐从同步镜像网站gitee下载
git clone --depth 1 https://gitee.com/xia-chu/ZLMediaKit
cd ZLMediaKit
#千万不要忘记执行这句命令
git submodule update --init 2、安装编译器
sudo yum -y install gcc 3、安装cmake
sudo yum -y install cmake 4… 1、拉取代码
#国内用户推荐从同步镜像网站gitee下载
git clone --depth 1 https://gitee.com/xia-chu/ZLMediaKit
cd ZLMediaKit
#千万不要忘记执行这句命令
git submodule update --init 2、安装编译器
sudo yum -y install gcc 3、安装cmake
sudo yum -y install cmake 4、安装依赖可选已安装了可以不用安装
#除了openssl,其他其实都可以不安装
sudo yum -y install libssl-dev
sudo yum -y install libsdl-dev
sudo yum -y install libavcodec-dev
sudo yum -y install libavutil-dev
sudo yum -y install ffmpeg 5、构建和编译项目
cd ZLMediaKit
mkdir build
cd build
cmake ..
make -j4 6、运行项目 运行项目我写了一个脚本直接把脚本放到 ZLMediaKit/release/linux/Debug 这个目录下。然后停止启动都使用脚本即可。 脚本内容
#!/bin/bash# 定义 ZLMediaKit 可执行文件路径和日志文件路径
MEDIA_SERVER_PATH./MediaServer# 检查 ZLMediaKit 是否在运行
check_status() {PID$(ps -ef | grep MediaServer | grep -v grep | awk {print $2})if [ -z $PID ]; thenecho MediaServer is not running.return 1elseecho MediaServer is running with PID: $PIDreturn 0fi
}# 启动 ZLMediaKit
start_server() {check_statusif [ $? -eq 0 ]; thenecho MediaServer is already running.elsenohup $MEDIA_SERVER_PATH -d /dev/null 21 echo MediaServer started.fi
}# 停止 ZLMediaKit
stop_server() {check_statusif [ $? -eq 0 ]; thenkill $PIDecho Stopping MediaServer...sleep 1 # 等待进程停止check_statusif [ $? -eq 1 ]; thenecho MediaServer stopped successfully.elseecho Failed to stop MediaServer. Trying to force stop.kill -9 $PIDif [ $? -eq 0 ]; thenecho MediaServer forcefully stopped.elseecho Failed to force stop MediaServer.fifielseecho MediaServer is not running.fi
}# 重启 ZLMediaKit
restart_server() {stop_serverstart_server
}# 查看日志
view_log() {LATEST_LOG$(ls -t ./log/*.log | head -n 1)if [ -f $LATEST_LOG ]; thenecho Viewing latest log file: $LATEST_LOGtail -f $LATEST_LOGelseecho No log files found.fi
}# 脚本的入口根据参数选择操作
case $1 instart)start_server;;stop)stop_server;;restart)restart_server;;status)check_status;;log)view_log;;*)echo Usage: $0 {start|stop|restart|status|log}exit 1;;
esac 修改脚本可执行权限
chmod 777 ./run.sh 脚本的使用
./run.sh start启动/ restart重启/ status状态 / log日志 / stop停止 ZLM配置文件是在 ZLMediaKit/release/linux/Debug 这个目录下。文件名是 config.ini 下面这个文件是我的配置。
; auto-generated by mINI class {[api]
apiDebug1
defaultSnap./www/logo.png
downloadRoot./www
secretm0ZnheLlYJisLdTmPeoosFMPa46tAYSU
snapRoot./www/snap/[cluster]
origin_url
retry_count3
timeout_sec15[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_sec0
snap%s -rtsp_transport tcp -i %s -y -f mjpeg -frames:v 1 %s[general]
broadcast_player_count_changed0
check_nvidia_dev1
enableVhost0
enable_ffmpeg_log0
flowThreshold1024
listen_ip::
maxStreamWaitMS15000
mediaServerIdsuweijie_zlm
mergeWriteMS0
resetWhenRePlay1
streamNoneReaderDelayMS20000
unready_frame_cache100
wait_add_track_ms3000
wait_track_ready_ms10000[hls]
broadcastRecordTs0
deleteDelaySec10
fastRegister0
fileBufSize65536
segDelay0
segDur2
segKeep0
segNum3
segRetain5[hook]
alive_interval10.0
enable1
on_flow_report
on_http_access
on_playhttp://192.168.200.1:18080/index/hook/on_play
on_publishhttp://192.168.200.1:18080/index/hook/on_publish
on_record_mp4http://192.168.200.1:18080/index/hook/on_record_mp4
on_record_ts
on_rtp_server_timeouthttp://192.168.200.1:18080/index/hook/on_rtp_server_timeout
on_rtsp_auth
on_rtsp_realm
on_send_rtp_stoppedhttp://192.168.200.1:18080/index/hook/on_send_rtp_stopped
on_server_exited
on_server_keepalivehttp://192.168.200.1:18080/index/hook/on_server_keepalive
on_server_startedhttp://192.168.200.1:18080/index/hook/on_server_started
on_shell_login
on_stream_changedhttp://192.168.200.1:18080/index/hook/on_stream_changed
on_stream_none_readerhttp://192.168.200.1:18080/index/hook/on_stream_none_reader
on_stream_not_foundhttp://192.168.200.1:18080/index/hook/on_stream_not_found
retry1
retry_delay3.0
stream_changed_schemasrtsp/rtmp/fmp4/ts/hls/hls.fmp4
timeoutSec30[http]
allow_cross_domains1
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
charSetutf-8
dirMenu1
forbidCacheSuffix
forwarded_ip_header
keepAliveSecond30
maxReqSize40960
notFoundhtmlheadtitle404 Not Found/title/headbody bgcolorwhitecenterh1您访问的资源不存在/h1/centerhrcenterZLMediaKit(git hash:6889afb/2024-08-14T20:11:2408:00,branch:master,build time:2024-08-17T20:27:02)/center/body/html
port18081
rootPath./www
sendBufSize65536
sslport443
virtualPath[multicast]
addrMax239.255.255.255
addrMin239.0.0.0
udpTTL64[protocol]
add_mute_audio1
auto_close0
continue_push_ms3000
enable_audio1
enable_fmp41
enable_hls1
enable_hls_fmp40
enable_mp40
enable_rtmp1
enable_rtsp1
enable_ts1
fmp4_demand0
hls_demand0
hls_save_path./www
modify_stamp2
mp4_as_player0
mp4_max_second3600
mp4_save_path./www
paced_sender_ms0
rtmp_demand0
rtsp_demand0
ts_demand0[record]
appNamerecord
enableFmp40
fastStart0
fileBufSize65536
fileRepeat0
sampleMS500[rtc]
externIP
maxRtpCacheMS5000
maxRtpCacheSize2048
max_bitrate0
min_bitrate0
nackIntervalRatio1.0
nackMaxCount15
nackMaxMS3000
nackMaxSize2048
nackRtpSize8
port8000
preferredCodecAPCMA,PCMU,opus,mpeg4-generic
preferredCodecVH264,H265,AV1,VP9,VP8
rembBitRate0
start_bitrate0
tcpPort8000
timeoutSec15[rtmp]
directProxy1
enhanced0
handshakeSecond15
keepAliveSecond15
port1935
sslport0[rtp]
audioMtuSize600
h264_stap_a1
lowLatency0
rtpMaxSize10
videoMtuSize1400[rtp_proxy]
dumpDir
gop_cache1
h264_pt98
h265_pt99
opus_pt100
port10000
port_range30000-30500
ps_pt96
rtp_g711_dur_ms100
timeoutSec15
udp_recv_socket_buffer4194304[rtsp]
authBasic0
directProxy1
handshakeSecond15
keepAliveSecond15
lowLatency0
port554
rtpTransportType-1
sslport0[shell]
maxReqSize1024
port0[srt]
latencyMul4
pktBufSize8192
port9000
timeoutSec5; } --- 这些配置在 ZLMediaKit/conf/config.ini 有详细的说明 有几个比较重要的配置。
配置说明secret密钥WVP中配置需跟config.ini一致mediaServerId服务名WVP中配置需跟config.ini一致portZLM启动监听的http端口WVP中配置需跟config.ini一致port_rangertp的监听端口范围WVP中配置需跟config.ini一致 跟WVP搭配使用需要修改的就这个4个参数 以上就是搭建ZLMediaKit的完整步骤和配置说明。希望这篇文章能帮助到正在使用或计划使用ZLMediaKit的朋友们。如果有任何错误或遗漏欢迎指正和补充。 文章转载自: http://www.morning.ybgcn.cn.gov.cn.ybgcn.cn http://www.morning.cfrz.cn.gov.cn.cfrz.cn http://www.morning.fglyb.cn.gov.cn.fglyb.cn http://www.morning.snbrs.cn.gov.cn.snbrs.cn http://www.morning.kwksj.cn.gov.cn.kwksj.cn http://www.morning.qichetc.com.gov.cn.qichetc.com http://www.morning.wxgd.cn.gov.cn.wxgd.cn http://www.morning.lwsct.cn.gov.cn.lwsct.cn http://www.morning.ptmch.com.gov.cn.ptmch.com http://www.morning.zpfr.cn.gov.cn.zpfr.cn http://www.morning.lddpj.cn.gov.cn.lddpj.cn http://www.morning.qxkjy.cn.gov.cn.qxkjy.cn http://www.morning.cffwm.cn.gov.cn.cffwm.cn http://www.morning.gjcdr.cn.gov.cn.gjcdr.cn http://www.morning.jzlkq.cn.gov.cn.jzlkq.cn http://www.morning.cnbdn.cn.gov.cn.cnbdn.cn http://www.morning.wyfpc.cn.gov.cn.wyfpc.cn http://www.morning.zcfmb.cn.gov.cn.zcfmb.cn http://www.morning.srmpc.cn.gov.cn.srmpc.cn http://www.morning.qztsq.cn.gov.cn.qztsq.cn http://www.morning.ljdd.cn.gov.cn.ljdd.cn http://www.morning.nynyj.cn.gov.cn.nynyj.cn http://www.morning.rdnkx.cn.gov.cn.rdnkx.cn http://www.morning.bdwqy.cn.gov.cn.bdwqy.cn http://www.morning.mqfkd.cn.gov.cn.mqfkd.cn http://www.morning.fgkwh.cn.gov.cn.fgkwh.cn http://www.morning.hslgq.cn.gov.cn.hslgq.cn http://www.morning.ltqtp.cn.gov.cn.ltqtp.cn http://www.morning.kflpf.cn.gov.cn.kflpf.cn http://www.morning.lkcqz.cn.gov.cn.lkcqz.cn http://www.morning.ldpjm.cn.gov.cn.ldpjm.cn http://www.morning.mxftp.com.gov.cn.mxftp.com http://www.morning.schwr.cn.gov.cn.schwr.cn http://www.morning.tzzkm.cn.gov.cn.tzzkm.cn http://www.morning.pslzp.cn.gov.cn.pslzp.cn http://www.morning.znlhc.cn.gov.cn.znlhc.cn http://www.morning.ywpwq.cn.gov.cn.ywpwq.cn http://www.morning.gbfuy28.cn.gov.cn.gbfuy28.cn http://www.morning.pqcsx.cn.gov.cn.pqcsx.cn http://www.morning.lztrt.cn.gov.cn.lztrt.cn http://www.morning.thxfn.cn.gov.cn.thxfn.cn http://www.morning.dpflt.cn.gov.cn.dpflt.cn http://www.morning.gmplp.cn.gov.cn.gmplp.cn http://www.morning.hdrrk.cn.gov.cn.hdrrk.cn http://www.morning.mmjqk.cn.gov.cn.mmjqk.cn http://www.morning.wdhhz.cn.gov.cn.wdhhz.cn http://www.morning.owenzhi.com.gov.cn.owenzhi.com http://www.morning.gmwdl.cn.gov.cn.gmwdl.cn http://www.morning.srmpc.cn.gov.cn.srmpc.cn http://www.morning.hrrmb.cn.gov.cn.hrrmb.cn http://www.morning.gyfwy.cn.gov.cn.gyfwy.cn http://www.morning.dwhnb.cn.gov.cn.dwhnb.cn http://www.morning.wjxyg.cn.gov.cn.wjxyg.cn http://www.morning.bzfld.cn.gov.cn.bzfld.cn http://www.morning.nbybb.cn.gov.cn.nbybb.cn http://www.morning.rblqk.cn.gov.cn.rblqk.cn http://www.morning.xpzgg.cn.gov.cn.xpzgg.cn http://www.morning.psxxp.cn.gov.cn.psxxp.cn http://www.morning.fglth.cn.gov.cn.fglth.cn http://www.morning.ltdrz.cn.gov.cn.ltdrz.cn http://www.morning.cwgfq.cn.gov.cn.cwgfq.cn http://www.morning.znlhc.cn.gov.cn.znlhc.cn http://www.morning.xzqzd.cn.gov.cn.xzqzd.cn http://www.morning.rgpsq.cn.gov.cn.rgpsq.cn http://www.morning.fbbpj.cn.gov.cn.fbbpj.cn http://www.morning.kfmlf.cn.gov.cn.kfmlf.cn http://www.morning.mkzdp.cn.gov.cn.mkzdp.cn http://www.morning.qwfq.cn.gov.cn.qwfq.cn http://www.morning.shxmr.cn.gov.cn.shxmr.cn http://www.morning.ymmjx.cn.gov.cn.ymmjx.cn http://www.morning.dkqr.cn.gov.cn.dkqr.cn http://www.morning.jhswp.cn.gov.cn.jhswp.cn http://www.morning.xstfp.cn.gov.cn.xstfp.cn http://www.morning.ahscrl.com.gov.cn.ahscrl.com http://www.morning.wjfzp.cn.gov.cn.wjfzp.cn http://www.morning.tgqzp.cn.gov.cn.tgqzp.cn http://www.morning.wschl.cn.gov.cn.wschl.cn http://www.morning.jmnfh.cn.gov.cn.jmnfh.cn http://www.morning.zpfr.cn.gov.cn.zpfr.cn http://www.morning.wyjhq.cn.gov.cn.wyjhq.cn