mirror of
https://github.com/Monibuca/plugin-rtmp.git
synced 2025-10-05 23:47:04 +08:00
update readme
This commit is contained in:
92
README.md
92
README.md
@@ -1,63 +1,73 @@
|
|||||||
# RTMP插件
|
# RTMP插件
|
||||||
|
rtmp插件提供rtmp协议的推拉流能力,以及向远程服务器推拉rtmp协议的能力。
|
||||||
|
|
||||||
## 插件源码地址
|
## 仓库地址
|
||||||
|
|
||||||
github.com/Monibuca/plugin-rtmp
|
https://github.com/Monibuca/plugin-rtmp
|
||||||
|
|
||||||
## 插件引入
|
## 引入
|
||||||
```go
|
```go
|
||||||
import (
|
import _ "m7s.live/plugin/rtmp/v4"
|
||||||
_ "m7s.live/plugin/rtmp/v4"
|
|
||||||
)
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## 默认插件配置
|
## 推拉地址形式
|
||||||
|
|
||||||
```yaml
|
|
||||||
rtmp:
|
|
||||||
tcp:
|
|
||||||
# rtmp 监听端口
|
|
||||||
listenaddr: :1935
|
|
||||||
# rtmp 监听端口
|
|
||||||
listennum: 0
|
|
||||||
# 输出分块大小
|
|
||||||
chunksize: 4096
|
|
||||||
publish:
|
|
||||||
pubaudio: true
|
|
||||||
pubvideo: true
|
|
||||||
kickexist: false
|
|
||||||
publishtimeout: 10
|
|
||||||
waitclosetimeout: 0
|
|
||||||
subscribe:
|
|
||||||
subaudio: true
|
|
||||||
subvideo: true
|
|
||||||
iframeonly: false
|
|
||||||
waittimeout: 10
|
|
||||||
pull:
|
|
||||||
repull: 0
|
|
||||||
pullonstart: false
|
|
||||||
pullonsubscribe: false
|
|
||||||
pulllist: {}
|
|
||||||
push:
|
|
||||||
repush: 0
|
|
||||||
pushlist: {}
|
|
||||||
```
|
```
|
||||||
## 插件功能
|
rtmp://localhost/live/test
|
||||||
|
```
|
||||||
|
- `localhost`是m7s的服务器域名或者IP地址,默认端口`1935`可以不写,否则需要写
|
||||||
|
- `live`代表`appName`
|
||||||
|
- `test`代表`streamName`
|
||||||
|
- m7s中`live/test`将作为`streamPath`为流的唯一标识
|
||||||
|
|
||||||
### 接收RTMP协议的推流
|
|
||||||
|
|
||||||
例如通过ffmpeg向m7s进行推流
|
例如通过ffmpeg向m7s进行推流
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
ffmpeg -i **** -f flv rtmp://localhost/live/test
|
ffmpeg -i [视频源] -f flv rtmp://localhost/live/test
|
||||||
```
|
```
|
||||||
|
|
||||||
会在m7s内部形成一个名为live/test的流
|
会在m7s内部形成一个名为live/test的流
|
||||||
|
|
||||||
### 从m7s拉取rtmp协议流
|
|
||||||
如果m7s中已经存在live/test流的话就可以用rtmp协议进行播放
|
如果m7s中已经存在live/test流的话就可以用rtmp协议进行播放
|
||||||
```bash
|
```bash
|
||||||
ffplay -i rtmp://localhost/live/test
|
ffplay -i rtmp://localhost/live/test
|
||||||
```
|
```
|
||||||
|
|
||||||
### 从远端拉流到m7s
|
|
||||||
|
## 配置
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
rtmp:
|
||||||
|
publish:
|
||||||
|
pubaudio: true
|
||||||
|
pubvideo: true
|
||||||
|
kickexist: false
|
||||||
|
publishtimeout: 10
|
||||||
|
waitclosetimeout: 0
|
||||||
|
subscribe:
|
||||||
|
subaudio: true
|
||||||
|
subvideo: true
|
||||||
|
iframeonly: false
|
||||||
|
waittimeout: 10
|
||||||
|
tcp:
|
||||||
|
listenaddr: :1935
|
||||||
|
listennum: 0
|
||||||
|
pull:
|
||||||
|
repull: 0 # 当断开后是否自动重新拉流,0代表不进行重新拉流,-1代表无限次重新拉流
|
||||||
|
pullonstart: false # 是否在m7s启动的时候自动拉流
|
||||||
|
pullonsubscribe: false # 是否在有人订阅的时候自动拉流(按需拉流)
|
||||||
|
pulllist: {} # 拉流列表,以 streamPath为key,远程地址为value
|
||||||
|
push:
|
||||||
|
repush: 0 # 当断开后是否自动重新推流,0代表不进行重新推流,-1代表无限次重新推流
|
||||||
|
pushlist: {} # 推流列表,以 streamPath为key,远程地址为value
|
||||||
|
chunksize: 4096
|
||||||
|
```
|
||||||
|
:::tip 配置覆盖
|
||||||
|
publish
|
||||||
|
subscribe
|
||||||
|
两项中未配置部分将使用全局配置
|
||||||
|
:::
|
||||||
|
|
||||||
|
## API
|
||||||
|
无
|
||||||
|
Reference in New Issue
Block a user