SafeFly Media Node 返回节点首页

ZLM 推流与播放简易教程

以下示例使用流标识 test001。先取得本节点的 publishKey,推流成功后再选择任意一种播放协议。

两个密钥用途不同: publishKey 用于推流鉴权;API Secret 只用于调用 ZLM 管理 API,不能拿来代替推流密钥。播放鉴权当前未启用。

1. 在服务器取得推流密钥

sudo bash /www/docker-compose/zlm/install.sh --status --show-secrets

也可以直接查看安装器生成的完整接入教程:

sudo cat /www/docker-compose/zlm/connection-guide.txt

完整密钥不要发到公开聊天、工单、网页或代码仓库。

2. 推流

FFmpeg

ffmpeg -re -i input.mp4 -c copy -f flv \
'rtmp://114.80.33.45:1937/live/test001?publishKey=替换为完整密钥'

OBS

OBS 字段填写内容
服务自定义
服务器rtmp://114.80.33.45:1937/live
串流密钥test001?publishKey=替换为完整密钥

WebRTC 推流信令

http://114.80.33.45:8181/index/api/webrtc?app=live&stream=test001&type=push&publishKey=替换为完整密钥

缺少密钥或密钥错误时,ZLM 会拒绝发布该流。

3. 播放

推流在线后使用以下任一地址。当前播放不需要 publishKey

协议播流地址
RTMPrtmp://114.80.33.45:1937/live/test001
HTTP-FLVhttp://114.80.33.45:8181/live/test001.live.flv
HLShttp://114.80.33.45:8181/live/test001/hls.m3u8
RTSPrtsp://114.80.33.45:554/live/test001
WebRTChttp://114.80.33.45:8181/index/api/webrtc?app=live&stream=test001&type=play

浏览器可打开 内置 WebRTC 测试页, 填写 app=livestream=test001 后播放。

4. 常见排查