Video stream switching system and device based on multi-node assistance

By using a signaling server to select the primary and backup receiving nodes in a video surveillance system based on the GB28181 protocol, and generating push and pull commands, the problem of the front-end player being unable to automatically switch when a streaming media node fails is solved, ensuring the reliability of the video stream and the user experience.

CN121644770APending Publication Date: 2026-03-10DONGTU TECH (YICHANG) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-25
Publication Date
2026-03-10

AI Technical Summary

Technical Problem

In video surveillance systems based on the GB28181 protocol, when a streaming media node fails, the front-end player cannot automatically and quickly switch to a healthy node, forcing users to manually re-initiate playback requests, which affects the viewing experience.

Method used

A video stream switching system based on multi-node assistance is provided. The signaling server selects the primary receiving node and the backup node according to the node load, generates push and pull commands, pushes the video stream to the primary receiving node through the camera and copies it to the backup node. The front-end player receives the pull information and quickly switches to another healthy node to continue playback when a fault is detected.

Benefits of technology

It enables automatic and rapid switching of the front-end player when the streaming media node fails, improving the reliability and continuity of the video stream and enhancing the user playback experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121644770A_ABST
    Figure CN121644770A_ABST
Patent Text Reader

Abstract

The invention relates to a video stream switching system and device based on multi-node assistance, and the system comprises a signaling server which is used for selecting a main receiving node and a corresponding standby node from all media nodes according to a node load; stream pushing instructions matched with all the main receiving nodes are generated respectively, and all the stream pushing instructions are sent to a camera; generating pull stream information, and sending the pull stream information to a front-end player; the camera is used for pushing a video stream to the main receiving node according to the stream pushing instruction; the main receiving node is used for copying the received video stream to the associated standby node; the front-end player is used for sending a playing request to the signaling server; and pulling the stream according to the stream pulling information to obtain and play the video stream, and when detecting that the current stream pulling node fails, quickly switching to another healthy node to continue playing based on the stream pulling information. The problem that the front-end player cannot be automatically and quickly switched to the healthy node when the current streaming media node fails is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of video stream processing technology, and in particular to a video stream switching system and device based on multi-node assistance. Background Technology

[0002] In video surveillance systems based on the GB28181 protocol, the signaling plane and media plane are typically deployed separately. The signaling plane is mainly used for device registration, session establishment, and control, while the media plane is responsible for receiving and forwarding video streams.

[0003] In practical applications, when a front-end player requests playback, it needs to call the signaling server to generate the corresponding port and notify the camera to push the stream. When a streaming media node crashes or malfunctions, the user needs to manually close the video and re-initiate the playback request, which is time-consuming and affects the viewing experience. Furthermore, even if there are multiple streaming media servers in the system, the front-end player still cannot quickly reconnect or automatically switch when a streaming media node fails.

[0004] Therefore, when the current streaming media node fails, the front-end player cannot automatically and quickly switch to a healthy node, requiring the user to manually re-initiate the playback request, which leads to a time-consuming process and affects the user's viewing experience.

[0005] There is currently no effective solution to the above problems. Summary of the Invention

[0006] This application provides a video stream switching system and device based on multi-node assistance to solve the aforementioned technical problem that "when the current streaming media node fails, the front-end player cannot automatically and quickly switch to a healthy node".

[0007] According to one aspect of the embodiments of this application, this application provides a video stream switching system based on multi-node assistance, comprising: a signaling server, configured to, upon receiving a playback request sent by a front-end player, select at least one primary receiving node from various media nodes based on node load, and determine at least one backup node corresponding to the primary receiving node; generate push streaming instructions matching each primary receiving node, and send each push streaming instruction to a camera; generate pull streaming information, and send the pull streaming information to the front-end player; a camera, configured to push a video stream to the primary receiving node according to the push streaming instructions; a primary receiving node, configured to copy the received video stream to an associated backup node; a front-end player, configured to send a playback request to the signaling server, and receive the pull streaming information returned by the signaling server; pull streaming according to the pull streaming information to obtain and play the video stream, and, upon detecting a failure of the current pull streaming node, quickly switch to another healthy node to continue playback based on the pull streaming information.

[0008] Optionally, the streaming information returned by the signaling server is a logical playback address. The front-end player uses this logical playback address to initiate a streaming request to the proxy server deployed on the signaling server. Upon receiving the streaming request, the proxy server selects a target node from the primary receiving node and its corresponding backup node, and pulls the video stream through the target node. It then outputs the video stream to the front-end player, monitors the output status of the target node, and if the output status of the target node is abnormal, reselects a healthy node as the new target node. Finally, it pulls the video stream through the new target node to continuously output the video stream to the front-end player.

[0009] Optionally, the streaming information returned by the signaling server is a playlist including the primary receiving node and the backup node, with each node in the playlist sorted by priority; the front-end player pulls the video stream from the target node in priority order, where the target node is the node with the highest priority in the playlist; when the streaming is interrupted at the target node, it automatically switches to the next priority media node for streaming.

[0010] Optionally, the system also includes a preheating service module, which is used to collect multiple operating indicators of each media node at preset intervals; calculate each operating indicator of each media node using a preset scoring formula to obtain a comprehensive score for each media node; sort each media node from high to low according to the comprehensive score to obtain a sorting table; and send the sorting table to the signaling server.

[0011] Optionally, multiple operational metrics include the current CPU utilization, current memory utilization, current thread load, current bandwidth utilization, and current stream percentage of the media node. The preheating service module is specifically used to: obtain the metric values ​​of each operational metric; subtract each metric value from the target value to obtain the idle rate corresponding to each operational metric; and perform a weighted summation of the idle rates to obtain the comprehensive score of the media node.

[0012] Optionally, the signaling server is also used to receive the sorting table sent by the preheating service module; determine the media nodes ranked before the first sequence number in the sorting table as the primary receiving nodes; and determine the backup nodes corresponding to the primary receiving nodes among the media nodes ranked before the second sequence number in the sorting table, wherein the second sequence number is greater than the first sequence number.

[0013] Optionally, the signaling server is also used to obtain node identification data of the primary receiving node and the backup node that have a corresponding relationship, wherein the node identification data includes the first node identifier of the primary receiving node and the second node identifier of the backup node; for each primary receiving node, a push command is generated based on the node identification data.

[0014] Optionally, the camera is also used to initiate a session establishment request to the main receiving node after receiving the streaming instruction, so as to establish a streaming session with the main receiving node; the signaling server is also used to generate an identifier after the camera establishes a streaming session with the main receiving node, wherein the identifier is used to identify the streaming session; and insert the identifier into a pre-configured address template to generate a logical playback address.

[0015] Optionally, the proxy server is also used to parse the streaming request when it receives it, and obtain the node identification data of the main receiving node and the backup node corresponding to the video stream; look up the health status of each main receiving node in the health mapping table based on the node identification data, wherein the health mapping table is generated by monitoring the running status of each media node; determine the target node among the main receiving nodes based on the health status, and establish a streaming session with the target node to obtain the video stream through the streaming session.

[0016] Optionally, the front-end player is also used to monitor the playback status of the video stream during playback; if the playback status is abnormal, it attempts to restore the connection with the signaling server; if the connection with the signaling server cannot be restored within a preset time, it re-initiates a new pull request to the signaling server according to the logical playback address.

[0017] According to another aspect of the embodiments of this application, this application provides a video stream switching device based on multi-node assistance, including the video stream switching system described above.

[0018] Compared with related technologies, the technical solutions provided in this application have the following advantages: This application provides a video stream switching system based on multi-node assistance, comprising: a signaling server, configured to, upon receiving a playback request from a front-end player, select at least one primary receiving node from various media nodes based on node load, and determine at least one backup node corresponding to the primary receiving node; generate push streaming instructions matching each primary receiving node, and send each push streaming instruction to a camera; generate pull streaming information, and send pull streaming information to the front-end player; a camera, configured to push the video stream to the primary receiving node according to the push streaming instructions; a primary receiving node, configured to copy the received video stream to an associated backup node; and a front-end player, configured to send a playback request to the signaling server and receive the pull streaming information returned by the signaling server; pull streaming according to the pull streaming information to acquire and play the video stream, and, upon detecting a failure of the current pull streaming node, quickly switch to another healthy node to continue playback based on the pull streaming information. First, the signaling server selects the primary receiving node and corresponding backup node according to load, and sends push streaming instructions to the camera and pull streaming information to the front-end player respectively; then, the primary receiving node copies the video stream to the backup node to form a redundant stream; finally, the front-end player performs pull streaming and video stream switching when playback is interrupted using the pull streaming information. This solves the problem that the front-end player cannot automatically and quickly switch to a healthy node when the current streaming media node fails. Attached Figure Description

[0019] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.

[0020] To more clearly illustrate the technical solutions in the embodiments of this application or related technologies, the accompanying drawings used in the description of the embodiments or related technologies will be briefly introduced below. Obviously, those skilled in the art can obtain other drawings based on these drawings without creative effort.

[0021] Figure 1 This is a schematic diagram illustrating the composition of an optional video stream switching system based on multi-node assistance, according to an embodiment of this application. Figure 2 A flowchart of an optional video stream switching method based on multi-node assistance provided according to an embodiment of this application; Figure 3 This is a timing diagram of an optional video playback process provided according to an embodiment of this application. Detailed Implementation

[0022] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0023] In the following description, the use of suffixes such as "module," "part," or "unit" to denote elements is solely for the purpose of illustration and has no specific meaning in itself. Therefore, "module" and "part" may be used interchangeably.

[0024] In video surveillance systems based on the GB28181 protocol, the signaling plane and media plane are typically deployed separately. The signaling plane is mainly used for device registration, session establishment, and control, while the media plane is responsible for receiving and forwarding video streams.

[0025] In practical applications, when a front-end player requests playback, it needs to call the signaling server to generate the corresponding port and notify the camera to push the stream. When a streaming media node crashes or malfunctions, the user needs to manually close the video and re-initiate the playback request, which is time-consuming and affects the viewing experience. Furthermore, even if there are multiple streaming media servers in the system, the front-end player still cannot quickly reconnect or automatically switch when a streaming media node fails.

[0026] Therefore, when the current streaming media node fails, the front-end player cannot automatically and quickly switch to a healthy node, requiring the user to manually re-initiate the playback request, which leads to a time-consuming process and affects the user's viewing experience.

[0027] To address the problems mentioned in the background art, according to one aspect of an embodiment of this application, a video stream switching system based on multi-node assistance is provided, such as... Figure 1 As shown, it includes: The signaling server 101 is used to select at least one main receiving node from various media nodes according to the node load when receiving a playback request sent by the front-end player, and determine at least one backup node corresponding to the main receiving node; generate push streaming instructions matching each main receiving node and send each push streaming instruction to the camera; generate pull streaming information and send pull streaming information to the front-end player. Camera 102 is used to push video streams to the main receiving node according to the streaming instructions; The primary receiving node 103 is used to copy the received video stream to the associated backup node; The front-end player 104 is used to send playback requests to the signaling server and receive streaming information returned by the signaling server; it pulls the stream according to the streaming information to obtain and play the video stream, and when the current streaming node is detected to be faulty, it quickly switches to another healthy node to continue playback based on the streaming information.

[0028] During the session establishment phase, the signaling server selects the primary receiving node based on the load of the media nodes and assigns at least one backup node to each primary receiving node to build a multi-node reception redundancy link.

[0029] The camera pushes the video stream to the main receiving node according to the push command, and the main receiving node copies the received video stream to the corresponding backup node, realizing synchronous storage across multiple nodes, thereby ensuring that the system can still provide a backup data source when the main node fails.

[0030] The signaling server provides the player with streaming information including multiple primary and backup nodes that have already received video streams, enabling the front-end player to quickly switch video streams.

[0031] The video stream switching system provided in this application ensures the reliability and continuity of the video stream in a multi-node environment, significantly improving the disaster recovery capability of streaming media services and the user playback experience.

[0032] As an optional implementation, the streaming information returned by the signaling server is a logical playback address. The front-end player uses this logical playback address to initiate a streaming request to the proxy server deployed on the signaling server. Upon receiving the streaming request, the proxy server selects a target node from the primary receiving node and its corresponding backup node, and pulls the video stream through the target node. It then outputs the video stream to the front-end player, monitors the output status of the target node, and if the output status of the target node is abnormal, reselects a healthy node as the new target node. Finally, it pulls the video stream through the new target node to continuously output the video stream to the front-end player.

[0033] In scenarios with a proxy server, the streaming information is a logical playback address, which does not point to a specific node's address. The player only recognizes this logical address for connection and playback. When playback is interrupted, the player does not perform complex node checks; it simply performs a reconnection operation, requesting the same logical address again.

[0034] During video playback, the front-end player obtains a unified formatted logical playback address from the signaling server and sends a streaming request to the proxy server using that address. The proxy server parses the request and selects a healthy node as the target node, providing the front-end player with a single-path access point.

[0035] During video playback, the proxy server continuously monitors the streaming status of the target node. When an anomaly is detected in the current target node, a new healthy node is immediately selected to continue providing the video stream. The entire switching process does not require the involvement of the front-end player. From the player's perspective, it only perceives a brief interruption and subsequent recovery of the connection to the same address, completely unaware that a node switch has occurred at the underlying level. This achieves rapid switching while ensuring uninterrupted playback.

[0036] As an optional implementation, the streaming information returned by the signaling server is a playlist including the primary receiving node and the backup node, with each node in the playlist sorted by priority; the front-end player pulls the video stream from the target node in priority order, where the target node is the node with the highest priority in the playlist; when the streaming is interrupted at the target node, it automatically switches to the next priority media node for streaming.

[0037] The streaming information returned by the signaling server can also be a priority list containing the addresses of multiple redundant nodes (i.e., primary and backup nodes). For example, [address of node A, address of node B, address of node C]. This list is sorted based on the load score of the preheating service module mentioned below, prioritizing the node with the lightest load and the best quality.

[0038] The player first attempts to connect to the first address in the list (usually the primary receiving node), continuously monitoring the connection status of the video stream. If it detects a current connection interruption, stuttering, or timeout (e.g., failure to recover within 200ms), it does not wait for user intervention but automatically and immediately switches to the next address in the list for reconnection. This process continues until an available node is found or the list is exhausted.

[0039] This embodiment pushes the fault-switching logic down to the front-end player, reducing the reliance on a centralized gateway.

[0040] As an optional embodiment, the system also includes a preheating service module, which is used to collect multiple operating indicators of each media node at preset intervals; calculate each operating indicator of each media node using a preset scoring formula to obtain a comprehensive score for each media node; sort each media node from high to low according to the comprehensive score to obtain a sorting table; and send the sorting table to the signaling server.

[0041] The preset period is set according to the actual situation and is a fixed time interval pre-configured by the system. In each period, the preheating service module will monitor the running status of all media nodes once. The monitoring is based on multiple current running indicators of the nodes, which can reflect the real-time performance of each media node.

[0042] After the indicators are collected, the preheating service module calculates the various operating indicators of each media node according to the preset scoring formula to generate a comprehensive score. Then, the media nodes are sorted from high to low according to the comprehensive scores to form a sorting table.

[0043] The sorting table comprehensively reflects the load differences and performance relative strengths and weaknesses of each media node within the current period. After sorting, the preheating service module sends the sorting table to the signaling server so that the signaling server can select the primary receiving node and backup node based on the node priority in the sorting table, making the node selection process more accurate and timely.

[0044] By periodically collecting and scoring operational metrics, node ranking is always based on real-time operational status, thereby avoiding the selection of nodes with excessive load or abnormal performance, and improving the rationality of subsequent signaling server selection of primary and backup receiving nodes.

[0045] As an optional implementation, multiple operating metrics include the current CPU (Central Processing Unit) utilization, current memory utilization, current thread load, current bandwidth utilization, and current stream percentage of the media node. The preheating service module is specifically used to: obtain the metric values ​​of each operating metric; subtract each metric value from the target value to obtain the idle rate corresponding to each operating metric; and perform a weighted summation of the idle rates to obtain the comprehensive score of the media node.

[0046] Assuming a target value of 1, the preset scoring formula provided in this application is: , in, Indicates the current CPU utilization rate. The weighting coefficient represents the current CPU utilization rate. Indicates the current memory usage. The weighting coefficient represents the current memory usage rate. Indicates the current thread load. This represents the weighting coefficient of the current thread load. This indicates the current bandwidth utilization rate. The weighting coefficient represents the current bandwidth utilization rate. Indicates the current percentage of streams. This represents the weighting coefficient indicating the current percentage of streams.

[0047] The operational metrics involved in this application are the current CPU utilization, memory utilization, thread load, bandwidth utilization, and stream count percentage, where the stream count percentage is the ratio of the current number of streams to the maximum allowed number of streams.

[0048] It should be noted that the selection of operating indicators can be adjusted according to actual needs; the examples provided in this application are merely examples.

[0049] The scoring process normalizes each indicator and applies corresponding weights. The final comprehensive score for each media node is obtained by weighted summation. The comprehensive score is used to reflect the overall carrying capacity and health status of the node in the current period.

[0050] In the scoring formula, each operational indicator is expressed in the form of (1 - indicator value). This ensures that the lower the indicator value (indicating a lighter load) and the higher the idle rate, the greater the score for that contribution, thus better reflecting the health of the node.

[0051] The weighting coefficient of idle rate can be adjusted according to the actual needs to determine the importance of different operating indicators. By using different weighting coefficients, the comprehensive score result can better reflect the overall expectations for node performance during system operation.

[0052] The higher the calculated Score(node) value, the lower the overall operating load and the higher the availability of the media node, making it a priority to use as the primary receiving node or a backup node.

[0053] By incorporating metrics such as CPU, memory, threads, bandwidth, and stream count into the scoring, the hardware and service load of media nodes can be evaluated from multiple dimensions, avoiding misjudgments caused by relying on a single metric. When node performance metrics change, the scoring formula can quickly reflect the current state of the node, ensuring that the ranking results are updated in real time based on the latest status, guaranteeing the timeliness and accuracy of node selection.

[0054] As an optional embodiment, the signaling server is also used to receive a sorting table sent by the preheating service module; determine the media nodes ranked before the first sequence number in the sorting table as the primary receiving nodes; and determine the backup nodes corresponding to the primary receiving nodes among the media nodes ranked before the second sequence number in the sorting table, wherein the second sequence number is greater than the first sequence number.

[0055] The first and second serial numbers are set according to the actual situation, and the second serial number must be greater than the first serial number. For example, the first serial number is 3 and the second serial number is 5.

[0056] Since the sorting table is arranged from high to low based on the overall score, the media nodes that are before the first number are in a state of low overall load and healthy resource status in the current period, making them more suitable as the main receiving nodes for camera streaming.

[0057] After determining the primary receiving node, the signaling server continues to select media nodes ranked before the second sequence number (excluding media nodes ranked before the first sequence number) from the sorting table as backup nodes for the primary receiving node. Since the second sequence number is greater than the first sequence number, the score of the backup node is lower than that of the primary receiving node.

[0058] One primary receiving node corresponds to at least one backup node. The backup node is used to receive the video stream copied by the corresponding primary receiving node, so as to ensure that a redundant video stream source can still be provided when the primary receiving node fails.

[0059] The node selection method based on a sorting table ensures that the selection of primary and backup nodes closely reflects the current load status of media nodes, preventing high-load nodes from being mistakenly selected as primary receivers, thus effectively reducing the probability of camera streaming failures. Furthermore, when the primary receiver malfunctions, the backup nodes, drawn from a list of nodes with higher overall scores, are relatively stable and can more quickly take over streaming media reception tasks, ensuring the continuity of the video stream.

[0060] As an optional embodiment, the signaling server is also used to obtain node identification data of the primary receiving node and the backup node that have a corresponding relationship, wherein the node identification data includes the first node identifier of the primary receiving node and the second node identifier of the backup node; for each primary receiving node, a push command is generated based on the node identification data.

[0061] The first node identifier is used to uniquely identify the primary receiving node, and the second node identifier is used to uniquely identify the backup node corresponding to the primary receiving node. By obtaining the node identifier data, the signaling server can clearly identify the identity information of each primary receiving node and simultaneously learn about its associated backup nodes.

[0062] For each primary receiving node, a corresponding streaming instruction (i.e., an INVITE request) is generated based on the node identification data. The streaming instruction includes at least the node address and port information of the primary receiving node, so that the camera can determine the node address and port information to be streamed after receiving the streaming instruction.

[0063] Since the correspondence between the backup node and the primary receiving node is established through node identification data, the primary receiving node can copy the video stream to its corresponding backup node after receiving it, thus achieving redundant distribution of the video stream. This eliminates the need for the camera to directly push the stream to the backup node, thereby avoiding increasing the uplink bandwidth pressure on the camera.

[0064] This application employs the session establishment mechanism from the GB28181 protocol. After generating the streaming instructions (INVITE message), the signaling server sends each streaming instruction to the camera via SIP (Session Initiation Protocol). Upon receiving the INVITE message, the camera establishes an RTP (Real-time Transport Protocol) / RTCP (Real-time Transport Control Protocol) media stream session with the corresponding primary receiving node according to the SDP (Session Description Protocol) information specified in GB28181. This ensures that the video stream can be stably received on multiple primary receiving nodes and further distributed to backup nodes.

[0065] As an optional embodiment, the camera is also used to initiate a session establishment request to the main receiving node after receiving the streaming instruction, so as to establish a streaming session with the main receiving node; the signaling server is also used to generate an identifier after the camera establishes a streaming session with the main receiving node, wherein the identifier is used to identify the streaming session; and insert the identifier into a pre-configured address template to generate a logical playback address.

[0066] The streaming command corresponds to the primary receiving node, which is equivalent to specifying the primary receiving node in the streaming command. After receiving the streaming command, the camera initiates a session establishment request to the corresponding primary receiving node.

[0067] After the camera and the main receiving node successfully establish a streaming session, the signaling server generates an identifier called a stream ID to identify the streaming session. This identifier corresponds to the current streaming session. The stream ID contains at least one of the following information: camera ID / device ID, a unique random number for the session, a timestamp, or a sequence number.

[0068] The signaling server reads the proxy server's access address template from a pre-configured address template, then inserts the aforementioned identifier into that address template to generate the logical playback address. This logical playback address is the access entry point used by the front-end player to access the corresponding video stream.

[0069] For example, the address template is: http: / / video.domain / live / {id}.flv, and the identifier is: streamId. By filling the identifier into the {id} field of the address template, you can get the actual logical playback address, which is http: / / video.domain / live / {streamId}.flv.

[0070] The address template contains the access address of the proxy server. The front-end player always accesses the proxy server instead of directly accessing the actual main receiving node.

[0071] The logical playback address is only used to indicate which stream is being accessed and does not express the network location of the specific receiving node. Even if the underlying receiving node changes due to health checks or other reasons, the logical playback address remains unchanged, and the front-end player does not need to obtain the logical playback address again.

[0072] The front-end player always uses the same logical playback address. Even if the streaming node is changed or the network topology is adjusted, the playback address does not need to be changed, which can reduce the complexity of business maintenance.

[0073] The backup node is used to receive the video stream copied from the associated primary receiving node and to cache the video stream; it provides the video stream to the proxy server if the associated primary receiving node is selected as the target node and the target node malfunctions.

[0074] After receiving the video stream from the camera, the primary receiving node copies the video stream and sends it to its associated backup node. The backup node then buffers the copied video stream upon receiving it.

[0075] When the proxy server processes streaming requests from the front-end player, it selects a primary receiving node as the target node based on its health status. The target node then outputs the video stream. If the target node malfunctions, the proxy server layer immediately switches the streaming path to a backup node associated with the primary receiving node upon detecting the anomaly. This eliminates the need to re-establish the streaming session. The backup node then immediately outputs the corresponding video stream to the proxy server based on its cached video stream, ensuring uninterrupted playback.

[0076] It should be noted that, under normal circumstances, the primary receiving node will be selected as the target node. However, if the health status of each target node changes drastically, the proxy server will select a backup node as the target node based on its health status. If the target node then malfunctions, a new target node needs to be selected based on its health status.

[0077] The target node must be either the primary receiving node or the backup node, because only the primary receiving node and the backup node have the video stream transmitted by the camera.

[0078] Because the backup node caches the video stream from the primary receiving node, even if the primary receiving node fails, the backup node can take over directly, continuously providing the video stream to the proxy server and preventing playback interruptions. Furthermore, the proxy server only needs to switch the streaming object between nodes; it does not need to obtain camera information or reconfigure the push path.

[0079] As an optional implementation, the proxy server is also used to parse the streaming request when it receives it, and obtain the node identification data of the main receiving node and the backup node corresponding to the video stream; look up the health status of each main receiving node in the health mapping table according to the node identification data, wherein the health mapping table is generated by monitoring the running status of each media node; determine the target node among the main receiving nodes according to the health status, and establish a streaming session with the target node to obtain the video stream through the streaming session.

[0080] The proxy server parses the received streaming request and obtains the node identification data of the primary receiving node and the backup node corresponding to the requested video stream. The node identification data contains the unique identification information of each primary receiving node and its associated backup node.

[0081] The proxy server uses the parsed node identifier data to look up the operational health status of each primary receiving node in the health mapping table. The health mapping table is generated and maintained by the proxy server periodically or in real-time monitoring the operational metrics of each media node, and is used to reflect the availability of the nodes.

[0082] The proxy server selects a healthy node from the primary receiving node as the target node based on its health status, establishes a streaming session with the target node, and obtains the video stream from the target node.

[0083] Through a pull session established with the target node, the proxy server outputs the video stream to the front-end player, ensuring that the player can play it normally.

[0084] In addition, under normal circumstances, the proxy server selects the target node from the primary receiving nodes. However, if the health status of each primary receiving node changes suddenly or even becomes unavailable, the proxy server will select the target node from the backup nodes based on the health status.

[0085] The unified access layer functionality in this application is implemented by executing Lua scripts on the proxy server (Nginx). Specifically, upon receiving a playback request, it searches for available streaming media nodes in a shared dictionary or Redis based on the stream ID (the identifier of the streaming session) and selects the optimal node based on the health check results. If a node is detected to be unresponsive or malfunctioning within a short period (e.g., 200ms), the request is immediately forwarded to the next healthy node. The signaling server maintains a node distribution and a rating list for each video. The operation of selecting the optimal node involves executing a Lua script on the proxy server (Nginx) to retrieve the video list, select the corresponding video, and return the one with the highest rating as the optimal node.

[0086] When multiple primary receiving nodes are available, the proxy server selects a suitable node as the target for pulling the stream based on its health status, thereby improving the success rate of pulling the stream.

[0087] As an optional embodiment, the front-end player is also used to monitor the playback status of the video stream during playback; if the playback status is abnormal, it attempts to restore the connection with the signaling server; if the connection with the signaling server cannot be restored within a preset time, it re-initiates a new pull request to the signaling server according to the logical playback address.

[0088] During video playback, the front-end player continuously monitors the playback status of the video stream, including checking whether the video playback is normal and whether there are any pauses or errors.

[0089] Specifically, the front-end player continuously listens for the following runtime events during video playback: playback error and stuttering / blocking. Once an error or stuttering is detected and it is determined to be a "stream interruption" (e.g., the output buffer has not received new data for a long time, the decoder has no new frames, etc.), the front-end player immediately enters the stream interruption recovery process and records the current time point.

[0090] The interruption recovery process involves the front-end player attempting to restore the original connection with the signaling server within a preset time (e.g., 200 milliseconds) to keep playback as uninterrupted as possible.

[0091] If the original connection cannot be restored within the preset time, the player will automatically re-initiate a new streaming request to the signaling server using the same logical playback address, thereby obtaining the video stream and continuing playback.

[0092] Since the front-end player accesses the logical playback address of the proxy server, rather than the fixed streaming media node address, it does not need to be concerned with changes in the specific IP or port of the underlying node. When the original connection cannot be restored, a new pull request can be initiated to automatically obtain the video stream from a healthy node, achieving seamless switching.

[0093] This application utilizes a collaborative mechanism of rapid front-end reconnection and dynamic routing at the unified access layer to control the playback stream recovery time within a short period, thereby significantly improving system reliability and user experience.

[0094] This application provides a video stream switching system based on multi-node assistance, comprising: a signaling server, configured to, upon receiving a playback request from a front-end player, select at least one primary receiving node from various media nodes based on node load, and determine at least one backup node corresponding to the primary receiving node; generate push streaming instructions matching each primary receiving node, and send each push streaming instruction to a camera; generate pull streaming information, and send pull streaming information to the front-end player; a camera, configured to push the video stream to the primary receiving node according to the push streaming instructions; a primary receiving node, configured to copy the received video stream to an associated backup node; and a front-end player, configured to send a playback request to the signaling server and receive the pull streaming information returned by the signaling server; pull streaming according to the pull streaming information to acquire and play the video stream, and, upon detecting a failure of the current pull streaming node, quickly switch to another healthy node to continue playback based on the pull streaming information. First, the signaling server selects the primary receiving node and corresponding backup node according to load, and sends push streaming instructions to the camera and pull streaming information to the front-end player respectively; then, the primary receiving node copies the video stream to the backup node to form a redundant stream; finally, the front-end player performs pull streaming and video stream switching when playback is interrupted using the pull streaming information. This solves the problem that the front-end player cannot automatically and quickly switch to a healthy node when the current streaming media node fails.

[0095] Figure 2 This application provides a flowchart of a video stream switching method based on multi-node assistance. As shown in the figure, the steps include: the client sends a playback request to the signaling service (corresponding to the signaling server in this application); the signaling service calls the Prewarm Service of the scheduling layer (corresponding to the prewarming service module in this application), and the Prewarm Service selects primary and backup nodes based on conditions such as load (e.g., streaming media server A and streaming media server B are primary receiving nodes, and streaming media server C and streaming media server D are backup nodes); the scheduling layer returns the selected node information to the signaling service; the signaling service sends an INVITE push stream command to the camera; the camera pushes the stream to the primary receiving nodes (A, B) based on the INVITE push stream command; the primary receiving nodes (A, B) copy the received video stream to the corresponding backup nodes (C, D) to form a redundant stream backup; the front-end playback module pulls the video stream from the primary node for playback; the signaling service returns the node access address to the front-end playback; when the primary receiving node (e.g., node A or node B) fails, the front-end automatically switches to the corresponding backup node (node ​​C or node D) to pull the redundant stream, realizing seamless switching of the video stream.

[0096] Figure 3 A timing diagram of a video playback process is provided for this application. As shown in the figure, the entire playback process is divided into the following three stages: The first stage is the node selection stage, which includes: the client first sends a playback request to the signaling service, the signaling service requests node selection from the Prewarm Service, and the Prewarm Service returns the Primary node and the Backup node.

[0097] The second phase is the streaming and redundant stream replication phase, which includes: the signaling service sending multiple INVITE commands to the camera, the camera pushing the video stream to the Primary node; the Primary node replicating the stream to the Backup node to form a redundant stream backup.

[0098] The third stage is the streaming and switching stage, which includes: the signaling service returns a unified address or priority list to the front end, and the front end pulls the stream from the Primary node for playback; if the Primary node fails and the stream is interrupted, the front end automatically switches to the Backup node to pull the redundant stream, achieving seamless playback continuation.

[0099] According to another aspect of the embodiments of this application, this application provides a video stream switching device based on multi-node assistance, including the video stream switching system described above.

[0100] Optionally, specific examples in this embodiment can refer to the examples described in the above embodiments, and will not be repeated here.

[0101] In specific implementation, the embodiments of this application can be referred to the above embodiments and have corresponding technical effects.

[0102] It is understood that the embodiments described herein can be implemented in hardware, software, firmware, middleware, microcode, or a combination thereof. For hardware implementation, the processing unit can be implemented in one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field-programmable gate arrays (FPGAs), general-purpose processors, controllers, microcontrollers, microprocessors, other electronic units for performing the functions described herein, or combinations thereof.

[0103] For software implementation, the techniques described herein can be implemented by units that perform the functions described herein. The software code can be stored in memory and executed by a processor. The memory can be implemented in the processor or external to the processor.

[0104] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0105] Those skilled in the art will understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.

[0106] In the embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative. For instance, the division of modules is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple modules or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection through some interfaces, devices, or units, and may be electrical, mechanical, or other forms.

[0107] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0108] In addition, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.

[0109] If the aforementioned function is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the embodiments of this application, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, ROM, RAM, magnetic disks, or optical disks. It should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. In the absence of further restrictions, an element defined by the phrase "comprising a..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0110] The above description is merely a specific embodiment of this application, enabling those skilled in the art to understand or implement this application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of this application. Therefore, this application is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features claimed herein.

Claims

1. A multi-node assisted based video stream switching system, characterized in that, The system comprises: a signaling server configured to, in response to receiving a play request sent by a front-end player, select at least one primary receiving node from each media node according to node load, and determine at least one backup node corresponding to the primary receiving node; generate a push stream instruction matched with each primary receiving node, and send the push stream instruction to a camera; generate a pull stream information, and send the pull stream information to the front-end player; the camera configured to push a video stream to the primary receiving node according to the push stream instruction; the primary receiving node configured to copy the received video stream to the associated backup node; the front-end player configured to send the play request to the signaling server, and receive the pull stream information returned by the signaling server; select a healthy node according to the pull stream information to pull the video stream, and continue playing when a current pull node fails.

2. The system of claim 1, wherein, The pull stream information returned by the signaling server is a logical play address, and the front-end player is configured to initiate a pull request to a proxy server deployed on the signaling server through the logical play address; the proxy server configured to, in response to receiving the pull request, select a target node from the primary receiving node and the corresponding backup node, and pull the video stream through the target node; output the video stream to the front-end player; monitor the output state of the target node, and reselect a new target node as a new target node when the output state of the target node is abnormal; pull the video stream through the new target node to continuously output the video stream to the front-end player.

3. The system of claim 1, wherein, The pull stream information returned by the signaling server is a play list comprising the primary receiving node and the backup node, and each node in the play list is sorted according to priority; the front-end player pulls the video stream from a target node according to the priority, wherein the target node is the node with the highest priority in the play list; when the target node is interrupted, the next priority media node is automatically switched to pull the video stream.

4. The system of claim 1, wherein, The system further comprises a preheating service module configured to collect a plurality of running indexes of each media node every preset period; calculate each running index of each media node through a preset scoring formula to obtain a comprehensive score of each media node; sort each media node according to the comprehensive score from high to low to obtain a sorting table; send the sorting table to the signaling server.

5. The system of claim 4, wherein, The plurality of running indexes comprise current CPU occupancy, current memory occupancy, current thread load, current bandwidth usage and current stream number proportion of the media node, and the preheating service module is specifically configured to: obtain an index value of each running index; subtract a target value from each index value to obtain an idle rate corresponding to each running index; The idle rates are weighted and summed to obtain the comprehensive score of the media node.

6. The system of claim 4, wherein, The signaling server is further configured to receive the ranking list sent by the preheating service module. The media node ranked before the first sequence number in the ranking list is determined as the primary receiving node. Among the media nodes ranked before the second sequence number in the ranking list, the standby node corresponding to the primary receiving node is determined, wherein the second sequence number is greater than the first sequence number.

7. The system of claim 2, wherein, The signaling server is further configured to obtain node identification data of the primary receiving node and the standby node having a corresponding relationship, wherein the node identification data includes a first node identification of the primary receiving node and a second node identification of the standby node. For each primary receiving node, the node identification data is used to generate the push stream instruction.

8. The system of claim 2, wherein, The camera is further configured to, after receiving the push stream instruction, initiate a session establishment request to the primary receiving node to establish a push stream session with the primary receiving node. The signaling server is further configured to generate an identifier after the camera and the primary receiving node establish the push stream session, wherein the identifier is used to identify the push stream session. The identifier is inserted into a preconfigured address template to generate the logical playback address.

9. The system of claim 7, wherein, The proxy server is further configured to, after receiving the pull stream request, parse the pull stream request to obtain node identification data of the primary receiving node and the standby node corresponding to the video stream. The health states of the primary receiving nodes are searched in a health mapping table according to the node identification data, wherein the health mapping table is generated by monitoring the running states of the media nodes. The target node is determined among the primary receiving nodes according to the health states, and a pull stream session is established with the target node to obtain the video stream through the pull stream session.

10. The system of claim 2, wherein, The front-end player is further configured to monitor a playback state of the video stream during playback of the video stream. In the case that the playback state is abnormal, a connection with the signaling server is attempted to be recovered. If the connection with the signaling server cannot be recovered within a preset time length, a new pull stream request is initiated to the signaling server according to the logical playback address.

11. A video stream switching device based on multi-node assistance, the device comprising: A video stream switching system including any one of claims 1 to 10.