WO2023045191A1 - Video stream obtaining method and apparatus, server, storage medium, and program product - Google Patents
Video stream obtaining method and apparatus, server, storage medium, and program product Download PDFInfo
- Publication number
- WO2023045191A1 WO2023045191A1 PCT/CN2022/071431 CN2022071431W WO2023045191A1 WO 2023045191 A1 WO2023045191 A1 WO 2023045191A1 CN 2022071431 W CN2022071431 W CN 2022071431W WO 2023045191 A1 WO2023045191 A1 WO 2023045191A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- video stream
- service
- task analysis
- task
- analysis service
- Prior art date
Links
- 238000000034 method Methods 0.000 title claims abstract description 128
- 238000013507 mapping Methods 0.000 claims abstract description 93
- 238000004590 computer program Methods 0.000 claims description 21
- 230000006870 function Effects 0.000 description 28
- 230000008569 process Effects 0.000 description 18
- 238000010586 diagram Methods 0.000 description 16
- 230000007246 mechanism Effects 0.000 description 11
- 238000003032 molecular docking Methods 0.000 description 9
- 238000004891 communication Methods 0.000 description 8
- 238000012545 processing Methods 0.000 description 4
- 230000005540 biological transmission Effects 0.000 description 3
- 230000008878 coupling Effects 0.000 description 3
- 238000010168 coupling process Methods 0.000 description 3
- 238000005859 coupling reaction Methods 0.000 description 3
- 230000010365 information processing Effects 0.000 description 3
- 230000011664 signaling Effects 0.000 description 3
- 230000001174 ascending effect Effects 0.000 description 2
- 230000009286 beneficial effect Effects 0.000 description 2
- 238000005315 distribution function Methods 0.000 description 2
- 230000003287 optical effect Effects 0.000 description 2
- 239000002699 waste material Substances 0.000 description 2
- 230000008602 contraction Effects 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 230000010354 integration Effects 0.000 description 1
- 238000002955 isolation Methods 0.000 description 1
- 239000000463 material Substances 0.000 description 1
- 238000011160 research Methods 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
- 238000012546 transfer Methods 0.000 description 1
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N21/00—Selective content distribution, e.g. interactive television or video on demand [VOD]
- H04N21/20—Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
- H04N21/25—Management operations performed by the server for facilitating the content distribution or administrating data related to end-users or client devices, e.g. end-user or client device authentication, learning user preferences for recommending movies
- H04N21/262—Content or additional data distribution scheduling, e.g. sending additional data at off-peak times, updating software modules, calculating the carousel transmission frequency, delaying a video stream transmission, generating play-lists
Definitions
- the embodiments of the present application relate to communication technologies, and relate to but are not limited to a method and device for acquiring a video stream, a server, a storage medium, and a program product.
- embodiments of the present application provide a method and device for acquiring video streams, a server, a storage medium, and a program product.
- the embodiment of the present application provides a method for acquiring a video stream, which is applied to a server, and the method includes:
- the first task analysis service in the server determines whether it has accessed the video stream after receiving the request message for obtaining the video stream; wherein, the request message is sent by the client based on the first mapping relationship to the For the first task analysis service, the first mapping relationship is used to indicate the client corresponding to each task analysis service in the server; when the first task analysis service does not access the video stream, the The task management service in the server redirects the client to the second task analysis service based on the second mapping relationship, so that the client can obtain the video stream through the redirected second task analysis service; wherein, The second mapping relationship is used to indicate that each task analysis service has a corresponding access video stream; the task management service is determined from multiple task analysis services in the server.
- the embodiment of the present application provides a device for obtaining a video stream
- the device includes: a determining unit configured to determine the first task analysis service in the server after receiving a request message for obtaining a video stream Whether the video stream has been accessed; wherein, the request message is sent by the client to the first task analysis service based on a first mapping relationship, and the first mapping relationship is used to indicate that each task in the server A client corresponding to the analysis service; a redirection unit configured to, when the first task analysis service does not access the video stream, the task management service in the server sends the client to the client based on the second mapping relationship Redirecting to the second task analysis service, so that the client can obtain the video stream through the redirected second task analysis service; wherein, the second mapping relationship is used to indicate that each task analysis service has Corresponding to the accessed video stream; the task management service is determined from multiple task analysis services in the server.
- an embodiment of the present application provides a server, including a memory and a processor, the memory stores a computer program that can run on the processor, and the processor implements the steps in the above method when executing the program.
- the embodiments of the present application provide a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps in the above method are implemented.
- an embodiment of the present application provides a computer program product
- the computer program product includes a non-transitory computer-readable storage medium storing a computer program, and when the computer program is read and executed by a computer, the implementation of the present application can be realized. Some or all steps of the method described in the example.
- the computer program product may be a software installation package.
- Embodiments of the present application provide a video stream acquisition method and device, server, storage medium, and program product.
- the first task analysis service in the server determines whether it has received the video stream. input the video stream; wherein, the request message is sent by the client to the first task analysis service based on the first mapping relationship, and the first mapping relationship is used to indicate that each task analysis service in the server corresponds to client; in the case that the first task analysis service does not access the video stream, the task management service in the server redirects the client to the second task analysis service based on the second mapping relationship, Enable the client to obtain the video stream through the redirected second task analysis service; wherein, the second mapping relationship is used to indicate that each task analysis service has a corresponding access to the video stream; the The task management service is determined from a plurality of task analysis services in the server.
- the redirection mechanism can be used to realize the traceability function of the video, so as to ensure that the video access distribution system (i.e. the server) is not connected to the front-end equipment (i.e. The device in which it is located) has a performance impact, and ensures that the internal forwarding function of the system is normal and effective.
- the video access distribution system i.e. the server
- the front-end equipment i.e. The device in which it is located
- FIG. 1A is a schematic diagram of a system architecture corresponding to a method for acquiring a video stream according to an embodiment of the present application
- FIG. 1B is a first schematic diagram of the implementation process of the method for acquiring video streams in the embodiment of the present application
- FIG. 2 is a second implementation flow diagram of a method for acquiring a video stream according to an embodiment of the present application
- FIG. 3 is a schematic diagram of the third implementation process of the method for acquiring video streams in the embodiment of the present application.
- FIG. 4 is a schematic diagram 4 of an implementation process of a method for acquiring a video stream according to an embodiment of the present application
- FIG. 5 is a schematic diagram of the implementation process of the video stream acquisition method according to the embodiment of the present application (5);
- FIG. 6 is a schematic diagram of the composition and structure of an apparatus for obtaining a video stream according to an embodiment of the present application
- FIG. 7 is a schematic diagram of a hardware entity of a server according to an embodiment of the present application.
- first ⁇ second ⁇ third involved in the embodiment of the present application is only to distinguish similar objects, and does not represent a specific ordering of objects. Understandably, “first ⁇ second ⁇ third Where permitted, the specific order or sequence may be interchanged such that the embodiments of the application described herein can be practiced in sequences other than those illustrated or described herein.
- FIG. 1A is a schematic diagram of a system architecture corresponding to a video stream acquisition method according to an embodiment of the present application.
- the system architecture may include at least one client 11, a network 12, a server 13, and at least one front-end device 14, in:
- the user can use the client 11 to interact with the server 13 through the network 12 to obtain data such as video streams located on the front-end device 14.
- the front-end device 14 accesses the server 13, and the server 13 can access and manage the front-end device 14, and send the access result to the client 11 at the same time. That is to say, the server 13 can request the video stream on the front-end device 14 and forward the video stream to the client 11 . Therefore, the server 13 can be regarded as a video access distribution system.
- the client 11 can be various types of devices with information processing capabilities, including but not limited to navigators, smart phones, tablet computers, wearable devices, laptop computers, all-in-one computers, and desktop computers, etc. .
- the client 11 may be a streaming media server.
- the server 13 may be a computing device with information processing capabilities such as a personal computer and a server cluster during implementation.
- Described server 13 can be the server that provides various services, for example, described server can be distributed server, comprises a plurality of node servers in the described distributed server, all has at least one task analysis service on each node server, when When the client 11 needs to acquire the video stream on the front-end device 14, the client 11 can send an acquisition request to a certain service node in the distributed server according to a certain mapping relationship, and the task analysis service on the service node The acquisition request may be processed.
- the front-end device 14 may be an electronic device (for example, a camera) or a platform (for example, a data platform of a view analysis manufacturer).
- FIG. 1B is a schematic diagram of the first implementation process of the method for obtaining video streams in the embodiment of the present application. As shown in FIG. 1B, the method includes:
- Step S101 the first task analysis service in the server determines whether it has accessed the video stream after receiving the request message for obtaining the video stream; wherein, the request message is sent by the client based on the first mapping relationship
- the first mapping relationship is used to indicate the client corresponding to each task analysis service in the server;
- the server may be a computing device with information processing capabilities such as a personal computer and a server cluster.
- the server has the functions of video access and video distribution, and the task analysis service in the server can access the video stream in the front-end device, and distribute the accessed video stream to the client.
- the task analysis service in the server can access the video stream in the front-end device, that is, the task analysis service can continuously access the video stream in the front-end device, and the task analysis service and The transmission state of the video stream is always maintained between the front-end devices.
- the client may be a streaming media server
- different streaming media servers correspond to different task analysis services.
- streaming media server A corresponds to task analysis service A
- streaming media server B corresponds to task analysis service B
- streaming media server C corresponds to task analysis service C.
- the client directly sends a request for obtaining video streams to the server through a domain name, and the server internally resolves the domain name and designates a certain node (possibly randomly designated) to process all the video streams.
- the server internally resolves the domain name and designates a certain node (possibly randomly designated) to process all the video streams.
- Step S102 in the case that the first task analysis service does not access the video stream, the task management service in the server redirects the client to the second task analysis service based on the second mapping relationship, so that The client can obtain the video stream through the redirected second task analysis service; wherein, the second mapping relationship is used to indicate that each task analysis service has correspondingly accessed video stream; the task The management service is determined from a plurality of task analysis services in the server.
- the first task analysis service may determine whether it accesses the video stream according to the identification information of the video stream, that is, determines whether it is in a state of transmitting the video stream.
- the service node where the first task analysis service is located may have a local cache, and the local cache stores the mapping relationship between the first task analysis service and the video stream it accesses, and further, the second A task analysis service can know whether it has accessed the video stream requested by the client by checking the data in the local cache.
- different task analysis services may correspond to different video streams.
- streaming media server A corresponds to task analysis service A
- the task analysis service A corresponds to accessing the first type of video stream.
- the streaming media server B corresponds to the task analysis service B
- the task analysis service B corresponds to accessing the second type of video stream.
- the streaming media server C corresponds to the task analysis service C
- the task analysis service C corresponds to accessing the third type of video stream.
- the streaming media server A (that is, the client A) sends a request message to the task analysis service A to obtain the third type of video stream, and the task analysis service A finds that it does not have access to the third type of video stream. type of video stream.
- the task analysis service A sends a query request message to the task management service, and the task management service inquires that the task analysis service C has accessed the third type of video stream, then the task management service redirects the streaming media service A to the task Analysis service C, after receiving the video stream request message sent by streaming media service A, the task analysis service C inquires that it has access to a third type of video stream, and directly sends the third type of video stream Return to streaming service A.
- the redirection mechanism is used to realize the traceability function of the video, to ensure that the video access distribution system (that is, the server) does not affect the performance of the front-end device (that is, the device where the video stream is located), and to ensure that the internal forwarding function of the system is normal and effective.
- the task management service may be determined from a certain task analysis service after the system is created, that is to say, the service node where the task management service is located not only has video access
- the traceability function also has specific video access and distribution functions, so that resource reuse can be realized.
- this embodiment of the present application further provides a video stream acquisition method, the method is applied to a server, and the server includes a plurality of service nodes, and there is at least one task analysis service on each of the service nodes,
- the methods include:
- Step S111 determining the first service node among the plurality of service nodes as a task management node
- the server usually includes several machines, or several sets of virtual machine environments.
- a machine or a set of virtual machine environments is a service node, and a server with multiple service nodes is a distributed server.
- the task analysis service can be regarded as a process running on this node, and this process will use the IP (Internet Protocol, Internet Protocol) address of this node to monitor externally or establish a network connection.
- the distributed server is characterized by multi-node and multi-copy operation.
- each of the multiple service nodes ie, physical machines
- a service task analysis service or task management service
- the distributed system framework is used to obtain the video stream, so that it has the characteristics of high reliability and high expansion, so as to ensure the stable and efficient operation of the access and forwarding functions in the scene of video stream acquisition.
- a certain node is elected as the role of task management, so as to realize the redirection scheduling of pulling video streams between different nodes.
- the main function of the task management node is to query whether there is a service node to access the video stream required by the client, and if there is a service node to access the video stream, then determine to access the video stream specific service node, and send the query result to the service node where the first task analysis service is located.
- the node where the first task analysis service is located then sends the node address of the specific service node to the client, so that the client can obtain the video stream through the task analysis service on the specific service node.
- any service node among the plurality of service nodes may be determined as the task management node, and a service node with the smallest load among the plurality of service nodes may be determined as the task management node.
- other methods can also be used to determine a certain service node as the task management node, that is, the method for determining the task management node in the embodiment of the present application is not limited, and those skilled in the art can use needs to be set.
- Step S112 determining the task analysis service in the task management node as the task management service
- this task analysis service is determined as the task management service.
- Step S113 the first task analysis service in the server determines whether it has accessed the video stream after receiving the request message for obtaining the video stream; wherein, the request message is sent by the client based on the first mapping relationship
- the first mapping relationship is used to indicate the client corresponding to each task analysis service in the server;
- the server is a distributed server, and the distributed server includes multiple service nodes, and there is at least one task analysis service on each service node, the first mapping relationship is used to indicate that each A client corresponding to the service node.
- the first task analysis service is a task analysis service on the service node corresponding to the client in the first mapping relationship.
- Step S114 in the case that the first task analysis service does not access the video stream, the task management service in the server redirects the client to the second task analysis service based on the second mapping relationship, so that The client can obtain the video stream through the redirected second task analysis service;
- the second mapping relationship is used to indicate that each of the service nodes has correspondingly accessed video streams.
- the second mapping relationship exists between the service node where the second task analysis service is located and the video stream.
- the distributed system framework can be used to obtain video streams, so that it has the characteristics of high reliability and high expansion, so as to ensure the stable and efficient operation of the access and forwarding functions in the video stream acquisition scene.
- a certain task analysis service is elected as the role of task management, so as to realize the redirection scheduling of pulling video streams between different services while reusing resources.
- FIG. 2 is a schematic diagram of the second implementation process of the method for obtaining a video stream in the embodiment of the present application, as shown in FIG. 2 , the method includes:
- Step S201 the first task analysis service in the server determines whether it has accessed the video stream after receiving the request message for obtaining the video stream; wherein, the request message is sent by the client based on the first mapping relationship
- the first mapping relationship is used to indicate the client corresponding to each task analysis service in the server;
- Step S202 In the case that the first task analysis service does not access the video stream, the first task analysis service sends a query request message to the task management service; wherein, the query request message carries Identification information of the video stream;
- Step S203 the task management service queries the task analysis service that has accessed the video stream according to the identification information and the second mapping relationship, and obtains a query result;
- the task management service may query the task analysis service that has accessed the video stream in the shared storage, In order to realize the traceability function of the video.
- the client can directly use the task analysis service that has accessed the video stream to obtain the video stream, thereby ensuring that the video access distribution system (that is, the server) does not affect the performance of the front-end equipment, and that the system's The internal forwarding function works normally.
- Step S204 when the query result indicates that the second task analysis service in the server has accessed the video stream, the task management service sends the query result to the first task analysis service, enabling the client to obtain the video stream through the second task analysis service; wherein, the second mapping relationship is used to indicate that each task analysis service has correspondingly accessed video stream; the task management The service is determined from a plurality of task analysis services in the server.
- the server includes multiple service nodes, and at least one task analysis service exists on each of the service nodes; correspondingly, the second mapping relationship is used to indicate that each of the service nodes The video stream that the node has been connected to;
- the method also includes:
- Step S21 determining the first service node among the plurality of service nodes as a task management node
- Step S22 determining the task analysis service in the task management node as the task management service.
- this embodiment of the present application further provides a method for obtaining a video stream, the method is applied to a server, and the method includes:
- Step S211 the first task analysis service in the server determines whether it has accessed the video stream after receiving the request message for obtaining the video stream; wherein, the request message is sent by the client based on the first mapping relationship
- the first mapping relationship is used to indicate the client corresponding to each task analysis service in the server;
- Step S212 in the case that the first task analysis service does not access the video stream, the first task analysis service sends a query request message to the task management service; wherein, the query request message carries Identification information of the video stream;
- Step S213 the task management service queries the task analysis service that has accessed the video stream according to the identification information and the second mapping relationship, and obtains a query result;
- the purpose of carrying the identification information of the video stream in the query request message is that the task management service can query which node the task analysis service on which accesses the video stream according to the identification information.
- Step S214 when the query result indicates that the second task analysis service in the server has accessed the video stream, the task management service sends the query result to the first task analysis service;
- Step S215 the first task analysis service sends the node address of the second task analysis service to the client, so that the client can establish media with the second task analysis service according to the node address Connect to obtain the video stream; wherein, the second mapping relationship is used to indicate that each task analysis service has correspondingly accessed video stream; the task management service analyzes the tasks from multiple tasks in the server identified in the service.
- the client when docking, the client first sends a basic signaling to the corresponding service node. After the service node determines that the video stream requested by the client is not accessed, it will search for the The service node of the video stream, and returns a 302 error, the error code carries a new address (that is, the found address of the service node that has accessed the video stream), and then, the client gets this After the new address, a request to obtain the video stream will be sent again, because the address has changed, so it is redirected.
- the service node determines that the video stream requested by the client is not accessed, it will search for the The service node of the video stream, and returns a 302 error, the error code carries a new address (that is, the found address of the service node that has accessed the video stream), and then, the client gets this After the new address, a request to obtain the video stream will be sent again, because the address has changed, so it is redirected.
- the task management service queries the task analysis service that has accessed the video stream according to the identification information and the second mapping relationship, and obtains a query result, including:
- Step S2131 the task management service determines the address information of the video stream that has been accessed according to the identification information and the second mapping relationship;
- the task analysis service that has accessed the video stream may be determined according to the address information that has accessed the video stream. That is to say, there is a corresponding relationship between the address information and the task analysis service, so that the traceability function of the video source to be accessed can be realized according to the corresponding relationship between the address information of the accessed video stream and the task analysis service.
- Step S2132 the task management service determines the task analysis service that has accessed the video stream according to the address information, and obtains a query result.
- FIG. 3 is a schematic diagram of the third implementation process of the method for obtaining a video stream according to the embodiment of the present application, as shown in FIG. 3 , the method includes:
- Step S301 the first task analysis service in the server determines whether it has accessed the video stream after receiving the request message for obtaining the video stream; wherein, the request message is sent by the client based on the first mapping relationship
- the first mapping relationship is used to indicate the client corresponding to each task analysis service in the server;
- step S302 if the first task analysis service does not access the video stream, perform the following step S302; if the first task analysis service has access to the video stream, perform the following steps S303 to S304 .
- Step S302 the task management service in the server redirects the client to the second task analysis service based on the second mapping relationship, so that the client can obtain the video through the redirected second task analysis service stream; wherein, the second mapping relationship is used to indicate that each task analysis service has correspondingly accessed video stream; the task management service is determined from multiple task analysis services in the server;
- Step S303 the first task analysis service establishes a media connection with the client
- the first task analysis service may be used directly to provide the client with the required video stream.
- Step S304 the first task analysis service sends the accessed video stream to the client through the media connection.
- this embodiment of the present application further provides a method for obtaining a video stream, the method is applied to a server, and the method includes:
- Step S311 the first task analysis service in the server determines whether it has accessed the video stream after receiving the request message for obtaining the video stream; wherein, the request message is sent by the client based on the first mapping relationship
- the first mapping relationship is used to indicate the client corresponding to each task analysis service in the server;
- Step S315 to step S316 if the first task analysis service does not access the video stream, perform the following steps S312 to S314; otherwise, if the first task analysis service has access to the video stream, perform the following Step S315 to step S316.
- Step S312 the first task analysis service sends a query request message to the task management service; wherein, the query request message carries identification information of the video stream;
- Step S313 the task management service queries the task analysis service that has accessed the video stream according to the identification information and the second mapping relationship, and obtains a query result;
- Step S314 when the query result indicates that the second task analysis service in the server has accessed the video stream, the task management service sends the query result to the first task analysis service, enabling the client to obtain the video stream through the second task analysis service; wherein, the second mapping relationship is used to indicate that each task analysis service has correspondingly accessed video stream; the task management The service is determined from a plurality of task analysis services in the server;
- Step S315 the first task analysis service establishes a media connection with the client
- Step S316 the first task analysis service sends the accessed video stream to the client through the media connection.
- the method further includes: when the query result shows that no task analysis service that has accessed the video stream is found, the task management service determines the target task analysis service according to preset rules. service, so that the client can obtain the video stream through the target task analysis service.
- FIG. 4 is a schematic diagram 4 of the implementation process of the method for obtaining a video stream according to the embodiment of the present application, as shown in FIG. 4 , the method includes:
- Step S401 the first task analysis service in the server determines whether it has accessed the video stream after receiving the request message for obtaining the video stream; wherein, the request message is sent by the client based on the first mapping relationship
- the first mapping relationship is used to indicate the client corresponding to each task analysis service in the server;
- Step S402. In the case that the first task analysis service does not access the video stream, the first task analysis service sends a query request message to the task management service; wherein, the query request message carries Identification information of the video stream;
- Step S403 the task management service queries the task analysis service that has accessed the video stream according to the identification information and the second mapping relationship, and obtains a query result;
- Step S404 when the query result shows that the second task analysis service in the server has accessed the video stream, the task management service sends the query result to the first task analysis service, enabling the client to obtain the video stream through the second task analysis service; wherein, the second mapping relationship is used to indicate that each task analysis service has correspondingly accessed video stream; the task management The service is determined from a plurality of task analysis services in the server;
- Step S405 when the query result shows that no task analysis service that has accessed the video stream is found, the task management service determines the target task analysis service according to preset rules, so that the client can pass The target task analysis service obtains the video stream.
- the query result shows that no task analysis service that has accessed the video stream is found, which means that none of the task analysis services in the server has access to the video stream, and the task management service can Determine a target task analysis service to obtain the video stream according to the preset rules.
- the task management service can Determine a target task analysis service to obtain the video stream according to the preset rules.
- this embodiment of the present application further provides a method for obtaining a video stream, the method is applied to a server, and the method includes:
- Step S411 the first task analysis service in the server determines whether it has accessed the video stream after receiving the request message for obtaining the video stream; wherein, the request message is sent by the client based on the first mapping relationship
- the first mapping relationship is used to indicate the client corresponding to each task analysis service in the server;
- Step S412 in the case that the first task analysis service does not access the video stream, the first task analysis service sends a query request message to the task management service; wherein, the query request message carries Identification information of the video stream;
- Step S413 the task management service queries the task analysis service that has accessed the video stream according to the identification information and the second mapping relationship, and obtains a query result;
- Step S414 when the query result shows that the second task analysis service in the server has accessed the video stream, the task management service sends the query result to the first task analysis service, enabling the client to obtain the video stream through the second task analysis service; wherein, the second mapping relationship is used to indicate that each task analysis service has correspondingly accessed video stream; the task management The service is determined from a plurality of task analysis services in the server;
- Step S415 when the query result indicates that no task analysis service that has accessed the video stream is found, the task management service determines the first task analysis service as the first task analysis service according to the first mapping relationship. The target task analysis service, so that the client can obtain the video stream through the first task analysis service.
- the first task analysis service is the task analysis service assigned by the server to process the request when the server receives the client's request for acquiring video streams.
- the nearest scheduling strategy which can reduce the redirection phenomenon, be more friendly to the client, the logic is simpler, and the efficiency is higher.
- this embodiment of the present application further provides a method for obtaining a video stream, the method is applied to a server, and the method includes:
- Step S421 the first task analysis service in the server determines whether it has accessed the video stream after receiving the request message for obtaining the video stream; wherein, the request message is sent by the client based on the first mapping relationship
- the first mapping relationship is used to indicate the client corresponding to each task analysis service in the server;
- the first task analysis service does not access the video stream, the first task analysis service sends a query request message to the task management service; wherein, the query request message carries Identification information of the video stream;
- Step S423 the task management service queries the task analysis service that has accessed the video stream according to the identification information and the second mapping relationship, and obtains a query result;
- Step S424 when the query result indicates that the second task analysis service in the server has accessed the video stream, the task management service sends the query result to the first task analysis service, enabling the client to obtain the video stream through the second task analysis service; wherein, the second mapping relationship is used to indicate that each task analysis service has correspondingly accessed video stream; the task management The service is determined from a plurality of task analysis services in the server;
- the server is a distributed server
- the distributed server includes multiple service nodes, and each service node has at least one task analysis service.
- the load of all task analysis services or a part of all task analysis services may be determined.
- the load of the task analysis service refers to the amount of the task analysis service accessing video streams and forwarding video streams.
- Step S426, the task management service sorts the loads of the at least two task analysis services in ascending order of values, and obtains a sorting result
- Step S427 the task management service determines the task analysis service with the smallest load as the target task analysis service according to the sorting result, so that the client can obtain the video stream through the task analysis service with the smallest load.
- a load balancing scheduling strategy can be adopted, and the node where the service with the smallest load among all task analysis services is selected as the docking node of the client, which can reduce the system Resource pressure, improved stability.
- this embodiment of the present application further provides a method for obtaining a video stream, the method is applied to a server, and the method includes:
- Step S431 the first task analysis service in the server determines whether it has accessed the video stream after receiving the request message for obtaining the video stream; wherein, the request message is sent by the client based on the first mapping relationship
- the first mapping relationship is used to indicate the client corresponding to each task analysis service in the server;
- Step S432 In the case that the first task analysis service does not access the video stream, the first task analysis service sends a query request message to the task management service; wherein, the query request message carries Identification information of the video stream;
- Step S433 the task management service queries the task analysis service that has accessed the video stream according to the identification information and the second mapping relationship, and obtains a query result;
- Step S434 when the query result indicates that the second task analysis service in the server has accessed the video stream, the task management service sends the query result to the first task analysis service, enabling the client to obtain the video stream through the second task analysis service; wherein, the second mapping relationship is used to indicate that each task analysis service has correspondingly accessed video stream; the task management The service is determined from a plurality of task analysis services in the server;
- Step S435 when the query result shows that no task analysis service that has accessed the video stream is found, the task management service determines a third task analysis service according to the access type of the video stream, so that The client can obtain the video stream through the third task analysis service.
- some service nodes can only receive a certain type of video stream, then the corresponding service node can be determined according to the access type of the video stream to be obtained, and then the service node can be used
- the task analysis service on the Internet can obtain the required video stream, so that the video stream access and forwarding functions can be realized more flexibly to meet the needs of user scenarios.
- client platforms can only correspond to certain service nodes. If the video stream required by the client has not been accessed by any service node, use the service node corresponding to the platform where the client is located. Get the video stream.
- client A and client B are requesting the same video stream on the front-end device at the same time, then in the distributed system at this time, the node corresponding to client A serves the node corresponding to client A and client B Service B will request the video source from the front-end device at the same time, which may result in waste of bandwidth resources of the front-end device and poor performance of the distributed system.
- the distribution module in the distributed system is not limited by the performance of the access module, that the access module does not affect the performance of the front-end equipment, and that system resources are efficiently and fully utilized.
- both the distribution module and the access module are located in the distributed system, the access module is mainly used to obtain video streams from the front-end equipment, and the distribution module is mainly used to transfer the obtained video streams sent to the client.
- the embodiment of the present application provides a solution for obtaining video streams.
- the solution (1) uses a distributed system to access video source data from different manufacturers and different protocols, that is, through docking with various manufacturers' protocols and standard platform protocols to obtain Access various types of video sources (including video and audio).
- the deployment of distributed architecture is adopted, and multiple nodes are connected at the same time, which improves the concurrency and access efficiency, and can use the distributed high reliability feature to improve the stability of the access module.
- some video protocols check the address, port and other information of the docking system when accessing, to prevent multiple accesses by a single user from affecting the performance of its equipment.
- the embodiment of the present application adopts a certain mechanism to ensure that the internal forwarding can be traced to the specific accessed media service node, so as to prevent multiple accesses due to multi-path forwarding.
- (3) Use the Manager-Worker mechanism to distinguish the functions of different nodes, let the Manager perform the traceability function of video access, and the Worker perform specific video access and distribution functions, so as to ensure that each video source is accessed at most once. In this way, the Manager-Worker mechanism ensures that there is a reasonable and efficient resource scheduling mechanism when multiple nodes do access and forwarding in a distributed system, and the system operation efficiency is improved to the greatest extent.
- the specific media service node to be forwarded is negotiated with the client through the redirection function, which can reduce bandwidth consumption between nodes.
- the embodiment of this application adopts the method of redirection to realize the client The connection to its corresponding task analysis service (that is, Worker). And, among the plurality of Workers in the distributed system, a certain Worker is elected as the role of management (that is, Manager), that is, as a task management service, so as to realize the scheduling of redirection of video streams pulled by different streaming media services.
- a variety of scheduling logics are designed to achieve load balancing for system scheduling.
- the cameras connected to the distributed system include camera A, camera B and camera C, and the cameras connected here belong to the front-end equipment.
- the services enabled by the distributed system itself include task analysis service A, task analysis service B and task analysis service C, which respectively access the video streams of camera A, camera B and camera C.
- the clients that pull video streams include client A, client B, and client C, that is, all three clients can use the distributed system to obtain the video stream in the camera, if client A has access
- the system will assign task analysis service A to handle the needs of client A. If client B has a need to obtain video streams, the system will assign task analysis service B to handle the needs of client B.
- each task analysis service has the function of requesting video stream from the camera and forwarding the video stream to the client.
- the task analysis service B is assigned as a task management service at the same time.
- the distributed system will assign task analysis service C to handle client C's demand for video stream acquisition, that is, client C first sends its corresponding pull request to Task Analysis Service C. Then, task analysis service C initiates a query request to the task management service (that is, task analysis service B) according to the query result of the video stream that is not connected to camera A, so as to obtain the information of which task analysis service accesses camera A's video stream. search result.
- the task management service returns the query result of the video stream connected to the camera A to the task analysis service C, and the task analysis service C returns the query result to the client C (here, the query result is the task analysis service A connection into the video stream of camera A).
- the client C establishes a connection with the task analysis service A that accesses the video stream of the camera A, so as to obtain the video stream accessed by the task analysis service A.
- FIG. 5 is a schematic diagram of the implementation process of the video stream acquisition method according to the embodiment of the present application, as shown in Figure 5 , the method includes:
- Step S501 the client sends an RTSP (Real Time Streaming Protocol, real-time streaming protocol) request to the task analysis service C;
- RTSP Real Time Streaming Protocol, real-time streaming protocol
- the RTSP request is mainly used to request a certain video source of RTSP type. That is to say, the distributed system connects the streams of various manufacturers and outputs them to the client through a unified and standard protocol. If it is an RTSP player, convert the streams of various front-end manufacturers into this RTSP stream for client access.
- Step S502 the task analysis service C queries the local list, and confirms whether it accesses the video stream requested by the client;
- Step S503 task analysis service C sends a query request to task management service if it does not access the video stream;
- Step S504 the task management service queries the address of accessing the video stream in the storage medium, and determines the task analysis service accessing the video stream as task analysis service A according to the address;
- the storage medium may be a shared storage storage medium, such as ZooKeeper.
- Step S505 the task management service returns the address of the task analysis service A to the task analysis service C;
- Step S506 the task analysis service C returns the address of the task analysis service A to the client;
- the task analysis service C returns the address of the client, that is, the redirection address.
- Step S507 the client sends an RTSP request to the task analysis service A according to the address of the task analysis service A;
- Step S508 the task analysis service A queries the local list to confirm whether it accesses the video stream requested by the client;
- Step S509 the task analysis service A converts the accessed video stream into an RTSP video stream and returns it to the client.
- the step S501 to the step S508 are signaling streams, that is, the signaling transmission path of this solution
- the step S509 is a video stream, that is, the video stream transmission path of this solution.
- the steps S501 to S509 are solutions in a case where there is a video stream that the client needs to pull in a certain node of the distributed system.
- the task management service queries all the task analysis services and does not access the video stream to be pulled, the following scheduling strategy is adopted.
- the first scheduling strategy the nearest scheduling strategy.
- the client When the client needs to pull the video stream and all the task analysis services in the distributed system do not access the video stream, select the nearest node of the client as the node for pulling the video stream (that is, the system provides The original node assigned by the client). For example, when client A requests the video source of camera A from task analysis service A, and task analysis service A finds that it does not access the video source of camera A locally, then the task analysis service A will send a request to the task management service. Query, if the query result shows that none of the video sources of camera A is accessed by other task analysis services, the nearest scheduling strategy will be adopted, and the node corresponding to task analysis service A will be directly selected as the docking node of client A. In this way, it can reduce The redirection phenomenon is more friendly to client A, the logic is simpler, and the efficiency is higher.
- step S415 is an implementation of the nearest scheduling policy.
- the second scheduling strategy a load balancing scheduling strategy.
- the client When the client needs to pull the video stream and all task analysis services in the distributed system do not access the video stream, select the node with the smallest load in the distributed system as the node for pulling the video stream. For example, when client A requests the video source of camera A from task analysis service A, and task analysis service A finds that it does not access the video source of camera A locally, then the task analysis service A will send a request to the task management service. Query, if the query result shows that none of the video sources of camera A is accessed by other task analysis services, a load balancing scheduling strategy will be adopted to calculate the load values of all task analysis services at this time, and the corresponding task analysis service with the smallest load value will be selected.
- the node of is used as the docking node of the client A. In this way, the resource pressure of the distributed system can be reduced and the stability can be improved.
- step S425 to step S427 is an implementation of the load balancing scheduling strategy.
- a certain node will be decided as the The node that pulls the video stream. For example, when client A requests the video source of camera A from task analysis service A, and task analysis service A finds that it does not access the video source of camera A locally, then the task analysis service A will send a request to the task management service.
- the user configuration information and the access of the video source will be The protocol type determines the set of nodes that can be scheduled, and then selects a node that meets the conditions as the docking node of the client A. In this way, the access and forwarding functions can be realized more flexibly under the condition of meeting the needs of the user scenario.
- step S435 is an implementation manner of the self-defined scheduling policy.
- the video stream acquisition scheme in the embodiment of the present application can achieve the following technical effects: (1) Based on the distributed system framework, it has the characteristics of high reliability and high expansion, thus ensuring the continuous success of video stream acquisition scenarios. stable and efficient operation of incoming and forwarding functions. (2) The Manager-Worker mechanism is adopted to realize the traceability function of the video, to ensure that the access module of the distributed system will have an impact on the performance of the front-end equipment, and to ensure that the internal forwarding function of the distributed system is normal and effective. (3) When the redirection mechanism is used to ensure multi-node distribution, the traced nodes can be directly fed back to the client for docking, which reduces the network consumption between the internal nodes of the system. (4) Flexible and diverse scheduling strategies enable the acquisition of video streams to cover various scene requirements.
- this embodiment of the present application provides a video stream acquisition device, which includes each unit included, each sub-unit and each module included in each unit, and each sub-module included in each module and each component can be realized by the processor in the server; of course, it can also be realized by a specific logic circuit; in the process of implementation, the processor can be CPU (Central Processing Unit, central processing unit), MPU (Microprocessor Unit, Microprocessor), DSP (Digital Signal Processing, digital signal processor) or FPGA (Field Programmable Gate Array, field programmable gate array), etc.
- CPU Central Processing Unit, central processing unit
- MPU Microprocessor Unit, Microprocessor
- DSP Digital Signal Processing, digital signal processor
- FPGA Field Programmable Gate Array, field programmable gate array
- FIG. 6 is a schematic diagram of the composition and structure of a video stream acquisition device according to an embodiment of the present application. As shown in FIG. 6, the device 600 includes:
- the determining unit 601 is configured such that the first task analysis service in the server determines whether it has accessed the video stream after receiving a request message for obtaining the video stream; wherein, the request message is obtained by the client based on the first
- the mapping relationship is sent to the first task analysis service, and the first mapping relationship is used to indicate the client corresponding to each task analysis service in the server;
- the redirection unit 602 is configured to redirect the client to the second task based on the second mapping relationship when the first task analysis service does not access the video stream. Analysis service, so that the client can obtain the video stream through the redirected second task analysis service; wherein, the second mapping relationship is used to indicate that each task analysis service has corresponding access to the video stream ;
- the task management service is determined from multiple task analysis services in the server.
- the redirecting unit 602 includes: a first sending module configured to send the first task analysis service to the The task management service sends a query request message; wherein, the query request message carries identification information of the video stream; the query module is configured so that the task management service, according to the identification information and the second mapping relationship, Querying the task analysis service that has accessed the video stream to obtain a query result; the second sending module is configured to be configured to, when the query result indicates that the second task analysis service in the server has accessed the video stream , the task management service sends the query result to the first task analysis service, so that the client can obtain the video stream through the second task analysis service.
- the second sending module includes: a first sending component configured to send the query result to the first task analysis service by the task management service; a second sending component configured to The first task analysis service sends the node address of the second task analysis service to the client, so that the client can establish a media connection with the second task analysis service according to the node address to obtain the described video stream.
- the query module includes: a first determining component configured to determine, according to the identification information and the second mapping relationship, the address information of the video stream that has been accessed by the task management service;
- the second determining component is configured such that the task management service determines the task analysis service that has accessed the video stream according to the address information, and obtains a query result.
- the server includes multiple service nodes, and at least one task analysis service exists on each of the service nodes; correspondingly, the second mapping relationship is used to indicate that each of the service nodes The node has correspondingly accessed the video stream; correspondingly, the device further includes: a management node determination unit configured to determine the first service node among the plurality of service nodes as a task management node; a management service determination unit, It is configured to determine the task analysis service in the task management node as the task management service.
- the device further includes: a connection establishment unit configured to establish a connection between the first task analysis service and the client when the first task analysis service has accessed the video stream A media connection; a sending unit configured to send the accessed video stream to the client through the media connection for the first task analysis service.
- the device further includes: a target service determining unit, configured to, if the query result shows that no task analysis service that has accessed the video stream is found, the task management service A rule is set to determine a target task analysis service, so that the client can obtain the video stream through the target task analysis service.
- a target service determining unit configured to, if the query result shows that no task analysis service that has accessed the video stream is found, the task management service A rule is set to determine a target task analysis service, so that the client can obtain the video stream through the target task analysis service.
- the target service determining unit includes: a first target service determining module, configured for the task management service to determine the first task analysis service as the target task according to the first mapping relationship An analysis service, so that the client can obtain the video stream through the first task analysis service.
- the target service determination unit includes: a load determination module configured for the task management service to determine the loads of at least two task analysis services in the server; a sorting module configured for the task management service Sorting the loads of the at least two task analysis services in ascending order to obtain a sorting result; the second target service determination module is configured so that the task management service sorts the task analysis service with the smallest load according to the sorting result Determine the target task analysis service, so that the client can obtain the video stream through the task analysis service with the least load.
- the target service determining unit includes: a third target service determining module, configured for the task management service to determine a third task analysis service according to the access type of the video stream, so that the client The terminal can obtain the video stream through the third task analysis service.
- the technical solution of the embodiment of the present application is essentially or the part that contributes to the prior art can be embodied in the form of a software product.
- the computer software product is stored in a storage medium and includes several instructions for Make an electronic device (which may be a personal computer, a server, etc.) execute all or part of the methods described in the various embodiments of the present application.
- the aforementioned storage media include: U disk, mobile hard disk, ROM (Read Only Memory, read-only memory), magnetic disk or optical disk and other media that can store program codes.
- embodiments of the present application are not limited to any specific combination of hardware and software.
- an embodiment of the present application provides a server, including a memory and a processor, the memory stores a computer program that can run on the processor, and when the processor executes the program, the video server provided in the above-mentioned embodiments is realized.
- an embodiment of the present application provides a readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, the steps in the method for acquiring a video stream described above are implemented.
- the embodiment of the present application also provides a computer program product, the computer program product carries a program code, and the instructions included in the program code can be used to execute the steps of the video stream acquisition method described in the above method embodiment, please refer to the above Method Example. That is, the computer program product provided by the embodiments of the present application includes a computer-readable storage medium storing program codes, and the instructions included in the program codes can be used to execute the steps of the methods for obtaining video streams described in the above method embodiments , for implementation, refer to the above-mentioned method embodiments.
- FIG. 7 is a schematic diagram of a hardware entity of the server in the embodiment of the present application.
- the hardware entity of the server 700 includes: a processor 701, a communication interface 702, and a memory 703, wherein
- Processor 701 generally controls the overall operation of server 700 .
- Communication interface 702 may enable server 700 to communicate with other servers or electronic devices or platforms over a network.
- the memory 703 is configured to store instructions and applications executable by the processor 701, and can also cache data to be processed or processed by each module in the processor 701 and the server 700 (for example, image data, audio data, voice communication data and video data) Communication data), can be realized by FLASH (flash memory) or RAM (Random Access Memory, random access memory);
- bus 704 is used to realize connection and communication between these hardware entities.
- the disclosed devices and methods may be implemented in other ways.
- the device embodiments described above are only illustrative.
- the division of the units is only a logical function division.
- the coupling, or direct coupling, or communication connection between the components shown or discussed may be through some interfaces, and the indirect coupling or communication connection of devices or units may be electrical, mechanical or other forms of.
- the units described above as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place or distributed to multiple network units; Part or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
- each functional unit in each embodiment of the present application can be integrated into one processing module, or each unit can be used as a single unit, or two or more units can be integrated into one unit; the above-mentioned integration
- the unit can be realized in the form of hardware or in the form of hardware plus software functional unit.
- Embodiments of the present application provide a video stream acquisition method and device, server, storage medium, and program product.
- the first task analysis service in the server determines whether it has Accessing the video stream; wherein, the request message is sent by the client to the first task analysis service based on a first mapping relationship, and the first mapping relationship is used to indicate that each task analysis service in the server
- the task management service in the server redirects the client to the second task analysis service based on the second mapping relationship , so that the client can obtain the video stream through the redirected second task analysis service; wherein, the second mapping relationship is used to indicate that each task analysis service has a corresponding access to the video stream;
- the above task management service is determined from multiple task analysis services in the server.
- the redirection mechanism can be used to realize the traceability function of the video, so as to ensure that the video access distribution system (i.e. The device where the flow is located) has a performance impact, and ensures that the internal forwarding function of the system is normal and effective.
- the video access distribution system i.e. The device where the flow is located
Landscapes
- Engineering & Computer Science (AREA)
- Databases & Information Systems (AREA)
- Multimedia (AREA)
- Signal Processing (AREA)
- Two-Way Televisions, Distribution Of Moving Picture Or The Like (AREA)
- Information Transfer Between Computers (AREA)
Abstract
Disclosed in embodiments of the present application are a video stream obtaining method and apparatus, a server, a storage medium, and a program product. The method comprises: a first task analysis service in a server determines, after receiving a request message for obtaining a video stream, whether the first task analysis service has access to the video stream, wherein the request message is sent to the first task analysis service by a client on the basis of a first mapping relationship, and the first mapping relationship is used for indicating a client corresponding to each task analysis service in the server; and in the case that the first task analysis service does not have access to the video stream, a task management service in the server redirects the client to a second task analysis service on the basis of a second mapping relationship, such that the client can obtain the video stream by means of the redirected second task analysis service, wherein the second mapping relationship is used for indicating a video stream to which each task analysis service has corresponding access, and the task management service is determined from a plurality of task analysis services in the server.
Description
相关申请的交叉引用Cross References to Related Applications
本申请基于申请号为202111109163.X、申请日为2021年09月22日的中国专利申请提出,并要求该中国专利申请的优先权,该中国专利申请的全部内容在此以全文引用的方式引入本申请。This application is based on a Chinese patent application with application number 202111109163.X and a filing date of September 22, 2021, and claims the priority of this Chinese patent application. The entire content of this Chinese patent application is hereby incorporated by reference in its entirety this application.
本申请实施例涉及通信技术,涉及但不限于一种视频流的获取方法及装置、服务器、存储介质和程序产品。The embodiments of the present application relate to communication technologies, and relate to but are not limited to a method and device for acquiring a video stream, a server, a storage medium, and a program product.
目前,现有的不同厂家使用的前端设备类型以及各自的平台协议类型各不相同,如此也对视频接入分发系统的兼容性、稳定性以及性能有着越来越高的要求。At present, the types of front-end equipment used by different manufacturers and the types of their respective platform protocols are different, which also has higher and higher requirements for the compatibility, stability and performance of the video access distribution system.
因此,如何提供一种兼容性强、性能高,并且稳定可靠的视频接入分发系统,成为本领域技术人员研究的热点。Therefore, how to provide a highly compatible, high-performance, stable and reliable video access distribution system has become a research hotspot for those skilled in the art.
发明内容Contents of the invention
有鉴于此,本申请实施例提供一种视频流的获取方法及装置、服务器、存储介质和程序产品。In view of this, embodiments of the present application provide a method and device for acquiring video streams, a server, a storage medium, and a program product.
本申请实施例的技术方案是这样实现的:The technical scheme of the embodiment of the application is realized in this way:
第一方面,本申请实施例提供一种视频流的获取方法,应用于服务器,所述方法包括:In the first aspect, the embodiment of the present application provides a method for acquiring a video stream, which is applied to a server, and the method includes:
所述服务器中的第一任务分析服务在接收到获取视频流的请求消息后,确定自身是否已接入所述视频流;其中,所述请求消息是客户端基于第一映射关系发送给所述第一任务分析服务的,所述第一映射关系用于表明所述服务器中每一任务分析服务对应的客户端;在所述第一任务分析服务未接入所述视频流的情况下,所述服务器中的任务管理服务基于第二映射关系将所述客户端重定向到第二任务分析服务,使得所述客户端能够通过重定向的第二任务分析服务获取到所述视频流;其中,所述第二映射关系用于表明所述每一任务分析服务已对应接入的视频流;所述任务管理服务是从所述服务器中的多个任务分析服务中确定出的。The first task analysis service in the server determines whether it has accessed the video stream after receiving the request message for obtaining the video stream; wherein, the request message is sent by the client based on the first mapping relationship to the For the first task analysis service, the first mapping relationship is used to indicate the client corresponding to each task analysis service in the server; when the first task analysis service does not access the video stream, the The task management service in the server redirects the client to the second task analysis service based on the second mapping relationship, so that the client can obtain the video stream through the redirected second task analysis service; wherein, The second mapping relationship is used to indicate that each task analysis service has a corresponding access video stream; the task management service is determined from multiple task analysis services in the server.
第二方面,本申请实施例提供一种视频流的获取装置,所述装置包括:确定单元,配置为所述服务器中的第一任务分析服务在接收到获取视频流的请求消息后,确定自身是否已接入所述视频流;其中,所述请求消息是客户端基于第一映射关系发送给所述第一任务分析服务的,所述第一映射关系用于表明所述服务器中每一任务分析服务对应的客户端;重定向单元,配置为在所述第一任务分析服务未接入所述视频流的情况下,所述服务器中的任务管理服务基于第二映射关系将所述客户端重定向到第二任务分析服务,使得所述客户端能够通过重定向的第二任务分析服务获取到所述视频流;其中,所述第二映射关系用于表明所述每一任务分析服务已对应接入的视频流;所述任务管理服务是从所述服务器中的多个任务分析服务中确定出的。In the second aspect, the embodiment of the present application provides a device for obtaining a video stream, the device includes: a determining unit configured to determine the first task analysis service in the server after receiving a request message for obtaining a video stream Whether the video stream has been accessed; wherein, the request message is sent by the client to the first task analysis service based on a first mapping relationship, and the first mapping relationship is used to indicate that each task in the server A client corresponding to the analysis service; a redirection unit configured to, when the first task analysis service does not access the video stream, the task management service in the server sends the client to the client based on the second mapping relationship Redirecting to the second task analysis service, so that the client can obtain the video stream through the redirected second task analysis service; wherein, the second mapping relationship is used to indicate that each task analysis service has Corresponding to the accessed video stream; the task management service is determined from multiple task analysis services in the server.
第三方面,本申请实施例提供一种服务器,包括存储器和处理器,所述存储器存储有可在处理器上运行的计算机程序,所述处理器执行所述程序时实现上述方法中的步骤。In a third aspect, an embodiment of the present application provides a server, including a memory and a processor, the memory stores a computer program that can run on the processor, and the processor implements the steps in the above method when executing the program.
第四方面,本申请实施例提供一种计算机可读存储介质,其上存储有计算机程序,该计算机程序被处理器执行时实现上述方法中的步骤。In a fourth aspect, the embodiments of the present application provide a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps in the above method are implemented.
第五方面,本申请实施例提供一种计算机程序产品,该计算机程序产品包括存储了计算机程序的非瞬时性计算机可读存储介质,该计算机程序被计算机读取并执行时,实现如本申请实施例中所描述的方法的部分或全部步骤。该计算机程序产品可以为一个软件安装包。In the fifth aspect, an embodiment of the present application provides a computer program product, the computer program product includes a non-transitory computer-readable storage medium storing a computer program, and when the computer program is read and executed by a computer, the implementation of the present application can be realized. Some or all steps of the method described in the example. The computer program product may be a software installation package.
本申请实施例提供一种视频流的获取方法及装置、服务器、存储介质和程序产品,通过所述服务器中的第一任务分析服务在接收到获取视频流的请求消息后,确定自身是否已接入所述视频流;其中,所述请求消息是客户端基于第一映射关系发送给所述第一任务分析服务的,所述第一映射关系用于表明所述服务器中每一任务分析服务对应的客户端;在所述第一任务分析服务未接入所述视频流的情况下,所述服务器中的任务管理服务基于第二映射关系将所述客户端重定向到第二任务分析服务,使得所述客户端能够通过重定向的第二任务分析服务获取到所述视频流;其中,所述第二映射关系用于表明所述每一任务分析服务已对应接入的视频流;所述任务管理服务是从所述服务器中的多个任务分析服务中确定出的,如此,能够采用重定向机制实现视频的溯源功能,保证视频接入分发系统(即服务器)不对前端设备(即视频流所在的设备)产生性能影响,且保证所述系统的内部转发功能正常有效。Embodiments of the present application provide a video stream acquisition method and device, server, storage medium, and program product. After receiving a request message for video stream acquisition, the first task analysis service in the server determines whether it has received the video stream. input the video stream; wherein, the request message is sent by the client to the first task analysis service based on the first mapping relationship, and the first mapping relationship is used to indicate that each task analysis service in the server corresponds to client; in the case that the first task analysis service does not access the video stream, the task management service in the server redirects the client to the second task analysis service based on the second mapping relationship, Enable the client to obtain the video stream through the redirected second task analysis service; wherein, the second mapping relationship is used to indicate that each task analysis service has a corresponding access to the video stream; the The task management service is determined from a plurality of task analysis services in the server. In this way, the redirection mechanism can be used to realize the traceability function of the video, so as to ensure that the video access distribution system (i.e. the server) is not connected to the front-end equipment (i.e. The device in which it is located) has a performance impact, and ensures that the internal forwarding function of the system is normal and effective.
图1A为本申请实施例视频流的获取方法所对应的系统架构的示意图;FIG. 1A is a schematic diagram of a system architecture corresponding to a method for acquiring a video stream according to an embodiment of the present application;
图1B为本申请实施例视频流的获取方法的实现流程示意图一;FIG. 1B is a first schematic diagram of the implementation process of the method for acquiring video streams in the embodiment of the present application;
图2为本申请实施例视频流的获取方法的实现流程示意图二;FIG. 2 is a second implementation flow diagram of a method for acquiring a video stream according to an embodiment of the present application;
图3为本申请实施例视频流的获取方法的实现流程示意图三;FIG. 3 is a schematic diagram of the third implementation process of the method for acquiring video streams in the embodiment of the present application;
图4为本申请实施例视频流的获取方法的实现流程示意图四;FIG. 4 is a schematic diagram 4 of an implementation process of a method for acquiring a video stream according to an embodiment of the present application;
图5为本申请实施例视频流的获取方法的实现流程示意图五;FIG. 5 is a schematic diagram of the implementation process of the video stream acquisition method according to the embodiment of the present application (5);
图6为本申请实施例视频流的获取装置的组成结构示意图;FIG. 6 is a schematic diagram of the composition and structure of an apparatus for obtaining a video stream according to an embodiment of the present application;
图7为本申请实施例服务器的一种硬件实体示意图。FIG. 7 is a schematic diagram of a hardware entity of a server according to an embodiment of the present application.
下面结合附图和实施例对本申请的技术方案进一步详细阐述。显然,所描述的实施例仅是本申请一部分实施例,而不是全部的实施例。基于本申请的实施例,本领域普通技术人员在没有做出创造性劳动的前提下所获得的所有其他实施例,都属于本申请保护的范围。The technical solution of the present application will be further described in detail below in conjunction with the accompanying drawings and embodiments. Apparently, the described embodiments are only some of the embodiments of the present application, rather than all the embodiments. Based on the embodiments of the present application, all other embodiments obtained by persons of ordinary skill in the art without making creative efforts belong to the scope of protection of the present application.
在以下的描述中,涉及到“一些实施例”,其描述了所有可能实施例的子集,但是可以理解,“一些实施例”可以是所有可能实施例的相同子集或不同子集,并且可以在不冲突的情况下相互结合。In the following description, references to "some embodiments" describe a subset of all possible embodiments, but it is understood that "some embodiments" may be the same subset or a different subset of all possible embodiments, and Can be combined with each other without conflict.
在后续的描述中,使用用于表示元件的诸如“模块”、“部件”或“单元”的后缀仅为了有利于本申请的说明,其本身没有特定的意义。因此,“模块”、“部件”或“单元”可以混合地使用。In the following description, the use of suffixes such as 'module', 'part' or 'unit' for denoting elements is only for facilitating the description of the present application and has no specific meaning by itself. Therefore, 'module', 'part' or 'unit' may be used in combination.
需要指出,本申请实施例所涉及的术语“第一\第二\第三”仅仅是是区别类似的对象,不代表针对对象的特定排序,可以理解地,“第一\第二\第三”在允许的情况下可以互换特定的顺序或先后次序,以使这里描述的本申请实施例能够以除了在这里图示或描述的以外的顺序实施。It should be pointed out that the term "first\second\third" involved in the embodiment of the present application is only to distinguish similar objects, and does not represent a specific ordering of objects. Understandably, "first\second\third Where permitted, the specific order or sequence may be interchanged such that the embodiments of the application described herein can be practiced in sequences other than those illustrated or described herein.
图1A为本申请实施例视频流的获取方法所对应的系统架构的示意图,如图1A所示,所述系统架构可以包括至少一个客户端11、网络12、服务器13和至少一个前端设备14,其中:FIG. 1A is a schematic diagram of a system architecture corresponding to a video stream acquisition method according to an embodiment of the present application. As shown in FIG. 1A, the system architecture may include at least one client 11, a network 12, a server 13, and at least one front-end device 14, in:
用户可以使用所述客户端11通过所述网络12与所述服务器13进行交互,以获取位于 所述前端设备14上的视频流等数据。所述前端设备14接入所述服务器13,所述服务器13可以访问和管理所述前端设备14,同时将访问的结果发送给所述客户端11。也就是说,所述服务器13可以请求所述前端设备14上的视频流,并将所述视频流转发给所述客户端11。因此,可以将所述服务器13看成是一个视频接入分发系统。The user can use the client 11 to interact with the server 13 through the network 12 to obtain data such as video streams located on the front-end device 14. The front-end device 14 accesses the server 13, and the server 13 can access and manage the front-end device 14, and send the access result to the client 11 at the same time. That is to say, the server 13 can request the video stream on the front-end device 14 and forward the video stream to the client 11 . Therefore, the server 13 can be regarded as a video access distribution system.
所述客户端11广义上讲可以是各种类型的具有信息处理能力的设备,包括但不限于导航仪、智能手机、平板电脑、可穿戴设备、膝上型便携计算机、一体机和台式计算机等。所述客户端11狭义上讲可以为流媒体服务端。In a broad sense, the client 11 can be various types of devices with information processing capabilities, including but not limited to navigators, smart phones, tablet computers, wearable devices, laptop computers, all-in-one computers, and desktop computers, etc. . In a narrow sense, the client 11 may be a streaming media server.
所述服务器13在实现的过程中可以是如个人计算机和服务器集群等具有信息处理能力的计算设备。所述服务器13可以是提供各种服务的服务器,例如,所述服务器可以为分布式服务器,所述分布式服务器中包括多个节点服务器,每一节点服务器上都存在至少一个任务分析服务,当所述客户端11需要获取前端设备14上的视频流时,所述客户端11可以根据某种映射关系向分布式服务器中的某个服务节点发送获取请求,所述服务节点上的任务分析服务可以对所述获取请求进行处理。所述前端设备14可以是电子设备(例如,摄像机)也可以是平台(例如视图解析厂家的数据平台)。The server 13 may be a computing device with information processing capabilities such as a personal computer and a server cluster during implementation. Described server 13 can be the server that provides various services, for example, described server can be distributed server, comprises a plurality of node servers in the described distributed server, all has at least one task analysis service on each node server, when When the client 11 needs to acquire the video stream on the front-end device 14, the client 11 can send an acquisition request to a certain service node in the distributed server according to a certain mapping relationship, and the task analysis service on the service node The acquisition request may be processed. The front-end device 14 may be an electronic device (for example, a camera) or a platform (for example, a data platform of a view analysis manufacturer).
基于此,本申请实施例提供一种视频流的获取方法,所述方法应用于服务器,该方法所实现的功能可以通过所述服务器的处理器调用程序代码来实现,当然程序代码可以保存在所述服务器的存储介质中。图1B为本申请实施例视频流的获取方法的实现流程示意图一,如图1B所示,所述方法包括:Based on this, an embodiment of the present application provides a method for acquiring a video stream, the method is applied to a server, and the functions implemented by the method can be implemented by calling the program code from the processor of the server. Of course, the program code can be stored in the storage medium of the server mentioned above. FIG. 1B is a schematic diagram of the first implementation process of the method for obtaining video streams in the embodiment of the present application. As shown in FIG. 1B, the method includes:
步骤S101、所述服务器中的第一任务分析服务在接收到获取视频流的请求消息后,确定自身是否已接入所述视频流;其中,所述请求消息是客户端基于第一映射关系发送给所述第一任务分析服务的,所述第一映射关系用于表明所述服务器中每一任务分析服务对应的客户端;Step S101, the first task analysis service in the server determines whether it has accessed the video stream after receiving the request message for obtaining the video stream; wherein, the request message is sent by the client based on the first mapping relationship For the first task analysis service, the first mapping relationship is used to indicate the client corresponding to each task analysis service in the server;
这里,所述服务器可以是如个人计算机和服务器集群等具有信息处理能力的计算设备。所述服务器具有视频接入和视频分发的功能,所述服务器中的任务分析服务能够接入前端设备中的视频流,并将接入的所述视频流分发给客户端。Here, the server may be a computing device with information processing capabilities such as a personal computer and a server cluster. The server has the functions of video access and video distribution, and the task analysis service in the server can access the video stream in the front-end device, and distribute the accessed video stream to the client.
本申请实施例中,所述服务器中的任务分析服务能够接入前端设备中的视频流,即所述任务分析服务能够持续的接入所述前端设备中的视频流,所述任务分析服务与所述前端设备之间一直保持着所述视频流的传输状态。In the embodiment of the present application, the task analysis service in the server can access the video stream in the front-end device, that is, the task analysis service can continuously access the video stream in the front-end device, and the task analysis service and The transmission state of the video stream is always maintained between the front-end devices.
这里,所述客户端可以为流媒体服务端,不同的流媒体服务端对应不同的任务分析服务。所述第一任务分析服务和发送请求消息的客户端之间存在第一映射关系。例如,流媒体服务端A对应任务分析服务A,流媒体服务端B对应任务分析服务B,流媒体服务端C对应任务分析服务C。Here, the client may be a streaming media server, and different streaming media servers correspond to different task analysis services. There is a first mapping relationship between the first task analysis service and the client sending the request message. For example, streaming media server A corresponds to task analysis service A, streaming media server B corresponds to task analysis service B, and streaming media server C corresponds to task analysis service C.
当然,在一些实施例中,也可以是所述客户端通过一个域名就直接向所述服务器发送获取视频流的请求,所述服务器内部解析域名指定某个节点(可能是随机指定)来处理所述请求,如此,如果采用分布式服务器则所述分布式服务器中的多节点随机可以实现负荷分担的高可靠性。Certainly, in some embodiments, it is also possible that the client directly sends a request for obtaining video streams to the server through a domain name, and the server internally resolves the domain name and designates a certain node (possibly randomly designated) to process all the video streams. In this way, if a distributed server is used, the multi-nodes in the distributed server can realize high reliability of load sharing at random.
步骤S102、在所述第一任务分析服务未接入所述视频流的情况下,所述服务器中的任务管理服务基于第二映射关系将所述客户端重定向到第二任务分析服务,使得所述客户端能够通过重定向的第二任务分析服务获取到所述视频流;其中,所述第二映射关系用于表明所述每一任务分析服务已对应接入的视频流;所述任务管理服务是从所述服务器中的多个任务分析服务中确定出的。Step S102, in the case that the first task analysis service does not access the video stream, the task management service in the server redirects the client to the second task analysis service based on the second mapping relationship, so that The client can obtain the video stream through the redirected second task analysis service; wherein, the second mapping relationship is used to indicate that each task analysis service has correspondingly accessed video stream; the task The management service is determined from a plurality of task analysis services in the server.
这里,所述第一任务分析服务可以根据所述视频流的标识信息,确定自身是否接入所述视频流,即确定自身是否处于传输所述视频流的状态。其中,所述第一任务分析服务所在的服务节点中可以有本地缓存,所述本地缓存中存储了所述第一任务分析服务和其所接入的视频流的映射关系,进而,所述第一任务分析服务通过查看所述本地缓存中的数据即可知晓其是否接入过所述客户端请求的视频流。Here, the first task analysis service may determine whether it accesses the video stream according to the identification information of the video stream, that is, determines whether it is in a state of transmitting the video stream. Wherein, the service node where the first task analysis service is located may have a local cache, and the local cache stores the mapping relationship between the first task analysis service and the video stream it accesses, and further, the second A task analysis service can know whether it has accessed the video stream requested by the client by checking the data in the local cache.
这里,不同的任务分析服务可以对应不同的视频流。所述第一任务分析服务和客户端需 要请求的视频流之间不存在第二映射关系,所述第二任务分析服务和客户端需要请求的视频流之间存在第二映射关系。例如,流媒体服务端A对应任务分析服务A,所述任务分析服务A对应接入第一类型的视频流。流媒体服务端B对应任务分析服务B,所述任务分析服务B对应接入第二类型的视频流。流媒体服务端C对应任务分析服务C,所述任务分析服务C对应接入第三类型的视频流。Here, different task analysis services may correspond to different video streams. There is no second mapping relationship between the first task analysis service and the video stream that the client needs to request, and there is a second mapping relationship between the second task analysis service and the video stream that the client needs to request. For example, streaming media server A corresponds to task analysis service A, and the task analysis service A corresponds to accessing the first type of video stream. The streaming media server B corresponds to the task analysis service B, and the task analysis service B corresponds to accessing the second type of video stream. The streaming media server C corresponds to the task analysis service C, and the task analysis service C corresponds to accessing the third type of video stream.
举例来说,流媒体服务端A(即客户端A)向任务分析服务A发送获取第三类型的视频流的请求消息,所述任务分析服务A自查发现自身并没有接入所述第三类型的视频流。所述任务分析服务A向任务管理服务发送查询请求消息,任务管理服务查询到是任务分析服务C接入了第三类型的视频流,则所述任务管理服务将流媒体服务A重定向到任务分析服务C,所述任务分析服务C在接收到流媒体服务A发送的视频流的请求消息后,查询到自身接入了第三类型的视频流,则直接将所述第三类型的视频流返回至流媒体服务A。如此,采用重定向机制实现视频的溯源功能,保证视频接入分发系统(即服务器)不对前端设备(即视频流所在的设备)产生性能影响,且保证所述系统的内部转发功能正常有效。For example, the streaming media server A (that is, the client A) sends a request message to the task analysis service A to obtain the third type of video stream, and the task analysis service A finds that it does not have access to the third type of video stream. type of video stream. The task analysis service A sends a query request message to the task management service, and the task management service inquires that the task analysis service C has accessed the third type of video stream, then the task management service redirects the streaming media service A to the task Analysis service C, after receiving the video stream request message sent by streaming media service A, the task analysis service C inquires that it has access to a third type of video stream, and directly sends the third type of video stream Return to streaming service A. In this way, the redirection mechanism is used to realize the traceability function of the video, to ensure that the video access distribution system (that is, the server) does not affect the performance of the front-end device (that is, the device where the video stream is located), and to ensure that the internal forwarding function of the system is normal and effective.
本申请实施例中,所述任务管理服务可以是在系统创建完成后就从某一任务分析服务中确定出的,也就是说,所述任务管理服务所在的服务节点,不但具备视频接入的溯源功能,还具备具体的视频接入和分发功能,如此,可以实现资源的复用。In this embodiment of the application, the task management service may be determined from a certain task analysis service after the system is created, that is to say, the service node where the task management service is located not only has video access The traceability function also has specific video access and distribution functions, so that resource reuse can be realized.
基于前述的实施例,本申请实施例再提供一种视频流的获取方法,所述方法应用于服务器,所述服务器包括多个服务节点,每一所述服务节点上存在至少一个任务分析服务,所述方法包括:Based on the foregoing embodiments, this embodiment of the present application further provides a video stream acquisition method, the method is applied to a server, and the server includes a plurality of service nodes, and there is at least one task analysis service on each of the service nodes, The methods include:
步骤S111、将所述多个服务节点中的第一服务节点,确定为任务管理节点;Step S111, determining the first service node among the plurality of service nodes as a task management node;
本申请实施例中,服务器通常包括若干台机器,或者若干套虚拟机环境,这种情况下,一台机器或者一套虚拟机环境就是一个服务节点,具有多个服务节点的服务器即分布式服务器。任务分析服务可以看作是在这个节点上运行的一个进程,这个进程会使用这个节点的IP(Internet Protocol,网际互联协议)地址对外监听或建立网络连接。In the embodiment of this application, the server usually includes several machines, or several sets of virtual machine environments. In this case, a machine or a set of virtual machine environments is a service node, and a server with multiple service nodes is a distributed server. . The task analysis service can be regarded as a process running on this node, and this process will use the IP (Internet Protocol, Internet Protocol) address of this node to monitor externally or establish a network connection.
这里,分布式服务器的特点是多节点多副本运行,一种情况,多个服务节点(即物理机)中的每一服务节点上都有一个服务(任务分析服务或任务管理服务)。另一种情况,一个服务器上存在多个服务,每一服务都看作是一个虚拟机,不同的虚拟机存在资源隔离,这两种情况都属于分布式服务器。本申请实施例中通过采用分布式系统框架来获取视频流,从而具备高可靠、高扩展等特性,如此能够保证视频流获取场景下接入和转发功能的稳定和高效运行。同时,在视频接入分发系统的多个服务节点中,选举某一节点作为任务管理的角色,从而实现不同节点之间拉取视频流的重定向的调度。Here, the distributed server is characterized by multi-node and multi-copy operation. In one case, each of the multiple service nodes (ie, physical machines) has a service (task analysis service or task management service). In another case, there are multiple services on one server, and each service is regarded as a virtual machine, and different virtual machines have resource isolation, both of which belong to distributed servers. In the embodiment of the present application, the distributed system framework is used to obtain the video stream, so that it has the characteristics of high reliability and high expansion, so as to ensure the stable and efficient operation of the access and forwarding functions in the scene of video stream acquisition. At the same time, among the multiple service nodes of the video access distribution system, a certain node is elected as the role of task management, so as to realize the redirection scheduling of pulling video streams between different nodes.
本申请实施例中,所述任务管理节点的主要作用是查询是否有服务节点接入客户端所需的视频流,以及如果有服务节点接入所述视频流,则确定接入所述视频流的特定服务节点,并将查询的结果发送给第一任务分析服务所在的服务节点。所述第一任务分析服务所在的节点再将所述特定服务节点的节点地址发送给所述客户端,从而所述客户端能够通过所述特定服务节点上的任务分析服务获取所述视频流。通过上述方式,能够采用重定向机制保证多服务分发时,可以将溯源后的服务直接反馈给客户端去对接,减少内部服务所在的节点之间的网络消耗。In the embodiment of the present application, the main function of the task management node is to query whether there is a service node to access the video stream required by the client, and if there is a service node to access the video stream, then determine to access the video stream specific service node, and send the query result to the service node where the first task analysis service is located. The node where the first task analysis service is located then sends the node address of the specific service node to the client, so that the client can obtain the video stream through the task analysis service on the specific service node. Through the above method, the redirection mechanism can be used to ensure the distribution of multiple services, and the traced services can be directly fed back to the client for docking, reducing the network consumption between the nodes where the internal services are located.
这里,可以将所述多个服务节点中的任一服务节点,确定为所述任务管理节点,还可以将所述多个服务节点中负载最小的服务节点,确定为所述任务管理节点。当然,还可以通过其他的方法来将某个服务节点确定为所述任务管理节点,即本申请实施例中对所述任务管理节点的确定方法并不做限制,本领域技术人员可以根据实际使用需求进行设置。Here, any service node among the plurality of service nodes may be determined as the task management node, and a service node with the smallest load among the plurality of service nodes may be determined as the task management node. Of course, other methods can also be used to determine a certain service node as the task management node, that is, the method for determining the task management node in the embodiment of the present application is not limited, and those skilled in the art can use needs to be set.
步骤S112、将所述任务管理节点中的任务分析服务,确定为任务管理服务;Step S112, determining the task analysis service in the task management node as the task management service;
这里,如果所述任务管理节点中存在一个任务分析服务,则将此任务分析服务确定为所述任务管理服务。Here, if there is a task analysis service in the task management node, this task analysis service is determined as the task management service.
步骤S113、所述服务器中的第一任务分析服务在接收到获取视频流的请求消息后,确定 自身是否已接入所述视频流;其中,所述请求消息是客户端基于第一映射关系发送给所述第一任务分析服务的,所述第一映射关系用于表明所述服务器中每一任务分析服务对应的客户端;Step S113, the first task analysis service in the server determines whether it has accessed the video stream after receiving the request message for obtaining the video stream; wherein, the request message is sent by the client based on the first mapping relationship For the first task analysis service, the first mapping relationship is used to indicate the client corresponding to each task analysis service in the server;
这里,如果所述服务器为分布式服务器、且所述分布式服务器包括多个服务节点,每一所述服务节点上存在至少一个任务分析服务,则所述第一映射关系用于表明所述每一所述服务节点对应的客户端。Here, if the server is a distributed server, and the distributed server includes multiple service nodes, and there is at least one task analysis service on each service node, the first mapping relationship is used to indicate that each A client corresponding to the service node.
这里,所述第一任务分析服务为在所述第一映射关系中所述客户端对应的服务节点上的任务分析服务。Here, the first task analysis service is a task analysis service on the service node corresponding to the client in the first mapping relationship.
步骤S114、在所述第一任务分析服务未接入所述视频流的情况下,所述服务器中的任务管理服务基于第二映射关系将所述客户端重定向到第二任务分析服务,使得所述客户端能够通过重定向的第二任务分析服务获取到所述视频流;Step S114, in the case that the first task analysis service does not access the video stream, the task management service in the server redirects the client to the second task analysis service based on the second mapping relationship, so that The client can obtain the video stream through the redirected second task analysis service;
其中,所述第二映射关系用于表明所述每一所述服务节点已对应接入的视频流。Wherein, the second mapping relationship is used to indicate that each of the service nodes has correspondingly accessed video streams.
这里,所述第二任务分析服务所在的服务节点与所述视频流存在所述第二映射关系。Here, the second mapping relationship exists between the service node where the second task analysis service is located and the video stream.
通过上述方式,能够采用分布式系统框架获取视频流,从而具备高可靠、高扩展等特性,如此能够保证视频流获取场景下接入和转发功能的稳定和高效运行。同时,在视频接入分发系统的多个任务分析服务中,选举某一任务分析服务作为任务管理的角色,从而在资源复用的同时实现不同服务之间拉取视频流的重定向的调度。Through the above method, the distributed system framework can be used to obtain video streams, so that it has the characteristics of high reliability and high expansion, so as to ensure the stable and efficient operation of the access and forwarding functions in the video stream acquisition scene. At the same time, among the multiple task analysis services of the video access distribution system, a certain task analysis service is elected as the role of task management, so as to realize the redirection scheduling of pulling video streams between different services while reusing resources.
基于前述的实施例,本申请实施例再提供一种视频流的获取方法,所述方法应用于服务器,图2为本申请实施例视频流的获取方法的实现流程示意图二,如图2所示,所述方法包括:Based on the aforementioned embodiments, the embodiment of the present application further provides a method for obtaining a video stream, and the method is applied to a server. FIG. 2 is a schematic diagram of the second implementation process of the method for obtaining a video stream in the embodiment of the present application, as shown in FIG. 2 , the method includes:
步骤S201、所述服务器中的第一任务分析服务在接收到获取视频流的请求消息后,确定自身是否已接入所述视频流;其中,所述请求消息是客户端基于第一映射关系发送给所述第一任务分析服务的,所述第一映射关系用于表明所述服务器中每一任务分析服务对应的客户端;Step S201, the first task analysis service in the server determines whether it has accessed the video stream after receiving the request message for obtaining the video stream; wherein, the request message is sent by the client based on the first mapping relationship For the first task analysis service, the first mapping relationship is used to indicate the client corresponding to each task analysis service in the server;
步骤S202、在所述第一任务分析服务未接入所述视频流的情况下,所述第一任务分析服务向所述任务管理服务发送查询请求消息;其中,所述查询请求消息中携带有所述视频流的标识信息;Step S202. In the case that the first task analysis service does not access the video stream, the first task analysis service sends a query request message to the task management service; wherein, the query request message carries Identification information of the video stream;
步骤S203、所述任务管理服务根据所述标识信息和所述第二映射关系,查询已接入所述视频流的任务分析服务,得到查询结果;Step S203, the task management service queries the task analysis service that has accessed the video stream according to the identification information and the second mapping relationship, and obtains a query result;
本申请实施例中,所述任务管理服务接收到所述第一任务分析服务发送的查询请求消息后,所述任务管理服务可以在共享存储中查询已接入所述视频流的任务分析服务,从而实现视频的溯源功能。如此,客户端可以直接使用已接入所述视频流的任务分析服务来获取所述视频流,从而可以保证视频接入分发系统(即服务器)不对前端设备产生性能影响,且保证所述系统的内部转发功能正常有效。In the embodiment of the present application, after the task management service receives the query request message sent by the first task analysis service, the task management service may query the task analysis service that has accessed the video stream in the shared storage, In order to realize the traceability function of the video. In this way, the client can directly use the task analysis service that has accessed the video stream to obtain the video stream, thereby ensuring that the video access distribution system (that is, the server) does not affect the performance of the front-end equipment, and that the system's The internal forwarding function works normally.
步骤S204、在所述查询结果表明所述服务器中的第二任务分析服务已接入所述视频流的情况下,所述任务管理服务将所述查询结果发送给所述第一任务分析服务,使得所述客户端能够通过所述第二任务分析服务获取所述视频流;其中,所述第二映射关系用于表明所述每一任务分析服务已对应接入的视频流;所述任务管理服务是从所述服务器中的多个任务分析服务中确定出的。Step S204, when the query result indicates that the second task analysis service in the server has accessed the video stream, the task management service sends the query result to the first task analysis service, enabling the client to obtain the video stream through the second task analysis service; wherein, the second mapping relationship is used to indicate that each task analysis service has correspondingly accessed video stream; the task management The service is determined from a plurality of task analysis services in the server.
在一些实施例中,所述服务器包括多个服务节点,每一所述服务节点上存在至少一个所述任务分析服务;对应地,所述第二映射关系用于表明所述每一所述服务节点已对应接入的视频流;In some embodiments, the server includes multiple service nodes, and at least one task analysis service exists on each of the service nodes; correspondingly, the second mapping relationship is used to indicate that each of the service nodes The video stream that the node has been connected to;
对应地,所述方法还包括:Correspondingly, the method also includes:
步骤S21、将所述多个服务节点中的第一服务节点,确定为任务管理节点;Step S21, determining the first service node among the plurality of service nodes as a task management node;
步骤S22、将所述任务管理节点中的任务分析服务,确定为所述任务管理服务。Step S22, determining the task analysis service in the task management node as the task management service.
基于前述的实施例,本申请实施例再提供一种视频流的获取方法,所述方法应用于服务器,所述方法包括:Based on the foregoing embodiments, this embodiment of the present application further provides a method for obtaining a video stream, the method is applied to a server, and the method includes:
步骤S211、所述服务器中的第一任务分析服务在接收到获取视频流的请求消息后,确定自身是否已接入所述视频流;其中,所述请求消息是客户端基于第一映射关系发送给所述第一任务分析服务的,所述第一映射关系用于表明所述服务器中每一任务分析服务对应的客户端;Step S211, the first task analysis service in the server determines whether it has accessed the video stream after receiving the request message for obtaining the video stream; wherein, the request message is sent by the client based on the first mapping relationship For the first task analysis service, the first mapping relationship is used to indicate the client corresponding to each task analysis service in the server;
步骤S212、在所述第一任务分析服务未接入所述视频流的情况下,所述第一任务分析服务向所述任务管理服务发送查询请求消息;其中,所述查询请求消息中携带有所述视频流的标识信息;Step S212, in the case that the first task analysis service does not access the video stream, the first task analysis service sends a query request message to the task management service; wherein, the query request message carries Identification information of the video stream;
步骤S213、所述任务管理服务根据所述标识信息和所述第二映射关系,查询已接入所述视频流的任务分析服务,得到查询结果;Step S213, the task management service queries the task analysis service that has accessed the video stream according to the identification information and the second mapping relationship, and obtains a query result;
这里,所述查询请求消息中携带有视频流的标识信息的作用是,所述任务管理服务能够根据所述标识信息查询是哪个节点上的任务分析服务接入了所述视频流。Here, the purpose of carrying the identification information of the video stream in the query request message is that the task management service can query which node the task analysis service on which accesses the video stream according to the identification information.
步骤S214、在所述查询结果表明所述服务器中的第二任务分析服务已接入所述视频流的情况下,所述任务管理服务将所述查询结果发送给所述第一任务分析服务;Step S214, when the query result indicates that the second task analysis service in the server has accessed the video stream, the task management service sends the query result to the first task analysis service;
步骤S215、所述第一任务分析服务将所述第二任务分析服务的节点地址发送给所述客户端,以使所述客户端能够根据所述节点地址与所述第二任务分析服务建立媒体连接从而获取所述视频流;其中,所述第二映射关系用于表明所述每一任务分析服务已对应接入的视频流;所述任务管理服务是从所述服务器中的多个任务分析服务中确定出的。Step S215, the first task analysis service sends the node address of the second task analysis service to the client, so that the client can establish media with the second task analysis service according to the node address Connect to obtain the video stream; wherein, the second mapping relationship is used to indicate that each task analysis service has correspondingly accessed video stream; the task management service analyzes the tasks from multiple tasks in the server identified in the service.
本申请实施例中,在对接的时候,客户端先向对应的服务节点发送一个基础的信令,所述服务节点确定未接入所述客户端请求的视频流后,会寻找已接入所述视频流的服务节点,并返回一个302错误,所述错误码中携带有新的地址(即找到的已接入所述视频流的服务节点的地址),进而,所述客户端拿到这个新的地址后会再发个获取视频流的请求,因为变地址了所以是重定向。如此,对于已接入的视频源,当客户端来向任务分析服务请求该视频源时,如果所述视频源已接入的节点不是当前所述客户端对应的服务节点,则采用重定向的方式实现客户端与服务节点之间的正确连接。In this embodiment of the application, when docking, the client first sends a basic signaling to the corresponding service node. After the service node determines that the video stream requested by the client is not accessed, it will search for the The service node of the video stream, and returns a 302 error, the error code carries a new address (that is, the found address of the service node that has accessed the video stream), and then, the client gets this After the new address, a request to obtain the video stream will be sent again, because the address has changed, so it is redirected. In this way, for a video source that has been accessed, when the client requests the video source from the task analysis service, if the node to which the video source has accessed is not the current service node corresponding to the client, redirected way to achieve the correct connection between the client and the service node.
在一些实施例中,所述步骤S213、任务管理服务根据所述标识信息和所述第二映射关系,查询已接入所述视频流的任务分析服务,得到查询结果,包括:In some embodiments, in step S213, the task management service queries the task analysis service that has accessed the video stream according to the identification information and the second mapping relationship, and obtains a query result, including:
步骤S2131、所述任务管理服务根据所述标识信息和所述第二映射关系,确定已接入所述视频流的地址信息;Step S2131, the task management service determines the address information of the video stream that has been accessed according to the identification information and the second mapping relationship;
这里,可以根据已接入所述视频流的地址信息,来确定已接入所述视频流的任务分析服务。也就是说,所述地址信息和所述任务分析服务之间存在对应关系,从而能够根据已接入视频流的地址信息与任务分析服务的对应关系,实现待接入视频源的溯源功能。Here, the task analysis service that has accessed the video stream may be determined according to the address information that has accessed the video stream. That is to say, there is a corresponding relationship between the address information and the task analysis service, so that the traceability function of the video source to be accessed can be realized according to the corresponding relationship between the address information of the accessed video stream and the task analysis service.
步骤S2132、所述任务管理服务根据所述地址信息,确定已接入所述视频流的任务分析服务,得到查询结果。Step S2132, the task management service determines the task analysis service that has accessed the video stream according to the address information, and obtains a query result.
基于前述的实施例,本申请实施例再提供一种视频流的获取方法,所述方法应用于服务器,图3为本申请实施例视频流的获取方法的实现流程示意图三,如图3所示,所述方法包括:Based on the foregoing embodiments, this embodiment of the present application further provides a method for obtaining a video stream, and the method is applied to a server. FIG. 3 is a schematic diagram of the third implementation process of the method for obtaining a video stream according to the embodiment of the present application, as shown in FIG. 3 , the method includes:
步骤S301、所述服务器中的第一任务分析服务在接收到获取视频流的请求消息后,确定自身是否已接入所述视频流;其中,所述请求消息是客户端基于第一映射关系发送给所述第一任务分析服务的,所述第一映射关系用于表明所述服务器中每一任务分析服务对应的客户端;Step S301, the first task analysis service in the server determines whether it has accessed the video stream after receiving the request message for obtaining the video stream; wherein, the request message is sent by the client based on the first mapping relationship For the first task analysis service, the first mapping relationship is used to indicate the client corresponding to each task analysis service in the server;
这里,如果所述第一任务分析服务未接入所述视频流,则执行下述步骤S302;如果所述第一任务分析服务已接入所述视频流,则执行下述步骤S303至步骤S304。Here, if the first task analysis service does not access the video stream, perform the following step S302; if the first task analysis service has access to the video stream, perform the following steps S303 to S304 .
步骤S302、所述服务器中的任务管理服务基于第二映射关系将所述客户端重定向到第二任务分析服务,使得所述客户端能够通过重定向的第二任务分析服务获取到所述视频流; 其中,所述第二映射关系用于表明所述每一任务分析服务已对应接入的视频流;所述任务管理服务是从所述服务器中的多个任务分析服务中确定出的;Step S302, the task management service in the server redirects the client to the second task analysis service based on the second mapping relationship, so that the client can obtain the video through the redirected second task analysis service stream; wherein, the second mapping relationship is used to indicate that each task analysis service has correspondingly accessed video stream; the task management service is determined from multiple task analysis services in the server;
步骤S303、所述第一任务分析服务与所述客户端建立媒体连接;Step S303, the first task analysis service establishes a media connection with the client;
这里,如果所述第一任务分析服务已接入所述视频流,则可以直接利用所述第一任务分析服务向所述客户端提供其所需的视频流。Here, if the first task analysis service has access to the video stream, the first task analysis service may be used directly to provide the client with the required video stream.
步骤S304、所述第一任务分析服务通过所述媒体连接,将接入的所述视频流发送给所述客户端。Step S304, the first task analysis service sends the accessed video stream to the client through the media connection.
基于前述的实施例,本申请实施例再提供一种视频流的获取方法,所述方法应用于服务器,所述方法包括:Based on the foregoing embodiments, this embodiment of the present application further provides a method for obtaining a video stream, the method is applied to a server, and the method includes:
步骤S311、所述服务器中的第一任务分析服务在接收到获取视频流的请求消息后,确定自身是否已接入所述视频流;其中,所述请求消息是客户端基于第一映射关系发送给所述第一任务分析服务的,所述第一映射关系用于表明所述服务器中每一任务分析服务对应的客户端;Step S311, the first task analysis service in the server determines whether it has accessed the video stream after receiving the request message for obtaining the video stream; wherein, the request message is sent by the client based on the first mapping relationship For the first task analysis service, the first mapping relationship is used to indicate the client corresponding to each task analysis service in the server;
这里,如果所述第一任务分析服务未接入所述视频流,则执行下述步骤S312至步骤S314;否则,如果所述第一任务分析服务已接入所述视频流,则执行下述步骤S315至步骤S316。Here, if the first task analysis service does not access the video stream, perform the following steps S312 to S314; otherwise, if the first task analysis service has access to the video stream, perform the following Step S315 to step S316.
步骤S312、所述第一任务分析服务向所述任务管理服务发送查询请求消息;其中,所述查询请求消息中携带有所述视频流的标识信息;Step S312, the first task analysis service sends a query request message to the task management service; wherein, the query request message carries identification information of the video stream;
步骤S313、所述任务管理服务根据所述标识信息和所述第二映射关系,查询已接入所述视频流的任务分析服务,得到查询结果;Step S313, the task management service queries the task analysis service that has accessed the video stream according to the identification information and the second mapping relationship, and obtains a query result;
步骤S314、在所述查询结果表明所述服务器中的第二任务分析服务已接入所述视频流的情况下,所述任务管理服务将所述查询结果发送给所述第一任务分析服务,使得所述客户端能够通过所述第二任务分析服务获取所述视频流;其中,所述第二映射关系用于表明所述每一任务分析服务已对应接入的视频流;所述任务管理服务是从所述服务器中的多个任务分析服务中确定出的;Step S314, when the query result indicates that the second task analysis service in the server has accessed the video stream, the task management service sends the query result to the first task analysis service, enabling the client to obtain the video stream through the second task analysis service; wherein, the second mapping relationship is used to indicate that each task analysis service has correspondingly accessed video stream; the task management The service is determined from a plurality of task analysis services in the server;
步骤S315、所述第一任务分析服务与所述客户端建立媒体连接;Step S315, the first task analysis service establishes a media connection with the client;
步骤S316、所述第一任务分析服务通过所述媒体连接,将接入的所述视频流发送给所述客户端。Step S316, the first task analysis service sends the accessed video stream to the client through the media connection.
在一些实施例中,所述方法还包括:在所述查询结果表明未查询到已接入所述视频流的任务分析服务的情况下,所述任务管理服务根据预设规则确定出目标任务分析服务,使得所述客户端能够通过所述目标任务分析服务获取所述视频流。In some embodiments, the method further includes: when the query result shows that no task analysis service that has accessed the video stream is found, the task management service determines the target task analysis service according to preset rules. service, so that the client can obtain the video stream through the target task analysis service.
基于前述的实施例,本申请实施例再提供一种视频流的获取方法,所述方法应用于服务器,图4为本申请实施例视频流的获取方法的实现流程示意图四,如图4所示,所述方法包括:Based on the foregoing embodiments, this embodiment of the present application further provides a method for obtaining a video stream, and the method is applied to a server. FIG. 4 is a schematic diagram 4 of the implementation process of the method for obtaining a video stream according to the embodiment of the present application, as shown in FIG. 4 , the method includes:
步骤S401、所述服务器中的第一任务分析服务在接收到获取视频流的请求消息后,确定自身是否已接入所述视频流;其中,所述请求消息是客户端基于第一映射关系发送给所述第一任务分析服务的,所述第一映射关系用于表明所述服务器中每一任务分析服务对应的客户端;Step S401, the first task analysis service in the server determines whether it has accessed the video stream after receiving the request message for obtaining the video stream; wherein, the request message is sent by the client based on the first mapping relationship For the first task analysis service, the first mapping relationship is used to indicate the client corresponding to each task analysis service in the server;
步骤S402、在所述第一任务分析服务未接入所述视频流的情况下,所述第一任务分析服务向所述任务管理服务发送查询请求消息;其中,所述查询请求消息中携带有所述视频流的标识信息;Step S402. In the case that the first task analysis service does not access the video stream, the first task analysis service sends a query request message to the task management service; wherein, the query request message carries Identification information of the video stream;
步骤S403、所述任务管理服务根据所述标识信息和所述第二映射关系,查询已接入所述视频流的任务分析服务,得到查询结果;Step S403, the task management service queries the task analysis service that has accessed the video stream according to the identification information and the second mapping relationship, and obtains a query result;
步骤S404、在所述查询结果表明所述服务器中的第二任务分析服务已接入所述视频流的情况下,所述任务管理服务将所述查询结果发送给所述第一任务分析服务,使得所述客户端能够通过所述第二任务分析服务获取所述视频流;其中,所述第二映射关系用于表明所述 每一任务分析服务已对应接入的视频流;所述任务管理服务是从所述服务器中的多个任务分析服务中确定出的;Step S404, when the query result shows that the second task analysis service in the server has accessed the video stream, the task management service sends the query result to the first task analysis service, enabling the client to obtain the video stream through the second task analysis service; wherein, the second mapping relationship is used to indicate that each task analysis service has correspondingly accessed video stream; the task management The service is determined from a plurality of task analysis services in the server;
步骤S405、在所述查询结果表明未查询到已接入所述视频流的任务分析服务的情况下,所述任务管理服务根据预设规则确定出目标任务分析服务,使得所述客户端能够通过所述目标任务分析服务获取所述视频流。Step S405, when the query result shows that no task analysis service that has accessed the video stream is found, the task management service determines the target task analysis service according to preset rules, so that the client can pass The target task analysis service obtains the video stream.
这里,所述查询结果表明未查询到已接入所述视频流的任务分析服务指的是所述服务器中的任一任务分析服务都未接入所述视频流,则所述任务管理服务可以根据预设规则确定出一个目标任务分析服务来获取所述视频流,如此,能够在视频流均未被任务分析服务接入过的情况下,采取灵活多样的调度策略保证可以覆盖各种场景需求。Here, the query result shows that no task analysis service that has accessed the video stream is found, which means that none of the task analysis services in the server has access to the video stream, and the task management service can Determine a target task analysis service to obtain the video stream according to the preset rules. In this way, when the video stream has not been accessed by the task analysis service, flexible and diverse scheduling strategies can be adopted to ensure that various scene requirements can be covered. .
基于前述的实施例,本申请实施例再提供一种视频流的获取方法,所述方法应用于服务器,所述方法包括:Based on the foregoing embodiments, this embodiment of the present application further provides a method for obtaining a video stream, the method is applied to a server, and the method includes:
步骤S411、所述服务器中的第一任务分析服务在接收到获取视频流的请求消息后,确定自身是否已接入所述视频流;其中,所述请求消息是客户端基于第一映射关系发送给所述第一任务分析服务的,所述第一映射关系用于表明所述服务器中每一任务分析服务对应的客户端;Step S411, the first task analysis service in the server determines whether it has accessed the video stream after receiving the request message for obtaining the video stream; wherein, the request message is sent by the client based on the first mapping relationship For the first task analysis service, the first mapping relationship is used to indicate the client corresponding to each task analysis service in the server;
步骤S412、在所述第一任务分析服务未接入所述视频流的情况下,所述第一任务分析服务向所述任务管理服务发送查询请求消息;其中,所述查询请求消息中携带有所述视频流的标识信息;Step S412, in the case that the first task analysis service does not access the video stream, the first task analysis service sends a query request message to the task management service; wherein, the query request message carries Identification information of the video stream;
步骤S413、所述任务管理服务根据所述标识信息和所述第二映射关系,查询已接入所述视频流的任务分析服务,得到查询结果;Step S413, the task management service queries the task analysis service that has accessed the video stream according to the identification information and the second mapping relationship, and obtains a query result;
步骤S414、在所述查询结果表明所述服务器中的第二任务分析服务已接入所述视频流的情况下,所述任务管理服务将所述查询结果发送给所述第一任务分析服务,使得所述客户端能够通过所述第二任务分析服务获取所述视频流;其中,所述第二映射关系用于表明所述每一任务分析服务已对应接入的视频流;所述任务管理服务是从所述服务器中的多个任务分析服务中确定出的;Step S414, when the query result shows that the second task analysis service in the server has accessed the video stream, the task management service sends the query result to the first task analysis service, enabling the client to obtain the video stream through the second task analysis service; wherein, the second mapping relationship is used to indicate that each task analysis service has correspondingly accessed video stream; the task management The service is determined from a plurality of task analysis services in the server;
步骤S415、在所述查询结果表明未查询到已接入所述视频流的任务分析服务的情况下,所述任务管理服务根据所述第一映射关系将所述第一任务分析服务确定为所述目标任务分析服务,使得所述客户端能够通过所述第一任务分析服务获取所述视频流。Step S415, when the query result indicates that no task analysis service that has accessed the video stream is found, the task management service determines the first task analysis service as the first task analysis service according to the first mapping relationship. The target task analysis service, so that the client can obtain the video stream through the first task analysis service.
这里,所述第一任务分析服务为服务器收到客户端的获取视频流的请求时分配的处理所述请求的任务分析服务,如此,能够在视频流均未被任务分析服务接入过的情况下,采取就近调度策略,这样可以减少重定向现象,对客户端更友好,逻辑也更简单,效率更高。Here, the first task analysis service is the task analysis service assigned by the server to process the request when the server receives the client's request for acquiring video streams. In this way, when no video stream has been accessed by the task analysis service , adopt the nearest scheduling strategy, which can reduce the redirection phenomenon, be more friendly to the client, the logic is simpler, and the efficiency is higher.
基于前述的实施例,本申请实施例再提供一种视频流的获取方法,所述方法应用于服务器,所述方法包括:Based on the foregoing embodiments, this embodiment of the present application further provides a method for obtaining a video stream, the method is applied to a server, and the method includes:
步骤S421、所述服务器中的第一任务分析服务在接收到获取视频流的请求消息后,确定自身是否已接入所述视频流;其中,所述请求消息是客户端基于第一映射关系发送给所述第一任务分析服务的,所述第一映射关系用于表明所述服务器中每一任务分析服务对应的客户端;Step S421, the first task analysis service in the server determines whether it has accessed the video stream after receiving the request message for obtaining the video stream; wherein, the request message is sent by the client based on the first mapping relationship For the first task analysis service, the first mapping relationship is used to indicate the client corresponding to each task analysis service in the server;
步骤S422、在所述第一任务分析服务未接入所述视频流的情况下,所述第一任务分析服务向所述任务管理服务发送查询请求消息;其中,所述查询请求消息中携带有所述视频流的标识信息;Step S422. In the case that the first task analysis service does not access the video stream, the first task analysis service sends a query request message to the task management service; wherein, the query request message carries Identification information of the video stream;
步骤S423、所述任务管理服务根据所述标识信息和所述第二映射关系,查询已接入所述视频流的任务分析服务,得到查询结果;Step S423, the task management service queries the task analysis service that has accessed the video stream according to the identification information and the second mapping relationship, and obtains a query result;
步骤S424、在所述查询结果表明所述服务器中的第二任务分析服务已接入所述视频流的情况下,所述任务管理服务将所述查询结果发送给所述第一任务分析服务,使得所述客户端能够通过所述第二任务分析服务获取所述视频流;其中,所述第二映射关系用于表明所述 每一任务分析服务已对应接入的视频流;所述任务管理服务是从所述服务器中的多个任务分析服务中确定出的;Step S424, when the query result indicates that the second task analysis service in the server has accessed the video stream, the task management service sends the query result to the first task analysis service, enabling the client to obtain the video stream through the second task analysis service; wherein, the second mapping relationship is used to indicate that each task analysis service has correspondingly accessed video stream; the task management The service is determined from a plurality of task analysis services in the server;
步骤S425、在所述查询结果表明未查询到已接入所述视频流的任务分析服务的情况下,所述任务管理服务确定所述服务器中至少两个任务分析服务的负载;Step S425, when the query result shows that no task analysis service that has accessed the video stream is found, the task management service determines the load of at least two task analysis services in the server;
这里,如果所述服务器为分布式服务器,所述分布式服务器包括的多个服务节点,每一服务节点上都有至少一个任务分析服务。在所述查询结果表明未查询到已接入所述视频流的任务分析服务的情况下,可以确定所有任务分析服务或者所有任务分析服务中的部分任务分析服务的负载。所述任务分析服务的负载指的是所述任务分析服务接入视频流和转发视频流的量。Here, if the server is a distributed server, the distributed server includes multiple service nodes, and each service node has at least one task analysis service. In the case where the query result indicates that no task analysis service that has accessed the video stream is found, the load of all task analysis services or a part of all task analysis services may be determined. The load of the task analysis service refers to the amount of the task analysis service accessing video streams and forwarding video streams.
步骤S426、所述任务管理服务将所述至少两个任务分析服务的负载按取值从小到大进行排序,得到排序结果;Step S426, the task management service sorts the loads of the at least two task analysis services in ascending order of values, and obtains a sorting result;
步骤S427、所述任务管理服务根据所述排序结果将负载最小的任务分析服务确定为所述目标任务分析服务,使得所述客户端能够通过所述负载最小的任务分析服务获取所述视频流。Step S427, the task management service determines the task analysis service with the smallest load as the target task analysis service according to the sorting result, so that the client can obtain the video stream through the task analysis service with the smallest load.
通过上述方式,能够在视频流均未被任务分析服务接入过的情况下,采取负载均衡调度策略,选择所有任务分析服务中负载最小的服务所在的节点作为客户端的对接节点,这样可以减少系统资源压力,提高稳定性。Through the above method, when the video stream has not been accessed by the task analysis service, a load balancing scheduling strategy can be adopted, and the node where the service with the smallest load among all task analysis services is selected as the docking node of the client, which can reduce the system Resource pressure, improved stability.
基于前述的实施例,本申请实施例再提供一种视频流的获取方法,所述方法应用于服务器,所述方法包括:Based on the foregoing embodiments, this embodiment of the present application further provides a method for obtaining a video stream, the method is applied to a server, and the method includes:
步骤S431、所述服务器中的第一任务分析服务在接收到获取视频流的请求消息后,确定自身是否已接入所述视频流;其中,所述请求消息是客户端基于第一映射关系发送给所述第一任务分析服务的,所述第一映射关系用于表明所述服务器中每一任务分析服务对应的客户端;Step S431, the first task analysis service in the server determines whether it has accessed the video stream after receiving the request message for obtaining the video stream; wherein, the request message is sent by the client based on the first mapping relationship For the first task analysis service, the first mapping relationship is used to indicate the client corresponding to each task analysis service in the server;
步骤S432、在所述第一任务分析服务未接入所述视频流的情况下,所述第一任务分析服务向所述任务管理服务发送查询请求消息;其中,所述查询请求消息中携带有所述视频流的标识信息;Step S432. In the case that the first task analysis service does not access the video stream, the first task analysis service sends a query request message to the task management service; wherein, the query request message carries Identification information of the video stream;
步骤S433、所述任务管理服务根据所述标识信息和所述第二映射关系,查询已接入所述视频流的任务分析服务,得到查询结果;Step S433, the task management service queries the task analysis service that has accessed the video stream according to the identification information and the second mapping relationship, and obtains a query result;
步骤S434、在所述查询结果表明所述服务器中的第二任务分析服务已接入所述视频流的情况下,所述任务管理服务将所述查询结果发送给所述第一任务分析服务,使得所述客户端能够通过所述第二任务分析服务获取所述视频流;其中,所述第二映射关系用于表明所述每一任务分析服务已对应接入的视频流;所述任务管理服务是从所述服务器中的多个任务分析服务中确定出的;Step S434, when the query result indicates that the second task analysis service in the server has accessed the video stream, the task management service sends the query result to the first task analysis service, enabling the client to obtain the video stream through the second task analysis service; wherein, the second mapping relationship is used to indicate that each task analysis service has correspondingly accessed video stream; the task management The service is determined from a plurality of task analysis services in the server;
步骤S435、在所述查询结果表明未查询到已接入所述视频流的任务分析服务的情况下,所述任务管理服务根据所述视频流的接入类型确定出第三任务分析服务,使得所述客户端能够通过所述第三任务分析服务获取所述视频流。Step S435, when the query result shows that no task analysis service that has accessed the video stream is found, the task management service determines a third task analysis service according to the access type of the video stream, so that The client can obtain the video stream through the third task analysis service.
这里,某些服务节点(即某些任务分析服务)只能接某种类型的视频流,则可以根据需要获取的视频流的接入类型,确定出对应的服务节点,然后使用所述服务节点上的任务分析服务来获取所需的视频流,这样可以更加灵活的在满足用户场景需求下实现视频流的接入和转发功能。Here, some service nodes (that is, some task analysis services) can only receive a certain type of video stream, then the corresponding service node can be determined according to the access type of the video stream to be obtained, and then the service node can be used The task analysis service on the Internet can obtain the required video stream, so that the video stream access and forwarding functions can be realized more flexibly to meet the needs of user scenarios.
当然,还可以是某些客户端平台只能对应某些服务节点,如果该客户端所需的视频流未被任一服务节点接入过,则使用该客户端所在的平台对应的服务节点来获取所述视频流。Of course, it is also possible that some client platforms can only correspond to certain service nodes. If the video stream required by the client has not been accessed by any service node, use the service node corresponding to the platform where the client is located. Get the video stream.
目前,采用分布式系统做视频接入分发有明显的优势,可以提高系统并发量、支持动态扩缩容,并且分布式系统也具有高可靠性等特点。但是,分布式系统的多节点服务在处理接入视频源时,容易出现同一路前端设备视频源被多次请求和转发的情况,导致前端设备带宽 资源被浪费,系统性能受限。例如,客户端A和客户端B同时在请求前端设备上的同一视频流,则此时在所述分布式系统中,所述客户端A对应的节点服务A和所述客户端B对应的节点服务B会同时向所述前端设备请求所述视频源,如此,可能造成前端设备的带宽资源浪费,以及所述分布式系统的性能不高。At present, using a distributed system for video access distribution has obvious advantages. It can increase the system concurrency, support dynamic expansion and contraction, and the distributed system also has the characteristics of high reliability. However, when the multi-node service of the distributed system handles access to video sources, it is easy for the same front-end device video source to be requested and forwarded multiple times, resulting in waste of front-end device bandwidth resources and limited system performance. For example, client A and client B are requesting the same video stream on the front-end device at the same time, then in the distributed system at this time, the node corresponding to client A serves the node corresponding to client A and client B Service B will request the video source from the front-end device at the same time, which may result in waste of bandwidth resources of the front-end device and poor performance of the distributed system.
因此,需要考虑视频的分发溯源,以及系统资源动态调度等功能。保证所述分布式系统中的分发模块不受接入模块的性能限制,接入模块不对前端设备产生性能影响,以及系统资源高效充分利用等。其中,所述分发模块和所述接入模块均位于所述分布式系统中,所述接入模块主要用于从所述前端设备获取视频流,所述分发模块主要用于将获取的视频流转发给所述客户端。Therefore, functions such as video distribution and traceability, and dynamic scheduling of system resources need to be considered. It is ensured that the distribution module in the distributed system is not limited by the performance of the access module, that the access module does not affect the performance of the front-end equipment, and that system resources are efficiently and fully utilized. Wherein, both the distribution module and the access module are located in the distributed system, the access module is mainly used to obtain video streams from the front-end equipment, and the distribution module is mainly used to transfer the obtained video streams sent to the client.
基于此,本申请实施例提供一种视频流的获取方案,所述方案(1)采用分布式系统接入不同厂家及不同协议的视频源数据,即通过对接各种厂家协议以及标准平台协议去接入各种类型视频源(包括视频和音频)。同时,采用分布式架构部署,多节点同时接入,提高并发量以及接入效率,能够利用分布式的高可靠特性提高接入模块的稳定性。(2)由于部分视频协议在接入时有校验对接系统的地址、端口等信息,以防止单用户多次接入影响其设备性能。因此本申请实施例在分布式系统下,采用一定机制保证内部转发时能溯源到具体接入的媒体服务节点,以防止因为多路转发出现多次接入的情况。(3)采用Manager-Worker机制,区分不同节点的功能,让Manager做视频接入的溯源功能,Worker做具体的视频接入和分发功能,这样保证每路视频源至多被接入一次。如此,通过Manager-Worker机制保证在分布式系统下多节点做接入和转发时,有合理高效的资源调度机制,最大程度的提高系统运行效率。(4)在转发视频流时,通过重定向功能与客户端协商具体转发的媒体服务节点,如此可以减少节点内部之间的带宽消耗。Based on this, the embodiment of the present application provides a solution for obtaining video streams. The solution (1) uses a distributed system to access video source data from different manufacturers and different protocols, that is, through docking with various manufacturers' protocols and standard platform protocols to obtain Access various types of video sources (including video and audio). At the same time, the deployment of distributed architecture is adopted, and multiple nodes are connected at the same time, which improves the concurrency and access efficiency, and can use the distributed high reliability feature to improve the stability of the access module. (2) Since some video protocols check the address, port and other information of the docking system when accessing, to prevent multiple accesses by a single user from affecting the performance of its equipment. Therefore, in the distributed system, the embodiment of the present application adopts a certain mechanism to ensure that the internal forwarding can be traced to the specific accessed media service node, so as to prevent multiple accesses due to multi-path forwarding. (3) Use the Manager-Worker mechanism to distinguish the functions of different nodes, let the Manager perform the traceability function of video access, and the Worker perform specific video access and distribution functions, so as to ensure that each video source is accessed at most once. In this way, the Manager-Worker mechanism ensures that there is a reasonable and efficient resource scheduling mechanism when multiple nodes do access and forwarding in a distributed system, and the system operation efficiency is improved to the greatest extent. (4) When forwarding video streams, the specific media service node to be forwarded is negotiated with the client through the redirection function, which can reduce bandwidth consumption between nodes.
实施的过程中,在客户端向节点拉取视频流时,当其拉取视频流对应的节点不是接入过所述视频流的节点时,本申请实施例中采用重定向的方式实现客户端与其对应的任务分析服务(即Worker)的连接。并且,在所述分布式系统的多个Worker中,选举某个Worker作为管理(即Manager)的角色,即作为任务管理服务,以实现不同流媒体服务拉取视频流的重定向的调度。同时,在重定向过程中当所有接入服务中均不存在需要拉取的视频流时,设计多种调度逻辑,实现系统调度的负载均衡。During the implementation process, when the client pulls the video stream from the node, when the node corresponding to the pulled video stream is not a node that has accessed the video stream, the embodiment of this application adopts the method of redirection to realize the client The connection to its corresponding task analysis service (that is, Worker). And, among the plurality of Workers in the distributed system, a certain Worker is elected as the role of management (that is, Manager), that is, as a task management service, so as to realize the scheduling of redirection of video streams pulled by different streaming media services. At the same time, when there is no video stream to be pulled in all access services during the redirection process, a variety of scheduling logics are designed to achieve load balancing for system scheduling.
其中,所述方案可以通过以下流程实现:Wherein, the scheme can be realized through the following process:
所述分布式系统接入的相机包括相机A、相机B和相机C,这里接入的相机就属于前端设备。所述分布式系统自身启用的服务包括任务分析服务A、任务分析服务B和任务分析服务C,其分别接入相机A、相机B和相机C的视频流。同时,拉取视频流的客户端包括客户端A、客户端B和客户端C,即这三个客户端都可以利用所述分布式系统来获取相机中的视频流,如果客户端A存在获取视频流的需求时,系统会分配任务分析服务A去处理客户端A的所述需求,如果客户端B存在获取视频流的需求时,系统会分配任务分析服务B去处理客户端B的所述需求,如果客户端C存在获取视频流的需求时,系统会分配任务分析服务C去处理客户端C的所述需求。其中,每个任务分析服务都具备从相机中请求视频流并且将所述视频流转发给客户端的功能。并且,所述任务分析服务B被同时分配为任务管理服务。The cameras connected to the distributed system include camera A, camera B and camera C, and the cameras connected here belong to the front-end equipment. The services enabled by the distributed system itself include task analysis service A, task analysis service B and task analysis service C, which respectively access the video streams of camera A, camera B and camera C. At the same time, the clients that pull video streams include client A, client B, and client C, that is, all three clients can use the distributed system to obtain the video stream in the camera, if client A has access When there is a demand for video streams, the system will assign task analysis service A to handle the needs of client A. If client B has a need to obtain video streams, the system will assign task analysis service B to handle the needs of client B. demand, if the client C has a demand for obtaining video streams, the system will assign task analysis service C to process the demand of the client C. Wherein, each task analysis service has the function of requesting video stream from the camera and forwarding the video stream to the client. Moreover, the task analysis service B is assigned as a task management service at the same time.
进而,当客户端C需要拉取相机A的视频流时,分布式系统会分配任务分析服务C去处理客户端C的获取视频流的需求,即客户端C首先发送其对应的拉流请求至任务分析服务C。然后,任务分析服务C根据其未接入相机A的视频流的查询结果,向任务管理服务(即任务分析服务B)发起查询请求,以获得是哪个任务分析服务接入相机A的视频流的查询结果。所述任务管理服务将接入相机A的视频流的查询结果返回至任务分析服务C,所述任务分析服务C将查询结果返回至客户端C(这里,所述查询结果为任务分析服务A接入相机A的视频流)。最后,客户端C与接入相机A的视频流的任务分析服务A建立连接,以获取所述任务分析服务A接入的视频流。Furthermore, when client C needs to pull the video stream of camera A, the distributed system will assign task analysis service C to handle client C's demand for video stream acquisition, that is, client C first sends its corresponding pull request to Task Analysis Service C. Then, task analysis service C initiates a query request to the task management service (that is, task analysis service B) according to the query result of the video stream that is not connected to camera A, so as to obtain the information of which task analysis service accesses camera A's video stream. search result. The task management service returns the query result of the video stream connected to the camera A to the task analysis service C, and the task analysis service C returns the query result to the client C (here, the query result is the task analysis service A connection into the video stream of camera A). Finally, the client C establishes a connection with the task analysis service A that accesses the video stream of the camera A, so as to obtain the video stream accessed by the task analysis service A.
这里,通过分布式系统将相机中的原始视频流转发为RTSP流以供客户端访问为例进行 说明,图5为本申请实施例视频流的获取方法的实现流程示意图五,如图5所示,所述方法包括:Here, the distributed system forwards the original video stream in the camera to an RTSP stream for client access as an example. Figure 5 is a schematic diagram of the implementation process of the video stream acquisition method according to the embodiment of the present application, as shown in Figure 5 , the method includes:
步骤S501、客户端向任务分析服务C发送RTSP(Real Time Streaming Protocol,实时流传输协议)请求;Step S501, the client sends an RTSP (Real Time Streaming Protocol, real-time streaming protocol) request to the task analysis service C;
这里,所述RTSP请求主要用于请求RTSP类型的某个视频源。也就是说,分布式系统把各个厂家的流都接进来,通过统一、标准的协议输出给客户端。如果是RTSP播放器,则将前端各种厂家的流转换为这个RTSP流供客户端访问。Here, the RTSP request is mainly used to request a certain video source of RTSP type. That is to say, the distributed system connects the streams of various manufacturers and outputs them to the client through a unified and standard protocol. If it is an RTSP player, convert the streams of various front-end manufacturers into this RTSP stream for client access.
步骤S502、任务分析服务C查询本地列表,确认其是否接入所述客户端请求拉取的视频流;Step S502, the task analysis service C queries the local list, and confirms whether it accesses the video stream requested by the client;
步骤S503、任务分析服务C在其未接入所述视频流的情况下,向任务管理服务发送查询请求;Step S503, task analysis service C sends a query request to task management service if it does not access the video stream;
步骤S504、任务管理服务在存储介质中查询接入所述视频流的地址,并根据所述地址确定接入所述视频流的任务分析服务为任务分析服务A;Step S504, the task management service queries the address of accessing the video stream in the storage medium, and determines the task analysis service accessing the video stream as task analysis service A according to the address;
这里,所述存储介质可以为共享存储的存储介质,例如ZooKeeper。Here, the storage medium may be a shared storage storage medium, such as ZooKeeper.
步骤S505、任务管理服务将任务分析服务A的地址返回给任务分析服务C;Step S505, the task management service returns the address of the task analysis service A to the task analysis service C;
步骤S506、任务分析服务C将所述任务分析服务A的地址返回至所述客户端;Step S506, the task analysis service C returns the address of the task analysis service A to the client;
这里,所述任务分析服务C返回至所述客户端的地址,即重定向地址。Here, the task analysis service C returns the address of the client, that is, the redirection address.
步骤S507、所述客户端根据所述任务分析服务A的地址向所述任务分析服务A发送RTSP请求;Step S507, the client sends an RTSP request to the task analysis service A according to the address of the task analysis service A;
步骤S508、所述任务分析服务A查询本地列表,确认其是否接入所述客户端请求拉取的视频流;Step S508, the task analysis service A queries the local list to confirm whether it accesses the video stream requested by the client;
步骤S509、所述任务分析服务A将已接入的所述视频流转换为RTSP类型的视频流返回至客户端。Step S509, the task analysis service A converts the accessed video stream into an RTSP video stream and returns it to the client.
这里,所述步骤S501至所述步骤S508为信令流,即本方案的信令传输路径,所述步骤S509为视频流,即本方案的视频流传输路径。并且,所述步骤S501至所述步骤S509为分布式系统的某一节点中存在客户端需要拉取的视频流的情况下的方案。Here, the step S501 to the step S508 are signaling streams, that is, the signaling transmission path of this solution, and the step S509 is a video stream, that is, the video stream transmission path of this solution. Moreover, the steps S501 to S509 are solutions in a case where there is a video stream that the client needs to pull in a certain node of the distributed system.
如果任务管理服务查询所有的任务分析服务均未接入需要拉取的视频流,则采用如下的调度策略。If the task management service queries all the task analysis services and does not access the video stream to be pulled, the following scheduling strategy is adopted.
(1)第一调度策略:就近调度策略。(1) The first scheduling strategy: the nearest scheduling strategy.
在客户端需要拉取视频流、且分布式系统中所有的任务分析服务均未接入所述视频流的情况下,选择所述客户端最近的节点作为拉取视频流的节点(即系统给所述客户端分配的原始节点)。例如,客户端A在向任务分析服务A请求相机A的视频源时,任务分析服务A发现其本地未接入所述相机A的视频源,则所述任务分析服务A会向任务管理服务去查询,如果查询结果表明所述相机A的视频源均未被其他任务分析服务接入,将采取就近调度策略,直接选择任务分析服务A对应的节点作为客户端A的对接节点,如此,能够减少重定向现象,对客户端A更加友好,逻辑也更简单,效率更高。When the client needs to pull the video stream and all the task analysis services in the distributed system do not access the video stream, select the nearest node of the client as the node for pulling the video stream (that is, the system provides The original node assigned by the client). For example, when client A requests the video source of camera A from task analysis service A, and task analysis service A finds that it does not access the video source of camera A locally, then the task analysis service A will send a request to the task management service. Query, if the query result shows that none of the video sources of camera A is accessed by other task analysis services, the nearest scheduling strategy will be adopted, and the node corresponding to task analysis service A will be directly selected as the docking node of client A. In this way, it can reduce The redirection phenomenon is more friendly to client A, the logic is simpler, and the efficiency is higher.
这里,上述步骤S415中所描述的方法即所述就近调度策略的一种实现方式。Here, the method described in the above step S415 is an implementation of the nearest scheduling policy.
(2)第二调度策略:负载均衡调度策略。(2) The second scheduling strategy: a load balancing scheduling strategy.
在客户端需要拉取视频流、且分布式系统中所有的任务分析服务均未接入所述视频流的情况下,选择所述分布式系统中负载最小的节点作为拉取视频流的节点。例如,客户端A在向任务分析服务A请求相机A的视频源时,任务分析服务A发现其本地未接入所述相机A的视频源,则所述任务分析服务A会向任务管理服务去查询,如果查询结果表明所述相机A的视频源均未被其他任务分析服务接入,将采取负载均衡调度策略,计算此时所有任务分析服务的负载值,选择负载值最小的任务分析服务对应的节点作为所述客户端A的对接节点,如此,能够减少分布式系统的资源压力,提高稳定性。When the client needs to pull the video stream and all task analysis services in the distributed system do not access the video stream, select the node with the smallest load in the distributed system as the node for pulling the video stream. For example, when client A requests the video source of camera A from task analysis service A, and task analysis service A finds that it does not access the video source of camera A locally, then the task analysis service A will send a request to the task management service. Query, if the query result shows that none of the video sources of camera A is accessed by other task analysis services, a load balancing scheduling strategy will be adopted to calculate the load values of all task analysis services at this time, and the corresponding task analysis service with the smallest load value will be selected. The node of is used as the docking node of the client A. In this way, the resource pressure of the distributed system can be reduced and the stability can be improved.
这里,上述步骤S425至步骤S427中所描述的方法即所述负载均衡调度策略的一种实现方式。Here, the method described in the above step S425 to step S427 is an implementation of the load balancing scheduling strategy.
(3)第三调度策略:自定义调度策略。(3) The third scheduling strategy: custom scheduling strategy.
在客户端需要拉取视频流、且分布式系统中所有的任务分析服务均未接入所述视频流的情况下,将根据不同视频接入类型以及用户指定的参数,来决策某个节点作为拉取视频流的节点。例如,客户端A在向任务分析服务A请求相机A的视频源时,任务分析服务A发现其本地未接入所述相机A的视频源,则所述任务分析服务A会向任务管理服务去查询,如果查询结果表明所述相机A的视频源均未被其他任务分析服务接入,且所述视频源为GB28181协议对应的视频源,将根据用户的配置信息以及所述视频源的接入协议类型,确定可以调度的节点集合,再从中选取某个满足条件的节点作为所述客户端A的对接节点,如此,能够更加灵活的在满足用户场景需求的条件下实现接入和转发功能。When the client needs to pull the video stream and all task analysis services in the distributed system do not access the video stream, a certain node will be decided as the The node that pulls the video stream. For example, when client A requests the video source of camera A from task analysis service A, and task analysis service A finds that it does not access the video source of camera A locally, then the task analysis service A will send a request to the task management service. Query, if the query result shows that the video source of camera A is not accessed by other task analysis services, and the video source is a video source corresponding to the GB28181 protocol, the user configuration information and the access of the video source will be The protocol type determines the set of nodes that can be scheduled, and then selects a node that meets the conditions as the docking node of the client A. In this way, the access and forwarding functions can be realized more flexibly under the condition of meeting the needs of the user scenario.
这里,上述步骤S435中所描述的方法即所述自定义调度策略的一种实现方式。Here, the method described in the above step S435 is an implementation manner of the self-defined scheduling policy.
在海量视频素材的采集和分析对系统的视频接入和转发功能有更高的要求。采用本申请实施例中的方案可以在兼容更多不同厂家协议视频源的同时,还能利用分布式的各种特性实现更加稳定、高效、灵活的部署,此外,本申请实施例视频流的获取方案中的溯源和动态资源调度以及重定向机制减少了对外部资源的依赖,以及内部资源的消耗。The collection and analysis of massive video materials have higher requirements on the video access and forwarding functions of the system. Adopting the solution in the embodiment of this application can not only be compatible with more different manufacturers’ protocol video sources, but also use various distributed characteristics to achieve more stable, efficient and flexible deployment. In addition, the acquisition of video streams in the embodiment of this application The traceability, dynamic resource scheduling and redirection mechanisms in the solution reduce the dependence on external resources and the consumption of internal resources.
也就是说,本申请实施例中的视频流的获取方案,可以达到如下技术效果:(1)基于分布式系统框架,具有高可靠、高扩展等特性,从而保证了视频流的获取场景下接入和转发功能的稳定和高效运行。(2)采用Manager-Worker机制,实现视频的溯源功能,保证所述分布式系统的接入模块不对会对前端设备产生性能影响,且保证所述分布式系统内部转发功能正常有效。(3)采用重定向机制保证多节点分发时,可以将溯源后的节点直接反馈给客户端去对接,减少了系统内部节点之间的网络消耗。(4)灵活多样的调度策略使得在视频流的获取过程中可以覆盖各种场景需求。That is to say, the video stream acquisition scheme in the embodiment of the present application can achieve the following technical effects: (1) Based on the distributed system framework, it has the characteristics of high reliability and high expansion, thus ensuring the continuous success of video stream acquisition scenarios. stable and efficient operation of incoming and forwarding functions. (2) The Manager-Worker mechanism is adopted to realize the traceability function of the video, to ensure that the access module of the distributed system will have an impact on the performance of the front-end equipment, and to ensure that the internal forwarding function of the distributed system is normal and effective. (3) When the redirection mechanism is used to ensure multi-node distribution, the traced nodes can be directly fed back to the client for docking, which reduces the network consumption between the internal nodes of the system. (4) Flexible and diverse scheduling strategies enable the acquisition of video streams to cover various scene requirements.
基于前述的实施例,本申请实施例提供一种视频流的获取装置,该装置包括所包括的各单元、以及各单元所包括的各子单元和各模块、以及各模块所包括的各子模块和各部件,可以通过服务器中的处理器来实现;当然也可通过具体的逻辑电路实现;在实施的过程中,处理器可以为CPU(Central Processing Unit,中央处理器)、MPU(Microprocessor Unit,微处理器)、DSP(Digital Signal Processing,数字信号处理器)或FPGA(Field Programmable Gate Array,现场可编程门阵列)等。Based on the aforementioned embodiments, this embodiment of the present application provides a video stream acquisition device, which includes each unit included, each sub-unit and each module included in each unit, and each sub-module included in each module and each component can be realized by the processor in the server; of course, it can also be realized by a specific logic circuit; in the process of implementation, the processor can be CPU (Central Processing Unit, central processing unit), MPU (Microprocessor Unit, Microprocessor), DSP (Digital Signal Processing, digital signal processor) or FPGA (Field Programmable Gate Array, field programmable gate array), etc.
图6为本申请实施例视频流的获取装置的组成结构示意图,如图6所示,所述装置600包括:FIG. 6 is a schematic diagram of the composition and structure of a video stream acquisition device according to an embodiment of the present application. As shown in FIG. 6, the device 600 includes:
确定单元601,配置为所述服务器中的第一任务分析服务在接收到获取视频流的请求消息后,确定自身是否已接入所述视频流;其中,所述请求消息是客户端基于第一映射关系发送给所述第一任务分析服务的,所述第一映射关系用于表明所述服务器中每一任务分析服务对应的客户端;The determining unit 601 is configured such that the first task analysis service in the server determines whether it has accessed the video stream after receiving a request message for obtaining the video stream; wherein, the request message is obtained by the client based on the first The mapping relationship is sent to the first task analysis service, and the first mapping relationship is used to indicate the client corresponding to each task analysis service in the server;
重定向单元602,配置为在所述第一任务分析服务未接入所述视频流的情况下,所述服务器中的任务管理服务基于第二映射关系将所述客户端重定向到第二任务分析服务,使得所述客户端能够通过重定向的第二任务分析服务获取到所述视频流;其中,所述第二映射关系用于表明所述每一任务分析服务已对应接入的视频流;所述任务管理服务是从所述服务器中的多个任务分析服务中确定出的。The redirection unit 602 is configured to redirect the client to the second task based on the second mapping relationship when the first task analysis service does not access the video stream. Analysis service, so that the client can obtain the video stream through the redirected second task analysis service; wherein, the second mapping relationship is used to indicate that each task analysis service has corresponding access to the video stream ; The task management service is determined from multiple task analysis services in the server.
在一些实施例中,所述重定向单元602,包括:第一发送模块,配置为在所述第一任务分析服务未接入所述视频流的情况下,所述第一任务分析服务向所述任务管理服务发送查询请求消息;其中,所述查询请求消息中携带有所述视频流的标识信息;查询模块,配置为所述任务管理服务根据所述标识信息和所述第二映射关系,查询已接入所述视频流的任务分析服务,得到查询结果;第二发送模块,配置为在所述查询结果表明所述服务器中的第二任务分析服务已接入所述视频流的情况下,所述任务管理服务将所述查询结果发送给所述第一任务分析服务,使得所述客户端能够通过所述第二任务分析服务获取所述视频流。In some embodiments, the redirecting unit 602 includes: a first sending module configured to send the first task analysis service to the The task management service sends a query request message; wherein, the query request message carries identification information of the video stream; the query module is configured so that the task management service, according to the identification information and the second mapping relationship, Querying the task analysis service that has accessed the video stream to obtain a query result; the second sending module is configured to be configured to, when the query result indicates that the second task analysis service in the server has accessed the video stream , the task management service sends the query result to the first task analysis service, so that the client can obtain the video stream through the second task analysis service.
在一些实施例中,所述第二发送模块,包括:第一发送部件,配置为所述任务管理服务 将所述查询结果发送给所述第一任务分析服务;第二发送部件,配置为所述第一任务分析服务将所述第二任务分析服务的节点地址发送给所述客户端,以使所述客户端能够根据所述节点地址与所述第二任务分析服务建立媒体连接从而获取所述视频流。In some embodiments, the second sending module includes: a first sending component configured to send the query result to the first task analysis service by the task management service; a second sending component configured to The first task analysis service sends the node address of the second task analysis service to the client, so that the client can establish a media connection with the second task analysis service according to the node address to obtain the described video stream.
在一些实施例中,所述查询模块,包括:第一确定部件,配置为所述任务管理服务根据所述标识信息和所述第二映射关系,确定已接入所述视频流的地址信息;第二确定部件,配置为所述任务管理服务根据所述地址信息,确定已接入所述视频流的任务分析服务,得到查询结果。In some embodiments, the query module includes: a first determining component configured to determine, according to the identification information and the second mapping relationship, the address information of the video stream that has been accessed by the task management service; The second determining component is configured such that the task management service determines the task analysis service that has accessed the video stream according to the address information, and obtains a query result.
在一些实施例中,所述服务器包括多个服务节点,每一所述服务节点上存在至少一个所述任务分析服务;对应地,所述第二映射关系用于表明所述每一所述服务节点已对应接入的视频流;对应地,所述装置还包括:管理节点确定单元,配置为将所述多个服务节点中的第一服务节点,确定为任务管理节点;管理服务确定单元,配置为将所述任务管理节点中的任务分析服务,确定为所述任务管理服务。In some embodiments, the server includes multiple service nodes, and at least one task analysis service exists on each of the service nodes; correspondingly, the second mapping relationship is used to indicate that each of the service nodes The node has correspondingly accessed the video stream; correspondingly, the device further includes: a management node determination unit configured to determine the first service node among the plurality of service nodes as a task management node; a management service determination unit, It is configured to determine the task analysis service in the task management node as the task management service.
在一些实施例中,所述装置还包括:连接建立单元,配置为在所述第一任务分析服务已接入所述视频流的情况下,所述第一任务分析服务与所述客户端建立媒体连接;发送单元,配置为所述第一任务分析服务通过所述媒体连接,将接入的所述视频流发送给所述客户端。In some embodiments, the device further includes: a connection establishment unit configured to establish a connection between the first task analysis service and the client when the first task analysis service has accessed the video stream A media connection; a sending unit configured to send the accessed video stream to the client through the media connection for the first task analysis service.
在一些实施例中,所述装置还包括:目标服务确定单元,配置为在所述查询结果表明未查询到已接入所述视频流的任务分析服务的情况下,所述任务管理服务根据预设规则确定出目标任务分析服务,使得所述客户端能够通过所述目标任务分析服务获取所述视频流。In some embodiments, the device further includes: a target service determining unit, configured to, if the query result shows that no task analysis service that has accessed the video stream is found, the task management service A rule is set to determine a target task analysis service, so that the client can obtain the video stream through the target task analysis service.
在一些实施例中,所述目标服务确定单元,包括:第一目标服务确定模块,配置为所述任务管理服务根据所述第一映射关系将所述第一任务分析服务确定为所述目标任务分析服务,使得所述客户端能够通过所述第一任务分析服务获取所述视频流。In some embodiments, the target service determining unit includes: a first target service determining module, configured for the task management service to determine the first task analysis service as the target task according to the first mapping relationship An analysis service, so that the client can obtain the video stream through the first task analysis service.
在一些实施例中,所述目标服务确定单元,包括:负载确定模块,配置为所述任务管理服务确定所述服务器中至少两个任务分析服务的负载;排序模块,配置为所述任务管理服务将所述至少两个任务分析服务的负载按取值从小到大进行排序,得到排序结果;第二目标服务确定模块,配置为所述任务管理服务根据所述排序结果将负载最小的任务分析服务确定为所述目标任务分析服务,使得所述客户端能够通过所述负载最小的任务分析服务获取所述视频流。In some embodiments, the target service determination unit includes: a load determination module configured for the task management service to determine the loads of at least two task analysis services in the server; a sorting module configured for the task management service Sorting the loads of the at least two task analysis services in ascending order to obtain a sorting result; the second target service determination module is configured so that the task management service sorts the task analysis service with the smallest load according to the sorting result Determine the target task analysis service, so that the client can obtain the video stream through the task analysis service with the least load.
在一些实施例中,所述目标服务确定单元,包括:第三目标服务确定模块,配置为所述任务管理服务根据所述视频流的接入类型确定出第三任务分析服务,使得所述客户端能够通过所述第三任务分析服务获取所述视频流。In some embodiments, the target service determining unit includes: a third target service determining module, configured for the task management service to determine a third task analysis service according to the access type of the video stream, so that the client The terminal can obtain the video stream through the third task analysis service.
以上装置实施例的描述,与上述方法实施例的描述是类似的,具有同方法实施例相似的有益效果。对于本申请装置实施例中未披露的技术细节,请参照本申请方法实施例的描述而理解。The description of the above device embodiment is similar to the description of the above method embodiment, and has similar beneficial effects as the method embodiment. For technical details not disclosed in the device embodiments of the present application, please refer to the description of the method embodiments of the present application for understanding.
需要说明的是,本申请实施例中,如果以软件功能模块的形式实现上述的视频流的获取方法,并作为独立的产品销售或使用时,也可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请实施例的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台电子设备(可以是个人计算机、服务器等)执行本申请各个实施例所述方法的全部或部分。而前述的存储介质包括:U盘、移动硬盘、ROM(Read Only Memory,只读存储器)、磁碟或者光盘等各种可以存储程序代码的介质。这样,本申请实施例不限制于任何特定的硬件和软件结合。It should be noted that, in the embodiment of the present application, if the above video stream acquisition method is implemented in the form of a software function module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the embodiment of the present application is essentially or the part that contributes to the prior art can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for Make an electronic device (which may be a personal computer, a server, etc.) execute all or part of the methods described in the various embodiments of the present application. The aforementioned storage media include: U disk, mobile hard disk, ROM (Read Only Memory, read-only memory), magnetic disk or optical disk and other media that can store program codes. Thus, embodiments of the present application are not limited to any specific combination of hardware and software.
对应地,本申请实施例提供一种服务器,包括存储器和处理器,所述存储器存储有可在处理器上运行的计算机程序,所述处理器执行所述程序时实现上述实施例中提供的视频流的获取方法中的步骤。Correspondingly, an embodiment of the present application provides a server, including a memory and a processor, the memory stores a computer program that can run on the processor, and when the processor executes the program, the video server provided in the above-mentioned embodiments is realized. A step in the stream's get method.
对应地,本申请实施例提供一种可读存储介质,其上存储有计算机程序,该计算机程序被处理器执行时实现上述视频流的获取方法中的步骤。Correspondingly, an embodiment of the present application provides a readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, the steps in the method for acquiring a video stream described above are implemented.
本申请实施例还提供一种计算机程序产品,该计算机程序产品承载有程序代码,所述程 序代码包括的指令可用于执行上述方法实施例中所述的视频流的获取方法的步骤,可参见上述方法实施例。即,本申请实施例所提供的计算机程序产品,包括存储了程序代码的计算机可读存储介质,所述程序代码包括的指令可用于执行上述方法实施例中所述的视频流的获取方法的步骤,在实施时可参见上述方法实施例。The embodiment of the present application also provides a computer program product, the computer program product carries a program code, and the instructions included in the program code can be used to execute the steps of the video stream acquisition method described in the above method embodiment, please refer to the above Method Example. That is, the computer program product provided by the embodiments of the present application includes a computer-readable storage medium storing program codes, and the instructions included in the program codes can be used to execute the steps of the methods for obtaining video streams described in the above method embodiments , for implementation, refer to the above-mentioned method embodiments.
这里需要指出的是:以上存储介质和服务器实施例的描述,与上述方法实施例的描述是类似的,具有同方法实施例相似的有益效果。对于本申请存储介质和服务器实施例中未披露的技术细节,请参照本申请方法实施例的描述而理解。It should be pointed out here that: the descriptions of the above storage medium and server embodiments are similar to the descriptions of the above method embodiments, and have similar beneficial effects to those of the method embodiments. For technical details not disclosed in the storage medium and server embodiments of the present application, please refer to the description of the method embodiments of the present application for understanding.
需要说明的是,图7为本申请实施例服务器的一种硬件实体示意图,如图7所示,该服务器700的硬件实体包括:处理器701、通信接口702和存储器703,其中It should be noted that FIG. 7 is a schematic diagram of a hardware entity of the server in the embodiment of the present application. As shown in FIG. 7, the hardware entity of the server 700 includes: a processor 701, a communication interface 702, and a memory 703, wherein
处理器701通常控制服务器700的总体操作。 Processor 701 generally controls the overall operation of server 700 .
通信接口702可以使服务器700通过网络与其他服务器或电子设备或平台通信。 Communication interface 702 may enable server 700 to communicate with other servers or electronic devices or platforms over a network.
存储器703配置为存储由处理器701可执行的指令和应用,还可以缓存待处理器701以及服务器700中各模块待处理或已经处理的数据(例如,图像数据、音频数据、语音通信数据和视频通信数据),可以通过FLASH(闪存)或RAM(Random Access Memory,随机访问存储器)实现;The memory 703 is configured to store instructions and applications executable by the processor 701, and can also cache data to be processed or processed by each module in the processor 701 and the server 700 (for example, image data, audio data, voice communication data and video data) Communication data), can be realized by FLASH (flash memory) or RAM (Random Access Memory, random access memory);
其中,服务器中的各个硬件实体通过总线704耦合在一起。可理解,总线704用于实现这些硬件实体之间的连接通信。Wherein, various hardware entities in the server are coupled together through the bus 704 . It can be understood that the bus 704 is used to realize connection and communication between these hardware entities.
在本申请所提供的几个实施例中,应该理解到,所揭露的设备和方法,可以通过其它的方式实现。以上所描述的设备实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,如:多个单元或组件可以结合,或可以集成到另一个系统,或一些特征可以忽略,或不执行。另外,所显示或讨论的各组成部分相互之间的耦合、或直接耦合、或通信连接可以是通过一些接口,设备或单元的间接耦合或通信连接,可以是电性的、机械的或其它形式的。In the several embodiments provided in this application, it should be understood that the disclosed devices and methods may be implemented in other ways. The device embodiments described above are only illustrative. For example, the division of the units is only a logical function division. In actual implementation, there may be other division methods, such as: multiple units or components can be combined, or May be integrated into another system, or some features may be ignored, or not implemented. In addition, the coupling, or direct coupling, or communication connection between the components shown or discussed may be through some interfaces, and the indirect coupling or communication connection of devices or units may be electrical, mechanical or other forms of.
上述作为分离部件说明的单元可以是、或也可以不是物理上分开的,作为单元显示的部件可以是、或也可以不是物理单元,即可以位于一个地方,也可以分布到多个网络单元上;可以根据实际的需要选择其中的部分或全部单元来实现本实施例方案的目的。The units described above as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place or distributed to multiple network units; Part or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
另外,在本申请各实施例中的各功能单元可以全部集成在一个处理模块中,也可以是各单元分别单独作为一个单元,也可以两个或两个以上单元集成在一个单元中;上述集成的单元既可以采用硬件的形式实现,也可以采用硬件加软件功能单元的形式实现。本领域普通技术人员可以理解:实现上述方法实施例的全部或部分步骤可以通过程序指令相关的硬件来完成,前述的程序可以存储于一计算机可读取存储介质中,该程序在执行时,执行包括上述方法实施例的步骤;而前述的存储介质包括:移动存储设备、ROM、RAM、磁碟或者光盘等各种可以存储程序代码的介质。In addition, each functional unit in each embodiment of the present application can be integrated into one processing module, or each unit can be used as a single unit, or two or more units can be integrated into one unit; the above-mentioned integration The unit can be realized in the form of hardware or in the form of hardware plus software functional unit. Those of ordinary skill in the art can understand that all or part of the steps for realizing the above-mentioned method embodiments can be completed by hardware related to program instructions, and the aforementioned program can be stored in a computer-readable storage medium. When the program is executed, the It includes the steps of the above method embodiments; and the aforementioned storage medium includes: various media that can store program codes such as removable storage devices, ROM, RAM, magnetic disks or optical disks.
本申请所提供的几个方法实施例中所揭露的方法,在不冲突的情况下可以任意组合,得到新的方法实施例。The methods disclosed in several method embodiments provided in this application can be combined arbitrarily to obtain new method embodiments under the condition of no conflict.
本申请所提供的几个产品实施例中所揭露的特征,在不冲突的情况下可以任意组合,得到新的产品实施例。本申请所提供的几个方法或设备实施例中所揭露的特征,在不冲突的情况下可以任意组合,得到新的方法实施例或设备实施例。The features disclosed in several product embodiments provided in this application can be combined arbitrarily without conflict to obtain new product embodiments. The features disclosed in several method or device embodiments provided in this application can be combined arbitrarily without conflict to obtain new method embodiments or device embodiments.
以上所述,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本申请揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应以所述权利要求的保护范围为准。The above is only a specific implementation of the application, but the scope of protection of the application is not limited thereto. Anyone familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the application. Should be covered within the protection scope of this application. Therefore, the protection scope of the present application should be determined by the protection scope of the claims.
本申请实施例提供了一种视频流的获取方法及装置、服务器、存储介质和程序产品,通过所述服务器中的第一任务分析服务在接收到获取视频流的请求消息后,确定自身是否已接 入所述视频流;其中,所述请求消息是客户端基于第一映射关系发送给所述第一任务分析服务的,所述第一映射关系用于表明所述服务器中每一任务分析服务对应的客户端;在所述第一任务分析服务未接入所述视频流的情况下,所述服务器中的任务管理服务基于第二映射关系将所述客户端重定向到第二任务分析服务,使得所述客户端能够通过重定向的第二任务分析服务获取到所述视频流;其中,所述第二映射关系用于表明所述每一任务分析服务已对应接入的视频流;所述任务管理服务是从所述服务器中的多个任务分析服务中确定出的,如此,能够采用重定向机制实现视频的溯源功能,保证视频接入分发系统(即服务器)不对前端设备(即视频流所在的设备)产生性能影响,且保证所述系统的内部转发功能正常有效。Embodiments of the present application provide a video stream acquisition method and device, server, storage medium, and program product. After receiving a request message for video stream acquisition, the first task analysis service in the server determines whether it has Accessing the video stream; wherein, the request message is sent by the client to the first task analysis service based on a first mapping relationship, and the first mapping relationship is used to indicate that each task analysis service in the server Corresponding client: in the case that the first task analysis service does not access the video stream, the task management service in the server redirects the client to the second task analysis service based on the second mapping relationship , so that the client can obtain the video stream through the redirected second task analysis service; wherein, the second mapping relationship is used to indicate that each task analysis service has a corresponding access to the video stream; The above task management service is determined from multiple task analysis services in the server. In this way, the redirection mechanism can be used to realize the traceability function of the video, so as to ensure that the video access distribution system (i.e. The device where the flow is located) has a performance impact, and ensures that the internal forwarding function of the system is normal and effective.
Claims (14)
- 一种视频流的获取方法,其中,应用于服务器,所述方法包括:A method for acquiring a video stream, wherein, applied to a server, the method includes:所述服务器中的第一任务分析服务在接收到获取视频流的请求消息后,确定自身是否已接入所述视频流;其中,所述请求消息是客户端基于第一映射关系发送给所述第一任务分析服务的,所述第一映射关系用于表明所述服务器中每一任务分析服务对应的客户端;The first task analysis service in the server determines whether it has accessed the video stream after receiving the request message for obtaining the video stream; wherein, the request message is sent by the client based on the first mapping relationship to the For the first task analysis service, the first mapping relationship is used to indicate the client corresponding to each task analysis service in the server;在所述第一任务分析服务未接入所述视频流的情况下,所述服务器中的任务管理服务基于第二映射关系将所述客户端重定向到第二任务分析服务,使得所述客户端能够通过重定向的第二任务分析服务获取到所述视频流;其中,所述第二映射关系用于表明所述每一任务分析服务已对应接入的视频流;所述任务管理服务是从所述服务器中的多个任务分析服务中确定出的。When the first task analysis service does not access the video stream, the task management service in the server redirects the client to the second task analysis service based on the second mapping relationship, so that the client The terminal can obtain the video stream through the redirected second task analysis service; wherein, the second mapping relationship is used to indicate that each task analysis service has a corresponding access to the video stream; the task management service is Determined from multiple task analysis services in the server.
- 根据权利要求1所述的方法,其中,所述在所述第一任务分析服务未接入所述视频流的情况下,所述服务器中的任务管理服务基于第二映射关系将所述客户端重定向到第二任务分析服务,使得所述客户端能够通过重定向的第二任务分析服务获取到所述视频流,包括:The method according to claim 1, wherein, in the case that the first task analysis service does not access the video stream, the task management service in the server assigns the client to the Redirecting to the second task analysis service, so that the client can obtain the video stream through the redirected second task analysis service, including:在所述第一任务分析服务未接入所述视频流的情况下,所述第一任务分析服务向所述任务管理服务发送查询请求消息;其中,所述查询请求消息中携带有所述视频流的标识信息;When the first task analysis service does not access the video stream, the first task analysis service sends a query request message to the task management service; wherein, the query request message carries the video stream Flow identification information;所述任务管理服务根据所述标识信息和所述第二映射关系,查询已接入所述视频流的任务分析服务,得到查询结果;The task management service queries the task analysis service that has accessed the video stream according to the identification information and the second mapping relationship, and obtains a query result;在所述查询结果表明所述服务器中的第二任务分析服务已接入所述视频流的情况下,所述任务管理服务将所述查询结果发送给所述第一任务分析服务,使得所述客户端能够通过所述第二任务分析服务获取所述视频流。If the query result indicates that the second task analysis service in the server has accessed the video stream, the task management service sends the query result to the first task analysis service, so that the The client can obtain the video stream through the second task analysis service.
- 根据权利要求2所述的方法,其中,所述任务管理服务将所述查询结果发送给所述第一任务分析服务,使得所述客户端能够通过所述第二任务分析服务获取所述视频流,包括:The method according to claim 2, wherein the task management service sends the query result to the first task analysis service, so that the client can obtain the video stream through the second task analysis service ,include:所述任务管理服务将所述查询结果发送给所述第一任务分析服务;The task management service sends the query result to the first task analysis service;所述第一任务分析服务将所述第二任务分析服务的节点地址发送给所述客户端,以使所述客户端能够根据所述节点地址与所述第二任务分析服务建立媒体连接从而获取所述视频流。The first task analysis service sends the node address of the second task analysis service to the client, so that the client can establish a media connection with the second task analysis service according to the node address to obtain The video stream.
- 根据权利要求2或3所述的方法,其中,所述任务管理服务根据所述标识信息和所述第二映射关系,查询已接入所述视频流的任务分析服务,得到查询结果,包括:The method according to claim 2 or 3, wherein the task management service queries the task analysis service that has accessed the video stream according to the identification information and the second mapping relationship, and obtains a query result, including:所述任务管理服务根据所述标识信息和所述第二映射关系,确定已接入所述视频流的地址信息;The task management service determines address information that has accessed the video stream according to the identification information and the second mapping relationship;所述任务管理服务根据所述地址信息,确定已接入所述视频流的任务分析服务,得到查询结果。The task management service determines the task analysis service that has accessed the video stream according to the address information, and obtains a query result.
- 根据权利要求1至4任一项所述的方法,其中,所述服务器包括多个服务节点,每一所述服务节点上存在至少一个所述任务分析服务;The method according to any one of claims 1 to 4, wherein the server includes a plurality of service nodes, and at least one task analysis service exists on each of the service nodes;对应地,所述第二映射关系用于表明所述每一所述服务节点已对应接入的视频流;Correspondingly, the second mapping relationship is used to indicate that each of the service nodes has correspondingly accessed video streams;对应地,所述方法还包括:Correspondingly, the method also includes:将所述多个服务节点中的第一服务节点,确定为任务管理节点;determining a first service node among the plurality of service nodes as a task management node;将所述任务管理节点中的任务分析服务,确定为所述任务管理服务。The task analysis service in the task management node is determined as the task management service.
- 根据权利要求1至5任一项所述的方法,其中,所述方法还包括:The method according to any one of claims 1 to 5, wherein the method further comprises:在所述第一任务分析服务已接入所述视频流的情况下,所述第一任务分析服务与所述客户端建立媒体连接;In the case that the first task analysis service has accessed the video stream, the first task analysis service establishes a media connection with the client;所述第一任务分析服务通过所述媒体连接,将接入的所述视频流发送给所述客户端。The first task analysis service sends the accessed video stream to the client through the media connection.
- 根据权利要求1至6任一项所述的方法,其中,所述方法还包括:The method according to any one of claims 1 to 6, wherein the method further comprises:在所述查询结果表明未查询到已接入所述视频流的任务分析服务的情况下,所述任务管理服务根据预设规则确定出目标任务分析服务,使得所述客户端能够通过所述目标任务分析服务获取所述视频流。When the query result shows that no task analysis service that has accessed the video stream is found, the task management service determines the target task analysis service according to preset rules, so that the client can pass the target The task analysis service obtains the video stream.
- 根据权利要求7所述的方法,其中,所述任务管理服务根据预设规则确定出目标任务分析服务,使得所述客户端能够通过所述目标任务分析服务获取所述视频流,包括:The method according to claim 7, wherein the task management service determines a target task analysis service according to preset rules, so that the client can obtain the video stream through the target task analysis service, comprising:所述任务管理服务根据所述第一映射关系将所述第一任务分析服务确定为所述目标任务分析服务,使得所述客户端能够通过所述第一任务分析服务获取所述视频流。The task management service determines the first task analysis service as the target task analysis service according to the first mapping relationship, so that the client can obtain the video stream through the first task analysis service.
- 根据权利要求7所述的方法,其中,所述任务管理服务根据预设规则确定出目标任务分析服务,使得所述客户端能够通过所述目标任务分析服务获取所述视频流,包括:The method according to claim 7, wherein the task management service determines a target task analysis service according to preset rules, so that the client can obtain the video stream through the target task analysis service, comprising:所述任务管理服务确定所述服务器中至少两个任务分析服务的负载;The task management service determines the load of at least two task analysis services in the server;所述任务管理服务将所述至少两个任务分析服务的负载按取值从小到大进行排序,得到排序结果;The task management service sorts the loads of the at least two task analysis services according to the values from small to large, and obtains the sorting results;所述任务管理服务根据所述排序结果将负载最小的任务分析服务确定为所述目标任务分析服务,使得所述客户端能够通过所述负载最小的任务分析服务获取所述视频流。The task management service determines the task analysis service with the smallest load as the target task analysis service according to the sorting result, so that the client can obtain the video stream through the task analysis service with the smallest load.
- 根据权利要求7所述的方法,其中,所述任务管理服务根据预设规则确定出目标任务分析服务,使得所述客户端能够通过所述目标任务分析服务获取所述视频流,包括:The method according to claim 7, wherein the task management service determines a target task analysis service according to preset rules, so that the client can obtain the video stream through the target task analysis service, comprising:所述任务管理服务根据所述视频流的接入类型确定出第三任务分析服务,使得所述客户端能够通过所述第三任务分析服务获取所述视频流。The task management service determines a third task analysis service according to the access type of the video stream, so that the client can obtain the video stream through the third task analysis service.
- 一种视频流的获取装置,其中,所述装置包括:A device for acquiring a video stream, wherein the device includes:确定单元,配置为所述服务器中的第一任务分析服务在接收到获取视频流的请求消息后,确定自身是否已接入所述视频流;其中,所述请求消息是客户端基于第一映射关系发送给所述第一任务分析服务的,所述第一映射关系用于表明所述服务器中每一任务分析服务对应的客户端;The determining unit is configured such that the first task analysis service in the server determines whether it has accessed the video stream after receiving a request message for obtaining the video stream; wherein, the request message is the client based on the first mapping The relationship is sent to the first task analysis service, and the first mapping relationship is used to indicate the client corresponding to each task analysis service in the server;重定向单元,配置为在所述第一任务分析服务未接入所述视频流的情况下,所述服务器中的任务管理服务基于第二映射关系将所述客户端重定向到第二任务分析服务,使得所述客户端能够通过重定向的第二任务分析服务获取到所述视频流;其中,所述第二映射关系用于表明所述每一任务分析服务已对应接入的视频流;所述任务管理服务是从所述服务器中的多个任务分析服务中确定出的。A redirection unit configured to redirect the client to the second task analysis service based on the second mapping relationship when the first task analysis service does not access the video stream. service, so that the client can obtain the video stream through the redirected second task analysis service; wherein, the second mapping relationship is used to indicate that each task analysis service has correspondingly accessed video stream; The task management service is determined from a plurality of task analysis services in the server.
- 一种服务器,包括存储器和处理器,所述存储器存储有可在处理器上运行的计算机程序,所述处理器执行所述程序时实现权利要求1至10任一项所述方法中的步骤。A server, comprising a memory and a processor, the memory stores a computer program that can run on the processor, and the processor implements the steps in the method of any one of claims 1 to 10 when executing the program.
- 一种计算机可读存储介质,其上存储有计算机程序,该计算机程序被处理器执行时实现权利要求1至10任一项所述方法中的步骤。A computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps in the method of any one of claims 1 to 10 are implemented.
- 一种计算机程序产品,所述计算机程序产品包括存储了计算机程序的非瞬时性计算机可读存储介质,所述计算机程序被计算机读取并执行时,实现权利要求1至10任一项所述方法中的步骤。A computer program product, the computer program product comprising a non-transitory computer-readable storage medium storing a computer program, when the computer program is read and executed by a computer, the method described in any one of claims 1 to 10 is realized in the steps.
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111109163.X | 2021-09-22 | ||
CN202111109163.XA CN113873301A (en) | 2021-09-22 | 2021-09-22 | Video stream acquisition method and device, server and storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2023045191A1 true WO2023045191A1 (en) | 2023-03-30 |
Family
ID=78993197
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2022/071431 WO2023045191A1 (en) | 2021-09-22 | 2022-01-11 | Video stream obtaining method and apparatus, server, storage medium, and program product |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN113873301A (en) |
WO (1) | WO2023045191A1 (en) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113873301A (en) * | 2021-09-22 | 2021-12-31 | 深圳市商汤科技有限公司 | Video stream acquisition method and device, server and storage medium |
Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20060070105A1 (en) * | 1999-11-15 | 2006-03-30 | Tomoaki Kawai | Control of data distribution apparatus and data distribution system |
CN101540886A (en) * | 2009-04-15 | 2009-09-23 | 中兴通讯股份有限公司 | Realization method and system of video-on-demand business and home streaming server |
CN107707939A (en) * | 2017-09-30 | 2018-02-16 | 深圳融创新技术有限公司 | Video access methods, access equalization server, central server and system |
CN109982034A (en) * | 2017-12-28 | 2019-07-05 | 杭州海康威视系统技术有限公司 | Access request processing method and processing device in video monitoring system |
CN111857974A (en) * | 2020-07-30 | 2020-10-30 | 江苏方天电力技术有限公司 | Service access method and device based on load balancer |
CN112565318A (en) * | 2019-09-25 | 2021-03-26 | 中兴通讯股份有限公司 | Server security defense method and system, communication equipment and storage medium |
CN113873301A (en) * | 2021-09-22 | 2021-12-31 | 深圳市商汤科技有限公司 | Video stream acquisition method and device, server and storage medium |
Family Cites Families (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN100505696C (en) * | 2006-07-19 | 2009-06-24 | 华为技术有限公司 | System, method and user terminal for realizing video live broadcast in media distributing network |
CN101119475B (en) * | 2007-08-21 | 2010-06-02 | 中兴通讯股份有限公司 | System and method for implementing video on-demand request redirection in IPTV system |
CN101505298B (en) * | 2009-02-09 | 2012-09-26 | 中兴通讯股份有限公司 | Storing and obtaining method for media time shift code stream and multimedia service system |
CN104363472A (en) * | 2014-10-20 | 2015-02-18 | 中兴通讯股份有限公司 | HLS-based (http live streaming based) capacity control method, HLS-based capacity control service system and SLB (server load balancing) server |
-
2021
- 2021-09-22 CN CN202111109163.XA patent/CN113873301A/en not_active Withdrawn
-
2022
- 2022-01-11 WO PCT/CN2022/071431 patent/WO2023045191A1/en active Application Filing
Patent Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20060070105A1 (en) * | 1999-11-15 | 2006-03-30 | Tomoaki Kawai | Control of data distribution apparatus and data distribution system |
CN101540886A (en) * | 2009-04-15 | 2009-09-23 | 中兴通讯股份有限公司 | Realization method and system of video-on-demand business and home streaming server |
CN107707939A (en) * | 2017-09-30 | 2018-02-16 | 深圳融创新技术有限公司 | Video access methods, access equalization server, central server and system |
CN109982034A (en) * | 2017-12-28 | 2019-07-05 | 杭州海康威视系统技术有限公司 | Access request processing method and processing device in video monitoring system |
CN112565318A (en) * | 2019-09-25 | 2021-03-26 | 中兴通讯股份有限公司 | Server security defense method and system, communication equipment and storage medium |
CN111857974A (en) * | 2020-07-30 | 2020-10-30 | 江苏方天电力技术有限公司 | Service access method and device based on load balancer |
CN113873301A (en) * | 2021-09-22 | 2021-12-31 | 深圳市商汤科技有限公司 | Video stream acquisition method and device, server and storage medium |
Also Published As
Publication number | Publication date |
---|---|
CN113873301A (en) | 2021-12-31 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
JP7463544B2 (en) | Blockchain message processing method, apparatus, computer device, and computer program | |
EP1047240B1 (en) | Method and apparatus for object rendering in a network | |
CN113572838B (en) | Network access method, device, equipment and medium based on Kubernetes | |
US7085805B1 (en) | Remote device management in grouped server environment | |
US20110258318A1 (en) | Network device and method for dynamically allocating connection resources | |
US11316916B2 (en) | Packet processing method, related device, and computer storage medium | |
WO2023045191A1 (en) | Video stream obtaining method and apparatus, server, storage medium, and program product | |
CN112104679B (en) | Method, apparatus, device and medium for processing hypertext transfer protocol request | |
US10681398B1 (en) | Video encoding based on viewer feedback | |
US10135916B1 (en) | Integration of service scaling and external health checking systems | |
CN106330504B (en) | Method for realizing application and service controller | |
EP1473897A1 (en) | Information processing device, information processing method, and computer program | |
CN113111666A (en) | System and method for realizing multi-language translation of application program | |
WO2019034091A1 (en) | Distribution method for distributed data computing, device, server and storage medium | |
CN110247847B (en) | Method and device for back source routing between nodes | |
CN106790632B (en) | Streaming data concurrent transmission method and device | |
US20150373095A1 (en) | Method and apparatus for determining service quality profile on data distribution service | |
WO2018086575A1 (en) | Method and device for controlling media resource | |
CN114051155A (en) | Video stream acquisition method, server and storage medium | |
US20170099333A1 (en) | Requesting and receiving a media stream within a networked system | |
KR20230105189A (en) | System and Method for processing data transmission in cloud computing service | |
US10990429B2 (en) | Rule-based reallocation of hosted compute resources | |
JP2010146246A (en) | Framework computer program for multi-agent system, network system and inter-agent communication method | |
KR101082786B1 (en) | System and Method for Allocation of Contents using Proxy Server | |
US11086822B1 (en) | Application-based compression |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 22871259 Country of ref document: EP Kind code of ref document: A1 |
|
NENP | Non-entry into the national phase |
Ref country code: DE |
|
122 | Ep: pct application non-entry in european phase |
Ref document number: 22871259 Country of ref document: EP Kind code of ref document: A1 |