mirror of
				https://github.com/Monibuca/plugin-rtsp.git
				synced 2025-10-31 19:03:05 +08:00 
			
		
		
		
	docs: update readme
This commit is contained in:
		| @@ -52,7 +52,7 @@ rtsp: | |||||||
|     rtcpaddr: :8001 |     rtcpaddr: :8001 | ||||||
|     readbuffercount: 2048 |     readbuffercount: 2048 | ||||||
|     writebuffercount: 2048 |     writebuffercount: 2048 | ||||||
|     pullprotocol: 'auto' # auto, tcp, udp |     pullprotocol: tcp # auto, tcp, udp | ||||||
| ``` | ``` | ||||||
| :::tip Configuration override | :::tip Configuration override | ||||||
| publish and subscribe, any section not configured will use global configuration. | publish and subscribe, any section not configured will use global configuration. | ||||||
| @@ -65,6 +65,7 @@ Get all RTSP streams | |||||||
|  |  | ||||||
| ### `rtsp/api/pull?target=[RTSP address]&streamPath=[Stream identity]&save=[0|1|2]` | ### `rtsp/api/pull?target=[RTSP address]&streamPath=[Stream identity]&save=[0|1|2]` | ||||||
| Pull the RTSP to m7s from a remote server | Pull the RTSP to m7s from a remote server | ||||||
| save meaning: 0, do not save; 1, save to pullonstart; 2, save to pullonsub | - save meaning: 0, do not save; 1, save to pullonstart; 2, save to pullonsub | ||||||
|  | - The RTSP address needs to be urlencoded to prevent special characters from affecting parsing | ||||||
| ### `rtsp/api/push?target=[RTSP address]&streamPath=[Stream identity]` | ### `rtsp/api/push?target=[RTSP address]&streamPath=[Stream identity]` | ||||||
| Push local streams to remote servers | Push local streams to remote servers | ||||||
| @@ -49,7 +49,7 @@ rtsp: | |||||||
|     rtcpaddr: :8001 |     rtcpaddr: :8001 | ||||||
|     readbuffercount: 2048 # 读取缓存队列大小 |     readbuffercount: 2048 # 读取缓存队列大小 | ||||||
|     writebuffercount: 2048 # 写出缓存队列大小 |     writebuffercount: 2048 # 写出缓存队列大小 | ||||||
|     pullprotocol: 'auto' # auto, tcp, udp |     pullprotocol: tcp # auto, tcp, udp | ||||||
| ``` | ``` | ||||||
| :::tip 配置覆盖 | :::tip 配置覆盖 | ||||||
| publish | publish | ||||||
| @@ -63,6 +63,7 @@ subscribe | |||||||
|  |  | ||||||
| ### `rtsp/api/pull?target=[RTSP地址]&streamPath=[流标识]&save=[0|1|2]` | ### `rtsp/api/pull?target=[RTSP地址]&streamPath=[流标识]&save=[0|1|2]` | ||||||
| 从远程拉取rtsp到m7s中 | 从远程拉取rtsp到m7s中 | ||||||
| save含义:0、不保存;1、保存到pullonstart;2、保存到pullonsub | - save含义:0、不保存;1、保存到pullonstart;2、保存到pullonsub | ||||||
|  | - RTSP地址需要进行urlencode 防止其中的特殊字符影响解析 | ||||||
| ### `rtsp/api/push?target=[RTSP地址]&streamPath=[流标识]` | ### `rtsp/api/push?target=[RTSP地址]&streamPath=[流标识]` | ||||||
| 将本地的流推送到远端 | 将本地的流推送到远端 | ||||||
| @@ -1,6 +1,8 @@ | |||||||
| package rtsp | package rtsp | ||||||
|  |  | ||||||
| import ( | import ( | ||||||
|  | 	"strings" | ||||||
|  |  | ||||||
| 	"github.com/bluenviron/gortsplib/v3/pkg/formats" | 	"github.com/bluenviron/gortsplib/v3/pkg/formats" | ||||||
| 	"github.com/bluenviron/gortsplib/v3/pkg/media" | 	"github.com/bluenviron/gortsplib/v3/pkg/media" | ||||||
| 	"github.com/bluenviron/mediacommon/pkg/codecs/mpeg4audio" | 	"github.com/bluenviron/mediacommon/pkg/codecs/mpeg4audio" | ||||||
| @@ -81,8 +83,7 @@ func (p *RTSPPublisher) SetTracks() error { | |||||||
| 				} | 				} | ||||||
| 				p.Tracks[track] = p.AudioTrack | 				p.Tracks[track] = p.AudioTrack | ||||||
| 			default: | 			default: | ||||||
| 				rtpMap, _ := forma.Marshal() | 				rtpMap := strings.ToLower(forma.RTPMap()) | ||||||
| 				rtpMap = strings.ToLower(rtpMap) |  | ||||||
| 				if strings.Contains(rtpMap, "pcm") { | 				if strings.Contains(rtpMap, "pcm") { | ||||||
| 					isMulaw := false | 					isMulaw := false | ||||||
| 					if strings.Contains(rtpMap, "pcmu") { | 					if strings.Contains(rtpMap, "pcmu") { | ||||||
| @@ -96,7 +97,7 @@ func (p *RTSPPublisher) SetTracks() error { | |||||||
| 					p.Tracks[track] = p.AudioTrack | 					p.Tracks[track] = p.AudioTrack | ||||||
| 				} else { | 				} else { | ||||||
| 					p.Error("unknown format", zap.Any("format", f.String())) | 					p.Error("unknown format", zap.Any("format", f.String())) | ||||||
| 				}				 | 				} | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 langhuihui
					langhuihui