CN111083430B - Image acquisition method and device, electronic equipment and storage medium - Google Patents

Image acquisition method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN111083430B
CN111083430B CN201811217567.9A CN201811217567A CN111083430B CN 111083430 B CN111083430 B CN 111083430B CN 201811217567 A CN201811217567 A CN 201811217567A CN 111083430 B CN111083430 B CN 111083430B
Authority
CN
China
Prior art keywords
code stream
acquired
code
terminal
stream
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.)
Active
Application number
CN201811217567.9A
Other languages
Chinese (zh)
Other versions
CN111083430A (en
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.)
Hangzhou Hikvision System Technology Co Ltd
Original Assignee
Hangzhou Hikvision System 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 Hangzhou Hikvision System Technology Co Ltd filed Critical Hangzhou Hikvision System Technology Co Ltd
Priority to CN201811217567.9A priority Critical patent/CN111083430B/en
Publication of CN111083430A publication Critical patent/CN111083430A/en
Application granted granted Critical
Publication of CN111083430B publication Critical patent/CN111083430B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N7/00Television systems
    • H04N7/18Closed-circuit television [CCTV] systems, i.e. systems in which the video signal is not broadcast
    • H04N7/181Closed-circuit television [CCTV] systems, i.e. systems in which the video signal is not broadcast for receiving images from a plurality of remote sources
    • 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/23Processing of content or additional data; Elementary server operations; Server middleware
    • H04N21/239Interfacing the upstream path of the transmission network, e.g. prioritizing client content requests
    • H04N21/2393Interfacing the upstream path of the transmission network, e.g. prioritizing client content requests involving handling client requests
    • 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
    • H04N21/26208Content 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 the scheduling operation being performed under constraints
    • H04N21/26216Content 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 the scheduling operation being performed under constraints involving the channel capacity, e.g. network bandwidth

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Databases & Information Systems (AREA)
  • Two-Way Televisions, Distribution Of Moving Picture Or The Like (AREA)

Abstract

The embodiment of the invention provides an image acquisition method, an image acquisition device, electronic equipment and a storage medium, wherein in the method, an image acquisition request sent by a terminal is received, wherein the image acquisition request comprises information of a code stream to be acquired; when the code stream to be acquired is a code stream which is not transmitted, acquiring the code rate of the code stream to be acquired according to the information of the code stream to be acquired; judging whether the sum of the code rate and the code rate of the code stream currently being transmitted exceeds the network bandwidth or not; and if not, acquiring the code stream to be acquired, and sending the code stream to be acquired to the terminal. According to the method and the device, the size relation between the sum of the code rate of the code stream to be acquired and the code rate of the code stream currently being transmitted and the network bandwidth is judged, and when the sum of the code rate of the code stream to be acquired and the code rate of the code stream currently being transmitted is determined not to exceed the network bandwidth, the code stream to be acquired is acquired and sent to the terminal, so that the image acquisition failure rate of acquiring the image from the code stream to be acquired is reduced.

Description

Image acquisition method and device, electronic equipment and storage medium
Technical Field
The present invention relates to the field of image acquisition technologies, and in particular, to an image acquisition method and apparatus, an electronic device, and a storage medium.
Background
Referring to fig. 1, the monitoring system includes a front-end network point and a monitoring center, the front-end network point includes a camera and a router, and the monitoring center includes a router, a server and a terminal.
The front-end network point is in communication connection with the monitoring center, so that the terminal can request the server to obtain the images acquired by the camera, the server sends the images acquired by the camera to the terminal, and a user views the images through the terminal.
The bitrate for each camera included in the front-end mesh point may be different, for example: the code rate of some cameras is 2M, and the code rate of some cameras is 6M. For unified management, in the related art, the code rate with the largest number of cameras included in a front-end mesh point is used as the code rate of an image transmission channel between each camera in the front-end mesh point and a server, and the number of cameras that can be used by a monitoring system at the same time is determined based on the code rate of the image transmission channel and the network bandwidth between the front-end mesh point and a monitoring center.
The server selects the cameras from the front-end network points, at the moment, the cameras are in an image data transmission state, the terminal can only request the server for the images collected by the cameras in the image data transmission state, and therefore when the terminal requests the server for obtaining the images collected by the cameras in the image data non-transmission state in the front-end network points, the server cannot obtain the images, and the terminal image obtaining fails.
For example: assuming that the front-end network point comprises 100 cameras, wherein the code rate of 60 cameras is 2M, and the code rates of the remaining 40 cameras are different from 1M to 6M, taking 2M as the code rate of the image transmission channel between each camera and the server. Assuming that the network bandwidth between the front-end network point and the monitoring center is 10M, since 2M is the code rate of the image transmission channel between each camera and the server, a total of 5 cameras are supported and used under the bandwidth. Assuming that the 5 cameras are respectively a camera a, a camera B, a camera C, a camera D and a camera E, and assuming that the front-end website further includes a camera F, the terminal requests the server to obtain an image acquired by the camera F, and the server notifies the terminal that the image acquisition fails.
Disclosure of Invention
An object of embodiments of the present invention is to provide an image acquisition method, an image acquisition device, an electronic device, and a storage medium, so as to reduce an image acquisition failure rate. The specific technical scheme is as follows:
an image acquisition method, the method comprising:
receiving an image acquisition request sent by a terminal, wherein the image acquisition request comprises information of a code stream to be acquired;
when the code stream to be acquired is a code stream which is not transmitted, acquiring the code rate of the code stream to be acquired according to the information of the code stream to be acquired;
judging whether the sum of the code rate and the code rate of the code stream currently being transmitted exceeds the network bandwidth or not;
and if not, acquiring the code stream to be acquired, and sending the code stream to be acquired to the terminal.
Optionally, the information of the code stream to be acquired includes: the mark of the camera corresponding to the code stream to be acquired and the mark of the code stream to be acquired; the step of obtaining the code rate of the code stream to be obtained according to the information of the code stream to be obtained comprises the following steps:
sending a request for acquiring the code rate of the code stream to be acquired to the camera corresponding to the code stream to be acquired based on the identifier of the camera corresponding to the code stream to be acquired and the identifier of the code stream to be acquired;
and receiving the code rate fed back by the camera corresponding to the code stream to be acquired.
Optionally, the information of the code stream to be acquired includes: the mark of the camera corresponding to the code stream to be acquired and the mark of the code stream to be acquired; the method further comprises the following steps:
when the sum of the code rate and the code rate of the currently transmitted code stream exceeds the network bandwidth, determining the camera corresponding to the code stream to be acquired according to the identification of the camera corresponding to the code stream to be acquired, and judging whether the camera corresponding to the code stream to be acquired is transmitting other code streams except the code stream to be acquired;
if so, selecting a first target code stream from other code streams except the code stream to be acquired, which are transmitted by the camera corresponding to the code stream to be acquired, according to a preset first selection rule, and sending the first target code stream to the terminal.
Optionally, the method further includes:
when the camera corresponding to the code stream to be acquired does not transmit other code streams except the code stream to be acquired, selecting a second target code stream from the code streams transmitted by other cameras except the camera corresponding to the code stream to be acquired according to a preset second selection rule;
disconnecting the transmission of the second target code stream;
and returning to execute the step of judging whether the sum of the code rate and the code rate of the code stream currently being transmitted exceeds the network bandwidth.
Optionally, the code stream being transmitted by the other cameras except the camera corresponding to the code stream to be acquired has a priority, the image acquisition request further includes the priority of the terminal, and after the step of receiving the image acquisition request sent by the terminal, the method further includes:
determining the priority of the terminal as the priority of the code stream to be acquired;
the step of selecting a second target code stream from the code streams transmitted by other cameras except the camera corresponding to the code stream to be acquired according to a preset second selection rule comprises the following steps:
determining a code stream with the lowest priority from the code streams transmitted by other cameras except the camera corresponding to the code stream to be acquired;
judging whether the priority of the code stream with the lowest priority is lower than the priority of the code stream to be acquired;
and if so, determining the code stream with the lowest priority as a second target code stream.
Optionally, before the step of determining the code stream with the lowest priority as the second target code stream, the method further includes:
judging whether the number of the code streams with the lowest priority is multiple or not;
if so, selecting the code stream with the least associated terminals from the code streams with the lowest priority as a second target code stream;
and if not, executing the step of determining the code stream with the lowest priority as a second target code stream.
Optionally, after the transmission of the second target code stream is disconnected, the method further includes:
determining a terminal associated with the second target code stream and a camera corresponding to the second target code stream;
judging whether the camera corresponding to the second target code stream is transmitting other code streams except the second target code stream; and if so, selecting a third target code stream from the other code streams except the second target code stream and sending the third target code stream to a terminal associated with the second target code stream.
Optionally, after the step of acquiring the code stream to be acquired and sending the code stream to be acquired to the terminal, the method further includes:
and recording the association relation between the terminal and the code stream to be acquired.
Optionally, after the step of recording the association relationship between the terminal and the code stream to be acquired, the method further includes:
receiving an image acquisition stopping request sent by the terminal, wherein the image acquisition stopping request comprises information of the code stream to be acquired;
deleting the association relation;
judging whether other terminals associated with the code stream to be acquired exist or not according to the identifier of the code stream to be acquired;
if the code stream to be acquired exists, determining the highest priority in the priorities of the other terminals, and determining the highest priority as the priority of the code stream to be acquired;
and if the current residual bandwidth does not exist, deleting all related information of the code stream to be acquired, and sending notification information of the residual bandwidth to a terminal related to the code stream currently being transmitted.
An image acquisition apparatus, the apparatus comprising:
the image acquisition request receiving module is used for receiving an image acquisition request sent by a terminal, wherein the image acquisition request comprises information of a code stream to be acquired;
a code rate obtaining module, configured to obtain a code rate of the code stream to be obtained according to information of the code stream to be obtained when the code stream to be obtained is a code stream that is not transmitted;
the bandwidth judging module is used for judging whether the sum of the code rate and the code rate of the code stream currently being transmitted exceeds the network bandwidth, and if not, the image obtaining module is triggered;
and the image acquisition module is used for acquiring the code stream to be acquired and sending the code stream to be acquired to the terminal.
Optionally, the information of the code stream to be acquired includes: the mark of the camera corresponding to the code stream to be acquired and the mark of the code stream to be acquired; the code rate obtaining module comprises:
the sending submodule is used for sending a request for acquiring the code rate to the camera to be accessed based on the identification of the camera to be accessed; the camera to be accessed is as follows: the camera corresponding to the code stream to be acquired;
and the receiving submodule is used for receiving the code rate fed back by the camera to be accessed.
Optionally, the information of the code stream to be acquired includes: the mark of the camera corresponding to the code stream to be acquired and the mark of the code stream to be acquired; the device further comprises:
the transmission judging module is used for determining the camera corresponding to the code stream to be acquired according to the identification of the camera corresponding to the code stream to be acquired when the sum of the code rate and the code rate of the currently transmitted code stream exceeds the network bandwidth, and judging whether the camera corresponding to the code stream to be acquired is transmitting other code streams except the code stream to be acquired; if yes, triggering a first selection module;
the first selection module is used for selecting a first target code stream from other code streams except the code stream to be acquired, which are transmitted by a camera corresponding to the code stream to be acquired, according to a preset first selection rule, and sending the first target code stream to the terminal.
Optionally, the transmission determining module is further configured to trigger a second selecting module when the camera corresponding to the code stream to be acquired does not transmit any other code stream except the code stream to be acquired;
the second selection module is used for selecting a second target code stream from the code streams transmitted by other cameras except the camera corresponding to the code stream to be acquired according to a preset second selection rule; disconnecting the transmission of the second target code stream; and triggering the bandwidth judging module.
Optionally, the code stream being transmitted by the other cameras except the camera corresponding to the code stream to be acquired has a priority, the image acquisition request further includes the priority of the terminal, and the apparatus further includes:
the priority determining module is used for determining the priority of the terminal as the priority of the code stream to be acquired after receiving the image acquisition request sent by the terminal;
the second selecting module comprises:
the first determining submodule is used for determining the code stream with the lowest priority from the code streams transmitted by other cameras except the camera corresponding to the code stream to be acquired;
the judging submodule is used for judging whether the priority of the code stream with the lowest priority is lower than the priority of the code stream to be acquired or not, and if so, the second determining submodule is triggered;
and the second determining submodule is used for determining the code stream with the lowest priority as a second target code stream.
Optionally, the apparatus further comprises:
the number judgment module is used for judging whether the number of the code streams with the lowest priority is multiple or not before the step of determining the code stream with the lowest priority as a second target code stream, if so, triggering the target code stream determination module, and if not, triggering the second determination submodule;
and the target code stream determining module is used for selecting the code stream with the least associated terminals from the code streams with the lowest priority as a second target code stream.
Optionally, the apparatus further comprises:
the third selection module is used for determining a terminal associated with the second target code stream and a camera corresponding to the second target code stream after the transmission of the second target code stream is cut off; judging whether the camera corresponding to the second target code stream is transmitting other code streams except the second target code stream; and if so, selecting a third target code stream from the other code streams except the second target code stream and sending the third target code stream to a terminal associated with the second target code stream.
Optionally, the apparatus further comprises:
and the recording module is used for recording the association relation between the terminal and the code stream to be acquired after acquiring the code stream to be acquired and sending the code stream to be acquired to the terminal.
Optionally, the apparatus further comprises:
the acquisition stopping image request receiving module is used for receiving an acquisition stopping image request sent by the terminal after recording the incidence relation between the terminal and the code stream to be acquired, wherein the acquisition stopping image request comprises the information of the code stream to be acquired;
a deleting module for deleting the association relation;
the terminal judging module is used for judging whether other terminals related to the code stream to be acquired exist or not according to the identifier of the code stream to be acquired, if so, the priority determining module of the code stream to be acquired is triggered, and if not, the notification information sending module is triggered;
the priority determining module of the code stream to be acquired is used for determining the highest priority among the priorities of the other terminals and determining the highest priority as the priority of the code stream to be acquired;
and the notification information sending module is used for deleting all relevant information of the code stream to be acquired and sending notification information with surplus bandwidth to a terminal related to the code stream currently being transmitted.
An electronic device comprises a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory are communicated with each other through the communication bus;
a memory for storing a computer program;
a processor for implementing any of the above-described method steps when executing the computer program stored in the memory.
A computer-readable storage medium, in which a computer program is stored which, when being executed by a processor, carries out the method steps of any of the above.
In the embodiment of the invention, an image acquisition request sent by a terminal is received, wherein the image acquisition request comprises information of a code stream to be acquired; judging whether the sum of the code rate and the code rate of the code stream currently being transmitted exceeds the network bandwidth or not; and if not, acquiring the code stream to be acquired, and sending the code stream to be acquired to the terminal. According to the method and the device, the size relation between the sum of the code rate of the code stream to be acquired and the code rate of the code stream currently being transmitted and the network bandwidth is judged, and when the sum of the code rate of the code stream to be acquired and the code rate of the code stream currently being transmitted is determined not to exceed the network bandwidth, the code stream to be acquired is acquired and sent to the terminal, so that the image acquisition failure rate of acquiring the image from the code stream to be acquired is reduced.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
FIG. 1 is a schematic diagram of a monitoring system;
fig. 2 is a schematic flowchart of a first image obtaining method according to an embodiment of the present invention;
fig. 3 is a schematic flow chart illustrating a process of acquiring a code rate of a camera to be accessed according to an identifier of the camera to be accessed according to an embodiment of the present invention;
FIG. 4 is a second flowchart of an image capturing method according to an embodiment of the present invention;
FIG. 5 is a schematic flow chart of a third image capturing method according to an embodiment of the present invention;
fig. 6 is a fourth flowchart illustrating an image obtaining method according to an embodiment of the present invention;
fig. 7 is a schematic flowchart of a fifth method for acquiring an image according to an embodiment of the present invention;
FIG. 8 is a schematic structural diagram of an image capturing apparatus according to an embodiment of the present invention;
fig. 9 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
First, an image obtaining method provided by an embodiment of the present invention is described below.
The image obtaining method provided by the embodiment of the present invention can be applied to various electronic devices, such as computers, servers, terminal devices, and the like, wherein in an implementation manner, the image obtaining method can be applied to a server in a monitoring system, and a specific structure of the monitoring system and a relationship between devices in the monitoring system can be referred to in fig. 1.
For ease of understanding, the following describes an image acquisition method provided by an embodiment of the present invention, with a server in the monitoring system shown in fig. 1 as an execution subject.
As shown in fig. 2, an image obtaining method provided in an embodiment of the present invention may include:
s101: and receiving an image acquisition request sent by a terminal, wherein the image acquisition request comprises information of a code stream to be acquired.
The code stream to be acquired comes from the cameras in the monitoring system shown in fig. 1, wherein each camera represents one video channel, and each video channel may correspond to one or more code streams of different types.
For example, a user sometimes wants to view a certain type of code stream of a certain camera, and may send a related instruction to the terminal, for example, by triggering a client to issue an instruction to the terminal.
After receiving the instruction, the terminal can send an image acquisition request to the server, wherein the image acquisition request comprises information of the code stream to be acquired, so that the server can receive the image acquisition request sent by the terminal and acquire the information of the code stream to be acquired, which is desired by a user.
Then, the server may determine whether the code stream to be acquired is a code stream that is not transmitted according to the information of the code stream to be acquired, and if the code stream is a code stream that is not transmitted, execute S102; and if the code stream is the code stream which is currently transmitted, directly distributing the code stream to the terminal.
The code stream that is not transmitted refers to a code stream that is not currently in a distribution state, that is, the code stream that is not transmitted is a code stream that is not acquired by the server and distributed to the terminal. The code stream currently being transmitted refers to a code stream currently in a distribution state, that is, the code stream currently being transmitted is a code stream which is currently acquired by the server and distributed to at least one terminal.
S102: and when the code stream to be acquired is the code stream which is not transmitted, acquiring the code rate of the code stream to be acquired according to the information of the code stream to be acquired.
For example, the obtained information of the code stream to be obtained may include an identifier of a camera corresponding to the code stream to be obtained and an identifier of the code stream to be obtained, so that the code rate of the code stream to be obtained may be determined by the identifier of the camera corresponding to the code stream to be obtained and the identifier of the code stream to be obtained.
For example, in a case where the server acquires and stores information of various types of code streams supported by the camera when managing the camera, the server may acquire the code rate of the code stream to be acquired according to the identifier of the camera corresponding to the code stream to be acquired and the identifier of the code stream to be acquired from a preset configuration file storing the code stream information of the camera or from a database.
For another example, referring to fig. 3, the server may obtain information of the code stream to be obtained from a camera corresponding to the code stream to be obtained, where the information includes:
s1021: and sending a request for acquiring the code rate of the code stream to be acquired to the camera corresponding to the code stream to be acquired based on the identifier of the camera corresponding to the code stream to be acquired and the identifier of the code stream to be acquired.
Since the monitoring system shown in fig. 1 may include a plurality of cameras, and each camera may include a plurality of code streams, in order to acquire a code rate of a code stream to be acquired, it is necessary to find a network address of the camera corresponding to the code stream to be acquired based on an identifier of the camera corresponding to the code stream to be acquired, and send an identifier of the code stream to be acquired and a request for acquiring the code rate of the code stream to the camera corresponding to the code stream to be acquired based on a network address of a camera to be accessed (the camera corresponding to the code stream to be acquired), where a correspondence between the identifier of the camera and the network address of the camera is stored in the server.
S1022: and receiving the code rate fed back by the camera corresponding to the code stream to be acquired.
After the camera corresponding to the code stream to be acquired receives the request for acquiring the code rate of the code stream to be acquired, the code rate of the code stream to be acquired is acquired according to the identifier of the code stream to be acquired, the code rate is sent to the server, and the server receives the code rate fed back by the camera corresponding to the code stream to be acquired.
Therefore, the code rate fed back by the camera corresponding to the code stream to be acquired is acquired by sending the request for acquiring the code rate.
S103: and judging whether the sum of the code rate and the code rate of the code stream currently being transmitted exceeds the network bandwidth, if not, executing the step S104.
After the code rate of the code stream to be acquired is acquired, whether the sum of the acquired code rate and the code rate of the code stream currently being transmitted exceeds the network bandwidth or not can be judged, and the subsequent steps are executed according to the judgment result. The code stream currently being transmitted refers to a code stream currently being in a distribution state, that is, the code stream currently being transmitted is a code stream already acquired by the terminal.
The network bandwidth refers to the amount of data that can be transmitted by the current network in a unit time (generally, 1 second). The network bandwidth may be determined based on a standard bandwidth, for example, in a case that the standard bandwidth is 10M, the network bandwidth may be determined to be 8M in consideration of an actual bandwidth usage.
S104: and acquiring a code stream to be acquired, and sending the code stream to be acquired to the terminal.
If the sum of the code rate and the code rate of the code stream currently being transmitted does not exceed the network bandwidth, it is determined that sufficient bandwidth exists, the code stream to be acquired can be acquired, and in this case, the code stream to be acquired can be acquired and transmitted to the terminal, so that the terminal can acquire the image corresponding to the image acquisition request from the code stream to be acquired. The terminal may be a device that operates a client supporting direct or indirect interaction with a user, for example: a mobile terminal, a tablet computer, a computer, etc., and is not particularly limited.
If the sum of the code rate and the code rate of the code stream currently being transmitted exceeds the network bandwidth, it is indicated that sufficient bandwidth does not exist, and the code stream to be acquired cannot be acquired.
In the embodiment of the invention, an image acquisition request sent by a terminal is received, wherein the image acquisition request comprises information of a code stream to be acquired; judging whether the sum of the code rate and the code rate of the code stream currently being transmitted exceeds the network bandwidth or not; and if not, acquiring the code stream to be acquired, and sending the code stream to be acquired to the terminal. In the invention, by judging the size relationship between the sum of the code rate of the code stream to be acquired and the code rate of the code stream currently being transmitted and the network bandwidth, when the sum of the code rate of the code stream to be acquired and the code rate of the code stream currently being transmitted is determined not to exceed the network bandwidth, the code stream to be acquired is acquired and is transmitted to the terminal, thereby reducing the failure rate of acquiring the image of the image acquired from the code stream to be acquired
On the basis of the method shown in fig. 2, referring to fig. 4, the method may further include: when the determination in step S103 is yes, it indicates that there is not enough bandwidth and the code stream to be acquired cannot be acquired, in this case, in order to enable the terminal to acquire an image from the code stream to be acquired, the following steps may be performed:
s105: determining a camera corresponding to the code stream to be acquired according to the identification of the camera corresponding to the code stream to be acquired, and judging whether the camera corresponding to the code stream to be acquired is transmitting other code streams except the code stream to be acquired; if yes, executing S106; if not, S107 is executed.
S106: according to a preset first selection rule, a first target code stream is selected from other code streams except the code stream to be acquired, which are transmitted by a camera corresponding to the code stream to be acquired, and the first target code stream is sent to a terminal.
For example, the first selection rule may refer to selecting, as the first target code stream, the code stream with the smallest code rate from other code streams, except the code stream to be acquired, which are transmitted by the camera corresponding to the code stream to be acquired; the method can also refer to selecting the code stream with the maximum code rate from other code streams which are transmitted by the camera corresponding to the code stream to be acquired and are except the code stream to be acquired as a first target code stream; the method can also be characterized in that a code stream closest to the code rate of the code stream to be acquired is selected from other code streams except the code stream to be acquired, which are transmitted by a camera corresponding to the code stream to be acquired, and is used as a first target code stream; the method may further refer to selecting, as the first target code stream, a code stream that is closest to a coding parameter (resolution and/or frame rate) of the code stream to be acquired from other code streams, except the code stream to be acquired, being transmitted by the camera corresponding to the code stream to be acquired, and the like, which is not limited specifically.
That is to say, a first target code stream is selected from other types of code streams collected by the same camera, and the first target code stream is sent to the terminal. Therefore, the terminal can acquire the images acquired by the same camera from the first target code stream, and the failure rate of image acquisition is reduced.
S107: according to a preset second selection rule, selecting a second target code stream from the code streams transmitted by other cameras except the camera corresponding to the code stream to be acquired; and disconnecting the transmission of the second target code stream, and returning to execute the step S103.
For example, the second selection rule may be that a code stream with the smallest code rate is selected from code streams transmitted by other cameras except the camera corresponding to the code stream to be acquired, and the selected code stream is used as a second target code stream; the code stream with the maximum code rate is selected from the code streams transmitted by other cameras except the camera corresponding to the code stream to be acquired as a second target code stream; the method can also be characterized in that a code stream closest to the code rate of the code stream to be acquired is selected from the code streams transmitted by other cameras except the camera corresponding to the code stream to be acquired as a second target code stream; or, the priority of the code stream being transmitted by other cameras except the camera corresponding to the code stream to be acquired can be acquired, and the code stream with the lowest priority is taken as a second target code stream; and is not particularly limited.
And after the second target code stream is selected, the transmission of the second target code stream can be cut off, and the bandwidth is given to the code stream to be acquired. If the sum of the code rate of the code stream to be acquired and the code rate of the code stream currently being transmitted still exceeds the network bandwidth after the second target code stream is disconnected, the code stream to be acquired still cannot be acquired. Therefore, after the second target code stream is disconnected, whether the sum of the code rate of the code stream to be acquired and the code rate of the code stream currently being transmitted exceeds the network bandwidth needs to be judged again, if the sum exceeds the network bandwidth, a new second target code stream is selected from the code streams being transmitted by other cameras except the camera corresponding to the code stream to be acquired, and the bandwidth is output again until the bandwidth does not exceed the network bandwidth any more.
After the transmission of the second target code stream is disconnected, in order to enable the terminal associated with the second target code stream to know the situation, a disconnection notice can be sent to the terminal associated with the second target code stream.
In one implementation, after the transmission of the second target code stream is disconnected, a terminal associated with the second target code stream and a camera corresponding to the second target code stream may be determined, and then, whether the camera corresponding to the second target code stream is transmitting other code streams except the second target code stream is determined; if so, selecting a third target code stream from other code streams except the second target code stream, and sending the third target code stream to a terminal associated with the second target code stream.
In this way, after the transmission of the second target code stream is disconnected, the terminal associated with the second target code stream can still obtain the code stream from the same camera as the code stream obtained before, so that the influence on other terminals in the monitoring system shown in fig. 1 when the code stream to be obtained is obtained can be reduced.
Under the above conditions, the camera corresponding to the code stream to be acquired does not transmit other code streams except the code stream to be acquired, that is, the terminal cannot acquire other code streams of the camera corresponding to the code stream to be acquired, so that bandwidth can be given to the code stream to be acquired by disconnecting the second target code stream, so that the server can acquire the code stream to be acquired and send the code stream to be acquired to the terminal, thereby reducing the failure rate of image acquisition.
In one case, the code stream currently being transmitted in the monitoring system has a priority, and the terminal in the monitoring system also has a priority, and the priority of the terminal may be determined based on the priority of the user using the terminal, that is, the priority of the user using the terminal is high, and then the priority of the terminal is high; the priority of the codestream currently being transmitted may be determined based on the priority of the terminal associated therewith.
Since one terminal can obtain a plurality of code streams currently being transmitted through the server and further obtain corresponding images, one terminal can have an associated relationship with the plurality of code streams currently being transmitted, and similarly, one code stream currently being transmitted can also have an associated relationship with the plurality of terminals.
When a code stream currently being transmitted has an associated relationship with a plurality of terminals, the highest priority among the priorities of the associated terminals may be determined, and the highest priority may be used as the priority of the code stream currently being transmitted.
If the code stream corresponding to the image acquisition request is the code stream which is currently transmitted when the terminal sends the image acquisition request, recording the association relation between the terminal and the code stream corresponding to the image acquisition request, determining the highest priority in the priorities of the terminal associated with the code stream corresponding to the image acquisition request, and taking the highest priority as the priority of the code stream corresponding to the image acquisition request.
The image acquiring request may further include a priority of the terminal, and on the basis of the method shown in fig. 4, after step 101, referring to fig. 5, the image acquiring method provided in the embodiment of the present invention may further include:
S101A: and determining the priority of the terminal as the priority of the code stream to be acquired.
The code stream to be acquired is a code stream which is not transmitted, so that the code stream does not have priority. At this time, only the terminal acquires the code stream to be acquired through the server, so that the priority of the terminal can be determined as the priority of the code stream to be acquired.
Step S107 in fig. 5 may include:
s1071: and determining the code stream with the lowest priority from the code streams transmitted by other cameras except the camera corresponding to the code stream to be acquired.
The purpose of determining the second target code stream is to give bandwidth to the code stream to be acquired by disconnecting the transmission of the second target code stream. And because the lower the priority of the code stream being transmitted by other cameras except the camera corresponding to the code stream to be acquired is, the less important the user using the terminal associated with the camera is, the code stream with the lower priority needs to be disconnected.
Therefore, when the second target code stream is determined, the code stream with the lowest priority can be determined from the code streams transmitted by other cameras except the camera corresponding to the code stream to be acquired.
S1072: and judging whether the priority of the code stream with the lowest priority is lower than the priority of the code stream to be acquired, if so, executing the step S1073, and if not, not performing any treatment.
Because the transmission of the code stream with lower priority is required to be disconnected, if the priority of the code stream with lower priority is higher than the priority of the code stream to be acquired, the user of the terminal associated with the code stream to be acquired is unimportant, and at the moment, bandwidth does not need to be given to the code stream to be acquired.
Therefore, after the code stream with the lowest priority is determined, it is necessary to determine whether the priority of the code stream with the lowest priority is lower than the priority of the code stream to be acquired, and execute subsequent steps according to the determination result.
S1073: and determining the code stream with the lowest priority as a second target code stream, and disconnecting the transmission of the second target code stream.
When the priority of the code stream with the lowest priority is lower than the priority of the code stream to be acquired, it is indicated that a user of a terminal associated with the code stream to be acquired is more important than a user of a terminal associated with the code stream with the lowest priority, at this time, the code stream with the lowest priority is determined as a second target code stream, and the code stream with the lowest priority gives bandwidth to the code stream to be acquired.
Therefore, when the sum of the code rate of the code stream to be acquired and the code rate of the code stream currently being transmitted exceeds the network bandwidth and the camera corresponding to the code stream to be acquired does not transmit other code streams except the code stream to be acquired, the code stream with the lowest priority is made to give the bandwidth to the code stream to be acquired by comparing the priorities of the code streams being transmitted by other cameras except the camera corresponding to the code stream to be acquired.
On the basis of the method shown in fig. 5, before step 1073, it may be determined whether the number of the code streams with the lowest priority is multiple, and when it is determined that the number of the code streams with the lowest priority is multiple, it is not necessary to disconnect the transmission of all the code streams with the lowest priority.
Referring to fig. 6, the image acquiring method provided in the embodiment of the present invention may further include:
S1073A: and judging whether the number of the code streams with the lowest priority is multiple, if so, executing step S1073B, and if not, executing step S1073C.
Because there may be a plurality of code streams with the lowest priority in the code streams transmitted by other cameras except the camera corresponding to the code stream to be acquired, before determining the second target code stream, it is necessary to determine whether the number of the code streams with the lowest priority is multiple, and execute the subsequent steps according to the determination result.
S1073B: and selecting the code stream with the least associated terminals from the code streams with the lowest priority as a second target code stream.
After the second target code stream is determined, the transmission of the second target code stream needs to be cut off, that is, the terminal associated with the second target code stream cannot obtain the second target code stream, that is, the terminal cannot obtain an image from the second target code stream, so that in order to make the fewest terminals unable to obtain the second target code stream, when the number of the code streams with the lowest priority is determined to be multiple, the code stream with the fewest associated terminals is selected as the second target code stream from the code streams with the lowest priority.
S1073C: and determining the code stream with the lowest priority as a second target code stream.
When the number of the code streams with the lowest priority is judged not to be multiple, the code stream with the lowest priority can be directly determined as a second target code stream.
S1073D: and disconnecting the transmission of the second target code stream.
Therefore, when the number of the code streams with the lowest priority is judged to be multiple, the code stream with the least related terminals is selected from the code streams with the lowest priority as the second target code stream, and the influence on other terminals is reduced to the greatest extent.
On the basis of the method shown in fig. 6, after step S104, referring to fig. 7, the image acquiring method provided in the embodiment of the present invention may further include:
S104A: and recording the association relation between the terminal and the code stream to be acquired.
After the code stream to be acquired is acquired and sent to the terminal, the terminal can receive the code stream to be acquired and acquire an image from the code stream to be acquired, and at the moment, the association relation between the terminal and the code stream to be acquired is recorded. Therefore, when other terminals are associated with the code stream to be acquired subsequently, the priority of the code stream to be acquired can be determined based on the priority of the terminal associated with the code stream to be acquired.
Determining the priority of the code stream to be acquired based on the priority of the terminal associated with the code stream to be acquired may be:
and determining the highest priority in the priorities of the terminals associated with the code streams to be acquired.
And determining the highest priority as the priority of the code stream to be acquired.
Therefore, the incidence relation between the terminal and the code stream to be acquired is recorded so as to determine the priority of the code stream to be acquired.
On the basis of the method shown in fig. 7, after step S104A, the image acquisition method provided in the embodiment of the present invention may further include:
receiving an image acquisition stopping request sent by a terminal, wherein the image acquisition stopping request comprises information of a code stream to be acquired;
deleting the association relation;
judging whether other terminals associated with the code stream to be acquired exist or not according to the identifier of the code stream to be acquired;
if so, determining the highest priority in the priorities of other terminals, and determining the highest priority as the priority of the code stream to be acquired;
if not, deleting all relevant information of the code stream to be acquired, and sending notification information of the surplus bandwidth to a terminal associated with the code stream currently being transmitted.
When the user does not want to continuously check the image corresponding to the code stream to be acquired, an access stop request is sent to the terminal, wherein the access stop request comprises information of the code stream to be acquired.
The terminal receives the access stop request and sends an image acquisition stop request to the server, the image acquisition stop request comprises information of the code stream to be acquired, and the server receives the image acquisition stop request sent by the terminal and learns that a user wants to stop acquiring the code stream to be acquired.
And the server can delete the recorded association relation after knowing that the user wants to stop acquiring the code stream to be acquired.
In the process that the terminal requests to acquire the code stream to be acquired, other terminals may also request to acquire the code stream to be acquired, and at this time, the code stream to be acquired has not only an associated relationship with the terminal but also an associated relationship with other terminals.
Therefore, after the association relationship is deleted, it is necessary to determine whether there are other terminals associated with the code stream to be acquired according to the information of the code stream to be acquired, and execute the subsequent process according to the determination result.
Since the priority of the terminal may be the highest priority among the priorities of the terminals associated with the code stream to be acquired, the priority of the code stream to be acquired may change after the association relationship is deleted.
Therefore, when it is determined that there are other terminals associated with the code stream to be acquired, the highest priority among the priorities of the other terminals needs to be determined, and the highest priority is determined as the priority of the code stream to be acquired.
When it is determined that there is no other terminal associated with the code stream to be acquired, it indicates that there is no user that needs to acquire the code stream, and at this time, a bandwidth occupied by the code stream to be acquired may be provided, so that all relevant information of the code stream to be acquired may be deleted, where all relevant information may include all information recorded by the server and associated with the code stream to be acquired, for example: the code stream to be acquired comprises the identification of the camera corresponding to the code stream to be acquired, the identification of the code stream to be acquired, a network address, a network interface and the like.
In order to enable the terminal associated with the currently transmitting code stream to know the information of the surplus bandwidth, notification information of the surplus bandwidth may be sent to the terminal associated with the currently transmitting code stream.
After receiving the notification information, the terminal associated with the currently transmitted code stream may output a prompt message to prompt the user that the spare bandwidth exists at this time, and the user that has been disconnected from acquiring the code stream may request to acquire the code stream to be acquired or the second target code stream again.
Therefore, when a request for stopping acquiring the image sent by the terminal is received, all related information of the code stream to be acquired is deleted, and the terminal is made to know the information of the surplus bandwidth by sending the notification information of the surplus bandwidth to the terminal related to the currently transmitted code stream, so that a user can quickly recover to acquire the image from the code stream to be acquired or the second target code stream based on the self-demand.
And aiming at the condition that the code stream corresponding to the image acquisition request is the currently transmitted code stream, directly sending the code stream corresponding to the image acquisition request to the terminal, and recording the associated association relationship between the terminal and the code stream corresponding to the image acquisition request.
Since the code stream association between the terminal and the image acquisition request is newly added, the priority of the code stream corresponding to the image acquisition request may change, and at this time, the highest priority in the priorities of the terminals associated with the code stream corresponding to the image acquisition request needs to be determined, and the highest priority is determined as the priority of the code stream corresponding to the image acquisition request.
Therefore, under the condition that the code stream corresponding to the image acquisition request is the currently transmitted code stream, the code stream corresponding to the image acquisition request is directly sent to the terminal, and the priority of the code stream corresponding to the image acquisition request is determined again.
With respect to the above method embodiment, referring to fig. 8, an embodiment of the present invention further provides an image capturing apparatus, where the apparatus may include:
an image acquisition request receiving module 801, configured to receive an image acquisition request sent by a terminal, where the image acquisition request includes information of a code stream to be acquired;
a code rate obtaining module 802, configured to obtain a code rate of the code stream to be obtained according to information of the code stream to be obtained when the code stream to be obtained is a code stream that is not transmitted;
a bandwidth determining module 803, configured to determine whether a sum of the code rate and a code rate of a currently transmitted code stream exceeds a network bandwidth, and if not, trigger the image obtaining module;
the image obtaining module 804 is configured to obtain the code stream to be obtained, and send the code stream to be obtained to the terminal.
In the embodiment of the invention, an image acquisition request sent by a terminal is received, wherein the image acquisition request comprises information of a code stream to be acquired; judging whether the sum of the code rate and the code rate of the code stream currently being transmitted exceeds the network bandwidth or not; and if not, acquiring the code stream to be acquired, and sending the code stream to be acquired to the terminal. According to the method and the device, the size relation between the sum of the code rate of the code stream to be acquired and the code rate of the code stream currently being transmitted and the network bandwidth is judged, and when the sum of the code rate of the code stream to be acquired and the code rate of the code stream currently being transmitted is determined not to exceed the network bandwidth, the code stream to be acquired is acquired and sent to the terminal, so that the image acquisition failure rate of acquiring the image from the code stream to be acquired is reduced.
In an implementation manner of the present invention, the information of the code stream to be acquired includes: the mark of the camera corresponding to the code stream to be acquired and the mark of the code stream to be acquired; the code rate obtaining module 802 may include:
the sending submodule is used for sending a request for obtaining the code rate to the camera to be accessed based on the identification of the camera to be accessed when the code stream to be obtained is a code stream which is not transmitted; the camera to be accessed is as follows: the camera corresponding to the code stream to be acquired;
and the receiving submodule is used for receiving the code rate fed back by the camera to be accessed.
In an implementation manner of the present invention, the information of the code stream to be acquired includes: the mark of the camera corresponding to the code stream to be acquired and the mark of the code stream to be acquired; the apparatus may further include:
the transmission judging module is used for determining the camera corresponding to the code stream to be acquired according to the identification of the camera corresponding to the code stream to be acquired when the sum of the code rate and the code rate of the currently transmitted code stream exceeds the network bandwidth, and judging whether the camera corresponding to the code stream to be acquired is transmitting other code streams except the code stream to be acquired; if yes, triggering a first selection module;
the first selection module is used for selecting a first target code stream from other code streams except the code stream to be acquired, which are transmitted by a camera corresponding to the code stream to be acquired, according to a preset first selection rule, and sending the first target code stream to the terminal.
In an implementation manner of the present invention, the transmission determining module is further configured to trigger a second selecting module when the camera corresponding to the code stream to be acquired does not transmit any other code stream except the code stream to be acquired;
the second selection module is used for selecting a second target code stream from the code streams transmitted by other cameras except the camera corresponding to the code stream to be acquired according to a preset second selection rule; disconnecting the transmission of the second target code stream; and triggering the bandwidth judging module.
In an implementation manner of the present invention, the code streams being transmitted by other cameras except the camera corresponding to the code stream to be acquired have priorities, the image acquisition request further includes the priority of the terminal, and the apparatus further includes:
the priority determining module is used for determining the priority of the terminal as the priority of the code stream to be acquired after receiving the image acquisition request sent by the terminal;
the second selecting module comprises:
the first determining submodule is used for determining the code stream with the lowest priority from the code streams transmitted by other cameras except the camera corresponding to the code stream to be acquired;
the judging submodule is used for judging whether the priority of the code stream with the lowest priority is lower than the priority of the code stream to be acquired or not, and if so, the second determining submodule is triggered;
and the second determining submodule is used for determining the code stream with the lowest priority as a second target code stream.
In one implementation manner of the present invention, the apparatus may further include:
the number judgment module is used for judging whether the number of the code streams with the lowest priority is multiple or not before the step of determining the code stream with the lowest priority as a second target code stream, if so, triggering the target code stream determination module, and if not, triggering the second determination submodule;
and the target code stream determining module is used for selecting the code stream with the least associated terminals from the code streams with the lowest priority as a second target code stream.
In one implementation manner of the present invention, the apparatus may further include:
the third selection module is used for determining a terminal associated with the second target code stream and a camera corresponding to the second target code stream after the transmission of the second target code stream is cut off; judging whether the camera corresponding to the second target code stream is transmitting other code streams except the second target code stream; and if so, selecting a third target code stream from the other code streams except the second target code stream and sending the third target code stream to a terminal associated with the second target code stream.
In one implementation manner of the present invention, the apparatus may further include:
and the recording module is used for recording the association relation between the terminal and the code stream to be acquired after acquiring the code stream to be acquired and sending the code stream to be acquired to the terminal.
In one implementation manner of the present invention, the apparatus may further include:
the acquisition stopping image request receiving module is used for receiving an acquisition stopping image request sent by the terminal after recording the incidence relation between the terminal and the code stream to be acquired, wherein the acquisition stopping image request comprises the information of the code stream to be acquired;
a deleting module for deleting the association relation;
the terminal judging module is used for judging whether other terminals related to the code stream to be acquired exist or not according to the identifier of the code stream to be acquired, if so, the priority determining module of the code stream to be acquired is triggered, and if not, the notification information sending module is triggered;
the priority determining module of the code stream to be acquired is used for determining the highest priority among the priorities of the other terminals and determining the highest priority as the priority of the code stream to be acquired;
and the notification information sending module is used for deleting all relevant information of the code stream to be acquired and sending notification information with surplus bandwidth to a terminal related to the code stream currently being transmitted.
An embodiment of the present invention further provides an electronic device, as shown in fig. 9, including a processor 901 and a memory 902,
a memory 902 for storing a computer program;
a processor 901, configured to execute the computer program stored in the memory 902, to implement an image obtaining method applied to a server in a monitoring system, where the method may include the following steps:
receiving an image acquisition request sent by a terminal, wherein the image acquisition request comprises information of a code stream to be acquired;
when the code stream to be acquired is a code stream which is not transmitted, acquiring the code rate of the code stream to be acquired according to the information of the code stream to be acquired;
judging whether the sum of the code rate and the code rate of the code stream currently being transmitted exceeds the network bandwidth or not;
and if not, acquiring the code stream to be acquired, and sending the code stream to be acquired to the terminal.
In the embodiment of the invention, electronic equipment receives an image acquisition request sent by a terminal, wherein the image acquisition request comprises information of a code stream to be acquired; judging whether the sum of the code rate and the code rate of the code stream currently being transmitted exceeds the network bandwidth or not; and if not, acquiring the code stream to be acquired, and sending the code stream to be acquired to the terminal. According to the method and the device, the size relation between the sum of the code rate of the code stream to be acquired and the code rate of the code stream currently being transmitted and the network bandwidth is judged, and when the sum of the code rate of the code stream to be acquired and the code rate of the code stream currently being transmitted is determined not to exceed the network bandwidth, the code stream to be acquired is acquired and sent to the terminal, so that the image acquisition failure rate of acquiring the image from the code stream to be acquired is reduced.
In an implementation manner of the present invention, the information of the code stream to be acquired includes: the mark of the camera corresponding to the code stream to be acquired and the mark of the code stream to be acquired; the step of obtaining the code rate of the code stream to be obtained according to the information of the code stream to be obtained comprises the following steps:
sending a request for acquiring the code rate of the code stream to be acquired to the camera corresponding to the code stream to be acquired based on the identifier of the camera corresponding to the code stream to be acquired and the identifier of the code stream to be acquired;
and receiving the code rate fed back by the camera corresponding to the code stream to be acquired.
In an implementation manner of the present invention, the information of the code stream to be acquired includes: the mark of the camera corresponding to the code stream to be acquired and the mark of the code stream to be acquired; the method further comprises the following steps:
when the sum of the code rate and the code rate of the currently transmitted code stream exceeds the network bandwidth, determining the camera corresponding to the code stream to be acquired according to the identification of the camera corresponding to the code stream to be acquired, and judging whether the camera corresponding to the code stream to be acquired is transmitting other code streams except the code stream to be acquired;
if so, selecting a first target code stream from other code streams except the code stream to be acquired, which are transmitted by the camera corresponding to the code stream to be acquired, according to a preset first selection rule, and sending the first target code stream to the terminal.
In one implementation manner of the present invention, the method may further include:
when the camera corresponding to the code stream to be acquired does not transmit other code streams except the code stream to be acquired, selecting a second target code stream from the code streams transmitted by other cameras except the camera corresponding to the code stream to be acquired according to a preset second selection rule;
disconnecting the transmission of the second target code stream;
and returning to execute the step of judging whether the sum of the code rate and the code rate of the code stream currently being transmitted exceeds the network bandwidth.
In an implementation manner of the present invention, the code streams being transmitted by other cameras except for the camera corresponding to the code stream to be acquired have a priority, the image acquisition request further includes a priority of the terminal, and after the step of receiving the image acquisition request sent by the terminal, the method further includes:
determining the priority of the terminal as the priority of the code stream to be acquired;
the step of selecting a second target code stream from the code streams transmitted by other cameras except the camera corresponding to the code stream to be acquired according to a preset second selection rule comprises the following steps:
determining a code stream with the lowest priority from the code streams transmitted by other cameras except the camera corresponding to the code stream to be acquired;
judging whether the priority of the code stream with the lowest priority is lower than the priority of the code stream to be acquired;
and if so, determining the code stream with the lowest priority as a second target code stream.
In an implementation manner of the present invention, before the step of determining the code stream with the lowest priority as the second target code stream, the method further includes:
judging whether the number of the code streams with the lowest priority is multiple or not;
if so, selecting the code stream with the least associated terminals from the code streams with the lowest priority as a second target code stream;
and if not, executing the step of determining the code stream with the lowest priority as a second target code stream.
In an implementation manner of the present invention, after the disconnecting the transmission of the second target code stream, the method further includes:
determining a terminal associated with the second target code stream and a camera corresponding to the second target code stream;
judging whether the camera corresponding to the second target code stream is transmitting other code streams except the second target code stream; and if so, selecting a third target code stream from the other code streams except the second target code stream and sending the third target code stream to a terminal associated with the second target code stream.
In an implementation manner of the present invention, after the step of acquiring the code stream to be acquired and sending the code stream to be acquired to the terminal, the method further includes:
and recording the association relation between the terminal and the code stream to be acquired.
In an implementation manner of the present invention, after the step of recording the association relationship between the terminal and the code stream to be acquired, the method further includes:
receiving an image acquisition stopping request sent by the terminal, wherein the image acquisition stopping request comprises information of the code stream to be acquired;
deleting the association relation;
judging whether other terminals associated with the code stream to be acquired exist or not according to the identifier of the code stream to be acquired;
if the code stream to be acquired exists, determining the highest priority in the priorities of the other terminals, and determining the highest priority as the priority of the code stream to be acquired;
and if the current residual bandwidth does not exist, deleting all related information of the code stream to be acquired, and sending notification information of the residual bandwidth to a terminal related to the code stream currently being transmitted.
The Memory mentioned in the above electronic device may include a Random Access Memory (RAM) or a Non-Volatile Memory (NVM), such as at least one disk Memory. Optionally, the memory may also be at least one memory device located remotely from the processor.
The Processor may be a general-purpose Processor, including a Central Processing Unit (CPU), a Network Processor (NP), and the like; but also Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field Programmable Gate Arrays (FPGAs) or other Programmable logic devices, discrete Gate or transistor logic devices, discrete hardware components.
An embodiment of the present invention further provides a computer-readable storage medium, in which a computer program is stored, and when the computer program is executed by a processor, the computer program implements an image obtaining method applied to a server in a monitoring system, where the method may include the following steps:
receiving an image acquisition request sent by a terminal, wherein the image acquisition request comprises information of a code stream to be acquired;
when the code stream to be acquired is a code stream which is not transmitted, acquiring the code rate of the code stream to be acquired according to the information of the code stream to be acquired;
judging whether the sum of the code rate and the code rate of the code stream currently being transmitted exceeds the network bandwidth or not;
and if not, acquiring the code stream to be acquired, and sending the code stream to be acquired to the terminal.
In the embodiment of the invention, when a computer program is executed by a processor, an image acquisition request sent by a terminal is received, wherein the image acquisition request comprises information of a code stream to be acquired; judging whether the sum of the code rate and the code rate of the code stream currently being transmitted exceeds the network bandwidth or not; and if not, acquiring the code stream to be acquired, and sending the code stream to be acquired to the terminal. According to the method and the device, the size relation between the sum of the code rate of the code stream to be acquired and the code rate of the code stream currently being transmitted and the network bandwidth is judged, and when the sum of the code rate of the code stream to be acquired and the code rate of the code stream currently being transmitted is determined not to exceed the network bandwidth, the code stream to be acquired is acquired and sent to the terminal, so that the image acquisition failure rate of acquiring the image from the code stream to be acquired is reduced.
In an implementation manner of the present invention, the information of the code stream to be acquired includes: the mark of the camera corresponding to the code stream to be acquired and the mark of the code stream to be acquired; the step of obtaining the code rate of the code stream to be obtained according to the information of the code stream to be obtained comprises the following steps:
sending a request for acquiring the code rate of the code stream to be acquired to the camera corresponding to the code stream to be acquired based on the identifier of the camera corresponding to the code stream to be acquired and the identifier of the code stream to be acquired;
and receiving the code rate fed back by the camera corresponding to the code stream to be acquired.
In an implementation manner of the present invention, the information of the code stream to be acquired includes: the mark of the camera corresponding to the code stream to be acquired and the mark of the code stream to be acquired; the method further comprises the following steps:
when the sum of the code rate and the code rate of the currently transmitted code stream exceeds the network bandwidth, determining the camera corresponding to the code stream to be acquired according to the identification of the camera corresponding to the code stream to be acquired, and judging whether the camera corresponding to the code stream to be acquired is transmitting other code streams except the code stream to be acquired;
if so, selecting a first target code stream from other code streams except the code stream to be acquired, which are transmitted by the camera corresponding to the code stream to be acquired, according to a preset first selection rule, and sending the first target code stream to the terminal.
In one implementation manner of the present invention, the method may further include:
when the camera corresponding to the code stream to be acquired does not transmit other code streams except the code stream to be acquired, selecting a second target code stream from the code streams transmitted by other cameras except the camera corresponding to the code stream to be acquired according to a preset second selection rule;
disconnecting the transmission of the second target code stream;
and returning to execute the step of judging whether the sum of the code rate and the code rate of the code stream currently being transmitted exceeds the network bandwidth.
In an implementation manner of the present invention, the code streams being transmitted by other cameras except for the camera corresponding to the code stream to be acquired have a priority, the image acquisition request further includes a priority of the terminal, and after the step of receiving the image acquisition request sent by the terminal, the method further includes:
determining the priority of the terminal as the priority of the code stream to be acquired;
the step of selecting a second target code stream from the code streams transmitted by other cameras except the camera corresponding to the code stream to be acquired according to a preset second selection rule comprises the following steps:
determining a code stream with the lowest priority from the code streams transmitted by other cameras except the camera corresponding to the code stream to be acquired;
judging whether the priority of the code stream with the lowest priority is lower than the priority of the code stream to be acquired;
and if so, determining the code stream with the lowest priority as a second target code stream.
In an implementation manner of the present invention, before the step of determining the code stream with the lowest priority as the second target code stream, the method further includes:
judging whether the number of the code streams with the lowest priority is multiple or not;
if so, selecting the code stream with the least associated terminals from the code streams with the lowest priority as a second target code stream;
and if not, executing the step of determining the code stream with the lowest priority as a second target code stream.
In an implementation manner of the present invention, after the disconnecting the transmission of the second target code stream, the method further includes:
determining a terminal associated with the second target code stream and a camera corresponding to the second target code stream;
judging whether the camera corresponding to the second target code stream is transmitting other code streams except the second target code stream; and if so, selecting a third target code stream from the other code streams except the second target code stream and sending the third target code stream to a terminal associated with the second target code stream.
In an implementation manner of the present invention, after the step of acquiring the code stream to be acquired and sending the code stream to be acquired to the terminal, the method further includes:
and recording the association relation between the terminal and the code stream to be acquired.
In an implementation manner of the present invention, after the step of recording the association relationship between the terminal and the code stream to be acquired, the method further includes:
receiving an image acquisition stopping request sent by the terminal, wherein the image acquisition stopping request comprises information of the code stream to be acquired;
deleting the association relation;
judging whether other terminals associated with the code stream to be acquired exist or not according to the identifier of the code stream to be acquired;
if the code stream to be acquired exists, determining the highest priority in the priorities of the other terminals, and determining the highest priority as the priority of the code stream to be acquired;
and if the current residual bandwidth does not exist, deleting all related information of the code stream to be acquired, and sending notification information of the residual bandwidth to a terminal related to the code stream currently being transmitted.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
All the embodiments in the present specification are described in a related manner, and the same and similar parts among the embodiments may be referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, as for the apparatus embodiment, the electronic device embodiment and the storage medium embodiment, since they are substantially similar to the method embodiment, the description is relatively simple, and in relation to the description, reference may be made to some portions of the description of the method embodiment.
The above description is only for the preferred embodiment of the present invention, and is not intended to limit the scope of the present invention. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention shall fall within the protection scope of the present invention.

Claims (11)

1. An image acquisition method, characterized in that the method comprises:
receiving an image acquisition request sent by a terminal, wherein the image acquisition request comprises information of a code stream to be acquired;
when the code stream to be acquired is a code stream which is not transmitted, acquiring the code rate of the code stream to be acquired according to the information of the code stream to be acquired;
judging whether the sum of the code rate and the code rate of the code stream currently being transmitted exceeds the network bandwidth or not;
if not, acquiring the code stream to be acquired, and sending the code stream to be acquired to the terminal;
the information of the code stream to be acquired comprises: the mark of the camera corresponding to the code stream to be acquired and the mark of the code stream to be acquired; the step of obtaining the code rate of the code stream to be obtained according to the information of the code stream to be obtained comprises the following steps:
sending a request for acquiring the code rate of the code stream to be acquired to the camera corresponding to the code stream to be acquired based on the identifier of the camera corresponding to the code stream to be acquired and the identifier of the code stream to be acquired;
and receiving the code rate fed back by the camera corresponding to the code stream to be acquired.
2. The method of claim 1, further comprising:
when the sum of the code rate and the code rate of the currently transmitted code stream exceeds the network bandwidth, determining the camera corresponding to the code stream to be acquired according to the identification of the camera corresponding to the code stream to be acquired, and judging whether the camera corresponding to the code stream to be acquired is transmitting other code streams except the code stream to be acquired;
if so, selecting a first target code stream from other code streams except the code stream to be acquired, which are transmitted by the camera corresponding to the code stream to be acquired, according to a preset first selection rule, and sending the first target code stream to the terminal.
3. The method of claim 2, further comprising:
when the camera corresponding to the code stream to be acquired does not transmit other code streams except the code stream to be acquired, selecting a second target code stream from the code streams transmitted by other cameras except the camera corresponding to the code stream to be acquired according to a preset second selection rule;
disconnecting the transmission of the second target code stream;
and returning to execute the step of judging whether the sum of the code rate and the code rate of the code stream currently being transmitted exceeds the network bandwidth.
4. The method according to claim 3, wherein the code streams being transmitted by the cameras other than the camera corresponding to the code stream to be acquired have a priority, the image acquisition request further includes the priority of the terminal, and after the step of receiving the image acquisition request sent by the terminal, the method further includes:
determining the priority of the terminal as the priority of the code stream to be acquired;
the step of selecting a second target code stream from the code streams transmitted by other cameras except the camera corresponding to the code stream to be acquired according to a preset second selection rule comprises the following steps:
determining the code stream with the lowest priority from the code streams transmitted by other cameras except the camera corresponding to the code stream to be acquired;
judging whether the priority of the code stream with the lowest priority is lower than the priority of the code stream to be acquired;
and if so, determining the code stream with the lowest priority as a second target code stream.
5. The method according to claim 4, wherein before the step of determining the code stream with the lowest priority as the second target code stream, the method further comprises:
judging whether the number of the code streams with the lowest priority is multiple or not;
if so, selecting the code stream with the least associated terminals from the code streams with the lowest priority as the second target code stream;
and if not, executing the step of determining the code stream with the lowest priority as a second target code stream.
6. The method of claim 3, wherein after the disconnecting the transmission of the second target codestream, the method further comprises:
determining a terminal associated with the second target code stream and a camera corresponding to the second target code stream;
judging whether the camera corresponding to the second target code stream is transmitting other code streams except the second target code stream; and if so, selecting a third target code stream from the other code streams except the second target code stream and sending the third target code stream to a terminal associated with the second target code stream.
7. The method according to claim 1, wherein after the steps of obtaining the code stream to be obtained and sending the code stream to be obtained to the terminal, the method further comprises:
and recording the association relation between the terminal and the code stream to be acquired.
8. The method according to claim 7, wherein after the step of recording the association relationship between the terminal and the code stream to be acquired, the method further comprises:
receiving an image acquisition stopping request sent by the terminal, wherein the image acquisition stopping request comprises information of the code stream to be acquired;
deleting the association relation;
judging whether other terminals associated with the code stream to be acquired exist or not according to the identifier of the code stream to be acquired;
if the code stream to be acquired exists, determining the highest priority in the priorities of the other terminals, and determining the highest priority as the priority of the code stream to be acquired;
and if the current residual bandwidth does not exist, deleting all related information of the code stream to be acquired, and sending notification information of the residual bandwidth to a terminal related to the code stream currently being transmitted.
9. An image acquisition apparatus, characterized in that the apparatus comprises:
the image acquisition request receiving module is used for receiving an image acquisition request sent by a terminal, wherein the image acquisition request comprises information of a code stream to be acquired;
a code rate obtaining module, configured to obtain a code rate of the code stream to be obtained according to information of the code stream to be obtained when the code stream to be obtained is a code stream that is not transmitted;
the bandwidth judging module is used for judging whether the sum of the code rate and the code rate of the code stream currently being transmitted exceeds the network bandwidth, and if not, the image obtaining module is triggered;
the image acquisition module is used for acquiring the code stream to be acquired and sending the code stream to be acquired to the terminal;
the information of the code stream to be acquired comprises: the mark of the camera corresponding to the code stream to be acquired and the mark of the code stream to be acquired; the code rate obtaining module comprises:
the sending submodule is used for sending a request for acquiring the code rate to the camera to be accessed based on the identification of the camera to be accessed; the camera to be accessed is as follows: the camera corresponding to the code stream to be acquired;
and the receiving submodule is used for receiving the code rate fed back by the camera to be accessed.
10. An electronic device is characterized by comprising a processor, a communication interface, a memory and a communication bus, wherein the processor and the communication interface are used for realizing mutual communication by the memory through the communication bus;
a memory for storing a computer program;
a processor for implementing the method steps of any one of claims 1 to 8 when executing the computer program stored in the memory.
11. A computer-readable storage medium, characterized in that a computer program is stored in the computer-readable storage medium, which computer program, when being executed by a processor, carries out the method steps of any one of the claims 1-8.
CN201811217567.9A 2018-10-18 2018-10-18 Image acquisition method and device, electronic equipment and storage medium Active CN111083430B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811217567.9A CN111083430B (en) 2018-10-18 2018-10-18 Image acquisition method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811217567.9A CN111083430B (en) 2018-10-18 2018-10-18 Image acquisition method and device, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN111083430A CN111083430A (en) 2020-04-28
CN111083430B true CN111083430B (en) 2021-04-23

Family

ID=70308166

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811217567.9A Active CN111083430B (en) 2018-10-18 2018-10-18 Image acquisition method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN111083430B (en)

Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101646069A (en) * 2009-09-10 2010-02-10 北京中兴网视科技有限公司 Image monitoring method based on 3 G wireless network and system
CN102246458A (en) * 2008-12-15 2011-11-16 微软公司 Video conferencing subscription using multiple bit rate streams
CN102843351A (en) * 2012-03-31 2012-12-26 华为技术有限公司 Streaming media service processing method, streaming media server and system
CN104363463A (en) * 2014-11-10 2015-02-18 能力天空科技(北京)有限公司 Video processing method, device and system
US9197904B2 (en) * 2011-12-15 2015-11-24 Flextronics Ap, Llc Networked image/video processing system for enhancing photos and videos
CN105338422A (en) * 2014-06-09 2016-02-17 杭州海康威视数字技术股份有限公司 Smoothing method of network transmission speed of video image data
CN105430453A (en) * 2015-11-27 2016-03-23 刘军 Media data acquisition method, media terminal and online music teaching system
CN106131693A (en) * 2016-08-23 2016-11-16 张程 A kind of modular transmission of video Play System and method
CN106488265A (en) * 2016-10-12 2017-03-08 广州酷狗计算机科技有限公司 A kind of method and apparatus sending Media Stream
CN108647240A (en) * 2018-04-04 2018-10-12 沈文策 A kind of method, apparatus, electronic equipment and the storage medium of statistics visit capacity

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102246458A (en) * 2008-12-15 2011-11-16 微软公司 Video conferencing subscription using multiple bit rate streams
CN101646069A (en) * 2009-09-10 2010-02-10 北京中兴网视科技有限公司 Image monitoring method based on 3 G wireless network and system
US9197904B2 (en) * 2011-12-15 2015-11-24 Flextronics Ap, Llc Networked image/video processing system for enhancing photos and videos
CN102843351A (en) * 2012-03-31 2012-12-26 华为技术有限公司 Streaming media service processing method, streaming media server and system
CN105338422A (en) * 2014-06-09 2016-02-17 杭州海康威视数字技术股份有限公司 Smoothing method of network transmission speed of video image data
CN104363463A (en) * 2014-11-10 2015-02-18 能力天空科技(北京)有限公司 Video processing method, device and system
CN105430453A (en) * 2015-11-27 2016-03-23 刘军 Media data acquisition method, media terminal and online music teaching system
CN106131693A (en) * 2016-08-23 2016-11-16 张程 A kind of modular transmission of video Play System and method
CN106488265A (en) * 2016-10-12 2017-03-08 广州酷狗计算机科技有限公司 A kind of method and apparatus sending Media Stream
CN108647240A (en) * 2018-04-04 2018-10-12 沈文策 A kind of method, apparatus, electronic equipment and the storage medium of statistics visit capacity

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
QoE感知的FiWi视频分发机制;王汝言;《通信学报》;20180125;第39卷(第1期);全文 *
基于多链路聚合的无线实时视频传输系统;林科文;《小型微型计算机系统》;20110515;第32卷(第5期);全文 *

Also Published As

Publication number Publication date
CN111083430A (en) 2020-04-28

Similar Documents

Publication Publication Date Title
CN110944220B (en) Video screen projection playing method, device, equipment and system
CN108809679B (en) Control method and device for network node and monitoring equipment
US20180124168A1 (en) Load balancing server for forwarding prioritized traffic from and to one or more prioritized auto-configuration servers
US9215292B2 (en) Information processing apparatus, data distribution system, method of controlling information processing apparatus, and storage medium
CN109982034B (en) Access request processing method and device in video monitoring system
CN113453047A (en) Resource request processing method and device, electronic equipment and storage medium
CN110677684A (en) Video processing method, video access method, distributed storage method and distributed video access system
CN110311975B (en) Data request processing method and device
CN111159269B (en) Data processing method, device and system
CN112448987A (en) Fusing degradation triggering method and system and storage medium
CN111083176B (en) Cloud self-adaptive online method and device for monitoring camera
CN111083430B (en) Image acquisition method and device, electronic equipment and storage medium
CN111949421B (en) SDK calling method, device, electronic equipment and computer readable storage medium
CN110677683B (en) Video storage and video access method and distributed storage and video access system
CN108156086B (en) Policy rule issuing method and device
CN110309028B (en) Monitoring information acquisition method, service monitoring method, device and system
CN111093099B (en) Streaming media service scheduling method, device and system
CN110460486B (en) Service node monitoring method and system
TWI619031B (en) Metadata server, network device and automatic resource management method
CN110139166B (en) Video data transmission method, device and system and electronic equipment
CN108737460B (en) Connection processing method and client
CN109756384B (en) Data source state determination method and device and computer readable storage medium
CN111400327A (en) Data synchronization method and device, electronic equipment and storage medium
US10831368B2 (en) Local storage memory management for a mobile device
CN110837431A (en) Service control method, service control device, computer equipment and computer-readable 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
GR01 Patent grant
GR01 Patent grant