CN116939132A - Video storage method, terminal and storage medium - Google Patents

Video storage method, terminal and storage medium Download PDF

Info

Publication number
CN116939132A
CN116939132A CN202210369973.7A CN202210369973A CN116939132A CN 116939132 A CN116939132 A CN 116939132A CN 202210369973 A CN202210369973 A CN 202210369973A CN 116939132 A CN116939132 A CN 116939132A
Authority
CN
China
Prior art keywords
read
service node
write
write service
storage
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.)
Pending
Application number
CN202210369973.7A
Other languages
Chinese (zh)
Inventor
童毅
白珂林
冉秀峰
李宠
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
China Mobile Communications Group Co Ltd
China Mobile IoT Co Ltd
Original Assignee
China Mobile Communications Group Co Ltd
China Mobile IoT 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 China Mobile Communications Group Co Ltd, China Mobile IoT Co Ltd filed Critical China Mobile Communications Group Co Ltd
Priority to CN202210369973.7A priority Critical patent/CN116939132A/en
Publication of CN116939132A publication Critical patent/CN116939132A/en
Pending legal-status Critical Current

Links

Abstract

The embodiment of the application discloses a video storage method, a terminal and a storage medium, wherein a first terminal is provided with recording service and storage distribution service; the first terminal responds to the recording service and receives an optimal read-write service node identifier distributed by the storage distribution service; and receiving video stream data based on the storage configuration information of the camera channel, and sending the video stream data to an optimal read-write service node corresponding to the optimal read-write service node identifier, so that the optimal read-write service node writes the video stream data into the file block. The second terminal is provided with a read-write service node; the second terminal responds to the storage distribution service and sends the resource use condition of the read-write service node to the storage distribution service so that the storage distribution service determines the optimal read-write service node according to the resource use condition; wherein, the best read-write service node is one of the read-write service nodes; and receiving video stream data sent by the recording service based on the optimal service node, and writing the video stream data into the file block.

Description

Video storage method, terminal and storage medium
Technical Field
The present application relates to the field of computer technologies, and in particular, to a video storage method, a terminal, and a storage medium.
Background
In the current security industry, a most typical basic application scene is that a front-end camera is used for collecting video and audio signals and carrying out coding compression, then a transmission device transmits the collected audio and video signals to a rear end, the rear-end device stores the audio and video signals, and a display and control device is used for decoding and displaying the audio and video signals; the core of the back-end equipment is a video storage system, and real-time audio and video data can be stored in a lasting mode.
In the existing video storage method, a network video recorder (Network Video Recorder, NVR) can be utilized to store video streams on a directly connected hard disk, however, the software functions of the NVR are relatively solidified, and if the application needs to be updated, the whole system needs to be updated; the method can also adopt an object storage mode, for example, an upper storage service system is used for uploading audio and video data packets to an object storage, and recording metadata information such as object names, camera channel numbers, starting time, duration and the like; however, in the manner of object storage, an object storage service needs to be purchased separately; that is, the existing video storage method generally has the defects of poor flexibility and weak system expandability.
Disclosure of Invention
The embodiment of the application provides a video storage method, a terminal and a storage medium, which have stronger flexibility and expandability and can improve video storage efficiency.
The technical scheme of the embodiment of the application is realized as follows:
in a first aspect, an embodiment of the present application provides a video storage method, which is applied to a first terminal, where a recording service and a storage distribution service are deployed in the first terminal; the method comprises the following steps:
receiving an optimal read-write service node identifier distributed by the storage distribution service in response to the recording service;
and receiving video stream data based on the storage configuration information of the camera channel, and sending the video stream data to the optimal read-write service node corresponding to the optimal read-write service node identifier, so that the optimal read-write service node writes the video stream data into a file block.
In a second aspect, an embodiment of the present application provides a video storage method, which is applied to a second terminal, where a read-write service node is deployed on the second terminal; the method comprises the following steps:
responding to a storage distribution service, and sending the resource use condition of the read-write service node to the storage distribution service so that the storage distribution service determines an optimal read-write service node according to the resource use condition; wherein the optimal read-write service node is one of the read-write service nodes;
And receiving video stream data sent by the recording service based on the optimal service node, and writing the video stream data into a file block.
In a third aspect, an embodiment of the present application provides a first terminal, where the first terminal includes a first receiving unit and a first transmitting unit,
the first receiving unit is used for responding to the recording service and receiving the best read-write service node identification distributed by the storage distribution service;
the first sending unit is configured to receive video stream data based on storage configuration information of a camera channel, and send the video stream data to an optimal read-write service node corresponding to the optimal read-write service node identifier, so that the optimal read-write service node writes the video stream data into a file block.
In a fourth aspect, an embodiment of the present application provides a second terminal, where the first terminal includes a first receiving unit and a first transmitting unit,
the first receiving unit is used for responding to the recording service and receiving the best read-write service node identification distributed by the storage distribution service;
the first sending unit is configured to receive video stream data based on storage configuration information of a camera channel, and send the video stream data to an optimal read-write service node corresponding to the optimal read-write service node identifier, so that the optimal read-write service node writes the video stream data into a file block.
In a fifth aspect, an embodiment of the present application provides a first terminal, where the first terminal includes a first processor, and a first memory storing instructions executable by the first processor, where the instructions, when executed by the first processor, implement the method according to the first aspect.
In a sixth aspect, an embodiment of the present application provides a second terminal, where the second terminal includes a second processor, and a second memory storing instructions executable by the second processor, where the instructions, when executed by the second processor, implement the method according to the second aspect.
In a seventh aspect, an embodiment of the present application provides a computer readable storage medium, applied to a first terminal and a second terminal, where the program is executed by a first processor to implement the method according to the first aspect; the program, when executed by a second processor, implements a method as described in the second aspect.
The embodiment of the application provides a video storage method, a terminal and a storage medium, wherein a first terminal is provided with recording service and storage distribution service; the first terminal responds to the recording service and receives an optimal read-write service node identifier distributed by the storage distribution service; and receiving video stream data based on the storage configuration information of the camera channel, and sending the video stream data to an optimal read-write service node corresponding to the optimal read-write service node identifier, so that the optimal read-write service node writes the video stream data into the file block. The second terminal is provided with a read-write service node; the second terminal responds to the storage distribution service and sends the resource use condition of the read-write service node to the storage distribution service so that the storage distribution service determines the optimal read-write service node according to the resource use condition; wherein, the best read-write service node is one of the read-write service nodes; and receiving video stream data sent by the recording service based on the optimal service node, and writing the video stream data into the file block. Therefore, in the application, the first terminal is provided with the recording service and the storage and distribution service, and the second terminal is provided with the read-write service node, so that when video storage is carried out, the first terminal can receive the optimal read-write service node identifier distributed by the storage and distribution service in the second terminal by responding to the recording service, wherein the second terminal determines the optimal read-write service node based on the resource use condition of all the read-write service nodes through the storage and distribution service; the first terminal sends the received video stream data to an optimal read-write service node, and finally the video stream data is written into a file block to finish video storage; that is, the application constructs recording service, storage distribution service and read-write service node according to micro service architecture, thereby separating the business logic of video recording and the business logic of video writing, realizing architecture decoupling, and thus, carrying out version iteration and flexible deployment on each service respectively; the method has strong flexibility and expandability, and can improve video storage efficiency.
Drawings
FIG. 1 is a schematic diagram of a basic application scenario in the security industry;
fig. 2 is a schematic diagram of an implementation flow of a video storage method according to an embodiment of the present application;
fig. 3 is a second schematic implementation flow chart of the video storage method according to the embodiment of the present application;
fig. 4 is a schematic diagram of a third implementation flow of a video storage method according to an embodiment of the present application;
fig. 5 is a schematic diagram of an implementation flow of a video storage method according to an embodiment of the present application;
fig. 6 is a schematic diagram of an implementation flow of a video storage method according to an embodiment of the present application;
fig. 7 is a schematic diagram illustrating an implementation of a video storage method according to an embodiment of the present application;
fig. 8 is a schematic diagram of a first component structure of a first terminal according to an embodiment of the present application;
fig. 9 is a schematic diagram of a composition structure of a second terminal according to an embodiment of the present application;
fig. 10 is a schematic diagram of a second component structure of the first terminal according to the embodiment of the present application;
fig. 11 is a schematic diagram of a second structure of a second terminal according to an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application. It is to be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to be limiting. It should be noted that, for convenience of description, only a portion related to the related application is shown in the drawings.
With the deep advancement of projects such as safe cities, safe communities and the like in the whole country, public security and household security are rapidly developed. Fig. 1 is a schematic view of a basic application scenario in the security industry, as shown in fig. 1, a front-end camera is responsible for collecting video and audio signals and performing coding compression, a transmission device is responsible for transmitting audio and video signals collected by the front end to a rear end, a rear-end device is responsible for storing the audio and video signals collected by the front end, and a display and control device is responsible for outputting the audio and video signals to a large screen after decoding. The video storage system is used as a back-end core system to store the real-time audio and video data in a lasting mode.
In the existing video storage method, one mode is to utilize NVR to store video, wherein the NVR is responsible for front-end camera access and stores video streams on a directly connected hard disk; the other mode is that a special VIDEO storage server is adopted to store VIDEO, the VIDEO Stream is acquired from the streaming media service according to the storage configuration issued by a service layer, and after being packaged into a certain format, such as a private format, a streaming media format (FLASH VIDEO, FLV), a high-definition format (TS) and the like, the VIDEO Stream is written into a direct-connected disk or an externally-hung IP storage local area network (Storage Area Network, SAN) and a network attached storage (Network Attached Storage, NAS), and index metadata is established for the written data, so that the VIDEO can be conveniently searched later, and the writing bandwidth can be increased by expanding the storage server; in another mode, the object storage is adopted for video storage, and the upper storage business system uploads the audio and video data to the object storage, so that the method is suitable for projects deployed on public clouds. Besides, the prior art also discloses a video access method, which is based on the user equipment to send an information push request to a push server; the information push request carries equipment information of the user equipment; the pushing server searches storage position information of a target video to be pushed to the user equipment based on the equipment information, and sends a pushing message carrying the storage position information to the user equipment; the user equipment responds to the push message and downloads and stores the target video according to the storage position information; the monitoring video storage system and the application method are designed aiming at a storage medium, a database, a service layer and an application layer respectively, and the storage retrieval service of the video is realized through a distributed cloud storage technology.
However, by adopting NVR to store video, the software functions are relatively solidified, so that some new applications are difficult to continuously release on the NVR, and the whole system is required to be updated by updating the applications; the video storage is carried out by adopting a special video storage system, the system is deployed on a physical server, the storage server is still single-point application, and an upper control management system (control management system, CMS) needs to be balanced to different storage services according to the load of a camera channel; when the object storage is adopted, the object storage service needs to be purchased independently, and the camera or the storage service needs to have public network access rights, and when the self-built private cloud is adopted to deploy the object storage system, the purchase and maintenance cost is high. That is, the existing video storage method generally has the defects of poor flexibility and weak system expandability.
In order to solve the problems of the video storage method in the prior art, the embodiment of the application provides a video storage method, a terminal and a storage medium, wherein a first terminal is provided with a recording service and a storage distribution service; the first terminal responds to the recording service and receives an optimal read-write service node identifier distributed by the storage distribution service; and receiving video stream data based on the storage configuration information of the camera channel, and sending the video stream data to an optimal read-write service node corresponding to the optimal read-write service node identifier, so that the optimal read-write service node writes the video stream data into the file block. The second terminal is provided with a read-write service node; the second terminal responds to the storage distribution service and sends the resource use condition of the read-write service node to the storage distribution service so that the storage distribution service determines the optimal read-write service node according to the resource use condition; wherein, the best read-write service node is one of the read-write service nodes; receiving video stream data sent by recording service based on an optimal service node, and writing the video stream data into a file block; the method has strong flexibility and expandability, and can improve video storage efficiency.
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application.
Example 1
The embodiment of the application provides a video storage method which is applied to a first terminal, wherein recording service and storage and distribution service are deployed in the first terminal; fig. 2 is a schematic diagram of an implementation flow of a video storage method according to an embodiment of the present application, as shown in fig. 2, the video storage method may include the following steps:
and step 101, receiving the best read-write service node identification distributed by the storage distribution service in response to the recording service.
In the embodiment of the application, the first terminal can receive the best read-write service node identification allocated by the storage distribution service in response to the recording service.
It should be noted that, in the embodiment of the present application, the recording service may be configured to receive a video stream of the streaming media service and perform video packaging on the received related information of the video stream; the recording service can also send requests of starting, writing, stopping video segments and the like to the read-write service node, so that the recording and writing of the video stream are realized.
In the embodiment of the application, the storage distribution service is used for receiving the resource use condition reported by the read-write service node, and the resource use condition can be understood as the load state of the load read-write service node, so that the optimal read-write service node can be allocated for the recording service; the storage distribution service can also generate node records of the optimal read-write service node; the node record may include a camera channel identifier, an allocation start time, an allocation end time, and the best read-write service node identifier.
It should be noted that, in the embodiment of the present application, the read-write service node may be used to execute the requests issued to the node, such as writing, reading, and querying video segments; the resource use condition of the node can be reported to the storage distribution service; the best read-write service node is one of the read-write service nodes.
It may be appreciated that in an embodiment of the present application, a micro service may be deployed on a first terminal: the distribution service and the recording service are stored so that the first terminal can start the video recording task by responding to the recording service.
Further, in the embodiment of the present application, a plurality of micro services may be deployed on one terminal at the same time, for example, the first terminal is terminal 1, and the recording service and the storage distribution service are deployed on terminal 1 at the same time; the micro services may also be deployed on different terminals, respectively, e.g. the first terminal comprises terminal 1 and terminal 2, the recording service may be deployed on terminal 1, and the storage distribution service may be deployed on terminal 2.
It can be understood that, in the embodiment of the present application, the best read-write service node identifier is the identifier information of the best read-write service node.
Step 102, receiving video stream data based on the storage configuration information of the camera channel, and sending the video stream data to an optimal read-write service node corresponding to the optimal read-write service node identifier, so that the optimal read-write service node writes the video stream data into the file block.
In the embodiment of the application, after receiving the optimal read-write service node identifier allocated by the storage distribution service in response to the recording service, the first terminal may receive video stream data based on the storage configuration information of the camera channel, and send the video stream data to the optimal read-write service node corresponding to the optimal read-write service node identifier, so that the optimal read-write service node writes the video stream data into the file block.
It should be noted that, in the embodiment of the present application, the video stream data is real-time video information received through a camera channel; that is, the present application can record and store real-time video data; for example, the real-time recorded monitoring video may be stored, and the video stream may be acquired from the streaming media service and stored.
Further, in the embodiment of the present application, the storage configuration information is a preset recording schedule, for example, the storage configuration information may be recorded all day, or may be scheduled to be recorded, that is, recorded in a certain period of time.
It can be understood that in the embodiment of the present application, the best read-write service node is determined by using the storage distribution service, and because the best read-write service node is in the best load state in all the read-write service nodes, the best read-write service node is used to receive and write video stream data, so that the recording and storage efficiency of the video stream data can be improved.
It should be noted that, in the embodiment of the present application, the file block is established by the read-write service node in the second terminal, and the second terminal is a storage medium; and the number of file blocks may be at least one, that is, the read-write service node may create at least one file block in the second terminal, thereby writing the video stream data to the file block.
It should also be noted that in the embodiments of the present application, the communication between the micro services is performed through a message queue.
Further, in an embodiment of the present application, after responding to the recording service, the first terminal may further include the following steps before receiving the best read-write service node identifier allocated by the storage distribution service:
step 103, if the camera channel is not the best read-write service node allocated for the first time and the resource usage weight of the last best read-write service node allocated for the last time is equal to the preset resource threshold, determining the best read-write service node in the rest read-write service nodes except the last best read-write service node allocated for the last time through the storage distribution service.
In the embodiment of the application, before receiving the identifier of the best read-write service node allocated by the storage distribution service, if the camera channel is not allocated with the best read-write service node for the first time and the resource usage weight of the last allocated best read-write service node is equal to the preset resource threshold, determining the best read-write service node in the rest read-write service nodes except the last allocated best read-write service node through the storage distribution service.
It can be understood that, in the embodiment of the present application, when video stream data is acquired through a camera channel and stored, a corresponding best read-write service node needs to be allocated to the camera channel, so when the camera channel is not allocated with the best read-write service node for the first time, that is, before that, there is a process that the camera channel receives the video stream data and writes the video stream data into the previously allocated best read-write service node, it can be determined first whether the last allocated best read-write service node of the camera channel can be used continuously.
Further, in the embodiment of the present application, the method for determining whether a read-write service node is an optimal read-write service node is that by calculating a resource usage weight of the read-write service node and comparing the resource usage weight with a preset resource threshold, if the resource usage weight is equal to the preset resource threshold, the read-write service node is not the optimal service node.
Similarly, for the case that the camera channel is not allocated with the best read-write service node for the first time, the best read-write service node allocated last time corresponding to the camera channel is judged based on the mode, and whether the best read-write service node allocated last time can be used as the best read-write service node for writing the current video stream is determined.
Further, in the embodiment of the present application, if the resource usage weight of the last allocated best read/write service node is equal to the preset resource threshold, the best read/write service node needs to be determined again, and the best read/write service node may be determined from the remaining read/write service nodes except the last allocated best read/write service node through the storage distribution service.
Further, in the embodiment of the present application, if the resource usage weight of the last allocated best read-write service node is smaller than the preset resource threshold, it is indicated that the last allocated best read-write service node has a remaining space, the load state is better, and video stream data can still be written through the best read-write service node; therefore, the read-write service node which is responsible for writing video stream data in the camera channel can be ensured not to be frequently switched.
Further, in an embodiment of the present application, the method for determining the best read-write service node by the first terminal from the remaining read-write service nodes except the last allocated best read-write service node through the storage distribution service may include the steps of:
and step 103a, determining the respective resource use weight of the rest read-write service nodes through the storage distribution service.
In the embodiment of the application, the first terminal determines the optimal read-write service node from the rest read-write service nodes except the last allocated optimal read-write service node through the storage distribution service; in some embodiments of the present application, the first terminal may first determine, through the storage distribution service, a resource usage weight of each of the remaining read-write service nodes.
It may be appreciated that in the embodiment of the present application, the resource usage weights of the remaining read-write service nodes are determined by the storage distribution service, so that the best service node is determined among the remaining read-write service nodes.
And 103b, determining the read-write service node corresponding to the minimum resource use weight in the resource use weights of the rest read-write service nodes as the optimal read-write service node.
In the embodiment of the application, after determining the respective resource usage weights of the remaining read-write service nodes through the storage distribution service, the first terminal may determine the read-write service node corresponding to the minimum resource usage weight among the respective resource usage weights of the remaining read-write service nodes as the best read-write service node.
It can be understood that, in the embodiment of the present application, the load state of the read-write service node corresponding to the smallest resource usage weight value in the resource usage weight values is optimal, so that the read-write service node corresponding to the smallest resource usage weight value can be determined as the optimal read-write service node.
Further, in the embodiment of the present application, the method for determining, by the first terminal, the resource usage weights of the remaining read-write service nodes through the storage distribution service, that is, the method proposed by step 103a may include the following steps:
step 103a1, acquiring respective resource use conditions of the remaining read-write service nodes through storage distribution service; wherein the resource usage includes at least one influencing factor; the influencing factors include disk usage, network bandwidth occupancy, central processing unit CPU usage, memory occupancy, and used storage space.
In the embodiment of the application, a first terminal determines the respective resource use weight of the remaining read-write service nodes through storage distribution service; in some embodiments of the present application, the first terminal may first obtain respective resource usage conditions of the remaining read-write service nodes through the storage distribution service; wherein the resource usage includes at least one influencing factor; the influencing factors include disk usage, network bandwidth occupancy, central processing unit CPU usage, memory occupancy, and used storage space.
It should be noted that, in the embodiment of the present application, the influencing factors in the resource usage situation include, but are not limited to, disk usage, network bandwidth occupancy, CPU usage, memory occupancy, and used storage space; the present application is not particularly limited.
Step 103a2, calculating the respective resource usage weights of the remaining read-write service nodes according to the resource usage situation, the weight corresponding to the influence factors, the preset influence factor threshold and the preset resource threshold.
In the embodiment of the application, after the first terminal obtains the respective resource usage conditions of the remaining read-write service nodes through the storage distribution service, the respective resource usage weights of the remaining read-write service nodes can be calculated according to the resource usage conditions, the weights corresponding to the influence factors, the preset influence factor threshold and the preset resource threshold.
In an exemplary embodiment of the present application, the calculation method of the resource usage weight is as follows:
wherein x is i For each influencing factor in resource usage, x i The value range of (2) is [0,1 ]];mx i Different influence factors can correspond to different preset influence factor thresholds, for example, the preset influence factor threshold corresponding to the network bandwidth occupancy rate can be set to be 0.9; omega i Different weights can be allocated for the weights corresponding to the influence factors, namely, different influence factors; max_int is a preset resource threshold.
It should be noted that, with respect to the above formula (1), when all x i I.e. all influencing factors satisfy 0.ltoreq.x i ≤mx i When the resource usage weight is calculatedEqual to->And when x is i Any one x of i Satisfy mx i ≤x i When the weight is less than or equal to 1, the resource use weight is ∈1>Then max_int is equal.
That is, once one influencing factor in the resource usage of a certain read-write service node satisfies mx i ≤x i And if the resource usage weight of the read-write service node is less than or equal to 1, the read-write service node can not be used as the optimal read-write service node.
Further, in an embodiment of the present application, after responding to the recording service, the first terminal may further include the following steps before receiving the best read-write service node identifier allocated by the storage distribution service:
step 104, if the camera channel is the best read-write service node allocated for the first time, determining the best read-write service node in all read-write service nodes through the storage distribution service.
In the embodiment of the application, before receiving the identifier of the best read-write service node allocated by the storage distribution service, if the camera channel is allocated with the best read-write service node for the first time, the first terminal determines the best read-write service node in all read-write service nodes through the storage distribution service.
It can be understood that, in the embodiment of the present application, when the camera channel is the best read-write service node allocated for the first time, that is, the best read-write service node is not allocated before the camera channel, the best read-write service node can be determined by storing and distributing services in all the read-write service nodes, and the method for determining the best read-write service node is the same as above.
It should be noted that, in the embodiment of the present application, if the best read-write service node does not exist in the read-write service nodes, the first terminal may blow the recording service and stop the new recording task.
Further, in the embodiment of the present application, the first terminal may be further deployed with a query service; fig. 3 is a second implementation flow chart of a video storage method according to an embodiment of the present application, as shown in fig. 3, a first terminal receives video stream data based on storage configuration information of a camera channel, and sends the video stream data to an optimal read-write service node corresponding to an optimal read-write service node identifier, so that after the optimal read-write service node writes the video stream data into a file block, i.e. after step 102, the method may further include the following steps:
and step 105, responding to the query service and sending a query request to the optimal read-write service node.
In the embodiment of the application, the first terminal receives the video stream data based on the storage configuration information of the camera channel and sends the video stream data to the optimal read-write service node corresponding to the optimal read-write service node identifier, so that the optimal read-write service node can respond to the query service to send the query request to the optimal read-write service node after writing the video stream data into the file block.
It should be noted that, in the embodiment of the present application, the query service is also a micro service, which is the same as the recording service, the storage distribution service, and the read-write service node described above; the query service may be configured to receive a video segment query message of the caller, send a query request to an optimal read-write service node allocated to the camera channel, and aggregate video segment information returned by the optimal read-write service node to the caller.
It will be appreciated that in embodiments of the present application, the query request is used to query the optimal read-write service node for specified video segment information.
Step 106, receiving video segment information queried by the optimal read-write service node according to the query request; the video segment information comprises a camera channel identifier, an optimal read-write service node identifier, video starting time, video duration and the number of fragments.
In the embodiment of the application, after responding to the query service and sending a query request to the optimal read-write service node, the first terminal can receive video segment information queried by the optimal read-write service node according to the query request; the video segment information comprises a camera channel identifier, an optimal read-write service node identifier, video starting time, video duration and the number of fragments.
Further, in the embodiment of the present application, the first terminal may be further deployed with a playback service; fig. 4 is a schematic diagram of an implementation flow chart of a video storage method according to an embodiment of the present application, as shown in fig. 4, after a first terminal receives video stream data based on storage configuration information of a camera channel, and sends the video stream data to an optimal read-write service node corresponding to an optimal read-write service node identifier, so that the optimal read-write service node writes the video stream data into a file block, that is, after step 102, the method may further include the following steps:
and step 107, responding to the playback service, and sending a video segment reading request to the optimal read-write service node.
In the embodiment of the application, the first terminal receives the video stream data based on the storage configuration information of the camera channel and sends the video stream data to the optimal read-write service node corresponding to the optimal read-write service node identifier, so that after the optimal read-write service node writes the video stream data into the file block, a request for reading the video segment can be sent to the optimal read-write service node in response to the playback service.
It should be noted that, in the embodiment of the present application, the playback service is the same as the recording service, the storage distribution service, and the read-write service node described above, and belongs to the micro service; the playback service may be configured to receive a user's play video segment request, send a read video segment request to an optimal read-write service node, read a slice of the video segment as needed, and transmit to the user via different streaming protocols, such as real-time messaging protocol (Real Time Messaging Protocol, RTMP), real-time streaming protocol (Real Time Streaming Protocol, RTSP), HTTP-FLV, etc.
It will be appreciated that in the embodiment of the present application, the video segment reading request is used to instruct the best read/write service node to read the corresponding video segment.
Step 108, receiving the corresponding video segment read by the optimal read-write service node according to the video segment reading request, and sending the video segment to the client.
In the embodiment of the application, after responding to the playback service and sending a video segment reading request to the optimal read-write service node, the first terminal can receive the corresponding video segment read by the optimal read-write service node according to the video segment reading request and send the video segment to the client.
It can be appreciated that in the embodiment of the present application, after the corresponding video segment is requested to be read according to the video segment reading request, the video segment may be sent to the client that requests to read the video segment.
Further, in an embodiment of the present application, the first terminal receives video stream data based on the storage configuration information of the camera channel, and sends the video stream data to the best read-write service node corresponding to the best read-write service node identifier, so that before the best read-write service node writes the video stream data into the file block, that is, before step 102, the method may further include the following steps:
step 109, generating a node record corresponding to the optimal read-write service node through the storage distribution service, and sending the node record to a database; the node record comprises a camera channel identifier, an allocation starting time, an allocation ending time and an optimal read-write service node identifier.
In the embodiment of the application, the first terminal receives video stream data based on the storage configuration information of the camera channel, and sends the video stream data to the optimal read-write service node corresponding to the optimal read-write service node identifier, so that before the optimal read-write service node writes the video stream data into the file block, a node record corresponding to the optimal read-write service node can be generated through storage distribution service, and the node record is sent to the database; the node record comprises a camera channel identifier, an allocation starting time, an allocation ending time and an optimal read-write service node identifier.
It should be noted that, in the embodiment of the present application, the database may be used to store node records.
The node record comprises a camera channel identifier, an allocation starting time, an allocation ending time and an optimal read-write service node identifier; illustratively, the node record includes a camera channel C, a distribution start time T1, a distribution end time T2, and an optimal read-write service node S; the node record indicates that the best read-write service node S is responsible for storing video stream data of the camera channel C during the time period t1 to t 2.
Further, in an embodiment of the present application, the method for the first terminal to send video stream data to the best read-write service node corresponding to the best read-write service node identifier may include the following steps:
and 110, packaging the video stream data to obtain video fragments.
In the embodiment of the application, a first terminal sends video stream data to an optimal read-write service node corresponding to an optimal read-write service node identifier; in some embodiments of the present application, the first terminal may first perform encapsulation processing on the video stream data to obtain video slices.
In the embodiment of the present application, the encapsulation process refers to encapsulating groups of pictures (Group of Pictures, GOP) in video stream data into a format, such as FMP4 or MPEG2-TS format, so as to obtain video slices.
And step 111, sending the video fragments to an optimal read-write service node.
In the embodiment of the application, after the first terminal encapsulates the video stream data to obtain the video fragments, the video fragments can be sent to the optimal read-write service node.
The embodiment of the application provides a video storage method, wherein a first terminal is provided with recording service and storage distribution service; the first terminal responds to the recording service and receives an optimal read-write service node identifier distributed by the storage distribution service; and receiving video stream data based on the storage configuration information of the camera channel, and sending the video stream data to an optimal read-write service node corresponding to the optimal read-write service node identifier, so that the optimal read-write service node writes the video stream data into the file block. The second terminal is provided with a read-write service node; the second terminal responds to the storage distribution service and sends the resource use condition of the read-write service node to the storage distribution service so that the storage distribution service determines the optimal read-write service node according to the resource use condition; wherein, the best read-write service node is one of the read-write service nodes; and receiving video stream data sent by the recording service based on the optimal service node, and writing the video stream data into the file block. Therefore, in the application, the first terminal is provided with the recording service and the storage and distribution service, and the second terminal is provided with the read-write service node, so that when video storage is carried out, the first terminal can receive the optimal read-write service node identifier distributed by the storage and distribution service in the second terminal by responding to the recording service, wherein the second terminal determines the optimal read-write service node based on the resource use condition of all the read-write service nodes through the storage and distribution service; the first terminal sends the received video stream data to an optimal read-write service node, and finally the video stream data is written into a file block to finish video storage; that is, the application constructs recording service, storage distribution service and read-write service node according to micro service architecture, thereby separating the business logic of video recording and the business logic of video writing, realizing architecture decoupling, and thus, carrying out version iteration and flexible deployment on each service respectively; the method has strong flexibility and expandability, and can improve video storage efficiency.
Example two
Based on the above embodiment, another embodiment of the present application provides a video storage method, which is applied to a second terminal, where a read-write service node is deployed on the second terminal; fig. 5 is a schematic diagram of an implementation flow chart of a video storage method provided by an embodiment of the present application, and as shown in fig. 5, the video storage method of the second terminal includes the following steps:
step 201, responding to the storage distribution service, and sending the resource use condition of the read-write service node to the storage distribution service so that the storage distribution service determines the optimal read-write service node according to the resource use condition; wherein, the best read-write service node is one of the read-write service nodes.
In the embodiment of the application, the second terminal can respond to the storage distribution service and send the resource use condition of the read-write service node to the storage distribution service so that the storage distribution service determines the optimal read-write service node according to the resource use condition; wherein, the best read-write service node is one of the read-write service nodes.
It should be noted that, in an embodiment of the present application, the second terminal may be a storage medium, such as a disk, network storage (Network Attached Storage, NAS), or IP storage area network (IP Storage Area Network, IPSAN).
Further, the second terminal is provided with a read-write service node, and the read-write service node can be used for executing the requests of writing, reading, inquiring video segments and the like issued to the second terminal; the resource use condition of the node can be reported to the storage distribution service; the best read-write service node is one of the read-write service nodes.
Step 202, receiving video stream data sent by the recording service based on the best service node, and writing the video stream data into the file block.
In the embodiment of the application, the second terminal responds to the storage distribution service, sends the resource use condition of the read-write service node to the storage distribution service, so that the storage distribution service can receive video stream data sent by the recording service based on the optimal service node after determining the optimal read-write service node according to the resource use condition, and writes the video stream data into the file block.
It should be noted that, in the embodiment of the present application, the best service node receives video stream data sent by the recording service, and actually receives video slices of the video stream data after encapsulation.
Further, in the embodiment of the present application, after receiving the video clips through the best read/write service node, the best read/write service node may acquire an idle or expired file block, thereby writing the video clips into the file block, and insert a record of video segments for recording related information of the inserted video clips.
Further, in an embodiment of the present application, the video segment record may include a video segment identifier, a file block identifier, a start storage location in a file block, a video start time, a video end time, a storage status, and the like.
Further, in the embodiment of the present application, when receiving the video stream data is terminated, the second terminal may update the video end time and the storage status in the record of the video segment through the optimal read-write service node.
Further, in an embodiment of the present application, before the second terminal receives the video stream data sent by the recording service based on the best service node and writes the video stream data into the file block, that is, before step 202, the second terminal may further include the following steps:
and 203, formatting the file by the read-write service node and creating a file block.
In the embodiment of the application, the second terminal can perform formatting processing through the read-write service node and create the file block before receiving video stream data sent by the recording service based on the optimal service node and writing the video stream data into the file block.
It should be noted that, in the embodiment of the present application, after the second terminal is formatted by the read-write service node, a file block is created on the formatted second terminal; the number of file blocks may be plural; file block size the present application is not particularly limited.
And 204, generating a file block record according to the file block identifier and the state of the file block, and transmitting the file block record to a database.
In the embodiment of the application, after the second terminal performs formatting processing through the read-write service node and creates the file block, the second terminal can generate the file block record according to the file block identifier and the state of the file block, and send the file block record to the database.
In an embodiment of the application, a database may be used to store file block records; the file block record includes a file block identification and a state of the file block.
Further, in the embodiment of the present application, an exemplary, fig. 6 is a schematic diagram of a fifth implementation flow of the video storage method according to the embodiment of the present application, and as shown in fig. 6, a main flow of recording video based on the video storage method according to the present application is shown, a recording service is started first, and a video recording task is started according to storage configuration information of a camera channel; further obtaining the optimal read-write service node identification through the storage distribution service; then sending a write-in starting request to the optimal read-write service node so as to receive a video stream corresponding to a camera channel acquired from streaming media service through the optimal read-write service node; then, whether the video stream is finished or not or whether the recording task is finished or not can be judged, if not, the acquired video stream data are packaged into video fragments, and the video fragments are written into an optimal read-write service node; and if the video recording task is finished, a write stopping request can be sent to the optimal read-write service node so as to finish the video recording task.
In summary, exemplary, fig. 7 is a schematic implementation diagram of a video storage method according to an embodiment of the present application, as shown in fig. 7, the present application is mainly based on storage of real-time video of different micro services, including recording service, query service, playback service, storage distribution service, and read-write service nodes; the services can be deployed on different terminals, and the services are communicated through a message queue; the second terminal where the read-write service node is located can be a disk, an IPSAN or an NAS, and the read-write service node can create a file block at the second terminal; thereby constituting the entire video storage system. Therefore, by constructing a plurality of micro services to store video, each service can be subjected to version iteration and persistence delivery respectively, and each service can be flexibly deployed according to the system scale; the number of each service can also be multiple, for example, multiple recording services, query services, read-write service nodes and the like can be deployed; therefore, the whole video storage system can not influence the service due to the upgrading and failure of a certain service, and the situation of video interruption can not occur when each service is upgraded in turn; meanwhile, the optimal read-write service node is determined among the plurality of read-write service nodes to be used for video storage, so that the writing performance of video storage can be improved, namely the video storage efficiency is improved.
The embodiment of the application provides a video storage method, wherein a first terminal is provided with recording service and storage distribution service; the first terminal responds to the recording service and receives an optimal read-write service node identifier distributed by the storage distribution service; and receiving video stream data based on the storage configuration information of the camera channel, and sending the video stream data to an optimal read-write service node corresponding to the optimal read-write service node identifier, so that the optimal read-write service node writes the video stream data into the file block. The second terminal is provided with a read-write service node; the second terminal responds to the storage distribution service and sends the resource use condition of the read-write service node to the storage distribution service so that the storage distribution service determines the optimal read-write service node according to the resource use condition; wherein, the best read-write service node is one of the read-write service nodes; and receiving video stream data sent by the recording service based on the optimal service node, and writing the video stream data into the file block. Therefore, in the application, the first terminal is provided with the recording service and the storage and distribution service, and the second terminal is provided with the read-write service node, so that when video storage is carried out, the first terminal can receive the optimal read-write service node identifier distributed by the storage and distribution service in the second terminal by responding to the recording service, wherein the second terminal determines the optimal read-write service node based on the resource use condition of all the read-write service nodes through the storage and distribution service; the first terminal sends the received video stream data to an optimal read-write service node, and finally the video stream data is written into a file block to finish video storage; that is, the application constructs recording service, storage distribution service and read-write service node according to micro service architecture, thereby separating the business logic of video recording and the business logic of video writing, realizing architecture decoupling, and thus, carrying out version iteration and flexible deployment on each service respectively; the method has strong flexibility and expandability, and can improve video storage efficiency.
Example III
Based on the above embodiments, in another embodiment of the present application, a first terminal is deployed with a recording service and a storage distribution service; fig. 8 is a schematic diagram of the composition structure of a first terminal according to an embodiment of the present application, as shown in fig. 8, a first terminal 10 according to an embodiment of the present application may include a first receiving unit 11, a first transmitting unit 12 and a determining unit 13,
the first receiving unit 11 is configured to receive, in response to the recording service, an identifier of an optimal read-write service node allocated by the storage distribution service.
The first sending unit 12 is configured to receive video stream data based on storage configuration information of a camera channel, and send the video stream data to an optimal read-write service node corresponding to the optimal read-write service node identifier, so that the optimal read-write service node writes the video stream data into a file block.
The determining unit 13 is configured to determine, before the first receiving unit 11 receives the identifier of the best read/write service node allocated by the storage distribution service, the best read/write service node from the remaining read/write service nodes except the best read/write service node allocated last time, if the camera channel is not the best read/write service node allocated first time and the resource usage weight of the last time allocated best read/write service node is equal to a preset resource threshold.
Further, the determining unit 13 is further configured to determine, by using the storage distribution service, a resource usage weight of each of the remaining read-write service nodes; and determining the read-write service node corresponding to the minimum resource use weight in the resource use weights of the rest read-write service nodes as the optimal read-write service node.
Further, the determining unit 13 is further configured to obtain respective resource usage conditions of the remaining read-write service nodes through the storage distribution service; wherein the resource usage includes at least one influencing factor; the influencing factors comprise disk utilization rate, network bandwidth occupancy rate, central Processing Unit (CPU) utilization rate, memory occupancy rate and used storage space; and calculating the respective resource use weight of the remaining read-write service nodes according to the resource use condition, the weight corresponding to the influence factor, a preset influence factor threshold and the preset resource threshold.
Further, the determining unit 13 is further configured to determine, before the first receiving unit 11 receives the identifier of the best read/write service node allocated by the storage distribution service, if the camera channel is the best read/write service node allocated for the first time, the best read/write service node among all the read/write service nodes through the storage distribution service.
Further, the first terminal is deployed with a query service; the first sending unit 12 is further configured to send a query request to the best read-write service node in response to the query service.
Further, the first receiving unit 11 is further configured to receive video segment information queried by the best read-write service node according to the query request; the video segment information comprises a camera channel identifier, the optimal read-write service node identifier, video starting time, video duration and the number of fragments.
Further, the first terminal is deployed with a playback service; the first sending unit 12 is further configured to send a request for reading video segments to the optimal read-write service node in response to the playback service.
Further, the first receiving unit 11 is further configured to receive a corresponding video segment read by the best read-write service node according to the video segment reading request, and send the video segment to a client.
Further, the first sending unit 12 is further configured to generate, by using the storage distribution service, a node record corresponding to the best read-write service node, and send the node record to a database; the node record comprises a camera channel identifier, an allocation starting time, an allocation ending time and the optimal read-write service node identifier.
Further, the first sending unit 12 is further configured to perform encapsulation processing on the video stream data to obtain video slices; and sending the video fragments to the optimal read-write service node.
In the embodiment of the application, the second terminal is provided with a read-write service node; fig. 9 is a schematic diagram of the composition structure of a second terminal according to an embodiment of the present application, as shown in fig. 9, a second terminal 20 according to an embodiment of the present application may include a second sending unit 21, a second receiving unit 22 and a processing unit 23,
the second sending unit 21 is configured to send, in response to a storage distribution service, a resource usage situation of the read-write service node to the storage distribution service, so that the storage distribution service determines an optimal read-write service node according to the resource usage situation; wherein the optimal read-write service node is one of the read-write service nodes.
The second receiving unit 22 is configured to receive video stream data sent by the recording service based on the best service node, and write the video stream data into a file block.
The processing unit 23 is configured to perform formatting processing through the read-write service node, and create a file block.
Further, the second sending unit 21 is further configured to generate a file block record according to the file block identifier and the status of the file block, and send the file block record to a database.
Fig. 10 is a schematic diagram of a second component structure of the first terminal according to the embodiment of the present application, as shown in fig. 10, the first terminal 10 according to the embodiment of the present application may further include a first processor 14, a first memory 15 storing executable instructions of the first processor 14, and further, the first terminal 10 may further include a first communication interface 16, and a first bus 17 for connecting the first processor 14, the first memory 15, and the first communication interface 16.
In an embodiment of the present application, the first processor 14 may be at least one of an application specific integrated circuit (Application Specific Integrated Circuit, ASIC), a digital signal processor (Digital Signal Processor, DSP), a digital signal processing device (Digital Signal Processing Device, DSPD), a programmable logic device (ProgRAMmable Logic Device, PLD), a field programmable gate array (Field ProgRAMmable Gate Array, FPGA), a central processing unit (Central Processing Unit, CPU), a controller, a microcontroller, and a microprocessor. It will be appreciated that the electronics for implementing the above-described processor functions may be other for different devices, and embodiments of the present application are not particularly limited. The first processor 14 may further comprise a first memory 15, which first memory 15 may be connected to the first processor 14, wherein the first memory 15 is adapted to store executable program code comprising computer operating instructions, which first memory 15 may comprise a high speed RAM memory, and may further comprise a non-volatile memory, e.g. at least two disk memories.
In an embodiment of the application, the first bus 17 is used to connect the first communication interface 16, the first processor 14 and the first memory 15 and the mutual communication between these devices.
In an embodiment of the application, the first memory 15 is used for storing instructions and data.
Further, in an embodiment of the present application, the first processor 14 is configured to receive, in response to the recording service, an identifier of a best read-write service node allocated by the storage distribution service; and receiving video stream data based on the storage configuration information of the camera channel, and sending the video stream data to the optimal read-write service node corresponding to the optimal read-write service node identifier, so that the optimal read-write service node writes the video stream data into a file block.
In practical applications, the first Memory 15 may be a volatile Memory (RAM), such as a Random-Access Memory (RAM); or a nonvolatile Memory (non-volatile Memory), such as a Read-Only Memory (ROM), a flash Memory (flash Memory), a Hard Disk (HDD) or a Solid State Drive (SSD); or a combination of the above types of memories and provides instructions and data to the first processor 14.
Fig. 11 is a schematic diagram of a second structure of a second terminal according to an embodiment of the present application, as shown in fig. 11, the second terminal 20 according to an embodiment of the present application may further include a second processor 24, a second memory 25 storing executable instructions of the second processor 24, and further, the video storage system 10 may further include a second communication interface 26, and a second bus 27 for connecting the second processor 24, the second memory 25, and the second communication interface 26.
In an embodiment of the present application, the second processor 24 may be at least one of an application specific integrated circuit (Application Specific Integrated Circuit, ASIC), a digital signal processor (Digital Signal Processor, DSP), a digital signal processing device (Digital Signal Processing Device, DSPD), a programmable logic device (ProgRAMmable Logic Device, PLD), a field programmable gate array (Field ProgRAMmable Gate Array, FPGA), a central processing unit (Central Processing Unit, CPU), a controller, a microcontroller, and a microprocessor. It will be appreciated that the electronics for implementing the above-described processor functions may be other for different devices, and embodiments of the present application are not particularly limited. The second processor 24 may further comprise a second memory 25, which second memory 25 may be connected to the second processor 24, wherein the second memory 25 is adapted to store executable program code comprising computer operating instructions, which second memory 25 may comprise a high speed RAM memory, and may further comprise a non-volatile memory, e.g. at least two disk memories.
In an embodiment of the application, a second bus 27 is used to connect the second communication interface 26, the second processor 24 and the second memory 25, as well as the mutual communication between these devices.
In an embodiment of the application, the second memory 25 is used for storing instructions and data.
Further, in an embodiment of the present application, the second processor 24 is configured to send, in response to a storage distribution service, a resource usage situation of the read-write service node to the storage distribution service, so that the storage distribution service determines an optimal read-write service node according to the resource usage situation; wherein the optimal read-write service node is one of the read-write service nodes; and receiving video stream data sent by the recording service based on the optimal service node, and writing the video stream data into a file block.
In practical applications, the second Memory 25 may be a volatile Memory (RAM), such as a Random-Access Memory (RAM); or a nonvolatile Memory (non-volatile Memory), such as a Read-Only Memory (ROM), a flash Memory (flash Memory), a Hard Disk (HDD) or a Solid State Drive (SSD); or a combination of the above types of memories and provides instructions and data to the second processor 24.
In addition, each functional module in the present embodiment may be integrated in one analysis unit, each unit may exist alone physically, or two or more units may be integrated in one unit. The integrated units may be implemented in hardware or in software functional modules.
The integrated units, if implemented in the form of software functional modules, may be stored in a computer-readable storage medium, if not sold or used as separate products, and based on this understanding, the technical solution of the present embodiment may be embodied essentially or partly in the form of a software product, or all or part of the technical solution may be embodied in a storage medium, which includes several instructions to cause a computer device (which may be a personal computer, a server, or a network device, etc.) or processor (processor) to perform all or part of the steps of the method of the present embodiment. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read Only Memory (ROM), a random access Memory (Random Access Memory, RAM), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
The embodiment of the application provides a terminal, wherein a first terminal is provided with recording service and storage distribution service; the first terminal responds to the recording service and receives an optimal read-write service node identifier distributed by the storage distribution service; and receiving video stream data based on the storage configuration information of the camera channel, and sending the video stream data to an optimal read-write service node corresponding to the optimal read-write service node identifier, so that the optimal read-write service node writes the video stream data into the file block. The second terminal is provided with a read-write service node; the second terminal responds to the storage distribution service and sends the resource use condition of the read-write service node to the storage distribution service so that the storage distribution service determines the optimal read-write service node according to the resource use condition; wherein, the best read-write service node is one of the read-write service nodes; and receiving video stream data sent by the recording service based on the optimal service node, and writing the video stream data into the file block. Therefore, in the application, the first terminal is provided with the recording service and the storage and distribution service, and the second terminal is provided with the read-write service node, so that when video storage is carried out, the first terminal can receive the optimal read-write service node identifier distributed by the storage and distribution service in the second terminal by responding to the recording service, wherein the second terminal determines the optimal read-write service node based on the resource use condition of all the read-write service nodes through the storage and distribution service; the first terminal sends the received video stream data to an optimal read-write service node, and finally the video stream data is written into a file block to finish video storage; that is, the application constructs recording service, storage distribution service and read-write service node according to micro service architecture, thereby separating the business logic of video recording and the business logic of video writing, realizing architecture decoupling, and thus, carrying out version iteration and flexible deployment on each service respectively; the method has strong flexibility and expandability, and can improve video storage efficiency.
Specifically, program instructions corresponding to a video storage method in the present embodiment may be stored on a storage medium such as an optical disc, a hard disc, a usb disk, or the like; when program instructions in the storage medium corresponding to the video storage method applied to the first terminal are read or executed by an electronic device, the method comprises the following steps:
receiving an optimal read-write service node identifier distributed by the storage distribution service in response to the recording service;
and receiving video stream data based on the storage configuration information of the camera channel, and sending the video stream data to the optimal read-write service node corresponding to the optimal read-write service node identifier, so that the optimal read-write service node writes the video stream data into a file block.
When program instructions in the storage medium corresponding to the video storage method applied to the second terminal are read or executed by an electronic device, the method comprises the following steps:
responding to a storage distribution service, and sending the resource use condition of the read-write service node to the storage distribution service so that the storage distribution service determines an optimal read-write service node according to the resource use condition; wherein the optimal read-write service node is one of the read-write service nodes;
And receiving video stream data sent by the recording service based on the optimal service node, and writing the video stream data into a file block.
It will be appreciated by those skilled in the art that embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of a hardware embodiment, a software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, magnetic disk storage, optical storage, and the like) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of implementations of methods, apparatus (systems) and computer program products according to embodiments of the application. It will be understood that each block and/or flow of the flowchart illustrations and/or block diagrams, and combinations of blocks and/or flow diagrams in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart block or blocks and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart block or blocks and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart block or blocks and/or block diagram block or blocks.
The foregoing description is only of the preferred embodiments of the present application, and is not intended to limit the scope of the present application.

Claims (16)

1. A video storage method, wherein the method is applied to a first terminal, and the first terminal is provided with a recording service and a storage distribution service; the method comprises the following steps:
Receiving an optimal read-write service node identifier distributed by the storage distribution service in response to the recording service;
and receiving video stream data based on the storage configuration information of the camera channel, and sending the video stream data to the optimal read-write service node corresponding to the optimal read-write service node identifier, so that the optimal read-write service node writes the video stream data into a file block.
2. The method of claim 1, wherein prior to receiving the best read-write service node identification assigned by the storage distribution service, the method comprises:
if the camera channel is not the best read-write service node allocated for the first time and the resource usage weight of the last best read-write service node allocated for the last time is equal to a preset resource threshold, determining the best read-write service node in the rest read-write service nodes except the last best read-write service node allocated for the last time through the storage distribution service.
3. The method of claim 2, wherein the determining, by the storage distribution service, the best read-write service node among remaining read-write service nodes other than the last allocated best read-write service node comprises:
Determining respective resource use weights of the remaining read-write service nodes through the storage distribution service;
and determining the read-write service node corresponding to the minimum resource use weight in the resource use weights of the rest read-write service nodes as the optimal read-write service node.
4. The method of claim 3, wherein said determining, by the storage distribution service, respective resource usage weights for the remaining read-write service nodes comprises:
acquiring respective resource use conditions of the remaining read-write service nodes through the storage distribution service; wherein the resource usage includes at least one influencing factor; the influencing factors comprise disk utilization rate, network bandwidth occupancy rate, central Processing Unit (CPU) utilization rate, memory occupancy rate and used storage space;
and calculating the respective resource use weight of the residual read-write service nodes according to the resource use condition, the weight corresponding to the influence factor, a preset influence factor threshold and the preset resource threshold.
5. The method of claim 1, wherein prior to receiving the best read-write service node identification assigned by the storage distribution service, the method comprises:
And if the camera channel is the best read-write service node allocated for the first time, determining the best read-write service node in all read-write service nodes through the storage distribution service.
6. The method of claim 1, wherein the first terminal is deployed with a query service; the storage configuration information based on the camera channel receives video stream data and sends the video stream data to an optimal read-write service node corresponding to the optimal read-write service node identifier, so that after the optimal read-write service node writes the video stream data into a file block, the method comprises the following steps:
responding to the query service, and sending a query request to the optimal read-write service node;
receiving video segment information queried by the optimal read-write service node according to the query request; the video segment information comprises a camera channel identifier, the optimal read-write service node identifier, video starting time, video duration and the number of fragments.
7. The method of claim 6, wherein the first terminal is deployed with a playback service; the storage configuration information based on the camera channel receives video stream data and sends the video stream data to an optimal read-write service node corresponding to the optimal read-write service node identifier, so that after the optimal read-write service node writes the video stream data into a file block, the method comprises the following steps:
Responding to the playback service, and sending a video segment reading request to the optimal read-write service node;
and receiving the corresponding video segment which is read by the optimal read-write service node according to the video segment reading request, and sending the video segment to a client.
8. The method according to claim 1, wherein the storage configuration information based on the camera channel receives video stream data and sends the video stream data to the best read-write service node corresponding to the best read-write service node identifier, so that before the best read-write service node writes the video stream data into a file block, the method includes:
generating a node record corresponding to the optimal read-write service node through the storage distribution service, and sending the node record to a database; the node record comprises a camera channel identifier, an allocation starting time, an allocation ending time and the optimal read-write service node identifier.
9. The method according to claim 1, wherein the sending the video stream data to the best read-write service node corresponding to the best read-write service node identifier comprises:
Packaging the video stream data to obtain video fragments;
and sending the video fragments to the optimal read-write service node.
10. The video storage method is characterized by being applied to a second terminal, wherein a read-write service node is deployed on the second terminal; the method comprises the following steps:
responding to a storage distribution service, and sending the resource use condition of the read-write service node to the storage distribution service so that the storage distribution service determines an optimal read-write service node according to the resource use condition; wherein the optimal read-write service node is one of the read-write service nodes;
and receiving video stream data sent by the recording service based on the optimal service node, and writing the video stream data into a file block.
11. The method of claim 10, wherein the method comprises, prior to receiving video stream data sent by a recording service based on the best serving node and writing the video stream data to a file block:
formatting is carried out through the read-write service node, and a file block is created;
generating a file block record according to the file block identifier and the state of the file block, and sending the file block record to a database.
12. A first terminal, wherein the first terminal is deployed with a recording service and a storage distribution service; the first terminal comprises a first receiving unit and a first transmitting unit,
the first receiving unit is used for responding to the recording service and receiving the best read-write service node identification distributed by the storage distribution service;
the first sending unit is configured to receive video stream data based on storage configuration information of a camera channel, and send the video stream data to an optimal read-write service node corresponding to the optimal read-write service node identifier, so that the optimal read-write service node writes the video stream data into a file block.
13. A second terminal, characterized in that the second terminal is deployed with a read-write service node; the second terminal comprises a second transmitting unit and a second receiving unit,
the second sending unit is used for responding to a storage distribution service and sending the resource use condition of the read-write service node to the storage distribution service so that the storage distribution service determines the optimal read-write service node according to the resource use condition; wherein the optimal read-write service node is one of the read-write service nodes;
The second receiving unit is configured to receive video stream data sent by the recording service based on the best service node, and write the video stream data into a file block.
14. A first terminal comprising a first processor, a first memory storing instructions executable by the first processor, which when executed by the first processor, implement the method of any of claims 1-9.
15. A second terminal comprising a second processor, a second memory storing instructions executable by the second processor, which when executed by the second processor, implement the method of claim 10 or 11.
16. A computer readable storage medium, having stored thereon a program for use in a first terminal and a second terminal, the program, when executed by a first processor, implementing the method according to any of claims 1-9; the program, when executed by a second processor, implements the method of claim 10 or 11.
CN202210369973.7A 2022-04-08 2022-04-08 Video storage method, terminal and storage medium Pending CN116939132A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210369973.7A CN116939132A (en) 2022-04-08 2022-04-08 Video storage method, terminal and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210369973.7A CN116939132A (en) 2022-04-08 2022-04-08 Video storage method, terminal and storage medium

Publications (1)

Publication Number Publication Date
CN116939132A true CN116939132A (en) 2023-10-24

Family

ID=88376265

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210369973.7A Pending CN116939132A (en) 2022-04-08 2022-04-08 Video storage method, terminal and storage medium

Country Status (1)

Country Link
CN (1) CN116939132A (en)

Similar Documents

Publication Publication Date Title
US9781486B2 (en) RS-DVR systems and methods for unavailable bitrate signaling and edge recording
US20140165116A1 (en) Efficient assignment of program copies in a network digital video recorder
JPWO2012096372A1 (en) Content playback apparatus, content playback method, distribution system, content playback program, recording medium, and data structure
JP2008533816A5 (en)
CN104967862A (en) Video storage method and device, and video searching method and device
WO2014010501A1 (en) Playback device, playback method, distribution device, distribution method, distribution program, playback program, recording medium, and metadata
US9942578B1 (en) Methods and apparatuses for a distributed live-on-demand (LOD) origin
CN103369351A (en) Streaming media fast-forward and fast-backward processing method, video server and system
EP1968318B1 (en) Distribution apparatus and playback apparatus
US20080063005A1 (en) Method and an apparatus for data streaming
CN111147869B (en) Video transcoding system and method based on distributed object storage
US20080068993A1 (en) Method and an apparatus for data streaming
WO2011137681A1 (en) Method and apparatus for filing time shift slicing files and playing programs in an interactive personality television system
CN109194678B (en) Distributed streaming media service system based on redis message queue
CN116939132A (en) Video storage method, terminal and storage medium
JP2020113922A (en) Video distribution device, video distribution method, and program
JP6642016B2 (en) Distribution equipment and information equipment
CN116132698A (en) Content recording method, playing method, CDN system and storage medium
CN112449209B (en) Video storage method and device, cloud server and computer readable storage medium
KR101213153B1 (en) System and method for searching video data having simultaneous play function
CN106257461B (en) Data storage method and device
JP2019054505A (en) Video monitoring method, server, and video monitoring system
JP2005071373A (en) Method for seamlessly dividing and restoring data stream in real time
KR102367134B1 (en) Method for controlling accelerator and accelerator thereof
JP6862323B2 (en) Video recording device and video recording method

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