CN113873301A - Video stream acquisition method and device, server and storage medium - Google Patents

Video stream acquisition method and device, server and storage medium Download PDF

Info

Publication number
CN113873301A
CN113873301A CN202111109163.XA CN202111109163A CN113873301A CN 113873301 A CN113873301 A CN 113873301A CN 202111109163 A CN202111109163 A CN 202111109163A CN 113873301 A CN113873301 A CN 113873301A
Authority
CN
China
Prior art keywords
video stream
service
task analysis
task
analysis service
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Withdrawn
Application number
CN202111109163.XA
Other languages
Chinese (zh)
Inventor
曹强
刘琛
顾恩超
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Sensetime Technology Co Ltd
Original Assignee
Shenzhen Sensetime Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Sensetime Technology Co Ltd filed Critical Shenzhen Sensetime Technology Co Ltd
Priority to CN202111109163.XA priority Critical patent/CN113873301A/en
Publication of CN113873301A publication Critical patent/CN113873301A/en
Priority to PCT/CN2022/071431 priority patent/WO2023045191A1/en
Withdrawn legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/20Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
    • H04N21/25Management 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/262Content 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

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

The embodiment of the application discloses a method and a device for acquiring video stream, a server and a storage medium, wherein the method comprises the following steps: after receiving a request message for acquiring a video stream, a first task analysis service in a server determines whether the first task analysis service has access to the video stream; the client sends the request message to a first task analysis service based on a first mapping relation, wherein the first mapping relation is used for indicating the client corresponding to each task analysis service in the server; under the condition that the first task analysis service does not access the video stream, redirecting the client to a second task analysis service by a task management service in the server based on a second mapping relation, so that the client can acquire the video stream through the redirected second task analysis service; the second mapping relation is used for indicating the video stream which is correspondingly accessed by each task analysis service; the task management service is determined from a plurality of task analysis services in the server.

Description

Video stream acquisition method and device, server and storage medium
Technical Field
The embodiment of the application relates to communication technology, in particular to but not limited to a method and a device for acquiring a video stream, a server and a storage medium.
Background
At present, with the rapid development of the intelligent security management industry, a large amount of video data, audio data and the like need to be extracted and analyzed. However, there are many existing security management manufacturers, and the types of the used front-end devices and the types of their respective platform protocols are different, so that there are increasingly high requirements on the compatibility, stability and performance of the video access distribution system in the security management industry.
Therefore, how to provide a video access distribution system with strong compatibility, high performance, and stability and reliability becomes a research hotspot for those skilled in the art.
Disclosure of Invention
In view of this, embodiments of the present application provide a method and an apparatus for acquiring a video stream, a server, and a storage medium.
The technical scheme of the embodiment of the application is realized as follows:
in a first aspect, an embodiment of the present application provides a method for acquiring a video stream, which is applied to a server, and the method includes:
after receiving a request message for acquiring a video stream, a first task analysis service in the server determines whether the first task analysis service has accessed the video stream; the request message is sent to the first task analysis service by the client based on a first mapping relation, wherein the first mapping relation is used for indicating the client corresponding to each task analysis service in the server; under the condition that the first task analysis service does not access the video stream, redirecting the client to a second task analysis service by a task management service in the server based on a second mapping relation, so that the client can acquire the video stream through the redirected second task analysis service; the second mapping relation is used for indicating the video stream which is correspondingly accessed by each task analysis service; the task management service is determined from a plurality of task analysis services in the server.
By the method, the video source tracing function can be realized by adopting a redirection mechanism, the video access distribution system (namely a server) is ensured not to generate performance influence on the front-end equipment (namely the equipment where the video stream is located), and the internal forwarding function of the system is ensured to be normal and effective.
In some embodiments, in the case that the first task analysis service does not access the video stream, redirecting the client to a second task analysis service by a task management service in the server based on a second mapping relationship so that the client can acquire the video stream through the redirected second task analysis service includes: under the condition 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 the identification information of the video stream; the task management service inquires the task analysis service accessed to the video stream according to the identification information and the second mapping relation to obtain an inquiry result; and under the condition that the query result indicates that a 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 acquire the video stream through the second task analysis service.
By the method, when the redirection mechanism is adopted to ensure multi-service distribution, the traced service can be directly fed back to the client for butt joint, and network consumption between nodes where the internal service is located is reduced.
In some embodiments, the task management service sending the query result to the first task analysis service so that the client can obtain the video stream through the second task analysis service, including: the task management service sends the query result to the first task analysis service; and 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 connection with the second task analysis service according to the node address to acquire the video stream.
By the method, when the redirection mechanism is adopted to ensure multi-service distribution, the node address of the traced service can be directly fed back to the client for butt joint, and network consumption between nodes where the internal service is located is reduced.
In some embodiments, the querying, by the task management service, the task analysis service that has accessed the video stream according to the identification information and the second mapping relationship to obtain a query result includes: the task management service determines the address information of the accessed video stream according to the identification information and the second mapping relation; and the task management service determines the task analysis service accessed to the video stream according to the address information to obtain a query result.
By the method, the traceability function of the video source to be accessed can be realized according to the corresponding relation between the address information of the accessed video stream and the task analysis service.
In some embodiments, the server comprises a plurality of service nodes, at least one of the task analysis services being present on each of the service nodes; correspondingly, the second mapping relationship is used for indicating the video stream to which each service node has correspondingly accessed; correspondingly, the method further comprises: determining a first service node in the plurality of service nodes as a task management node; and determining the task analysis service in the task management node as the task management service.
By the mode, the video stream can be acquired by adopting the distributed system framework, so that the method has the characteristics of high reliability, high expansion and the like, and the stable and efficient operation of the access and forwarding functions in the video stream acquisition scene can be ensured. Meanwhile, in a plurality of task analysis services of the video access distribution system, a certain task analysis service is elected as a role of task management, so that the redirection scheduling of pulling video streams among different services is realized while resources are multiplexed.
In some embodiments, the method further comprises: the first task analysis service establishing a media connection with the client if the first task analysis service has access to the video stream; the first task analysis service sends the accessed video stream to the client through the media connection.
By the method, the video stream required by the client can be acquired by directly utilizing the task analysis service under the condition that the task analysis service corresponding to the client has access to the video stream.
In some embodiments, the method further comprises: and under the condition that the query result indicates that the task analysis service accessed to the video stream is not queried, the task management service determines a target task analysis service according to a preset rule, so that the client can acquire the video stream through the target task analysis service.
By the method, under the condition that the video streams are not accessed by the task analysis service, flexible and various scheduling strategies can be adopted to ensure that various scene requirements can be covered.
In some embodiments, the task management service determines a target task analysis service according to a preset rule, so that the client can obtain the video stream through the target task analysis service, including: the task management service determines the first task analysis service as the target task analysis service according to the first mapping relation, so that the client can acquire the video stream through the first task analysis service.
By the method, the local scheduling strategy can be adopted under the condition that the video streams are not accessed by the task analysis service, so that the redirection phenomenon can be reduced, the client side is more friendly, the logic is simpler, and the efficiency is higher.
In some embodiments, the task management service determines a target task analysis service according to a preset rule, so that the client can obtain the video stream through the target task analysis service, including: 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 from small to large according to values to obtain a sorting result; and the task management service determines the task analysis service with the minimum load as the target task analysis service according to the sequencing result, so that the client can acquire the video stream through the task analysis service with the minimum load.
By the method, under the condition that the video stream is not accessed by the task analysis service, a load balancing scheduling strategy is adopted, and the node where the service with the minimum load is located in all the task analysis services is selected as the docking node of the client, so that the system resource pressure can be reduced, and the stability is improved.
In some embodiments, the task management service determines a target task analysis service according to a preset rule, so that the client can obtain the video stream through the target task analysis service, including: and the task management service determines a third task analysis service according to the access type of the video stream, so that the client can acquire the video stream through the third task analysis service.
By the method, the task analysis service matched with the video stream can be selected as the docking node of the client according to the access type of the video stream acquired by the client under the condition that the video stream is not accessed by the task analysis service, so that the video stream access and forwarding functions can be more flexibly realized under the condition of meeting the scene requirements of users.
In a second aspect, an embodiment of the present application provides an apparatus for acquiring a video stream, where the apparatus includes: the determining unit is used for determining whether the first task analysis service in the server has accessed the video stream after receiving a request message for acquiring the video stream; the request message is sent to the first task analysis service by the client based on a first mapping relation, wherein the first mapping relation is used for indicating the client corresponding to each task analysis service in the server; a redirection unit, configured to redirect, by a task management service in the server, the client to a second task analysis service based on a second mapping relationship when the first task analysis service does not access the video stream, so that the client can obtain the video stream through the redirected second task analysis service; the second mapping relation is used for indicating the video stream which is correspondingly accessed by each task analysis service; the task management service is determined from a plurality of 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, where the memory stores a computer program executable on the processor, and the processor implements the steps in the method when executing the program.
In a fourth aspect, the present application provides a computer-readable storage medium, on which a computer program is stored, and the computer program, when executed by a processor, implements the steps in the method.
The embodiment of the application provides a method and a device for acquiring a video stream, a server and a storage medium, wherein after receiving a request message for acquiring the video stream, a first task analysis service in the server determines whether the server has accessed the video stream; the request message is sent to the first task analysis service by the client based on a first mapping relation, wherein the first mapping relation is used for indicating the client corresponding to each task analysis service in the server; under the condition that the first task analysis service does not access the video stream, redirecting the client to a second task analysis service by a task management service in the server based on a second mapping relation, so that the client can acquire the video stream through the redirected second task analysis service; the second mapping relation is used for indicating the video stream which is correspondingly accessed by each task analysis service; the task management service is determined from a plurality of task analysis services in the server, so that the video tracing function can be realized by adopting a redirection mechanism, a video access distribution system (namely the server) is ensured not to generate performance influence on front-end equipment (namely equipment where the video stream is located), and the internal forwarding function of the system is ensured to be normal and effective.
Drawings
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;
fig. 1B is a schematic flow chart of a first implementation of a method for acquiring a video stream according to an embodiment of the present application;
fig. 2 is a schematic flow chart illustrating an implementation process of a video stream acquisition method according to an embodiment of the present application;
fig. 3 is a schematic flow chart of an implementation of a video stream acquisition method according to an embodiment of the present application;
fig. 4 is a schematic flow chart of an implementation of a video stream acquisition method according to an embodiment of the present application;
fig. 5 is a schematic flow chart of an implementation of a video stream acquisition method according to an embodiment of the present application;
fig. 6 is a schematic structural diagram illustrating a component of an apparatus for acquiring 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.
Detailed Description
The technical solution of the present application is further elaborated below with reference to the drawings and the embodiments. It should be apparent that the described embodiments are only some of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments of the present application without making any creative effort, shall fall within the protection scope of the present application.
In the following description, reference is made to "some embodiments" which describe a subset of all possible embodiments, but it is understood that "some embodiments" may be the same subset or different subsets of all possible embodiments, and may be combined with each other without conflict.
In the following description, suffixes such as "module", "component", or "unit" used to denote elements are used only for the convenience of description of the present application, and have no specific meaning by themselves. Thus, "module", "component" or "unit" may be used mixedly.
It should be noted that the terms "first \ second \ third" referred to in the embodiments of the present application are only used for distinguishing similar objects and do not represent a specific ordering for the objects, and it should be understood that "first \ second \ third" may be interchanged under specific ordering or sequence if allowed, so that the embodiments of the present application described herein can be implemented in other orders than illustrated or described herein.
Fig. 1A is a schematic view of a system architecture corresponding to an acquisition method of a video stream 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, where:
a user may use the client 11 to interact with the server 13 via the network 12 to obtain data, such as a video stream, located on the head-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 simultaneously send the access result to the client 11. That is, the server 13 may request a video stream on the head-end device 14 and forward the video stream to the client 11. The server 13 can therefore be seen as a video access distribution system.
The client 11 may broadly be any of various types of devices having information processing capabilities including, but not limited to, a navigator, a smart phone, a tablet, a wearable device, a laptop portable computer, a kiosk, a desktop computer, and the like. The client 11 may be a streaming server in a narrow sense.
The server 13 may be a computing device with information processing capability such as a personal computer and a server cluster in the implementation process. The server 13 may be a server providing various services, for example, the server may be a distributed server, the distributed server includes a plurality of node servers, each node server has at least one task analysis service, when the client 11 needs to acquire a video stream on the front-end device 14, the client 11 may 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 may process the acquisition request. The front-end 14 may be an electronic device (e.g., a camera) or a platform (e.g., a security manager platform).
Based on this, the embodiment of the present application provides a method for acquiring a video stream, where the method is applied to a server, and the functions implemented by the method may be implemented by a processor of the server calling a program code, and of course, the program code may be stored in a storage medium of the server. Fig. 1B is a first schematic flow chart illustrating an implementation process of a method for acquiring a video stream according to an embodiment of the present application, as shown in fig. 1B, the method includes:
step S101, after receiving a request message for acquiring a video stream, a first task analysis service in the server determines whether the first task analysis service has accessed the video stream; the request message is sent to the first task analysis service by the client based on a first mapping relation, wherein the first mapping relation is used for indicating the client corresponding to each task analysis service in the server;
here, the server may be a computing device having an information processing capability 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 equipment and distribute the accessed video stream to the client.
In this embodiment of the application, the task analysis service in the server can be accessed to a video stream in the front-end device, that is, the task analysis service can be continuously accessed to the video stream in the front-end device, and a transmission state of the video stream is always maintained between the task analysis service and the front-end device.
Here, the client may be a streaming media server, and different streaming media servers correspond to different task analysis services. A first mapping relationship exists between the first task analysis service and a client sending a request message. For example, the streaming media server a corresponds to the task analysis service a, the streaming media server B corresponds to the task analysis service B, and the streaming media server C corresponds to the task analysis service C.
Of course, in some embodiments, the client may also directly send a request for obtaining a video stream to the server through a domain name, and the server internally resolves the domain name to designate a node (possibly randomly designated) to process the request, so that if a distributed server is adopted, multiple nodes in the distributed server can randomly achieve high reliability of load sharing.
Step S102, under the condition that the first task analysis service does not access the video stream, redirecting the client to a second task analysis service by a task management service in the server based on a second mapping relation, so that the client can acquire the video stream through the redirected second task analysis service; the second mapping relation is used for indicating the video stream which is correspondingly accessed by each task analysis service; the task management service is determined from a plurality of task analysis services in the server.
Here, the first task analysis service may determine whether or not it accesses the video stream, i.e., whether or not it is in a state of transmitting the video stream, based on the identification information of the video stream. The service node where the first task analysis service is located may have a local cache, where the local cache stores a mapping relationship between the first task analysis service and the video stream accessed by the first task analysis service, and further, the first task analysis service may know whether the first task analysis service has accessed the video stream requested by the client by checking data in the local cache.
Here, different task analysis services may correspond to different video streams. And a second mapping relation does not exist between the first task analysis service and the video stream required to be requested by the client, and a second mapping relation exists between the second task analysis service and the video stream required to be requested by the client. For example, the streaming media server a corresponds to a task analysis service a, and the task analysis service a corresponds to access to a first type of video stream. The streaming media server B corresponds to a task analysis service B, and the task analysis service B is correspondingly accessed to a second type of video stream. And the streaming media server C corresponds to a task analysis service C, and the task analysis service C is correspondingly accessed to a third type of video stream.
For example, the streaming media server a (i.e., the client a) sends a request message for acquiring a third type of video stream to the task analysis service a, and the task analysis service a finds itself without accessing the third type of video stream. The task analysis service A sends a query request message to a task management service, the task management service queries that the task analysis service C accesses a third type of video stream, the task management service redirects the streaming media service A to the task analysis service C, the task analysis service C queries that the task analysis service C accesses the third type of video stream after receiving the request message of the video stream sent by the streaming media service A, and the task analysis service directly returns the third type of video stream to the streaming media service A. Therefore, the video source tracing function is realized by adopting a redirection mechanism, the video access distribution system (namely a server) is ensured not to generate performance influence on the front-end equipment (namely the equipment where the video stream is located), and the internal forwarding function of the system is ensured to be normal and effective.
In the embodiment of the application, the task management service can be determined from a certain task analysis service after the system is created, that is, the service node where the task management service is located has not only a video access traceability function, but also a specific video access and distribution function, so that resource multiplexing can be realized.
Based on the foregoing embodiment, an embodiment of the present application further provides a method for acquiring a video stream, where the method is applied to a server, the server includes a plurality of service nodes, and at least one task analysis service exists on each service node, and the method includes:
step S111, determining a first service node in the plurality of service nodes as a task management node;
in the embodiment of the present application, a server generally includes a plurality of machines or a plurality of sets of virtual machine environments, in which case, one machine or one set of virtual machine environments is one service node, and a server having a plurality of service nodes is a distributed server. The task analysis service may be regarded as a process running on the node, and the process may listen to the outside or establish a network connection using an IP (Internet Protocol) address of the node.
Here, the distributed server is characterized by a multi-node multi-copy operation, in one case, one service (task analysis service or task management service) on each of a plurality of service nodes (i.e., physical machines). In another case, there are multiple services on a server, each service is regarded as a virtual machine, and resource isolation exists between different virtual machines, which both belong to a distributed server. In the embodiment of the application, the video stream is acquired by adopting the distributed system framework, so that the video stream has the characteristics of high reliability, high expansion and the like, and the stable and efficient operation of the access and forwarding functions in the video stream acquisition scene can be ensured. Meanwhile, a certain node is elected to serve as a role of task management in a plurality of service nodes of the video access distribution system, so that the redirection scheduling of pulling video streams among different nodes is realized.
In the embodiment of the application, the task management node is mainly used for inquiring whether a service node accesses a video stream required by a client, determining a specific service node accessing the video stream if the service node accesses the video stream, and sending an inquiry result to a service node where a first task analysis service is located. And the node where the first task analysis service is located sends the node address of the specific service node to the client, so that the client can acquire the video stream through the task analysis service on the specific service node. By the method, when the redirection mechanism is adopted to ensure multi-service distribution, the traced service can be directly fed back to the client for butt joint, and network consumption between nodes where the internal service is located is reduced.
Here, any service node of the plurality of service nodes may be determined as the task management node, and a service node with a minimum load of the plurality of service nodes may be determined as the task management node. Of course, a certain service node may also be determined as the task management node by other methods, that is, the determination method of the task management node in the embodiment of the present application is not limited, and a person skilled in the art may set the determination method according to actual use requirements.
Step S112, determining the task analysis service in the task management node as a task management service;
here, if one task analysis service exists in the task management node, the task analysis service is determined as the task management service.
Step S113, after receiving a request message for acquiring a video stream, a first task analysis service in the server determines whether the first task analysis service has accessed the video stream; the request message is sent to the first task analysis service by the client based on a first mapping relation, wherein the first mapping relation is used for indicating the client corresponding to each task analysis service in the server;
here, if the server is a distributed server, and the distributed server includes a plurality of service nodes, and at least one task analysis service exists on each service node, the first mapping relationship is used to indicate a client corresponding to each service node.
Here, the first task analysis service is a task analysis service on a service node corresponding to the client in the first mapping relationship.
Step S114, when the first task analysis service does not access the video stream, the task management service in the server redirects the client to a second task analysis service based on a second mapping relationship, so that the client can acquire the video stream through the redirected second task analysis service;
wherein the second mapping relation is used for indicating the video stream to which each service node has correspondingly accessed.
Here, the service node where the second task analysis service is located has the second mapping relationship with the video stream.
By the mode, the video stream can be acquired by adopting the distributed system framework, so that the method has the characteristics of high reliability, high expansion and the like, and the stable and efficient operation of the access and forwarding functions in the video stream acquisition scene can be ensured. Meanwhile, in a plurality of task analysis services of the video access distribution system, a certain task analysis service is elected as a role of task management, so that the redirection scheduling of pulling video streams among different services is realized while resources are multiplexed.
Based on the foregoing embodiment, an embodiment of the present application further provides a method for acquiring a video stream, where the method is applied to a server, fig. 2 is a schematic diagram of an implementation flow of the method for acquiring a video stream according to the embodiment of the present application, and as shown in fig. 2, the method includes:
step S201, after receiving a request message for acquiring a video stream, a first task analysis service in the server determines whether the first task analysis service has accessed the video stream; the request message is sent to the first task analysis service by the client based on a first mapping relation, wherein the first mapping relation is used for indicating the client corresponding to each task analysis service in the server;
step S202, under the condition 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 the identification information of the video stream;
step S203, the task management service inquires the task analysis service accessed to the video stream according to the identification information and the second mapping relation to obtain an inquiry result;
in the embodiment of the application, after the task management service receives the query request message sent by the first task analysis service, the task management service can query the task analysis service accessed to the video stream in the shared storage, so that the video source tracing function is realized. Therefore, the client can directly use the task analysis service accessed to the video stream to obtain the video stream, so that the video access distribution system (namely, a server) can be ensured not to generate performance influence on the front-end equipment, and the internal forwarding function of the system is ensured to be normal and effective.
Step S204, under the condition that the query result indicates that a 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 mapping relation is used for indicating the video stream which is correspondingly accessed by each task analysis service; the task management service is determined from a plurality of task analysis services in the server.
In some embodiments, the server comprises a plurality of service nodes, at least one of the task analysis services being present on each of the service nodes; correspondingly, the second mapping relationship is used for indicating the video stream to which each service node has correspondingly accessed;
correspondingly, the method further comprises:
step S21, determining a first service node of 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.
Based on the foregoing embodiments, an embodiment of the present application further provides a method for acquiring a video stream, where the method is applied to a server, and the method includes:
step S211, after receiving a request message for acquiring a video stream, a first task analysis service in the server determines whether the first task analysis service has accessed the video stream; the request message is sent to the first task analysis service by the client based on a first mapping relation, wherein the first mapping relation is used for indicating the client corresponding to each task analysis service in the server;
step S212, under the condition 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 the identification information of the video stream;
step S213, the task management service inquires the task analysis service accessed to the video stream according to the identification information and the second mapping relation to obtain an inquiry result;
here, the query request message carries identification information of a video stream, so that the task management service can query which node has the task analysis service access to 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 a media connection with the second task analysis service according to the node address to obtain the video stream; the second mapping relation is used for indicating the video stream which is correspondingly accessed by each task analysis service; the task management service is determined from a plurality of task analysis services in the server.
In the embodiment of the application, during docking, a client sends a basic signaling to a corresponding service node, after the service node determines that a video stream requested by the client is not accessed, the service node which has accessed the video stream is searched, a 302 error is returned, the error code carries a new address (namely the address of the service node which has accessed the video stream is found), and then the client sends a request for acquiring the video stream after taking the new address, and redirection is performed because the address is changed. In this way, for an accessed video source, when a client requests the video source from a task analysis service, if a node accessed by the video source is not a service node corresponding to the current client, correct connection between the client and the service node is realized in a redirection mode.
In some embodiments, the step S213, querying, by the task management service, the task analysis service that has accessed the video stream according to the identification information and the second mapping relationship to obtain a query result, including:
step S2131, the task management service determines the address information of the accessed video stream according to the identification information and the second mapping relation;
here, the task analysis service that has accessed the video stream may be determined according to address information of the accessed video stream. That is to say, there is a corresponding relationship between the address information and the task analysis service, so that the tracing 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 accessed to the video stream according to the address information to obtain a query result.
Based on the foregoing embodiment, an embodiment of the present application further provides a method for acquiring a video stream, where the method is applied to a server, fig. 3 is a schematic view of a third implementation flow of the method for acquiring a video stream according to the embodiment of the present application, and as shown in fig. 3, the method includes:
step S301, after receiving a request message for acquiring a video stream, a first task analysis service in the server determines whether the first task analysis service has accessed the video stream; the request message is sent to the first task analysis service by the client based on a first mapping relation, wherein the first mapping relation is used for indicating the client corresponding to each task analysis service in the server;
here, if the first task analysis service does not access the video stream, the following step S302 is performed; if the first task analysis service has access to the video stream, the following steps S303 to S304 are performed.
Step S302, redirecting the client to a second task analysis service by a task management service in the server based on a second mapping relation, so that the client can acquire the video stream through the redirected second task analysis service; the second mapping relation is used for indicating the video stream which is correspondingly accessed by each task analysis service; the task management service is determined from a plurality of task analysis services in the server;
step S303, the first task analysis service establishes media connection with the client;
here, if the first task analysis service has access to the video stream, the client may be provided with its required video stream directly using the first task analysis service.
Step S304, the first task analysis service sends the accessed video stream to the client through the media connection.
Based on the foregoing embodiments, an embodiment of the present application further provides a method for acquiring a video stream, where the method is applied to a server, and the method includes:
step S311, after receiving a request message for acquiring a video stream, a first task analysis service in the server determines whether the first task analysis service has accessed the video stream; the request message is sent to the first task analysis service by the client based on a first mapping relation, wherein the first mapping relation is used for indicating the client corresponding to each task analysis service in the server;
here, if the first task analysis service does not access the video stream, the following steps S312 to S314 are performed; otherwise, if the first task analysis service has access to the video stream, the following steps S315 to S316 are performed.
Step S312, the first task analysis service sends a query request message to the task management service; wherein, the query request message carries the identification information of the video stream;
step S313, the task management service inquires the task analysis service accessed to the video stream according to the identification information and the second mapping relation to obtain an inquiry 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, so that the client can obtain the video stream through the second task analysis service; the second mapping relation is used for indicating the video stream which is correspondingly accessed by each task analysis service; the task management service is determined from a plurality of task analysis services in the server;
step S315, the first task analysis service establishes media connection with the client;
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 comprises: and under the condition that the query result indicates that the task analysis service accessed to the video stream is not queried, the task management service determines a target task analysis service according to a preset rule, so that the client can acquire the video stream through the target task analysis service.
Based on the foregoing embodiment, an embodiment of the present application further provides a method for acquiring a video stream, where the method is applied to a server, fig. 4 is a schematic diagram of an implementation flow of the method for acquiring a video stream according to the embodiment of the present application, and as shown in fig. 4, the method includes:
step S401, after receiving a request message for acquiring a video stream, a first task analysis service in the server determines whether the first task analysis service has accessed the video stream; the request message is sent to the first task analysis service by the client based on a first mapping relation, wherein the first mapping relation is used for indicating the client corresponding to each task analysis service in the server;
step S402, under the condition 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 the identification information of the video stream;
step S403, the task management service inquires the task analysis service accessed to the video stream according to the identification information and the second mapping relation to obtain an inquiry result;
step S404, 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 mapping relation is used for indicating the video stream which is correspondingly accessed by each task analysis service; the task management service is determined from a plurality of task analysis services in the server;
step S405, under the condition that the query result shows that the task analysis service accessed to the video stream is not queried, the task management service determines a target task analysis service according to a preset rule, so that the client can obtain the video stream through the target task analysis service.
Here, the query result indicates that the task analysis service which has accessed the video stream is not queried, that is, any task analysis service in the server does not access the video stream, and the task management service may determine a target task analysis service according to a preset rule to obtain the video stream, so that under the condition that no video stream is accessed by the task analysis service, flexible and various scheduling strategies are adopted to ensure that various scene requirements can be covered.
Based on the foregoing embodiments, an embodiment of the present application further provides a method for acquiring a video stream, where the method is applied to a server, and the method includes:
step S411, after receiving a request message for acquiring a video stream, a first task analysis service in the server determines whether the first task analysis service has accessed the video stream; the request message is sent to the first task analysis service by the client based on a first mapping relation, wherein the first mapping relation is used for indicating the client corresponding to each task analysis service in the server;
step S412, under the condition 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 the 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 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 mapping relation is used for indicating the video stream which is correspondingly accessed by each task analysis service; the task management service is determined from a plurality of task analysis services in the server;
step S415, when the query result indicates that the task analysis service accessed to the video stream is not queried, 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.
Here, the first task analysis service is a task analysis service which is allocated by the server when the server receives a request of the client for acquiring the video stream and processes the request, so that a near scheduling policy can be adopted under the condition that no video stream is accessed by the task analysis service, and thus, the redirection phenomenon can be reduced, the client is more friendly, the logic is simpler, and the efficiency is higher.
Based on the foregoing embodiments, an embodiment of the present application further provides a method for acquiring a video stream, where the method is applied to a server, and the method includes:
step S421, after receiving a request message for acquiring a video stream, a first task analysis service in the server determines whether the first task analysis service has accessed the video stream; the request message is sent to the first task analysis service by the client based on a first mapping relation, wherein the first mapping relation is used for indicating the client corresponding to each task analysis service in the server;
step S422, in a 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 the identification information of the video stream;
step S423, the task management service queries the task analysis service accessed to 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, so that the client can obtain the video stream through the second task analysis service; the second mapping relation is used for indicating the video stream which is correspondingly accessed by each task analysis service; the task management service is determined from a plurality of task analysis services in the server;
step S425, when the query result indicates that the task analysis service accessed to the video stream is not queried, the task management service determines loads of at least two task analysis services in the server;
here, if the server is a distributed server, the distributed server includes a plurality of service nodes, and each service node has at least one task analysis service thereon. In the case that the query result indicates that the task analysis service which has accessed the video stream is not queried, the load of all task analysis services or a part of all task analysis services can be determined. The load of the task analysis service refers to the amount of the task analysis service accessing the video stream and forwarding the video stream.
Step S426, the task management service sorts the loads of the at least two task analysis services from small to large according to values to obtain a sorting result;
step S427, the task management service determines the task analysis service with the minimum 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 minimum load.
By the method, under the condition that the video stream is not accessed by the task analysis service, a load balancing scheduling strategy is adopted, and the node where the service with the minimum load is located in all the task analysis services is selected as the docking node of the client, so that the system resource pressure can be reduced, and the stability is improved.
Based on the foregoing embodiments, an embodiment of the present application further provides a method for acquiring a video stream, where the method is applied to a server, and the method includes:
step S431, after receiving the request message for acquiring the video stream, the first task analysis service in the server determines whether the first task analysis service has accessed the video stream; the request message is sent to the first task analysis service by the client based on a first mapping relation, wherein the first mapping relation is used for indicating the client corresponding to each task analysis service in the server;
step S432, in 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 the identification information of the video stream;
step S433, the task management service inquires the task analysis service accessed to the video stream according to the identification information and the second mapping relation to obtain an inquiry 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, so that the client can obtain the video stream through the second task analysis service; the second mapping relation is used for indicating the video stream which is correspondingly accessed by each task analysis service; the task management service is determined from a plurality of task analysis services in the server;
step S435, when the query result indicates that the task analysis service accessed to the video stream is not queried, 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 (i.e. some task analysis services) can only receive a certain type of video stream, and then the corresponding service node can be determined according to the access type of the video stream to be obtained, and then the task analysis service on the service node is used to obtain the required video stream, so that the access and forwarding functions of the video stream can be more flexibly realized under the condition of meeting the requirements of user scenes.
Of course, it may also be that some client platforms may only correspond to some service nodes, and if the video stream required by the client is not accessed by any service node, the video stream is acquired by using the service node corresponding to the platform where the client is located.
At present, the distributed system has obvious advantages of video access distribution, capability of improving system concurrency and supporting dynamic expansion and contraction capacity, and has the characteristics of high reliability and the like. However, when the multi-node service of the distributed system processes the access video source, the situation that the video source of the same path of front-end equipment is requested and forwarded for many times is easy to occur, so that the bandwidth resource of the front-end equipment is wasted, and the system performance is limited. For example, if a client a and a client B simultaneously request the same video stream on a front-end device, in the distributed system, a node service a corresponding to the client a and a node service B corresponding to the client B may simultaneously request the video source from the front-end device, which may cause waste of bandwidth resources of the front-end device and poor performance of the distributed system.
Therefore, functions such as video distribution tracing and dynamic scheduling of system resources need to be considered. The distribution module in the distributed system is not limited by the performance of the access module, the access module does not affect the performance of the front-end equipment, the system resources are efficiently and fully utilized, and the like. The distribution module and the access module are both located in the distributed system, the access module is mainly used for obtaining video streams from the front-end equipment, and the distribution module is mainly used for forwarding the obtained video streams to the client.
Based on this, the embodiment of the present application provides a scheme for acquiring a video stream, where in the scheme (1) a distributed system is adopted to access video source data of different manufacturers and different protocols, that is, various types of video sources (including video and audio) are accessed by interfacing various manufacturer protocols and standard platform protocols. Meanwhile, the distributed architecture deployment is adopted, multiple nodes are accessed simultaneously, the concurrency and the access efficiency are improved, and the stability of an access module can be improved by utilizing the distributed high-reliability characteristic. (2) When part of video protocols are accessed, the information such as the address, the port and the like of the docking system is verified, so that the influence of multiple accesses of a single user on the performance of the equipment is prevented. Therefore, in the embodiment of the application, a certain mechanism is adopted to ensure that the media service node which is accessed specifically can be traced when the media service node is forwarded internally, so that the situation that multiple accesses occur due to multipath forwarding is prevented. (3) A Manager-Worker mechanism is adopted to distinguish functions of different nodes, so that the Manager is used for tracing the video access, and the Worker is used for performing specific video access and distribution functions, thereby ensuring that each video source is accessed at most once. Therefore, a Manager-Worker mechanism ensures that a reasonable and efficient resource scheduling mechanism exists when multiple nodes access and forward in a distributed system, and the operation efficiency of the system is improved to the maximum extent. (4) When the video stream is forwarded, the specific forwarded media service node is negotiated with the client through the redirection function, so that the bandwidth consumption between the interior of the nodes can be reduced.
In the implementation process, when the client pulls the video stream to the node, and when the node corresponding to the pulled video stream is not the node accessed to the video stream, the connection between the client and the corresponding task analysis service (i.e., Worker) is realized in a redirection manner in the embodiment of the application. And in a plurality of Workers in the distributed system, a certain Worker is elected as a role of management (namely Manager), namely as a task management service, so as to realize the redirection scheduling of pulling video streams by different streaming media services. Meanwhile, when video streams needing to be pulled do not exist in all the access services in the redirection process, various scheduling logics are designed, and load balance of system scheduling is achieved.
The scheme can be realized through the following processes:
the cameras accessed by the distributed system comprise a camera A, a camera B and a camera C, wherein the accessed cameras belong to the front-end equipment. The services enabled by the distributed system comprise a task analysis service A, a task analysis service B and a task analysis service C which are respectively accessed to video streams of the camera A, the camera B and the camera C. Meanwhile, the client for pulling the video stream comprises a client A, a client B and a client C, namely the three clients can all acquire the video stream in the camera by using the distributed system, if the client A has the requirement for acquiring the video stream, the system can allocate the task analysis service A to process the requirement of the client A, if the client B has the requirement for acquiring the video stream, the system can allocate the task analysis service B to process the requirement of the client B, and if the client C has the requirement for acquiring the video stream, the system can allocate the task analysis service C to process the requirement of the client C. Wherein each task analysis service has the function of requesting a video stream from a camera and forwarding the video stream to a client. And, the task analysis service B is simultaneously allocated as a task management service.
Furthermore, when the client C needs to pull the video stream of the camera a, the distributed system may allocate the task analysis service C to handle the requirement of the client C for acquiring the video stream, that is, the client C first sends a pull stream request corresponding to the client C to the task analysis service C. Then, the task analysis service C initiates a query request to the task management service (i.e., the task analysis service B) according to the query result of the video stream that is not accessed to the camera a, so as to obtain the query result of which task analysis service is accessed to the video stream of the camera a. The task management service returns the query result of the video stream accessed 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 video stream accessed to the camera a by the task analysis service a). And finally, the client C establishes connection with the task analysis service A of the video stream accessed to the camera A to acquire the video stream accessed by the task analysis service A.
Here, an example that an original video stream in a camera is forwarded to an RTSP stream by a distributed system for a client to access is described, fig. 5 is a schematic diagram of an implementation flow of a video stream obtaining method according to an embodiment of the present application, and as shown in fig. 5, the method includes:
step S501, the client sends RTSP (Real Time Streaming Protocol) request to the task analysis service C;
here, the RTSP request is mainly used to request a certain video source of the RTSP type. That is, the distributed system interfaces the flows of the various vendors and outputs them to the clients via a uniform, standardized protocol. If the RTSP player is used, streams of various manufacturers at the front end are converted into the RTSP stream for the client to access.
Step S502, the task analysis service C inquires a local list and confirms whether to access the video stream requested to be pulled by the client;
step S503, the task analysis service C sends a query request to the task management service under the condition that the task analysis service C does not access the video stream;
step S504, the task management service inquires an address accessed to the video stream in a storage medium, and determines the task analysis service accessed to the video stream as a task analysis service A according to the address;
here, the storage medium may be a storage medium of shared storage, 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;
here, the task analysis service C returns to the address of the client, i.e., 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 inquires a local list and confirms whether to access the video stream requested to be pulled by the client;
step S509, the task analysis service a converts the accessed video stream into an RTSP-type video stream, and returns the RTSP-type video stream to the client.
Here, the steps S501 to S508 are signaling streams, that is, signaling transmission paths of the present scheme, and the step S509 is video streams, that is, video stream transmission paths of the present scheme. In addition, the steps S501 to S509 are schemes in a case where a video stream that the client needs to pull exists in a certain node of the distributed system.
And if the task management service inquires that all the task analysis services do not access the video stream to be pulled, adopting the following scheduling strategy.
(1) The first scheduling strategy is as follows: a nearby scheduling policy.
When a client needs to pull a video stream and all task analysis services in a distributed system do not access the video stream, selecting a node closest to the client as a node for pulling the video stream (namely an original node distributed to the client by the system). For example, when a client a requests a video source of a camera a from a task analysis service a, the task analysis service a finds that the video source of the camera a is not accessed locally, the task analysis service a queries a task management service, and if a query result indicates that the video source of the camera a is not accessed by other task analysis services, a near scheduling policy is adopted, and a node corresponding to the task analysis service a is directly selected as a docking node of the client a.
Here, the method described in the above step S415 is one implementation of the nearby scheduling policy.
(2) And the second scheduling strategy is as follows: and (4) load balancing scheduling strategies.
And under the condition that the client needs to pull the video stream and all task analysis services in the distributed system do not access the video stream, selecting the node with the minimum load in the distributed system as the node for pulling the video stream. For example, when a client a requests a task analysis service a for a video source of a camera a, the task analysis service a finds that the video source of the camera a is not accessed locally, the task analysis service a queries a task management service, if the query result indicates that none of the video sources of the camera a is accessed by other task analysis services, a load balancing scheduling policy is adopted, load values of all the task analysis services at the time are calculated, and a node corresponding to the task analysis service with the smallest load value is selected as a docking node of the client a.
Here, the method described in the above step S425 to step S427 is one implementation of the load balancing scheduling policy.
(3) And a third scheduling strategy: and (4) customizing a scheduling strategy.
And under the condition that the client needs to pull the video stream and all task analysis services in the distributed system do not access the video stream, deciding a certain node as a node for pulling the video stream according to different video access types and parameters specified by a user. For example, when a client a requests a video source of a camera a from a task analysis service a, the task analysis service a finds that the video source of the camera a is not accessed locally, the task analysis service a queries a task management service, if a query result indicates that none of the video sources of the camera a is accessed by other task analysis services, and the video source is a video source corresponding to a GB28181 protocol, a schedulable node set is determined according to configuration information of a user and an access protocol type of the video source, and then a node satisfying a condition is selected from the schedulable node set as a docking node of the client a, so that access and forwarding functions can be realized more flexibly under the condition of satisfying a user scene requirement.
Here, the method described in step S435 is one implementation of the custom scheduling policy.
In the field of intelligent security management, the acquisition and analysis of mass video materials have higher requirements on the video access and forwarding functions of the system. By adopting the scheme in the embodiment of the application, more different manufacturer protocol video sources can be compatible, and meanwhile, more stable, efficient and flexible deployment can be realized by utilizing various distributed characteristics.
That is to say, the scheme for acquiring a video stream in the embodiment of the present application can achieve the following technical effects: (1) based on a distributed system framework, the method has the characteristics of high reliability, high expansion and the like, so that the stable and efficient operation of the access and forwarding functions under the video stream acquisition scene is ensured. (2) And a Manager-Worker mechanism is adopted to realize the source tracing function of the video, ensure that the access module of the distributed system does not influence the performance of the front-end equipment, and ensure that the internal forwarding function of the distributed system is normal and effective. (3) When a redirection mechanism is adopted to ensure that the nodes after tracing can be directly fed back to the client side for butt joint when the nodes are distributed, and the network consumption among the nodes in the system is reduced. (4) The flexible and various scheduling strategies can cover various scene requirements in the video stream acquisition process.
Based on the foregoing embodiments, the present application provides an apparatus for acquiring a video stream, where the apparatus includes units, sub-units and modules included in the units, and sub-modules and components included in the modules, and may be implemented by a processor in a server; of course, the implementation can also be realized through a specific logic circuit; in the implementation process, the processor may be a CPU (Central Processing Unit), an MPU (Microprocessor Unit), a DSP (Digital Signal Processing), an FPGA (Field Programmable Gate Array), or the like.
Fig. 6 is a schematic structural diagram of a device for acquiring a video stream according to an embodiment of the present application, and as shown in fig. 6, the device 600 includes:
a determining unit 601, configured to determine, by a first task analysis service in the server, whether the first task analysis service has accessed a video stream after receiving a request message for acquiring the video stream; the request message is sent to the first task analysis service by the client based on a first mapping relation, wherein the first mapping relation is used for indicating the client corresponding to each task analysis service in the server;
a redirecting unit 602, configured to, when the first task analysis service does not access the video stream, redirect the client to a second task analysis service by a task management service in the server based on a second mapping relationship, so that the client can obtain the video stream through the redirected second task analysis service; the second mapping relation is used for indicating the video stream which is correspondingly accessed by each task analysis service; the task management service is determined from a plurality of task analysis services in the server.
In some embodiments, the redirection unit 602 includes: a first sending module, configured to send, by the first task analysis service, a query request message to the task management service when the first task analysis service does not access the video stream; wherein, the query request message carries the identification information of the video stream; the query module is used for querying the task analysis service accessed to the video stream by the task management service according to the identification information and the second mapping relation to obtain a query result; and the second sending module is configured to, when the query result indicates that a second task analysis service in the server has accessed the video stream, send the query result to the first task analysis service by the task management 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 unit, configured to send the query result to the first task analysis service by the task management service; a second sending component, configured to send, by the first task analysis service, 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.
In some embodiments, the query module comprises: a first determining unit, configured to determine, by the task management service, address information of the accessed video stream according to the identification information and the second mapping relationship; and the second determining component is used for determining the task analysis service accessed to the video stream by the task management service according to the address information to obtain a query result.
In some embodiments, the server comprises a plurality of service nodes, at least one of the task analysis services being present on each of the service nodes; correspondingly, the second mapping relationship is used for indicating the video stream to which each service node has correspondingly accessed; correspondingly, the device further comprises: a management node determining unit, configured to determine a first service node in the plurality of service nodes as a task management node; and the management service determining unit is used for determining the task analysis service in the task management node as the task management service.
In some embodiments, the apparatus further comprises: a connection establishing unit, configured to establish a media connection with the client by the first task analysis service when the first task analysis service has accessed the video stream; a sending unit, configured to send the accessed video stream to the client through the media connection by the first task analysis service.
In some embodiments, the apparatus further comprises: and the target service determining unit is used for determining a target task analysis service according to a preset rule by the task management service under the condition that the query result indicates that the task analysis service accessed to the video stream is not queried, so that the client can acquire the video stream through the target task analysis service.
In some embodiments, the target service determination unit includes: a first target service determination module, configured to determine, by the task management service, 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.
In some embodiments, the target service determination unit includes: the load determining module is used for determining the load of at least two task analysis services in the server by the task management service; the sequencing module is used for sequencing the loads of the at least two task analysis services from small to large according to the values by the task management service to obtain a sequencing result; and the second target service determination module is used for determining the task analysis service with the minimum load as the target task analysis service by the task management service according to the sequencing result, so that the client can acquire the video stream through the task analysis service with the minimum load.
In some embodiments, the target service determination unit includes: and the third target service determining module is used for determining a third task analysis service by the task management service according to the access type of the video stream, so that the client can acquire the video stream through the third task analysis service.
The above description of the apparatus embodiments, similar to the above description of the method embodiments, has similar beneficial effects as the method embodiments. For technical details not disclosed in the embodiments of the apparatus of the present application, reference is made to the description of the embodiments of the method of the present application for understanding.
It should be noted that, in the embodiment of the present application, if the above-mentioned method for acquiring a video stream is implemented in the form of a software functional module and is sold or used as a standalone product, it may also be stored in a computer-readable storage medium. Based on such understanding, the technical solutions of the embodiments of the present application may be essentially implemented or portions thereof contributing to the prior art may be embodied in the form of a software product stored in a storage medium, and including several instructions for causing an electronic device (which may be a personal computer, a server, etc.) to execute all or part of the methods described in the embodiments of the present application. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a ROM (Read Only Memory), a magnetic disk, or an optical disk. 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, which includes a memory and a processor, where the memory stores a computer program that can run on the processor, and the processor executes the computer program to implement the steps in the method for acquiring a video stream provided in the foregoing embodiment.
Correspondingly, the embodiment of the present application provides a readable storage medium, on which a computer program is stored, and the computer program, when executed by a processor, implements the steps in the above-mentioned video stream acquisition method.
Here, it should be noted that: the above description of the storage medium and server embodiments is similar to the description of the method embodiments described above, with similar beneficial effects as the method embodiments. For technical details not disclosed in the embodiments of the storage medium and the server of the present application, reference is made to the description of the embodiments of the method of the present application for understanding.
It should be noted that fig. 7 is a schematic diagram of a hardware entity of a server according to an embodiment of the present application, and 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
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 via a network.
The Memory 703 is configured to store instructions and applications executable by the processor 701, and may also cache data (e.g., image data, audio data, voice communication data, and video communication data) to be processed or already processed by each module in the processor 701 and the server 700, and may be implemented by a FLASH Memory (FLASH Memory) or a Random Access Memory (RAM);
wherein the various hardware entities in the server are coupled together by a bus 704. It is understood that bus 704 is used to enable communications of connections between these hardware entities.
In the several embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other ways. The above-described device embodiments are merely illustrative, for example, the division of the unit is only a logical functional division, and there may be other division ways in actual implementation, such as: multiple units or components may be combined, or may be integrated into another system, or some features may be omitted, or not implemented. In addition, the coupling, direct coupling or communication connection between the components shown or discussed may be through some interfaces, and the indirect coupling or communication connection between the devices or units may be electrical, mechanical or other forms.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, that is, may be located in one place, or may be distributed on a plurality of network units; some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, all functional units in the embodiments of the present application may be integrated into one processing module, or each unit may be separately regarded as one unit, or two or more units may be integrated into one unit; the integrated unit can be realized in a form of hardware, or in a form of hardware plus a software functional unit. Those of ordinary skill in the art will understand that: all or part of the steps for implementing the method embodiments may be implemented by hardware related to program instructions, and the program may be stored in a computer readable storage medium, and when executed, the program performs the steps including the method embodiments; and the aforementioned storage medium includes: a removable storage device, a ROM, a RAM, a magnetic or optical disk, or various other media that can store program code.
The methods disclosed in the several method embodiments provided in the present application may be combined arbitrarily without conflict to obtain new method embodiments.
Features disclosed in several of the product embodiments provided in the present application may be combined in any combination to yield new product embodiments without conflict. The features disclosed in the several method or apparatus embodiments provided in the present application may be combined arbitrarily, without conflict, to arrive at new method embodiments or apparatus embodiments.
The above description is only for the specific embodiments of the present application, but the scope of the present application is not limited thereto, and any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present application, and shall be covered by the scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims (13)

1. A method for acquiring a video stream, applied to a server, includes:
after receiving a request message for acquiring a video stream, a first task analysis service in the server determines whether the first task analysis service has accessed the video stream; the request message is sent to the first task analysis service by the client based on a first mapping relation, wherein the first mapping relation is used for indicating the client corresponding to each task analysis service in the server;
under the condition that the first task analysis service does not access the video stream, redirecting the client to a second task analysis service by a task management service in the server based on a second mapping relation, so that the client can acquire the video stream through the redirected second task analysis service; the second mapping relation is used for indicating the video stream which is correspondingly accessed by each task analysis service; the task management service is determined from a plurality of task analysis services in the server.
2. The method according to claim 1, wherein, in a case that the first task analysis service does not access the video stream, redirecting the client to a second task analysis service by a task management service in the server based on a second mapping relationship, so that the client can obtain the video stream through the redirected second task analysis service, comprises:
under the condition 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 the identification information of the video stream;
the task management service inquires the task analysis service accessed to the video stream according to the identification information and the second mapping relation to obtain an inquiry result;
and under the condition that the query result indicates that a 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 acquire the video stream through the second task analysis service.
3. The method of 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, comprising:
the task management service sends the query result to the first task analysis service;
and 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 connection with the second task analysis service according to the node address to acquire the video stream.
4. The method according to claim 2 or 3, wherein the task management service queries a task analysis service that has accessed the video stream according to the identification information and the second mapping relationship to obtain a query result, including:
the task management service determines the address information of the accessed video stream according to the identification information and the second mapping relation;
and the task management service determines the task analysis service accessed to the video stream according to the address information to obtain a query result.
5. The method according to any one of claims 1 to 4, wherein the server comprises a plurality of service nodes, at least one of the task analysis services being present on each of the service nodes;
correspondingly, the second mapping relationship is used for indicating the video stream to which each service node has correspondingly accessed;
correspondingly, the method further comprises:
determining a first service node in the plurality of service nodes as a task management node;
and determining the task analysis service in the task management node as the task management service.
6. The method according to any one of claims 1 to 5, further comprising:
the first task analysis service establishing a media connection with the client if the first task analysis service has access to the video stream;
the first task analysis service sends the accessed video stream to the client through the media connection.
7. The method according to any one of claims 1 to 6, further comprising:
and under the condition that the query result indicates that the task analysis service accessed to the video stream is not queried, the task management service determines a target task analysis service according to a preset rule, so that the client can acquire the video stream through the target task analysis service.
8. The method according to claim 7, wherein the task management service determines a target task analysis service according to a preset rule, so that the client can obtain the video stream through the target task analysis service, including:
the task management service determines the first task analysis service as the target task analysis service according to the first mapping relation, so that the client can acquire the video stream through the first task analysis service.
9. The method according to claim 7, wherein the task management service determines a target task analysis service according to a preset rule, so that the client can obtain the video stream through the target task analysis service, including:
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 from small to large according to values to obtain a sorting result;
and the task management service determines the task analysis service with the minimum load as the target task analysis service according to the sequencing result, so that the client can acquire the video stream through the task analysis service with the minimum load.
10. The method according to claim 7, wherein the task management service determines a target task analysis service according to a preset rule, so that the client can obtain the video stream through the target task analysis service, including:
and the task management service determines a third task analysis service according to the access type of the video stream, so that the client can acquire the video stream through the third task analysis service.
11. An apparatus for acquiring a video stream, the apparatus comprising:
the determining unit is used for determining whether the first task analysis service in the server has accessed the video stream after receiving a request message for acquiring the video stream; the request message is sent to the first task analysis service by the client based on a first mapping relation, wherein the first mapping relation is used for indicating the client corresponding to each task analysis service in the server;
a redirection unit, configured to redirect, by a task management service in the server, the client to a second task analysis service based on a second mapping relationship when the first task analysis service does not access the video stream, so that the client can obtain the video stream through the redirected second task analysis service; the second mapping relation is used for indicating the video stream which is correspondingly accessed by each task analysis service; the task management service is determined from a plurality of task analysis services in the server.
12. A server comprising a memory and a processor, the memory storing a computer program operable on the processor, the processor when executing the program implementing the steps in the method of any one of claims 1 to 10.
13. A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the steps of the method of any one of claims 1 to 10.
CN202111109163.XA 2021-09-22 2021-09-22 Video stream acquisition method and device, server and storage medium Withdrawn CN113873301A (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN202111109163.XA CN113873301A (en) 2021-09-22 2021-09-22 Video stream acquisition method and device, server and storage medium
PCT/CN2022/071431 WO2023045191A1 (en) 2021-09-22 2022-01-11 Video stream obtaining method and apparatus, server, storage medium, and program product

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
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
CN113873301A true CN113873301A (en) 2021-12-31

Family

ID=78993197

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111109163.XA Withdrawn CN113873301A (en) 2021-09-22 2021-09-22 Video stream acquisition method and device, server and storage medium

Country Status (2)

Country Link
CN (1) CN113873301A (en)
WO (1) WO2023045191A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2023045191A1 (en) * 2021-09-22 2023-03-30 上海商汤智能科技有限公司 Video stream obtaining method and apparatus, server, storage medium, and program product

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1909509A (en) * 2006-07-19 2007-02-07 华为技术有限公司 System, method and user terminal for realizing video live broadcast in media distributing network
CN101119475A (en) * 2007-08-21 2008-02-06 中兴通讯股份有限公司 System and method for implementing video on-demand request redirection in IPTV system
CN101505298A (en) * 2009-02-09 2009-08-12 中兴通讯股份有限公司 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
CN109982034A (en) * 2017-12-28 2019-07-05 杭州海康威视系统技术有限公司 Access request processing method and processing device in video monitoring system

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2001218194A (en) * 1999-11-15 2001-08-10 Canon Inc Control method for image pickup unit and image distributing system, controller for image pickup unit, system and device for distributing image and device and method for distributing data
CN101540886B (en) * 2009-04-15 2012-09-05 中兴通讯股份有限公司 Realization method and system of video-on-demand business and home streaming server
CN107707939B (en) * 2017-09-30 2023-03-10 江西欧菲炬能物联科技有限公司 Video access method, access balance server, central server and 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

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1909509A (en) * 2006-07-19 2007-02-07 华为技术有限公司 System, method and user terminal for realizing video live broadcast in media distributing network
CN101119475A (en) * 2007-08-21 2008-02-06 中兴通讯股份有限公司 System and method for implementing video on-demand request redirection in IPTV system
CN101505298A (en) * 2009-02-09 2009-08-12 中兴通讯股份有限公司 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
CN109982034A (en) * 2017-12-28 2019-07-05 杭州海康威视系统技术有限公司 Access request processing method and processing device in video monitoring system

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2023045191A1 (en) * 2021-09-22 2023-03-30 上海商汤智能科技有限公司 Video stream obtaining method and apparatus, server, storage medium, and program product

Also Published As

Publication number Publication date
WO2023045191A1 (en) 2023-03-30

Similar Documents

Publication Publication Date Title
JP7463544B2 (en) Blockchain message processing method, apparatus, computer device, and computer program
CN107431651B (en) Life cycle management method and equipment for network service
CN106031130B (en) Content distribution network framework with edge proxies
CN107508795B (en) Cross-container cluster access processing device and method
KR101544359B1 (en) System and method for describing applications for manageability and efficient scale-up deployment
CN105786451A (en) Method, device and system for processing complicated event
JP7237195B2 (en) COMMUNICATION METHOD, APPARATUS, ENTITY AND COMPUTER PROGRAM
KR20110053906A (en) Method and system for optimization of multimedia service over ims network
CN115208812B (en) Service processing method and device, equipment and computer readable storage medium
CN111327668B (en) Network management method, device, equipment and storage medium
EP3057287A1 (en) Node allocation method, device and system
RU2008138577A (en) NETWORK SYSTEM
US20160183229A1 (en) Ip phone network system, server apparatus, ip exchange and resource capacity expansion method
CN109729115A (en) Realize method, apparatus, the proxy server, terminal device of distributed computing
CN113453025B (en) Data acquisition method and device
CN113873301A (en) Video stream acquisition method and device, server and storage medium
CN112653632A (en) Flow control realization method and device
CN106330504B (en) Method for realizing application and service controller
WO2022067830A1 (en) Application context migration method and device
US8843635B2 (en) Apparatus and method for providing a service through sharing solution providing unit in cloud computing environment
US20150373095A1 (en) Method and apparatus for determining service quality profile on data distribution service
JP2019041241A (en) Distribution system
CN112583949A (en) VPC (virtual private network) public network access method and VPC equipment
JP2010146246A (en) Framework computer program for multi-agent system, network system and inter-agent communication method
CN112099942B (en) Port multiplexing method, system, terminal, server, equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
REG Reference to a national code

Ref country code: HK

Ref legal event code: DE

Ref document number: 40064035

Country of ref document: HK

WW01 Invention patent application withdrawn after publication
WW01 Invention patent application withdrawn after publication

Application publication date: 20211231