CN116896546A - Visual intercom method, system and storage medium based on SRT communication protocol - Google Patents
Visual intercom method, system and storage medium based on SRT communication protocol Download PDFInfo
- Publication number
- CN116896546A CN116896546A CN202311142068.9A CN202311142068A CN116896546A CN 116896546 A CN116896546 A CN 116896546A CN 202311142068 A CN202311142068 A CN 202311142068A CN 116896546 A CN116896546 A CN 116896546A
- Authority
- CN
- China
- Prior art keywords
- srt
- push
- pull
- link
- client
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
- 238000000034 method Methods 0.000 title claims abstract description 79
- 238000004891 communication Methods 0.000 title claims abstract description 64
- 230000000007 visual effect Effects 0.000 title claims abstract description 31
- 230000011664 signaling Effects 0.000 claims description 73
- 238000004590 computer program Methods 0.000 claims description 18
- 230000004044 response Effects 0.000 claims description 12
- 238000005516 engineering process Methods 0.000 abstract description 14
- 230000008569 process Effects 0.000 abstract description 12
- 238000012545 processing Methods 0.000 abstract description 2
- 230000005540 biological transmission Effects 0.000 description 20
- 230000009286 beneficial effect Effects 0.000 description 6
- 238000010586 diagram Methods 0.000 description 5
- 230000002457 bidirectional effect Effects 0.000 description 3
- 238000010276 construction Methods 0.000 description 3
- 230000000694 effects Effects 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 230000003287 optical effect Effects 0.000 description 2
- 238000006467 substitution reaction Methods 0.000 description 2
- 238000012795 verification Methods 0.000 description 2
- 238000012937 correction Methods 0.000 description 1
- 230000007547 defect Effects 0.000 description 1
- 230000006870 function Effects 0.000 description 1
- 230000007774 longterm Effects 0.000 description 1
- 230000007246 mechanism Effects 0.000 description 1
- 238000012806 monitoring device Methods 0.000 description 1
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L65/00—Network arrangements, protocols or services for supporting real-time applications in data packet communication
- H04L65/1066—Session management
- H04L65/1101—Session protocols
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L65/00—Network arrangements, protocols or services for supporting real-time applications in data packet communication
- H04L65/80—Responding to QoS
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N7/00—Television systems
- H04N7/14—Systems for two-way working
- H04N7/141—Systems for two-way working between two video terminals, e.g. videophone
- H04N7/147—Communication arrangements, e.g. identifying the communication as a video-communication, intermediate storage of the signals
Landscapes
- Engineering & Computer Science (AREA)
- Multimedia (AREA)
- Signal Processing (AREA)
- Computer Networks & Wireless Communication (AREA)
- Business, Economics & Management (AREA)
- General Business, Economics & Management (AREA)
- Interconnected Communication Systems, Intercoms, And Interphones (AREA)
Abstract
Description
技术领域Technical field
本发明涉及可视对讲处理技术领域,尤其涉及基于SRT通信协议的可视对讲方法、系统及存储介质。The present invention relates to the technical field of video intercom processing, and in particular to a video intercom method, system and storage medium based on SRT communication protocol.
背景技术Background technique
现有技术中,远程实时可视对讲有基于RTMP(Real-Time Messaging Protocol)协议的方式和基于WebRTC技术实现的方案。然而RTMP协议存在实时性差、延迟累积、不支持H.265编码等缺点,另外RTMP协议基于TCP协议传输,使用非公共端口1935,很难通过防火墙。此外,因为RTMP不支持双向通信,如果需要建立对讲通道,需要单独建立语音对讲通道,增加实施的技术难度。对于WebRTC技术,基于浏览器使用P2P,即点对点连接,安全性较差,在复杂的网络环境下,无法保障视频质量,WebRTC技术较为复杂,不够轻量,并且缺乏服务器方案的部署,不能满足媒体数据的海量分发。综上,现有的可视对讲的方式,存在建立链接通道的过程复杂、需要额外建立对讲通道、不够轻量化的问题。In the existing technology, remote real-time video intercom includes methods based on RTMP (Real-Time Messaging Protocol) protocol and solutions based on WebRTC technology. However, the RTMP protocol has shortcomings such as poor real-time performance, accumulated delay, and does not support H.265 encoding. In addition, the RTMP protocol is based on TCP protocol transmission and uses non-public port 1935, making it difficult to pass the firewall. In addition, because RTMP does not support two-way communication, if an intercom channel needs to be established, a separate voice intercom channel needs to be established, which increases the technical difficulty of implementation. For WebRTC technology, P2P is used based on the browser, that is, point-to-point connection, which has poor security. In a complex network environment, video quality cannot be guaranteed. WebRTC technology is more complex, not lightweight enough, and lacks the deployment of server solutions, which cannot meet the needs of the media. Massive distribution of data. In summary, the existing video intercom method has the problems of complicated process of establishing link channels, the need to establish additional intercom channels, and not being lightweight enough.
发明内容Contents of the invention
本发明提供基于SRT通信协议的可视对讲方法、系统及存储介质,用以解决现有技术中建立链接通道过程复杂、需要额外建立对讲通道以及不够轻量化的缺陷。The present invention provides a visual intercom method, system and storage medium based on SRT communication protocol to solve the defects in the prior art that the process of establishing a link channel is complicated, additional intercom channels need to be established, and it is not lightweight enough.
本发明提供基于SRT通信协议的可视对讲方法,应用于媒体服务器,包括:The present invention provides a visual intercom method based on SRT communication protocol, which is applied to media servers and includes:
响应于客户端的第一请求信息,所述第一请求信息包括客户端的客户端识别信息以及目标端的目标端识别信息;In response to the client's first request information, the first request information includes client identification information of the client and target identification information of the target terminal;
根据所述第一请求信息,按照URL格式生成与所述目标端对应的第一SRT推拉流地址;According to the first request information, generate the first SRT push-pull stream address corresponding to the target end according to the URL format;
发送所述第一SRT推拉流地址至所述目标端,以与所述目标端建立第一SRT推拉流链接;Send the first SRT push-pull flow address to the target end to establish a first SRT push-pull flow link with the target end;
根据所述第一SRT推拉流链接以及所述第一请求信息,按照URL格式生成第二SRT推拉流地址;Generate a second SRT push-pull stream address according to the URL format according to the first SRT push-pull stream link and the first request information;
发送所述第二SRT推拉流地址至所述客户端,以与所述客户端建立第二SRT推拉流链接;Send the second SRT push-pull stream address to the client to establish a second SRT push-pull stream link with the client;
根据所述第一SRT推拉流链接以及所述第二SRT推拉流链接,传输所述客户端与所述目标端之间的音频数据和视频数据;Transmit audio data and video data between the client and the target according to the first SRT push-pull stream link and the second SRT push-pull stream link;
其中,所述第一SRT推拉流地址以及所述第二SRT推拉流地址用于指示基于SRT协议建立推流和拉流复用的链接。Wherein, the first SRT push-pull stream address and the second SRT push-pull stream address are used to indicate establishing a link for push and pull multiplexing based on the SRT protocol.
根据本发明提供的基于SRT通信协议的可视对讲方法,所述根据所述第一请求信息,按照URL格式生成与所述目标端对应的第一SRT推拉流地址,包括:According to the video intercom method based on the SRT communication protocol provided by the present invention, the first SRT push-pull stream address corresponding to the target end is generated according to the URL format according to the first request information, including:
根据所述第一请求信息,确定目标端识别信息;Determine target terminal identification information according to the first request information;
根据所述目标端识别信息,生成第一密钥信息;Generate first key information according to the target identification information;
根据所述目标端识别信息以及所述第一密钥信息,按照URL格式生成所述第一SRT推拉流地址;Generate the first SRT push-pull stream address according to the URL format according to the target identification information and the first key information;
其中,所述第一SRT推拉流地址包括SRT协议字段、与所述第一密钥信息对应的第一密钥字段以及第一推拉流标识字段。Wherein, the first SRT push-pull stream address includes an SRT protocol field, a first key field corresponding to the first key information, and a first push-pull stream identification field.
根据本发明提供的基于SRT通信协议的可视对讲方法,所述根据所述第一SRT推拉流链接以及所述第一请求信息,按照URL格式生成第二SRT推拉流地址,包括:According to the video intercom method based on the SRT communication protocol provided by the present invention, the second SRT push-pull stream address is generated according to the URL format according to the first SRT push-pull stream link and the first request information, including:
当所述第一SRT推拉流链接的建立,根据所述第一请求信息,确定客户端识别信息;When the first SRT push-pull stream link is established, determine the client identification information according to the first request information;
根据所述客户端识别信息,生成第二密钥信息;Generate second key information according to the client identification information;
根据所述客户端识别信息以及所述第二密钥信息,按照URL格式生成所述第二SRT推拉流地址;Generate the second SRT push-pull stream address according to the URL format according to the client identification information and the second key information;
其中,所述第二SRT推拉流地址包括SRT协议字段、与所述第二密钥信息对应的第二密钥字段以及第二推拉流标识字段。Wherein, the second SRT push-pull stream address includes an SRT protocol field, a second key field corresponding to the second key information, and a second push-pull stream identification field.
根据本发明提供的基于SRT通信协议的可视对讲方法,所述发送所述第一SRT推拉流地址至所述目标端,以与所述目标端建立第一SRT推拉流链接,包括:According to the video intercom method based on the SRT communication protocol provided by the present invention, sending the first SRT push-pull flow address to the target end to establish a first SRT push-pull flow link with the target end includes:
发送所述第一SRT推拉流地址至信令服务器,以指示所述信令服务器转发所述第一SRT推拉流地址至所述目标端;Send the first SRT push-pull flow address to the signaling server to instruct the signaling server to forward the first SRT push-pull flow address to the target end;
响应于第二请求信息,与所述目标端建立第一SRT推拉流链接;In response to the second request information, establish a first SRT push-pull stream link with the target end;
其中,所述第二请求信息基于所述第一SRT推拉流地址生成。Wherein, the second request information is generated based on the first SRT push-pull stream address.
根据本发明提供的基于SRT通信协议的可视对讲方法,所述发送所述第二SRT推拉流地址至所述客户端,以与所述客户端建立第二SRT推拉流链接,包括:According to the video intercom method based on the SRT communication protocol provided by the present invention, sending the second SRT push-pull stream address to the client to establish a second SRT push-pull stream link with the client includes:
发送所述第二SRT推拉流地址至信令服务器,以指示所述信令服务器转发所述第二SRT推拉流地址至所述客户端;Send the second SRT push-pull flow address to the signaling server to instruct the signaling server to forward the second SRT push-pull flow address to the client;
响应于第三请求信息,与所述客户端建立第二SRT推拉流链接;In response to the third request information, establish a second SRT push-pull stream link with the client;
其中,所述第三请求信息基于所述第二SRT推拉流地址生成。Wherein, the third request information is generated based on the second SRT push-pull stream address.
根据本发明提供的基于SRT通信协议的可视对讲方法,在所述根据所述第一SRT推拉流链接以及所述第二SRT推拉流链接,传输所述客户端与所述目标端之间的音频数据和视频数据之后,还包括:According to the video intercom method based on the SRT communication protocol provided by the present invention, according to the first SRT push-pull flow link and the second SRT push-pull flow link, the transmission between the client and the target end is After the audio data and video data, it also includes:
响应于所述客户端的停止请求,关闭所述第二SRT推拉流链接;In response to the client's stop request, close the second SRT push-pull stream link;
若不能从所述客户端获取数据并且持续预设时间后,关闭所述第一SRT推拉流链接。If data cannot be obtained from the client and continues for a preset time, the first SRT push-pull stream link is closed.
根据本发明提供的基于SRT通信协议的可视对讲方法,应用于客户端,包括:The video intercom method based on SRT communication protocol provided by the present invention is applied to the client and includes:
向信令服务器发送第一请求信息,所述第一请求信息包括客户端的客户端识别信息以及目标端的目标端识别信息;Send first request information to the signaling server, where the first request information includes client identification information of the client and target identification information of the target terminal;
从信令服务器获取第二SRT推拉流地址;Obtain the second SRT push-pull flow address from the signaling server;
根据所述第二SRT推拉流地址,与媒体服务器建立第二SRT推拉流链接;Establish a second SRT push-pull stream link with the media server according to the second SRT push-pull stream address;
与所述信令服务器建立会话保活链接,所述会话保活链接用于维持所述第二SRT推拉流链接;Establish a session keep-alive link with the signaling server, the session keep-alive link being used to maintain the second SRT push-pull flow link;
根据所述第二SRT推拉流链接,发送音频数据至所述媒体服务器以指示所述媒体服务器转发音频数据至所述目标端,从所述媒体服务器获取所述目标端的音频数据和视频数据。According to the second SRT push-pull stream link, audio data is sent to the media server to instruct the media server to forward audio data to the target end, and audio data and video data of the target end are obtained from the media server.
根据本发明提供的基于SRT通信协议的可视对讲方法,在所述根据所述第二SRT推拉流链接,发送音频数据至所述媒体服务器以指示所述媒体服务器转发音频数据至所述目标端,从所述媒体服务器获取所述目标端的音频数据和视频数据之后,还包括:According to the video intercom method based on the SRT communication protocol provided by the present invention, during the push-pull stream link according to the second SRT, audio data is sent to the media server to instruct the media server to forward the audio data to the target. end, after obtaining the audio data and video data of the target end from the media server, it also includes:
响应于停止操作,关闭与所述信令服务器之间的所述会话保活链接;In response to the stop operation, closing the session keepalive link with the signaling server;
发送停止请求至所述媒体服务器以关闭所述第二SRT推拉流链接。Send a stop request to the media server to close the second SRT push-pull stream link.
根据本发明提供的基于SRT通信协议的可视对讲方法,应用于目标端,包括:The video intercom method based on SRT communication protocol provided by the present invention is applied to the target end and includes:
获取第一SRT推拉流地址;Get the first SRT push-pull stream address;
根据所述第一SRT推拉流地址,与媒体服务器建立第一SRT推拉流链接;Establish a first SRT push-pull stream link with the media server according to the first SRT push-pull stream address;
根据所述第一SRT推拉流链接,发送视频数据和音频数据至所述媒体服务器以指示所述媒体服务器转发视频数据和音频数据至客户端,从所述媒体服务器获取所述客户端的音频数据。According to the first SRT push-pull stream link, video data and audio data are sent to the media server to instruct the media server to forward the video data and audio data to the client, and the audio data of the client is obtained from the media server.
根据本发明提供的基于SRT通信协议的可视对讲方法,在所述根据所述第一SRT推拉流链接,发送视频数据和音频数据至所述媒体服务器以指示所述媒体服务器转发视频数据和音频数据至客户端,从所述媒体服务器获取所述客户端的音频数据之后,还包括:According to the video intercom method based on the SRT communication protocol provided by the present invention, according to the first SRT push-pull stream link, video data and audio data are sent to the media server to instruct the media server to forward the video data and Audio data to the client. After obtaining the audio data of the client from the media server, it also includes:
当从所述媒体服务器不能获取所述客户端的音频数据并且持续预设时间后,关闭所述第一SRT推拉流链接。When the audio data of the client cannot be obtained from the media server and continues for a preset time, the first SRT push-pull stream link is closed.
根据本发明提供的基于SRT通信协议的可视对讲方法,应用于信令服务器,包括:The video intercom method based on the SRT communication protocol provided by the present invention is applied to the signaling server and includes:
响应于客户端的第一请求信息,所述第一请求信息包括客户端的客户端识别信息以及目标端的目标端识别信息;In response to the client's first request information, the first request information includes client identification information of the client and target identification information of the target terminal;
转发所述第一请求信息至媒体服务器,以获取第一SRT推拉流地址;Forward the first request information to the media server to obtain the first SRT push-pull stream address;
发送所述第一SRT推拉流地址至所述目标端,以使所述目标端基于所述第一SRT推拉流地址与所述媒体服务器建立第一SRT推拉流链接;Send the first SRT push-pull stream address to the target end, so that the target end establishes a first SRT push-pull stream link with the media server based on the first SRT push-pull stream address;
从所述媒体服务器获取第二SRT推拉流地址;Obtain the second SRT push-pull stream address from the media server;
将所述第二SRT推拉流地址发送至所述客户端,以使所述客户端基于所述第二SRT推拉流地址与所述媒体服务器建立第二SRT推拉流链接。The second SRT push-pull stream address is sent to the client, so that the client establishes a second SRT push-pull stream link with the media server based on the second SRT push-pull stream address.
本发明还提供可视对讲系统,包括:客户端设备、目标端设备、信令服务器以及媒体服务器;所述客户端设备发送第一请求信息至所述信令服务器;所述信令服务器转发所述第一请求信息至所述媒体服务器;所述媒体服务器根据所述第一请求信息,按照URL格式生成与所述目标端设备对应的第一SRT推拉流地址,发送所述第一SRT推拉流地址至所述信令服务器;所述信令服务器转发所述第一SRT推拉流地址至所述目标端设备;所述目标端设备根据所述第一SRT推拉流地址与所述媒体服务器建立第一SRT推拉流链接;所述媒体服务器根据所述第一SRT推拉流链接以及所述第一请求信息,生成第二SRT推拉流地址,发送所述第二SRT推拉流地址至所述信令服务器;所述信令服务器转发所述第二SRT推拉流地址至所述客户端设备;所述客户端设备根据所述第二SRT推拉流地址与所述媒体服务器建立第二SRT推拉流链接;所述媒体服务器根据所述第一SRT推拉流链接,获取所述目标端设备的视频数据和音频数据并且发送所述客户端的音频数据至所述目标端设备,根据所述第二SRT推拉流链接,获取所述客户端设备的音频数据并且发送所述目标端设备的视频数据和音频数据至所述客户端设备。The present invention also provides a video intercom system, including: a client device, a target device, a signaling server and a media server; the client device sends the first request information to the signaling server; the signaling server forwards The first request information is sent to the media server; the media server generates the first SRT push-pull stream address corresponding to the target device according to the URL format according to the first request information, and sends the first SRT push-pull stream address. stream address to the signaling server; the signaling server forwards the first SRT push-pull stream address to the target device; the target device establishes a connection with the media server based on the first SRT push-pull stream address. A first SRT push-pull stream link; the media server generates a second SRT push-pull stream address based on the first SRT push-pull stream link and the first request information, and sends the second SRT push-pull stream address to the signaling Server; the signaling server forwards the second SRT push-pull stream address to the client device; the client device establishes a second SRT push-pull stream link with the media server based on the second SRT push-pull stream address; The media server obtains the video data and audio data of the target device according to the first SRT push-pull stream link and sends the client's audio data to the target device, and according to the second SRT push-pull stream link , obtain the audio data of the client device and send the video data and audio data of the target device to the client device.
本发明还提供一种电子设备,包括存储器、处理器及存储在存储器上并可在处理器上运行的计算机程序,所述处理器执行所述程序时实现如上述任一种所述基于SRT通信协议的可视对讲方法。The present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, it implements SRT-based communication as described above. Protocol video intercom method.
本发明还提供一种非暂态计算机可读存储介质,其上存储有计算机程序,该计算机程序被处理器执行时实现如上述任一种所述基于SRT通信协议的可视对讲方法。The present invention also provides a non-transitory computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the video intercom method based on the SRT communication protocol as described above is implemented.
本发明还提供一种计算机程序产品,包括计算机程序,所述计算机程序被处理器执行时实现如上述任一种所述基于SRT通信协议的可视对讲方法。The present invention also provides a computer program product, which includes a computer program. When the computer program is executed by a processor, the computer program implements any of the above-mentioned video intercom methods based on the SRT communication protocol.
本发明提供的基于SRT通信协议的可视对讲方法,至少具有以下有益效果:媒体服务器根据第一请求信息,按照URL格式生成第一SRT推拉流地址,使得目标端根据第一SRT推拉流地址与媒体服务器建立第一SRT推拉流链接,在建立第一SRT推拉流链接成功后,媒体服务器根据第一请求信息,按照URL格式生成第二SRT推拉流地址,使得客户端根据第二SRT推拉流地址与媒体服务器建立第二SRT推拉流链接,媒体服务器根据第一SRT推拉流链接和第二SRT推拉流链接传输客户端和目标端之间的视频数据和音频数据,实现可视对讲的效果。以此,将SRT协议与URL技术结合,通过第一SRT推拉流地址、第二SRT推拉流地址,能够便捷、快速与媒体服务器建立第一SRT推拉流链接、第二SRT推拉流链接,有利于简化建立链接通道的过程,并且SRT推拉流链接具有双向传输的特性,能够在同一SRT推拉流链接通道上传输视频数据和音频数据,无需额外建立对讲通道,同时,基于URL格式的第一SRT推拉流地址、第二SRT推拉流地址,传输时数据量小,有利于实现轻量化搭建链接。The visual intercom method based on the SRT communication protocol provided by the present invention has at least the following beneficial effects: the media server generates the first SRT push-pull stream address according to the URL format according to the first request information, so that the target end can push-pull the stream address according to the first SRT Establish the first SRT push-pull stream link with the media server. After the first SRT push-pull stream link is successfully established, the media server generates the second SRT push-pull stream address according to the URL format based on the first request information, so that the client can push-pull the stream according to the second SRT The address establishes a second SRT push-pull stream link with the media server. The media server transmits video data and audio data between the client and the target client based on the first SRT push-pull stream link and the second SRT push-pull stream link to achieve the effect of visual intercom. . In this way, the SRT protocol is combined with URL technology, and the first SRT push-pull stream link and the second SRT push-pull stream link can be established conveniently and quickly with the media server through the first SRT push-pull stream address and the second SRT push-pull stream address, which is beneficial to Simplifies the process of establishing a link channel, and the SRT push-pull stream link has bidirectional transmission characteristics and can transmit video data and audio data on the same SRT push-pull stream link channel without the need to establish an additional intercom channel. At the same time, the first SRT based on the URL format The push-pull stream address and the second SRT push-pull stream address have a small amount of data during transmission, which is conducive to lightweight link construction.
附图说明Description of the drawings
为了更清楚地说明本发明或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作一简单地介绍,显而易见地,下面描述中的附图是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to explain the present invention or the technical solutions in the prior art more clearly, the drawings needed to be used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings in the following description are of the present invention. For some embodiments of the invention, those of ordinary skill in the art can also obtain other drawings based on these drawings without exerting creative efforts.
图1是本发明提供的基于SRT通信协议的可视对讲方法的信令图;Figure 1 is a signaling diagram of the visual intercom method based on SRT communication protocol provided by the present invention;
图2是本发明提供应用于媒体服务器的基于SRT通信协议的可视对讲方法的流程示意图之一;Figure 2 is one of the flow diagrams of the video intercom method based on the SRT communication protocol applied to the media server provided by the present invention;
图3是本发明提供应用于媒体服务器的基于SRT通信协议的可视对讲方法的流程示意图之二;Figure 3 is a second schematic flowchart of the video intercom method based on the SRT communication protocol applied to the media server provided by the present invention;
图4是本发明提供应用于媒体服务器的基于SRT通信协议的可视对讲方法的流程示意图之三;Figure 4 is the third schematic flow chart of the video intercom method based on the SRT communication protocol applied to the media server provided by the present invention;
图5是本发明提供应用于媒体服务器的基于SRT通信协议的可视对讲方法的流程示意图之四;Figure 5 is a schematic flowchart of the fourth embodiment of the present invention providing a video intercom method based on the SRT communication protocol applied to a media server;
图6是本发明提供应用于媒体服务器的基于SRT通信协议的可视对讲方法的流程示意图之五;FIG. 6 is a schematic flow chart of the fifth video intercom method based on the SRT communication protocol applied to the media server provided by the present invention;
图7是本发明提供应用于客户端的基于SRT通信协议的可视对讲方法的流程示意图;Figure 7 is a schematic flow chart of the video intercom method based on the SRT communication protocol provided by the present invention and applied to the client;
图8是本发明提供应用于目标端的基于SRT通信协议的可视对讲方法的流程示意图;Figure 8 is a schematic flowchart of the video intercom method based on the SRT communication protocol provided by the present invention and applied to the target end;
图9是本发明提供应用于信令服务器的基于SRT通信协议的可视对讲方法的流程示意图;Figure 9 is a schematic flow chart of the visual intercom method based on the SRT communication protocol applied to the signaling server provided by the present invention;
图10是本发明提供的可视对讲系统的结构示意图;Figure 10 is a schematic structural diagram of the video intercom system provided by the present invention;
图11是本发明提供的电子设备的结构示意图。Figure 11 is a schematic structural diagram of the electronic device provided by the present invention.
具体实施方式Detailed ways
为使本发明的目的、技术方案和优点更加清楚,下面将结合本发明中的附图,对本发明中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。In order to make the purpose, technical solutions and advantages of the present invention more clear, the technical solutions in the present invention will be clearly and completely described below in conjunction with the accompanying drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention. , not all examples. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without making creative efforts fall within the scope of protection of the present invention.
下面结合图1至图5描述本发明的基于SRT通信协议的可视对讲方法,应用于媒体服务器,包括:The video intercom method based on the SRT communication protocol of the present invention is described below with reference to Figures 1 to 5. It is applied to the media server and includes:
S100:响应于客户端的第一请求信息,所述第一请求信息包括客户端的客户端识别信息以及目标端的目标端识别信息;S100: Respond to the client's first request information, where the first request information includes client identification information of the client and target identification information of the target terminal;
S110:根据所述第一请求信息,按照URL格式生成与所述目标端对应的第一SRT推拉流地址;S110: According to the first request information, generate the first SRT push-pull stream address corresponding to the target end according to the URL format;
S120:发送所述第一SRT推拉流地址至所述目标端,以与所述目标端建立第一SRT推拉流链接;S120: Send the first SRT push-pull flow address to the target end to establish a first SRT push-pull flow link with the target end;
S130:根据所述第一SRT推拉流链接以及所述第一请求信息,按照URL格式生成第二SRT推拉流地址;S130: Generate a second SRT push-pull stream address according to the URL format according to the first SRT push-pull stream link and the first request information;
S140:发送所述第二SRT推拉流地址至所述客户端,以与所述客户端建立第二SRT推拉流链接;S140: Send the second SRT push-pull stream address to the client to establish a second SRT push-pull stream link with the client;
S150:根据所述第一SRT推拉流链接以及所述第二SRT推拉流链接,传输所述客户端与所述目标端之间的音频数据和视频数据;S150: Transmit audio data and video data between the client and the target according to the first SRT push-pull stream link and the second SRT push-pull stream link;
其中,所述第一SRT推拉流地址以及所述第二SRT推拉流地址用于指示基于SRT协议建立推流和拉流复用的链接。Wherein, the first SRT push-pull stream address and the second SRT push-pull stream address are used to indicate establishing a link for push and pull multiplexing based on the SRT protocol.
媒体服务器根据第一请求信息,按照URL格式生成第一SRT推拉流地址,使得目标端根据第一SRT推拉流地址与媒体服务器建立第一SRT推拉流链接,在建立第一SRT推拉流链接成功后,媒体服务器根据第一请求信息,按照URL格式生成第二SRT推拉流地址,使得客户端根据第二SRT推拉流地址与媒体服务器建立第二SRT推拉流链接,媒体服务器根据第一SRT推拉流链接和第二SRT推拉流链接传输客户端和目标端之间的视频数据和音频数据,实现可视对讲的效果。以此,将SRT协议与URL技术结合,通过第一SRT推拉流地址、第二SRT推拉流地址,能够便捷、快速与媒体服务器建立第一SRT推拉流链接、第二SRT推拉流链接,有利于简化建立链接通道的过程,并且SRT推拉流链接具有双向传输的特性,能够在同一SRT推拉流链接通道上传输视频数据和音频数据,无需额外建立对讲通道,同时,基于URL格式的第一SRT推拉流地址、第二SRT推拉流地址,传输时数据量小,有利于实现轻量化搭建链接。The media server generates the first SRT push-pull stream address according to the URL format according to the first request information, so that the target end establishes the first SRT push-pull stream link with the media server based on the first SRT push-pull stream address. After the first SRT push-pull stream link is successfully established, , the media server generates the second SRT push-pull stream address according to the URL format according to the first request information, so that the client establishes the second SRT push-pull stream link with the media server based on the second SRT push-pull stream address, and the media server generates the second SRT push-pull stream link based on the first SRT push-pull stream link. And the second SRT push-pull stream link transmits video data and audio data between the client and the target to achieve the effect of visual intercom. In this way, the SRT protocol is combined with URL technology, and the first SRT push-pull stream link and the second SRT push-pull stream link can be established conveniently and quickly with the media server through the first SRT push-pull stream address and the second SRT push-pull stream address, which is beneficial to Simplifies the process of establishing a link channel, and the SRT push-pull stream link has bidirectional transmission characteristics and can transmit video data and audio data on the same SRT push-pull stream link channel without the need to establish an additional intercom channel. At the same time, the first SRT based on the URL format The push-pull stream address and the second SRT push-pull stream address have a small amount of data during transmission, which is conducive to lightweight link construction.
URL(Uniform Resource Locator)是一种用于标识和定位互联网上资源的字符串格式,包括了访问资源所需的协议、位置、访问条件等。SRT(Secure Reliable Transport)协议是一种开源的实时传输协议,旨在提供可靠、安全且低延迟的流媒体传输,具有前向纠错、丢包重传机制以使得数据可靠地传输,并且具有双向传输特性,能够在同一SRT链接上传输视频数据和音频数据,即视频和音频复用一个通道,无需额外为对讲的音频建立链接,同时,SRT链接支持H.265编码传输。将SRT协议与URL技术结合,能够方便快捷建立SRT链接,以提供低延时、稳定、可靠的双向传输通道,满足可视对讲的需求。URL (Uniform Resource Locator) is a string format used to identify and locate resources on the Internet, including the protocol, location, access conditions, etc. required to access the resource. SRT (Secure Reliable Transport) protocol is an open source real-time transmission protocol designed to provide reliable, secure and low-latency streaming media transmission. It has forward error correction and packet loss retransmission mechanisms to ensure reliable transmission of data, and has The two-way transmission feature can transmit video data and audio data on the same SRT link, that is, video and audio multiplex one channel, without the need to establish an additional link for intercom audio. At the same time, the SRT link supports H.265 encoding transmission. Combining the SRT protocol with URL technology can quickly and easily establish an SRT link to provide a low-latency, stable, and reliable two-way transmission channel to meet the needs of video intercoms.
参考图3,本发明提供应用于媒体服务器的基于SRT通信协议的可视对讲方法,在一些实施例中,所述S110,包括:Referring to Figure 3, the present invention provides a video intercom method based on SRT communication protocol applied to a media server. In some embodiments, the S110 includes:
S111:根据所述第一请求信息,确定目标端识别信息;S111: Determine the target identification information according to the first request information;
S112:根据所述目标端识别信息,生成第一密钥信息;S112: Generate first key information according to the target identification information;
S113:根据所述目标端识别信息以及所述第一密钥信息,按照URL格式生成所述第一SRT推拉流地址;S113: Generate the first SRT push-pull stream address according to the URL format according to the target identification information and the first key information;
其中,所述第一SRT推拉流地址包括SRT协议字段、与所述第一密钥信息对应的第一密钥字段以及第一推拉流标识字段。Wherein, the first SRT push-pull stream address includes an SRT protocol field, a first key field corresponding to the first key information, and a first push-pull stream identification field.
通过根据目标端识别信息生成第一密钥信息,并且第一SRT推拉流地址包括对应的第一密钥字段,使得目标端根据第一SRT推拉流地址与媒体服务器建立第一SRT推拉流链接过程中,根据第一密钥信息和第一密钥字段进行安全验证,有利于提高第一SRT推拉流链接的安全性。By generating the first key information based on the target identification information, and the first SRT push-pull stream address including the corresponding first key field, the target terminal establishes the first SRT push-pull stream link process with the media server based on the first SRT push-pull stream address. , performing security verification based on the first key information and the first key field is beneficial to improving the security of the first SRT push-pull flow link.
目标端识别信息可以是为目标端的MAC地址、IP地址、身份识别码等实施方式。The target identification information may be the target's MAC address, IP address, identification code and other implementation methods.
参考图4,本发明提供应用于媒体服务器的基于SRT通信协议的可视对讲方法,在一些实施例中,所述S130,包括:Referring to Figure 4, the present invention provides a video intercom method based on the SRT communication protocol applied to the media server. In some embodiments, the S130 includes:
S131:当所述第一SRT推拉流链接的建立,根据所述第一请求信息,确定客户端识别信息;S131: When the first SRT push-pull stream link is established, determine the client identification information according to the first request information;
S132:根据所述客户端识别信息,生成第二密钥信息;S132: Generate second key information according to the client identification information;
S133:根据所述客户端识别信息以及所述第二密钥信息,按照URL格式生成所述第二SRT推拉流地址;S133: Generate the second SRT push-pull stream address according to the URL format according to the client identification information and the second key information;
其中,所述第二SRT推拉流地址包括SRT协议字段、与所述第二密钥信息对应的第二密钥字段以及第二推拉流标识字段。Wherein, the second SRT push-pull stream address includes an SRT protocol field, a second key field corresponding to the second key information, and a second push-pull stream identification field.
在第一SRT推拉流链接建立,即目标设备与媒体服务器能够正常传输数据后,根据客户端识别信息生成第二密钥信息,并且第二SRT推拉流地址包括对应的第二密钥字段,使得客户端根据第二SRT推拉流地址与媒体服务器建立第二SRT推拉流链接过程中,根据第二密钥信息和第二密钥字段进行安全验证,有利于提高第二SRT推拉流链接的安全性。After the first SRT push-pull stream link is established, that is, the target device and the media server can transmit data normally, the second key information is generated based on the client identification information, and the second SRT push-pull stream address includes the corresponding second key field, so that When the client establishes the second SRT push-pull stream link with the media server based on the second SRT push-pull stream address, security verification is performed based on the second key information and the second key field, which is beneficial to improving the security of the second SRT push-pull stream link. .
客户端识别信息可以是为客户端的MAC地址、IP地址或身份识别码等实施方式。The client identification information may be the client's MAC address, IP address or identity code.
参考图5,本发明提供应用于媒体服务器的基于SRT通信协议的可视对讲方法,在一些实施例中,所述S120,包括:Referring to Figure 5, the present invention provides a video intercom method based on SRT communication protocol applied to a media server. In some embodiments, the S120 includes:
S121:发送所述第一SRT推拉流地址至信令服务器,以指示所述信令服务器转发所述第一SRT推拉流地址至所述目标端;S121: Send the first SRT push-pull flow address to the signaling server to instruct the signaling server to forward the first SRT push-pull flow address to the target end;
S122:响应于第二请求信息,与所述目标端建立第一SRT推拉流链接;S122: In response to the second request information, establish a first SRT push-pull stream link with the target end;
其中,所述第二请求信息基于所述第一SRT推拉流地址生成。Wherein, the second request information is generated based on the first SRT push-pull stream address.
信令服务器用于会话管理,可以直接与客户端、目标端直接发送或接收消息,目标端建立链接、会话一般与信令服务器进行交互。媒体服务器将生成的第一SRT推拉流地址发送给信令服务器,信令服务器转发第一SRT推拉流地址至目标端,目标端使用第一SRT推拉流地址时,会生成第二请求信息发送至媒体服务器,媒体服务器响应第二请求信息与目标端建立第一SRT推拉流链接。以此,目标端通过第一SRT推拉流地址能够直接与媒体服务器建立第一SRT推拉流链接,无需再次经过信令服务器,有利于简化建立链接通道的过程。The signaling server is used for session management and can directly send or receive messages with the client and target. The target establishes a link and session and generally interacts with the signaling server. The media server sends the generated first SRT push-pull stream address to the signaling server, and the signaling server forwards the first SRT push-pull stream address to the target end. When the target end uses the first SRT push-pull flow address, it will generate a second request information and send it to The media server responds to the second request information and establishes a first SRT push-pull stream link with the target end. In this way, the target end can directly establish the first SRT push-pull stream link with the media server through the first SRT push-pull stream address without going through the signaling server again, which is beneficial to simplifying the process of establishing a link channel.
在本发明的一些实施例中,亦可以是媒体服务器直接发送第一SRT推拉流地址至目标端。In some embodiments of the present invention, the media server may also directly send the first SRT push-pull stream address to the target end.
参考图6,本发明提供应用于媒体服务器的基于SRT通信协议的可视对讲方法,在一些实施例中,所述S140,包括:Referring to Figure 6, the present invention provides a video intercom method based on the SRT communication protocol applied to the media server. In some embodiments, the S140 includes:
S141:发送所述第二SRT推拉流地址至信令服务器,以指示所述信令服务器转发所述第二SRT推拉流地址至所述客户端;S141: Send the second SRT push-pull flow address to the signaling server to instruct the signaling server to forward the second SRT push-pull flow address to the client;
S142:响应于第三请求信息,与所述客户端建立第二SRT推拉流链接;S142: In response to the third request information, establish a second SRT push-pull stream link with the client;
其中,所述第三请求信息基于所述第二SRT推拉流地址生成。Wherein, the third request information is generated based on the second SRT push-pull stream address.
信令服务器用于会话管理,可以直接与客户端、目标端直接发送或接收消息,客户端建立链接、会话一般与信令服务器进行交互,请求信息发送至客户端。媒体服务器将生成的第二SRT推拉流地址发送给信令服务器,信令服务器转发第二SRT推拉流地址至客户端,目标端使用第二SRT推拉流地址时,会生成第三请求信息发送至媒体服务器,媒体服务器响应第三请求信息与客户端建立第二SRT推拉流链接。以此,客户端发送第一请求信息至信令服务器后,信令服务器返回第二SRT推拉流地址,无需改变通信目标,客户端通过第二SRT推拉流地址能够直接与媒体服务器建立第二SRT推拉流链接,无需再次经过信令服务器,有利于简化建立链接通道的过程。The signaling server is used for session management and can directly send or receive messages to the client and target. The client establishes a link and session and generally interacts with the signaling server to request information to be sent to the client. The media server sends the generated second SRT push-pull stream address to the signaling server, and the signaling server forwards the second SRT push-pull stream address to the client. When the target uses the second SRT push-pull stream address, a third request message is generated and sent to The media server responds to the third request information and establishes a second SRT push-pull stream link with the client. In this way, after the client sends the first request information to the signaling server, the signaling server returns the second SRT push-pull stream address without changing the communication target. The client can directly establish the second SRT with the media server through the second SRT push-pull stream address. Push-pull streaming links do not need to go through the signaling server again, which helps simplify the process of establishing link channels.
在本发明的一些实施例中,亦可以是媒体服务器直接发送第二SRT推拉流地址至客户端。In some embodiments of the present invention, the media server may also directly send the second SRT push-pull stream address to the client.
参考图1和图2,本发明提供应用于媒体服务器的基于SRT通信协议的可视对讲方法,在一些实施例中,在所述S150之后,还包括:Referring to Figures 1 and 2, the present invention provides a video intercom method based on SRT communication protocol applied to a media server. In some embodiments, after S150, it also includes:
S160:响应于所述客户端的停止请求,关闭所述第二SRT推拉流链接;S160: In response to the client's stop request, close the second SRT push-pull stream link;
S170:若不能从所述客户端获取数据并且持续预设时间后,关闭所述第一SRT推拉流链接。S170: If data cannot be obtained from the client and continues for a preset time, close the first SRT push-pull flow link.
当客户端完成可视对讲业务后,发送停止请求,媒体服务器响应停止请求,关闭第二SRT推拉流链接以释放链接资源,在没有收到客户端的数据并持续预设时间后,关闭第一SRT推拉流链接以释放链接资源。以此,能够在完成可视对讲业务后及时释放第二SRT推拉流链接的资源,在释放第二SRT推拉流链接并且经过预设时间后释放第一SRT推拉流链接的资源。在预设时间内,若客户端再次通过第二SRT推拉流地址建立第二SRT推拉流链接,能够正常与目标端继续进行可视对讲业务,无需等待客户端重新建立第一SRT推拉流链接,有利于提高效率。另外,在客户端故障不能够发送数据至媒体服务器时,经过预设时间后释放第一SRT推拉流链接的资源,避免长时间占用资源空运行。When the client completes the video intercom service, it sends a stop request. The media server responds to the stop request and closes the second SRT push-pull stream link to release link resources. After no data is received from the client for a preset time, the first SRT stream link is closed. SRT pushes and pulls streaming links to release link resources. In this way, the resources of the second SRT push-pull flow link can be released in time after the video intercom service is completed, and the resources of the first SRT push-pull flow link can be released after the second SRT push-pull flow link is released and a preset time has elapsed. Within the preset time, if the client establishes the second SRT push-pull stream link again through the second SRT push-pull stream address, it can continue the video intercom service with the target end normally without waiting for the client to re-establish the first SRT push-pull stream link. , which helps to improve efficiency. In addition, when the client fails and cannot send data to the media server, the resources of the first SRT push-pull stream link are released after a preset time to avoid empty running of resources occupied for a long time.
参考图1和图7,本发明还提供应用于客户端的基于SRT通信协议的可视对讲方法,包括:Referring to Figures 1 and 7, the present invention also provides a visual intercom method based on the SRT communication protocol applied to the client, including:
S200:向信令服务器发送第一请求信息,所述第一请求信息包括客户端的客户端识别信息以及目标端的目标端识别信息;S200: Send first request information to the signaling server, where the first request information includes client identification information of the client and target identification information of the target terminal;
S210:从信令服务器获取第二SRT推拉流地址;S210: Obtain the second SRT push-pull stream address from the signaling server;
S220:根据所述第二SRT推拉流地址,与媒体服务器建立第二SRT推拉流链接;S220: Establish a second SRT push-pull stream link with the media server according to the second SRT push-pull stream address;
S230:与所述信令服务器建立会话保活链接,所述会话保活链接用于维持所述第二SRT推拉流链接;S230: Establish a session keep-alive link with the signaling server. The session keep-alive link is used to maintain the second SRT push-pull flow link;
S240:根据所述第二SRT推拉流链接,发送音频数据至所述媒体服务器以指示所述媒体服务器转发音频数据至所述目标端,从所述媒体服务器获取所述目标端的音频数据和视频数据。S240: According to the second SRT push-pull stream link, send audio data to the media server to instruct the media server to forward the audio data to the target end, and obtain the audio data and video data of the target end from the media server .
在进行可视对讲业务时,客户端发送第一请求信息至信令服务器,获取返回的第二SRT推拉流地址,客户端使用第二SRT推拉流地址能够发送第三请求至媒体服务器,以与媒体服务器建立第二SRT推拉流链接。客户端基于第二SRT推拉流链接,能够发送本地的音频数据作为推流发送至媒体服务器以让目标端获取,同时从媒体服务器获取作为拉流的目标端的音频数据和视频数据,利用媒体服务器作为中继与目标端实现可视对讲。以此,使用SRT协议与URL技术结合,生成的第二SRT推拉流地址,客户端能够使用第二SRT推拉流地址,快速、便捷地与媒体服务器建立第二SRT推拉流链接,有利于简化建立链接通道的过程,并且SRT推拉流链接具有双向传输的特性,能够在同一SRT推拉流链接通道上传输视频数据和音频数据,无需额外建立对讲通道,同时,基于URL格式的第二SRT推拉流地址,传输时数据量小,有利于实现轻量化搭建链接。When performing the video intercom service, the client sends the first request information to the signaling server to obtain the returned second SRT push-pull stream address. The client can use the second SRT push-pull stream address to send the third request to the media server to Establish a second SRT push-pull stream link with the media server. Based on the second SRT push-pull stream link, the client can send local audio data as a push stream to the media server for the target end to obtain, and at the same time obtain the audio data and video data of the target end as a pull stream from the media server, using the media server as a The relay and target terminal realize visual intercom. In this way, using the second SRT push-pull stream address generated by combining the SRT protocol and URL technology, the client can use the second SRT push-pull stream address to quickly and conveniently establish a second SRT push-pull stream link with the media server, which is conducive to simplifying the establishment. The process of linking channels, and the SRT push-pull stream link has the characteristics of two-way transmission, which can transmit video data and audio data on the same SRT push-pull stream link channel without the need to establish an additional intercom channel. At the same time, a second SRT push-pull stream based on the URL format Address, the amount of data during transmission is small, which is conducive to lightweight link building.
由于信令服务器用于管理链接会话,客户端与信令服务器建立会话保活链接,用于维持第二SRT推拉流链接,当客户端出现故障等情况时,信令服务器不能够通过会话保活链接收到客户端的保活心跳包,信令服务器能够向媒体服务器发送指令,以使媒体服务器关闭第二SRT推拉流链接释放资源。以此,能够在客户端故障时,及时关闭第二SRT推拉流链接,避免长期占用资源。Since the signaling server is used to manage link sessions, the client establishes a session keep-alive link with the signaling server to maintain the second SRT push-pull stream link. When the client fails, the signaling server cannot use session keep-alive. After the link receives the keep-alive heartbeat packet from the client, the signaling server can send an instruction to the media server so that the media server closes the second SRT push-pull stream link to release resources. In this way, when the client fails, the second SRT push-pull stream link can be closed in time to avoid long-term resource occupation.
保活会话链接用于周期性发送保活心跳数据包,能够获知链接的对方是否正常工作或者使用的链路是否可靠,当超过预设时间没收到保活心跳数据包,可认为链接的对方故障或者链路故障。The keep-alive session link is used to periodically send keep-alive heartbeat packets to know whether the other party of the link is working normally or whether the link used is reliable. If the keep-alive heartbeat packet is not received after the preset time, it can be considered that the other party of the link is faulty. Or the link fails.
参考图1和图7,本发明提供应用于客户端的基于SRT通信协议的可视对讲方法,在一些实施例中,在所述S240之后,还包括:Referring to Figures 1 and 7, the present invention provides a visual intercom method based on the SRT communication protocol applied to the client. In some embodiments, after the S240, it also includes:
S250:响应于停止操作,关闭与所述信令服务器之间的所述会话保活链接;S250: In response to the stop operation, close the session keepalive link with the signaling server;
S260:发送停止请求至所述媒体服务器以关闭所述第二SRT推拉流链接。S260: Send a stop request to the media server to close the second SRT push-pull stream link.
当使用者完成可视对讲业务产生停止操作,客户端关闭与信令服务器之间的会话保活链接,并且通过第二SRT推拉流链接发送停止请求至媒体服务器,使得媒体服务器关闭第二SRT推拉流链接以释放链接资源。When the user completes the stop operation of the video intercom service, the client closes the session keepalive link with the signaling server, and sends a stop request to the media server through the second SRT push-pull stream link, causing the media server to close the second SRT. Push and pull streaming links to release link resources.
参考图1和图8,本发明还提供应用于目标端的基于SRT通信协议的可视对讲方法,包括:Referring to Figures 1 and 8, the present invention also provides a visual intercom method based on the SRT communication protocol applied to the target end, including:
S300:获取第一SRT推拉流地址;S300: Obtain the first SRT push-pull stream address;
S310:根据所述第一SRT推拉流地址,与媒体服务器建立第一SRT推拉流链接;S310: Establish a first SRT push-pull stream link with the media server according to the first SRT push-pull stream address;
S320:根据所述第一SRT推拉流链接,发送视频数据和音频数据至所述媒体服务器以指示所述媒体服务器转发视频数据和音频数据至客户端,从所述媒体服务器获取所述客户端的音频数据。S320: According to the first SRT push-pull stream link, send video data and audio data to the media server to instruct the media server to forward the video data and audio data to the client, and obtain the client's audio from the media server data.
信令服务器将第一SRT推拉流地址发送给目标端,目标端使用获取的第一SRT推拉流地址,会产生发送至媒体服务器的第二请求信息,进而能够与媒体服务器建立第一SRT推拉流链接。目标端基于第一SRT推拉流链接,能够将本地产生的视频数据和音频数据作为推流发送至媒体服务器以让客户端获取,同时亦能够获取作为拉流的客户端的音频数据,进行本地播放,利用媒体服务器作为中继达到可视对讲的目的。以此,使用SRT协议与URL技术结合,生成的第一SRT推拉流地址,目标端能够使用第一SRT推拉流地址,快速、便捷地与媒体服务器建立第一SRT推拉流链接,有利于简化建立链接通道的过程,并且SRT推拉流链接具有双向传输的特性,能够在同一SRT推拉流链接通道上传输视频数据和音频数据,无需额外建立对讲通道,同时,基于URL格式的第一SRT推拉流地址,传输时数据量小,有利于实现轻量化搭建链接。The signaling server sends the first SRT push-pull stream address to the target end. The target end uses the obtained first SRT push-pull flow address to generate the second request information sent to the media server, and then can establish the first SRT push-pull flow with the media server. Link. Based on the first SRT push-pull stream link, the target end can send locally generated video data and audio data as push streams to the media server for the client to obtain. At the same time, it can also obtain the audio data of the client as a pull stream for local playback. Use the media server as a relay to achieve the purpose of video intercom. In this way, using the SRT protocol combined with URL technology to generate the first SRT push-pull stream address, the target can use the first SRT push-pull stream address to quickly and conveniently establish the first SRT push-pull stream link with the media server, which is conducive to simplifying the establishment. The process of linking channels, and the SRT push-pull stream link has the characteristics of two-way transmission, which can transmit video data and audio data on the same SRT push-pull stream link channel without the need to establish an additional intercom channel. At the same time, the first SRT push-pull stream based on the URL format Address, the amount of data during transmission is small, which is conducive to lightweight link building.
参考图1和图8,本发明提供应用于目标端的基于SRT通信协议的可视对讲方法,在一些实施例中,在所述S320之后,还包括:Referring to Figures 1 and 8, the present invention provides a video intercom method based on the SRT communication protocol applied to the target end. In some embodiments, after the S320, it also includes:
S330:当从所述媒体服务器不能获取所述客户端的音频数据并且持续预设时间后,关闭所述第一SRT推拉流链接。S330: When the audio data of the client cannot be obtained from the media server and continues for a preset time, close the first SRT push-pull stream link.
不能从媒体服务器获取客户端的音频数据并且持续预设时间后,可认为客户端故障,不能继续进行可视对讲,因此关闭第一SRT推拉流链接以释放链接资源,有利于避免链接资源长期被占用空运行,提高资源利用率。After the client's audio data cannot be obtained from the media server for a preset time, it can be considered that the client is faulty and video intercom cannot continue. Therefore, the first SRT push-pull stream link is closed to release the link resources, which is helpful to prevent the link resources from being used for a long time. Occupy empty running and improve resource utilization.
参考图1和图9,本发明还提供应用于信令服务器的基于SRT通信协议的可视对讲方法,包括:Referring to Figures 1 and 9, the present invention also provides a visual intercom method based on the SRT communication protocol applied to the signaling server, including:
S400:响应于客户端的第一请求信息,所述第一请求信息包括客户端的客户端识别信息以及目标端的目标端识别信息;S400: Respond to the first request information of the client, where the first request information includes the client identification information of the client and the target identification information of the target terminal;
S410:转发所述第一请求信息至媒体服务器,以获取第一SRT推拉流地址;S410: Forward the first request information to the media server to obtain the first SRT push-pull stream address;
S420:发送所述第一SRT推拉流地址至所述目标端,以使所述目标端基于所述第一SRT推拉流地址与所述媒体服务器建立第一SRT推拉流链接;S420: Send the first SRT push-pull stream address to the target terminal, so that the target terminal establishes a first SRT push-pull stream link with the media server based on the first SRT push-pull stream address;
S430:从所述媒体服务器获取第二SRT推拉流地址;S430: Obtain the second SRT push-pull stream address from the media server;
S440:将所述第二SRT推拉流地址发送至所述客户端,以使所述客户端基于所述第二SRT推拉流地址与所述媒体服务器建立第二SRT推拉流链接。S440: Send the second SRT push-pull stream address to the client, so that the client establishes a second SRT push-pull stream link with the media server based on the second SRT push-pull stream address.
信令服务器收到客户端发送的第一请求信息后转发至媒体服务器,将媒体服务器生成的第一SRT推拉流地址转发至目标端,在目标端与媒体服务器建立第一SRT推拉流链接后,媒体服务器生成第二SRT推拉流地址,信令服务器从媒体服务器获取第二SRT推拉流地址后转发至客户端,客户端基于第二SRT推拉流地址能够与媒体服务器建立第二SRT推拉流链接,进而进行可视对讲。以此,使用SRT协议与URL技术结合,生成的第一SRT推拉流地址、第二SRT推拉流地址,能够快速、便捷地与媒体服务器建立SRT推拉流链接,有利于简化建立链接通道的过程,并且SRT推拉流链接具有双向传输的特性,能够在同一SRT推拉流链接通道上传输视频数据和音频数据,无需额外建立对讲通道,同时,基于URL格式的第一SRT推拉流地址、第二SRT推拉流地址,传输时数据量小,有利于实现轻量化搭建链接。After receiving the first request information sent by the client, the signaling server forwards it to the media server, and forwards the first SRT push-pull stream address generated by the media server to the target end. After the target end establishes the first SRT push-pull flow link with the media server, The media server generates a second SRT push-pull stream address, and the signaling server obtains the second SRT push-pull stream address from the media server and forwards it to the client. The client can establish a second SRT push-pull stream link with the media server based on the second SRT push-pull stream address. Then carry out visual intercom. In this way, the first SRT push-pull stream address and the second SRT push-pull stream address generated by using the SRT protocol and URL technology can quickly and conveniently establish an SRT push-pull stream link with the media server, which is conducive to simplifying the process of establishing a link channel. Moreover, the SRT push-pull stream link has bidirectional transmission characteristics and can transmit video data and audio data on the same SRT push-pull stream link channel without establishing an additional intercom channel. At the same time, based on the URL format of the first SRT push-pull stream address, the second SRT The push-pull stream address has a small amount of data during transmission, which is conducive to lightweight link building.
下面对本发明提供的可视对讲系统进行描述,下文描述的可视对讲系统与上文描述的基于SRT通信协议的可视对讲方法可相互对应参照。The video intercom system provided by the present invention is described below. The video intercom system described below and the video intercom method based on the SRT communication protocol described above can correspond to each other.
参考图10,本发明还提供可视对讲系统,包括:客户端设备、目标端设备、信令服务器以及媒体服务器;Referring to Figure 10, the present invention also provides a video intercom system, including: client device, target device, signaling server and media server;
所述客户端设备发送第一请求信息至所述信令服务器;The client device sends first request information to the signaling server;
所述信令服务器转发所述第一请求信息至所述媒体服务器;The signaling server forwards the first request information to the media server;
所述媒体服务器根据所述第一请求信息,按照URL格式生成与所述目标端设备对应的第一SRT推拉流地址,发送所述第一SRT推拉流地址至所述信令服务器;The media server generates a first SRT push-pull stream address corresponding to the target device according to the URL format according to the first request information, and sends the first SRT push-pull stream address to the signaling server;
所述信令服务器转发所述第一SRT推拉流地址至所述目标端设备;The signaling server forwards the first SRT push-pull stream address to the target device;
所述目标端设备根据所述第一SRT推拉流地址与所述媒体服务器建立第一SRT推拉流链接;The target device establishes a first SRT push-pull stream link with the media server based on the first SRT push-pull stream address;
所述媒体服务器根据所述第一SRT推拉流链接以及所述第一请求信息,生成第二SRT推拉流地址,发送所述第二SRT推拉流地址至所述信令服务器;The media server generates a second SRT push-pull stream address according to the first SRT push-pull stream link and the first request information, and sends the second SRT push-pull stream address to the signaling server;
所述信令服务器转发所述第二SRT推拉流地址至所述客户端设备;The signaling server forwards the second SRT push-pull stream address to the client device;
所述客户端设备根据所述第二SRT推拉流地址与所述媒体服务器建立第二SRT推拉流链接;The client device establishes a second SRT push-pull stream link with the media server according to the second SRT push-pull stream address;
所述媒体服务器根据所述第一SRT推拉流链接,获取所述目标端设备的视频数据和音频数据并且发送所述客户端设备的音频数据至所述目标端设备,根据所述第二SRT推拉流链接,获取所述客户端设备的音频数据并且发送所述目标端设备的视频数据和音频数据至所述客户端设备。The media server pushes and pulls the stream link according to the first SRT, obtains the video data and audio data of the target device and sends the audio data of the client device to the target device, and pushes and pulls according to the second SRT. Stream link, obtain the audio data of the client device and send the video data and audio data of the target device to the client device.
将SRT协议与URL技术结合,通过第一SRT推拉流地址、第二SRT推拉流地址,目标端设备、客户端设备能够便捷、快速与媒体服务器建立第一SRT推拉流链接、第二SRT推拉流链接,有利于简化建立链接通道的过程,并且SRT推拉流链接具有双向传输的特性,能够在同一SRT推拉流链接通道上传输视频数据和音频数据,无需额外建立对讲通道,同时,基于URL格式的第一SRT推拉流地址、第二SRT推拉流地址,传输时数据量小,有利于实现轻量化搭建链接。Combining the SRT protocol with URL technology, through the first SRT push-pull stream address and the second SRT push-pull stream address, the target device and client device can conveniently and quickly establish the first SRT push-pull stream link and the second SRT push-pull stream with the media server. link, which helps simplify the process of establishing a link channel, and the SRT push-pull stream link has the characteristics of two-way transmission, and can transmit video data and audio data on the same SRT push-pull stream link channel without the need to establish an additional intercom channel. At the same time, based on the URL format The first SRT push-pull flow address and the second SRT push-pull flow address have a small amount of data during transmission, which is conducive to lightweight link construction.
客户端设备具体可以是为手机、计算机、嵌入式设备等实施方式。目标端设备具体可以是为手机、计算机、监控设备、智能门铃等实施方式。采用信令服务器和媒体服务器的结构,能够明确划分功能,便于管理和扩展。The client device may specifically be a mobile phone, a computer, an embedded device, or other implementations. The target device may specifically be a mobile phone, a computer, a monitoring device, a smart doorbell and other implementations. The structure of signaling server and media server can clearly divide functions and facilitate management and expansion.
图11示例了本发明提供的一种电子设备的实体结构示意图,如图11所示,该电子设备可以包括:处理器(processor)810、通信接口(Communications Interface)820、存储器(memory)830和通信总线840,其中,处理器810,通信接口820,存储器830通过通信总线840完成相互间的通信。处理器810可以调用存储器830中的逻辑指令,以执行上述的基于SRT通信协议的可视对讲方法。Figure 11 is a schematic diagram of the physical structure of an electronic device provided by the present invention. As shown in Figure 11, the electronic device may include: a processor (processor) 810, a communications interface (Communications Interface) 820, a memory (memory) 830 and Communication bus 840, in which the processor 810, the communication interface 820, and the memory 830 complete communication with each other through the communication bus 840. The processor 810 can call logical instructions in the memory 830 to execute the above-mentioned video intercom method based on the SRT communication protocol.
本发明提供的电子设备,可作为媒体服务器、客户端设备、目标端设备或信令服务器使用。The electronic device provided by the present invention can be used as a media server, client device, target device or signaling server.
此外,上述的存储器830中的逻辑指令可以通过软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本发明的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本发明各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、磁碟或者光盘等各种可以存储程序代码的介质。In addition, the above-mentioned logical instructions in the memory 830 can be implemented in the form of software functional units and can be stored in a computer-readable storage medium when sold or used as an independent product. Based on this understanding, the technical solution of the present invention essentially or the part that contributes to the existing technology or the part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium, including Several instructions are used to cause a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in various embodiments of the present invention. The aforementioned storage media include: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), magnetic disk or optical disk and other media that can store program code. .
另一方面,本发明还提供一种计算机程序产品,所述计算机程序产品包括计算机程序,计算机程序可存储在非暂态计算机可读存储介质上,所述计算机程序被处理器执行时,计算机能够执行上述各方法所提供的基于SRT通信协议的可视对讲方法。On the other hand, the present invention also provides a computer program product. The computer program product includes a computer program. The computer program can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can Execute the video intercom method based on the SRT communication protocol provided by each of the above methods.
又一方面,本发明还提供一种非暂态计算机可读存储介质,其上存储有计算机程序,该计算机程序被处理器执行时实现以执行上述各方法提供的基于SRT通信协议的可视对讲方法。In another aspect, the present invention also provides a non-transitory computer-readable storage medium on which a computer program is stored. The computer program is implemented when executed by the processor to execute the visual interface based on the SRT communication protocol provided by the above methods. Talk about methods.
以上所描述的装置实施例仅仅是示意性的,其中所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部模块来实现本实施例方案的目的。本领域普通技术人员在不付出创造性的劳动的情况下,即可以理解并实施。The device embodiments described above are only illustrative. The units described as separate components may or may not be physically separated. The components shown as units may or may not be physical units, that is, they may be located in One location, or it can be distributed across multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment. Persons of ordinary skill in the art can understand and implement the method without any creative effort.
通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到各实施方式可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件。基于这样的理解,上述技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品可以存储在计算机可读存储介质中,如ROM/RAM、磁碟、光盘等,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行各个实施例或者实施例的某些部分所述的方法。Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the part of the above technical solution that essentially contributes to the existing technology can be embodied in the form of a software product. The computer software product can be stored in a computer-readable storage medium, such as ROM/RAM, magnetic disc, optical disk, etc., including a number of instructions to cause a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in various embodiments or certain parts of the embodiments.
最后应说明的是:以上实施例仅用以说明本发明的技术方案,而非对其限制;尽管参照前述实施例对本发明进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本发明各实施例技术方案的精神和范围。Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present invention, but not to limit it; although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that it can still be used Modifications are made to the technical solutions described in the foregoing embodiments, or equivalent substitutions are made to some of the technical features; however, these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims (15)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202311142068.9A CN116896546B (en) | 2023-09-06 | 2023-09-06 | Visual intercom method, system and storage medium based on SRT communication protocol |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202311142068.9A CN116896546B (en) | 2023-09-06 | 2023-09-06 | Visual intercom method, system and storage medium based on SRT communication protocol |
Publications (2)
Publication Number | Publication Date |
---|---|
CN116896546A true CN116896546A (en) | 2023-10-17 |
CN116896546B CN116896546B (en) | 2023-12-26 |
Family
ID=88315166
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202311142068.9A Active CN116896546B (en) | 2023-09-06 | 2023-09-06 | Visual intercom method, system and storage medium based on SRT communication protocol |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN116896546B (en) |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2020086452A1 (en) * | 2018-10-22 | 2020-04-30 | Radiant Communications Corporation | Low-latency video internet streaming for management and transmission of multiple data streams |
CN112333268A (en) * | 2020-11-02 | 2021-02-05 | 中国联合网络通信集团有限公司 | Data transmission method and device |
US11100197B1 (en) * | 2020-04-10 | 2021-08-24 | Avila Technology Llc | Secure web RTC real time communications service for audio and video streaming communications |
CN114598428A (en) * | 2022-05-10 | 2022-06-07 | 北京中科大洋科技发展股份有限公司 | Redundancy flow pushing method based on SRT protocol |
US11388068B1 (en) * | 2020-10-21 | 2022-07-12 | Sprint Communications Company L.P. | Service record tracker network function |
CN115103146A (en) * | 2022-06-15 | 2022-09-23 | 中移(杭州)信息技术有限公司 | Video playback method, device, device and storage medium |
-
2023
- 2023-09-06 CN CN202311142068.9A patent/CN116896546B/en active Active
Patent Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2020086452A1 (en) * | 2018-10-22 | 2020-04-30 | Radiant Communications Corporation | Low-latency video internet streaming for management and transmission of multiple data streams |
US20210377330A1 (en) * | 2018-10-22 | 2021-12-02 | Radiant Communications Corporation | Low-latency video internet streaming for management and transmission of multiple data streams |
US11100197B1 (en) * | 2020-04-10 | 2021-08-24 | Avila Technology Llc | Secure web RTC real time communications service for audio and video streaming communications |
US11388068B1 (en) * | 2020-10-21 | 2022-07-12 | Sprint Communications Company L.P. | Service record tracker network function |
CN112333268A (en) * | 2020-11-02 | 2021-02-05 | 中国联合网络通信集团有限公司 | Data transmission method and device |
CN114598428A (en) * | 2022-05-10 | 2022-06-07 | 北京中科大洋科技发展股份有限公司 | Redundancy flow pushing method based on SRT protocol |
CN115103146A (en) * | 2022-06-15 | 2022-09-23 | 中移(杭州)信息技术有限公司 | Video playback method, device, device and storage medium |
Non-Patent Citations (2)
Title |
---|
井坂一喜: "SRT(secure reliable transport)", 《映像情報メディア学会誌》, vol. 74, no. 1 * |
张博力;: "浅谈SRT传输协议在广播电视信号传输中的应用", 现代电视技术, no. 05 * |
Also Published As
Publication number | Publication date |
---|---|
CN116896546B (en) | 2023-12-26 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CA2611776C (en) | Method and communication unit for communicating between communication apparatuses | |
CN111479121B (en) | Live broadcasting method and system based on streaming media server | |
US7177398B2 (en) | Bi-directional messaging for an emergency services network | |
US7904521B2 (en) | Method for transferring chat messages by establishing chat room data transfer channel | |
JP2005318503A (en) | Presence server, session control server, packet relay system, server, and system | |
JP2009523330A (en) | Voice instant messaging between mobile and computing devices | |
CN112995234B (en) | Media transmission link management method and device | |
WO2019184262A1 (en) | Multi-type media data network address translation traversing method, terminal and system | |
WO2019128647A1 (en) | Message transmission method and device, storage medium and electronic device | |
US11671487B1 (en) | Port prediction for peer-to-peer communications | |
EP2863591A1 (en) | Transmission method for media data stream and thin client | |
CN113014855B (en) | Video conference acceleration method, system and video conference acceleration platform | |
CN109889405B (en) | Communication method of network telephone, related device and system | |
WO2008003217A1 (en) | A method and appratus and system for transfering short message | |
CN116896546A (en) | Visual intercom method, system and storage medium based on SRT communication protocol | |
CN101938521B (en) | Method for transmitting signaling in VoIP system | |
CN113596147B (en) | Message pushing method, device, equipment and storage medium | |
CN114143387A (en) | Quic-based application layer communication method, device and storage medium | |
CN108881774B (en) | Calling system and method for multimedia network call | |
CN112788348A (en) | On-demand method, device, equipment, system and storage medium | |
JP3296354B2 (en) | Data communication method, client, server, and recording medium recording communication program | |
JP3968060B2 (en) | Session media holding method, holding device, holding program, and recording medium recording the program | |
CN110768824B (en) | A hybrid network system and method for establishing communication connection thereof | |
KR101303543B1 (en) | A total session management for a multimedia instant messaging service and the management method thereof | |
JP2005317001A (en) | Presence server, session control server and packet relay system |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |