CN116437140A - Video frame storage method, device, edge terminal and storage medium - Google Patents
Video frame storage method, device, edge terminal and storage medium Download PDFInfo
- Publication number
- CN116437140A CN116437140A CN202310391162.1A CN202310391162A CN116437140A CN 116437140 A CN116437140 A CN 116437140A CN 202310391162 A CN202310391162 A CN 202310391162A CN 116437140 A CN116437140 A CN 116437140A
- Authority
- CN
- China
- Prior art keywords
- target
- video
- video frame
- annular groove
- event
- 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
Links
- 238000000034 method Methods 0.000 title claims abstract description 75
- 230000015654 memory Effects 0.000 claims abstract description 47
- 230000006870 function Effects 0.000 claims description 18
- 238000004590 computer program Methods 0.000 claims description 9
- 239000012634 fragment Substances 0.000 claims description 8
- 230000002829 reductive effect Effects 0.000 abstract description 11
- 238000010586 diagram Methods 0.000 description 14
- 230000014759 maintenance of location Effects 0.000 description 13
- 230000003139 buffering effect Effects 0.000 description 12
- 238000013473 artificial intelligence Methods 0.000 description 9
- 230000001960 triggered effect Effects 0.000 description 9
- 238000005516 engineering process Methods 0.000 description 7
- 238000004364 calculation method Methods 0.000 description 4
- 230000002035 prolonged effect Effects 0.000 description 3
- 238000013500 data storage Methods 0.000 description 2
- 230000036961 partial effect Effects 0.000 description 2
- 230000000717 retained effect Effects 0.000 description 2
- 238000006467 substitution reaction Methods 0.000 description 2
- 208000000044 Amnesia Diseases 0.000 description 1
- 208000026139 Memory disease Diseases 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 125000004122 cyclic group Chemical group 0.000 description 1
- 238000007405 data analysis Methods 0.000 description 1
- 230000007547 defect Effects 0.000 description 1
- 230000000670 limiting effect Effects 0.000 description 1
- 230000009225 memory damage Effects 0.000 description 1
- 230000006984 memory degeneration Effects 0.000 description 1
- 208000023060 memory loss Diseases 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 230000002441 reversible effect Effects 0.000 description 1
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N21/00—Selective content distribution, e.g. interactive television or video on demand [VOD]
- H04N21/40—Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
- H04N21/43—Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
- H04N21/433—Content storage operation, e.g. storage operation in response to a pause request, caching operations
- H04N21/4334—Recording operations
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N21/00—Selective content distribution, e.g. interactive television or video on demand [VOD]
- H04N21/80—Generation or processing of content or additional data by content creator independently of the distribution process; Content per se
- H04N21/83—Generation or processing of protective or descriptive data associated with content; Content structuring
- H04N21/845—Structuring of content, e.g. decomposing content into time segments
- H04N21/8456—Structuring of content, e.g. decomposing content into time segments by decomposing the content in the time domain, e.g. in time segments
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D10/00—Energy efficient computing, e.g. low power processors, power management or thermal management
Landscapes
- Engineering & Computer Science (AREA)
- Multimedia (AREA)
- Signal Processing (AREA)
- Television Signal Processing For Recording (AREA)
Abstract
The application relates to the field of memories and discloses a video frame storage method, a video frame storage device, an edge terminal and a storage medium. When determining that a target event occurs, determining a target video frame in a video stream according to a user selection instruction, and recording an index position written in a target annular groove; the user selection instruction is used for selecting a target video frame corresponding to a target time point or a target time period before and after the occurrence of the target event; reading a target video frame from the target annular groove according to the index position; and assembling the target video frames to generate and store video clips. According to the method and the device, only the video clips corresponding to the designated target time point or the target time period are stored, the number of video frames required to be read and written is reduced, the number of times of reading and writing of the memory is further reduced, the memory is prevented from executing high-strength reading and writing operation, and the damage probability of the memory caused by long-time reading and writing is reduced.
Description
Technical Field
The present disclosure relates to the field of memory technologies, and in particular, to a video frame storage method, a video frame storage device, an edge terminal, and a storage medium.
Background
With the development of machine vision technology, the application of artificial intelligence technology (i.e., AI technology) is becoming wider and wider, and the application coverage of the whole field is gradually realized. In the application process of the artificial intelligence technology, the traditional centralized artificial intelligence edge computing technical solution (i.e., AI edge computing technology) cannot meet the performance requirements of the existing application equipment on the aspects of speed, instantaneity and the like, and further has gradually transitioned into the distributed artificial intelligence edge computing technical solution in recent years.
At present, the artificial intelligence edge computing technical solution has a great defect in the problem of video disc-drop retention. Since the resources of the edge side device are limited, how to efficiently keep the video focused by the user in the limited resources becomes an important issue.
The existing video disc-falling retention scheme is to add a memory similar to an SD card or an SSD hard disc and the like in edge side equipment to store all video fragments in a certain time, but the method has high requirements on the size of the memory and the quality of the memory, the common memory is difficult to bear high-strength writing operation, and the memory is easy to damage due to the fact that the video is written in a long-time circulation mode, so that data is lost. Therefore, how to reduce or avoid the damage of the memory caused by long-time reading and writing is a problem to be solved.
Disclosure of Invention
In view of the above, in order to solve the problems in the prior art, the present application provides a video frame storage method, a device, an edge terminal and a storage medium.
In a first aspect, the present invention provides a video frame storage method applied to an edge terminal having a storage function, where the edge terminal is provided with at least one annular groove, and each annular groove is used for writing a video stream, the method includes:
when determining that a target event occurs, determining a target video frame in the video stream according to a user selection instruction, and recording an index position written in a target annular groove into the target video frame; the user selection instruction is used for selecting a target video frame corresponding to a target time point or a target time period before and after the occurrence of the target event;
reading a target video frame from the target annular groove according to the index position;
and assembling the target video frames to generate and store video clips.
In an alternative embodiment, the determining, according to a user selection instruction, a target video frame in the video stream, and recording an index position written in a target annular groove, where the target video frame is written, includes:
when the video stream is written, receiving a user selection instruction, and selecting a corresponding video frame from the video stream as a target video frame according to the user selection instruction;
and writing the target video frames into a target annular groove frame by frame, and recording the index positions of the target video frames in the target annular groove.
In an alternative embodiment, the method further comprises:
acquiring stored historical video clips corresponding to historical events of different event types;
calculating the video length of each type of historical video clips;
based on the video length, a corresponding size annular groove is predicted and created.
In an alternative embodiment, said predicting and creating a corresponding size annular groove based on said video length comprises:
according to the video length, respectively calculating the occupied space values of the historical video clips of different event types;
according to the occupied space value, predicting the space size of the annular groove required by different event types respectively;
an annular groove is created, wherein the spatial size of the annular groove is the largest of the spatial sizes of the annular grooves required for the different event types.
In an alternative embodiment, before the step of acquiring the stored historical video clips corresponding to the historical events of different event types, the method further includes:
pre-selecting a target time point or a target time period before and after the occurrence of the historical event as target time;
reading a video frame corresponding to the target time from a video stream containing a video clip corresponding to the historical event;
and assembling the video frames corresponding to the target time to generate a historical video clip, and storing the historical video clip.
In an alternative embodiment, after the assembling the target video frame to generate and store a video clip, the method further includes:
if the video stream is determined to have the same type or different types of events with the target event, recording the index position written into the target annular groove and corresponding to the video frame in the video stream;
and reading and assembling the corresponding video frames from the target annular groove according to the index position, and further generating corresponding video fragments for storage.
In an alternative embodiment, the method further comprises:
writing the target video frame into the target annular groove according to the clockwise direction, and registering a callback function; and the callback function is used for reading the target video frames cached in the target annular groove according to the anticlockwise direction.
In a second aspect, the present invention provides a video frame storage device comprising:
the recording module is used for determining a target video frame in the video stream according to a user selection instruction when determining that a target event occurs, and recording an index position written in a target annular groove into the target video frame; the user selection instruction is used for selecting a target video frame corresponding to a target time point or a target time period before and after the occurrence of the target event;
the reading module is used for reading the target video frame from the target annular groove according to the index position;
and the assembling module is used for assembling the target video frames to generate and store video clips.
In a third aspect, the present invention provides an edge terminal comprising a memory storing a computer program and at least one processor for executing the computer program to implement the video frame storage method as described above.
In a fourth aspect, the present invention provides a computer storage medium storing a computer program which, when executed, implements a video frame storage method according to the foregoing.
The embodiment of the application has the following beneficial effects:
the embodiment of the application provides a video frame storage method, which comprises the following steps: when determining that a target event occurs, determining a target video frame in the video stream according to a user selection instruction, and recording an index position written in the target video frame in a target annular groove; the user selection instruction is used for selecting a target video frame corresponding to a target time point or a target time period before and after the occurrence of the target event; reading a target video frame from the target annular groove according to the index position; and assembling the target video frames to generate and store video clips. According to the embodiment of the application, the video clips corresponding to the target time points or the target time periods, which are designated before and after the target event occurs, are subjected to the disc-dropping retention, so that the disc-dropping retention is not required for all the video clips corresponding to the whole process of the target event, the number of video frames required to be read and written is reduced, the number of times of reading and writing of the memory is further reduced, the memory is prevented from executing high-strength writing operation, the memory is further not required to circularly store videos for a long time, the damage probability of the memory caused by long-time reading and writing is reduced, the service life of the memory is prolonged, and meanwhile, the safety of the video frames stored in the memory is also improved.
Drawings
In order to more clearly illustrate the technical solutions of the present application, the drawings that are required for the embodiments will be briefly described, it being understood that the following drawings only illustrate some embodiments of the present application and therefore should not be considered as limiting the scope of protection of the present application. Like elements are numbered alike in the various figures.
Fig. 1 is a schematic diagram of a correspondence of an edge terminal in an embodiment of the present application when executing a video frame storage method;
FIG. 2 is a schematic diagram of a first process of annular groove writing video frames in an embodiment of the present application;
fig. 3 is a schematic diagram of a first implementation of a video frame storage method according to an embodiment of the present application;
fig. 4 is a schematic diagram illustrating a second implementation of a video frame storage method according to an embodiment of the present application;
FIG. 5 is a schematic diagram of a second process of annular groove writing video frames in an embodiment of the present application;
fig. 6 is a schematic diagram illustrating a third implementation of a video frame storage method according to an embodiment of the present application;
fig. 7 is a schematic diagram illustrating a fourth implementation of a video frame storage method according to an embodiment of the present application;
fig. 8 is a schematic diagram illustrating a fifth implementation of a video frame storage method according to an embodiment of the present application;
fig. 9 shows a schematic structural diagram of a video frame storage device according to an embodiment of the present application.
Detailed Description
The following description of the embodiments of the present application will be made clearly and completely with reference to the drawings in the embodiments of the present application, and it is apparent that the described embodiments are only some embodiments of the present application, not all embodiments.
The components of the embodiments of the present application, which are generally described and illustrated in the figures herein, may be arranged and designed in a wide variety of different configurations. Thus, the following detailed description of the embodiments of the present application, as provided in the accompanying drawings, is not intended to limit the scope of the application, as claimed, but is merely representative of selected embodiments of the application. All other embodiments, which can be made by those skilled in the art based on the embodiments of the present application without making any inventive effort, are intended to be within the scope of the present application.
In the following, the terms "comprises", "comprising", "having" and their cognate terms may be used in various embodiments of the present application are intended only to refer to a particular feature, number, step, operation, element, component, or combination of the foregoing, and should not be interpreted as first excluding the existence of or increasing the likelihood of one or more other features, numbers, steps, operations, elements, components, or combinations of the foregoing.
Furthermore, the terms "first," "second," "third," and the like are used merely to distinguish between descriptions and should not be construed as indicating or implying relative importance.
Unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as commonly understood by one of ordinary skill in the art to which various embodiments of this application belong. The terms (such as those defined in commonly used dictionaries) will be interpreted as having a meaning that is identical to the meaning of the context in the relevant art and will not be interpreted in an idealized or overly formal sense unless expressly so defined herein in connection with the various embodiments.
Edge computing refers to artificial intelligence algorithms that are handled locally on hardware devices, can process data without network connection, meaning that data creation, etc. can be done without streaming or in cloud data storage.
Example 1
The edge device can analyze whether the video stream triggers the occurrence of the event or not through the edge computing technology and related programs (such as an edge computing cache control program and the like), and can save the video corresponding to the event occurrence process in a disc-dropping mode. In the process of executing edge calculation by the edge device, for the occurrence process of an event, a user usually does not pay attention to all videos corresponding to the whole event occurrence process, but focuses on video clips corresponding to a certain time period before and after the occurrence of the event, and further when video clips are left, the video clips are not required to be left in a tray, so that the space of an internal memory is occupied, and the memory is damaged due to long-time reading and writing operations.
Based on the above, the embodiment of the application provides a video frame storage method, which is applied to an edge terminal with a storage function, and prevents a memory from being damaged due to long-time read-write operation by performing disc-dropping retention on a video segment corresponding to a target time point or a target time period.
As shown in fig. 1, the reservoirs inside the edge termination are provided with at least one annular groove (shown as groove 1, groove 2). Each annular groove is used for writing one path of video stream, so that the video stream is buffered (i.e. buffered), and corresponding video frames in the buffered video stream are conveniently stored (i.e. dropped disc is reserved).
In this embodiment, by using the characteristic that the read-write of the memory device hardly generates life loss, one or more annular grooves are created in the edge terminal with the storage function in the setting mode of the annular array buffer (i.e., ringBuffer) to buffer (i.e., write in) the relevant video segments of an event that may occur or has occurred in the future; one video clip contains one or more video frames.
Specifically, each annular groove is arranged in an annular data structure, and when each annular groove writes related video frames, video frames corresponding to adjacent moments are stored in an annular mode; and the annular groove can multiplex buffering (i.e., overwriting) multiple video frames in the same video stream. As shown in fig. 1 and 2, a plurality of video frames (such as illustrated frame x, frame y, frame z, etc.) are buffered in the annular groove, and index positions (i.e., position orientations) for buffering the respective video frames in the annular groove correspond to illustrated 0, 1, 2, …, 9 or slot [0], slot [1], …, slot [8].
Referring to fig. 3, the video frame storage method is described in detail below.
And S10, when the occurrence of the target event is determined, determining a target video frame in the video stream according to a user selection instruction, and recording the index position written in the target video frame in the target annular groove.
The video stream is processed as a steady and continuous stream through the network for recording various dynamic images. In this embodiment, the video stream is used to transmit dynamic images (i.e., videos) of the whole process of recording the occurrence of a plurality of events.
In this embodiment, when each path of video stream is written into a corresponding annular groove for buffering, a preset edge calculation buffer control program (i.e., an edge calculation program) is used to analyze and calculate a video stream including a complete occurrence process corresponding to when a plurality of events are triggered, so as to identify whether a target event is triggered in the video stream. That is, the images in each path of video stream are acquired and analyzed, and whether the video stream contains the image fragments triggering the occurrence of the target event and recording the whole process of the occurrence of the target event is judged.
The type and the number range of the target event are not limited, and the target event may be all events of different types or specified events of a certain type, and may be set correspondingly according to actual requirements, which is not limited herein.
Specifically, an edge computing program in the edge device analyzes each video stream written into the memory and starts a storage flow, if it is determined that a dynamic image recorded by the video stream meets a preset event triggering condition and a target event is set, the target event is an event of a certain type required to be concerned, whether the event is triggered in the video stream is correspondingly identified by the edge computing program, and when the event is confirmed to be triggered, the writing position of a video frame at a moment of interest in the event occurrence process is recorded.
In addition, when the triggering of the target event is identified by means of an artificial intelligence method (i.e., AI) or a sensor, the above-mentioned procedure of recording the writing position of the video frame at the time of interest of the target event is also started correspondingly. Wherein the target event identified by the artificial intelligence means (i.e., AI) or sensor corresponds to an AI event or sensor event.
It will be appreciated that each annular groove may be used to write all video frames contained in a video stream, and when it is determined that the video stream contains a video clip corresponding to the occurrence of a target event, the index position for writing the target video frame corresponding to the target event is recorded at the same time. Wherein, a video clip contains a plurality of video frames.
One or more video frames corresponding to the target event in the video stream record the whole process or partial process of the target event; the whole process of the target event comprises the steps of before, during and after the event.
It should be noted that, the event triggering condition may be set correspondingly according to the actual service requirement, which is not limited herein; for example, if the edge device is used for storing a dynamic image related to the interior of a certain parking lot, further, the types of events that can be triggered are various, for example, illegal parking, vehicle collision and the like can be set; if the event type is illegal parking, the corresponding setting event triggering condition may be that the dynamic image includes a picture with a parking prohibition sign, etc.
For example, in an actual application scenario such as a highway, if each street lamp pole on the highway is respectively provided with a camera and a velocimeter; the camera is used for collecting video pictures of all vehicles passing through and transmitting the video pictures to the edge equipment in a video stream form for buffering, the velocimeter can monitor the speed of all vehicles passing through, if the overspeed of the vehicles is monitored, an overspeed event is triggered, so that the edge equipment can find out the camera which is the same as the velocimeter in a lamp post according to the serial number of the velocimeter, locate an annular groove for buffering the video stream of the camera according to the serial number of the camera, and then can selectively read a target video frame corresponding to the overspeed event of the vehicles according to a preset target time period to generate video fragments and save the video fragments.
In addition, in this embodiment, each path of video stream may trigger the occurrence of multiple events of different event types simultaneously or in a time period, and specifically, trigger rules such as event trigger time, trigger mechanism, trigger mode and the like may be set correspondingly according to actual requirements, which is not limited herein. For example, it may be assumed that each video stream periodically triggers an event with a period of half an hour, where each event triggering manner may be a sensor direct trigger, or may be an artificial intelligence machine vision trigger, and the specific triggering manner may be determined according to a device or an application program in an actual application scenario.
In one embodiment, as shown in fig. 4, step S10 further includes the following steps:
s11, when the video stream is written, receiving a user selection instruction, and selecting a corresponding video clip from the video stream as a target video frame according to the user selection instruction.
And S12, writing the target video frames into the target annular groove frame by frame, and recording the index position of the target video frames in the target annular groove.
After confirming that the related video stream has the triggering target event (namely, after confirming that the target event occurs), video fragments recorded with the whole process or partial process of the target event can be subjected to disc-dropping and storage according to a user selection instruction. Further, in this embodiment, the video frame of the written time point or time period related to the occurrence process of the target event is read from the set annular groove according to the user's requirement, so as to perform the disc-drop retention.
First, the video stream is written into the corresponding annular groove for buffering. And further, in the video stream writing process, receiving a user selection instruction, determining a video frame corresponding to a corresponding time point or time period from the video stream triggering the occurrence of the target event according to the user selection instruction, marking the video frame as a target video frame, and recording the index position of the target video frame written in the target annular groove when the target video frame is written in the target annular groove.
It should be noted that, the user selection instruction is used for indicating that the selection of the target video frame corresponding to the target time point or the target time period before and after the occurrence of the target event. For example, a corresponding video frame may be selected that is within one minute before the occurrence of the target event and two minutes in the occurrence of the target event; or may be all video frames in which the entire process of occurrence of the target event is to be recorded.
It is worth noting that all video frames corresponding to the whole process of the target event occurrence are buffered in the annular groove. That is, in the present embodiment, all video frames included in the video stream are written into the corresponding annular grooves frame by frame.
As an alternative implementation manner, each annular groove is preset to store video clips corresponding to all events in one video stream. And each annular groove is continuously written into video frames in the corresponding video stream, and when the annular groove is full, the buffered video frames are continuously covered in an overwriting mode, so that the cyclic writing of the annular groove is realized.
In addition, in one embodiment, each video frame in the video stream is written into the target annular groove in a clockwise direction when the video stream is written. After writing target video frames into a target annular groove frame by frame in a clockwise direction, registering a callback function at the same time; and subsequently, the target video frames cached in the target annular groove can be sequentially read according to the anticlockwise direction through the callback function, so that the searching efficiency and the reading efficiency of the target video frames are improved.
For example, as shown in fig. 5, if it is determined that the K-type event is triggered, all video frame data of the K-type event is buffered in a clockwise direction through preset configuration parameters of the K-type event (i.e., a target time point required to be set by the K-type event and a target video frame corresponding to the target time point), and an index position of a target video frame in an annular groove is recorded at the same time, and then the callback function is executed to read the target video frame data. Specifically, if the user is concerned about m frames of audio/video data before the occurrence of the K-type event and n frames of audio/video data after the occurrence of the K-type event, registering a callback function and recording index positions written in m frames of audio/video data before the occurrence of the K-type event and n frames of audio/video data after the occurrence of the K-type event when buffering video frames of the K-type event; all target video frames (i.e., m+n frames of data) buffered in the annular groove are then read in a counter-clockwise direction by executing a callback function.
And S20, reading the target video frame from the target annular groove according to the index position.
After the target video frame is written into the target annular groove for buffering, the target video frame buffered at the corresponding position in the target annular groove can be read out later.
In the present embodiment, the position of the written target video frame in the target annular groove is determined according to the recorded index position, so that the buffered target video frame is read at the corresponding position.
In addition, since the annular groove can overwrite a plurality of video frames, in order to ensure that the target video frames are not covered, all target video frames are read from the target annular groove immediately after the completion of buffering all target video frames corresponding to the target event is determined.
S30, assembling the target video frames to generate and store video clips.
And assembling the target video frames read from the target annular groove to form a video clip, and storing the video clip to realize the disc-falling retention of the video clip corresponding to the target event. The storage mode can be that the generated video clips are uploaded to a cloud server or stored in a preset storage area in a memory for disc placement and storage.
As an alternative embodiment, as shown in fig. 6, after step S30, the present embodiment further includes the following steps:
s41, if the event of the same type or different types with the target event occurs in the video stream, recording the index position of the corresponding video frame written in the video stream in the target annular groove.
S42, reading and assembling the corresponding video frames from the target annular groove according to the index position, and further generating corresponding video clips for storage.
Optionally, after the target video frame corresponding to the target event is read and assembled into a video clip for disc-dropping and storage, the video frame corresponding to the rest events in the same video stream can be continuously rewritten by the target annular groove. Wherein the remaining events may be the same type of event as the target event or different types of events; and similarly, when video clips of a certain target time point or a certain target time period which are required to be concerned corresponding to the event are written into the target annular groove frame by frame, the index position of the video clips is recorded, so that the target video frames of the event can be conveniently read later, the target video frames are assembled to generate the video clips, and the video clips are stored.
It can be understood that in this embodiment, each annular groove may sequentially write the target video frames corresponding to all events in the corresponding video stream, and further, the assembly and storage processing may be performed after buffering all the target video frames corresponding to the events.
In an embodiment, as shown in fig. 7, the embodiment of the present application further specifically includes the following steps:
s51, acquiring stored historical video clips corresponding to the historical events of different event types.
S52, calculating the video length of each type of historical video clips.
And S53, predicting and creating the annular groove with the corresponding size based on the video length.
In an embodiment, the historical video clips stored in the tray may include all video frames corresponding to the whole process of the historical event, or may be target video frames corresponding to the historical event selected by the user. Furthermore, the size of the annular groove can be correspondingly estimated and set according to the video length of the historical video clip, so that the annular groove can be used for writing all target video frames in the historical video clip corresponding to the event type without being overwritten.
Further, the video length corresponding to each historical video segment of the same event type is calculated, the video lengths of various historical videos are classified, and an average value or a median value can be correspondingly taken from the video length values and used as the video length of the standard corresponding to the event type.
Optionally, the video length of the video clip recorded corresponding to each event may be preset autonomously (i.e. preset the video length of the standard corresponding to the event type), and when the video clip corresponding to the event is stored, the video clip of the preset corresponding video length is stored; it can be understood that the video length of each historical video clip corresponding to the same event type written by the edge device is the same; the specific set value of the video length is not limited herein.
According to the video length of the standard corresponding to different event types, the space size of the annular groove used for writing in different event types is predicted, the maximum value is selected as the space size of the created annular groove, and therefore, when the annular groove is written in the target video frame of a certain event, all the target video frames corresponding to the event are not overwritten, the situation that the number of target video frames read subsequently is incomplete, so that complete video fragments required by non-disc-falling retention are caused, and the subsequent data analysis and processing are affected is avoided.
In one embodiment, as shown in fig. 8, step S53 specifically includes the following steps:
s531, according to the video length, the occupied space values of the historical video clips of different event types are calculated respectively.
S532, the space size of the annular groove required by different event types is respectively predicted according to the occupied space value.
S533, creating an annular groove.
Specifically, the required occupancy space values for the video lengths corresponding to the historical video clips of different event types are different. The occupied space value is the space size required for storing the historical video clips. In this embodiment, the space occupation value (i.e. the space size) required for storing the historical video clips corresponding to the event types is calculated by the video lengths of the historical video clips corresponding to the event types (i.e. the video lengths of the standards corresponding to the event types).
Further, according to the space occupation value required by the historical video clips corresponding to each event type, the space size required by the annular groove for storing (i.e. writing) the video clip of the event type can be correspondingly predicted, and then the maximum value is selected as the space size required by the created annular groove or grooves, and then the video frames contained in the video clip corresponding to one event type are correspondingly written through the created annular groove or grooves. In addition, the space size of the created annular groove may be the maximum value of the space sizes of the annular grooves required for different event types or more; that is, it is ensured that all target video frames corresponding to all events can be written in one time by the created annular groove, and all target video frames corresponding to the events are not overwritten.
In this embodiment, video clips corresponding to a plurality of target events in different video streams are buffered in different annular grooves, one path of video stream is correspondingly written into one annular groove, and then video frames buffered (i.e. written) in the same annular groove are read by adopting a reading mode of an annular array, so that quick positioning and reading of video frames corresponding to a certain target time point or a certain target time period are realized, the time complexity of positioning the video frames is only O (1), and the positioning and reading efficiency of the target video frames are correspondingly improved.
As a preferred solution, the obtained historical video clip may be a target video frame corresponding to the historical event selected by the user. That is, in the process of writing all video frames corresponding to the history event, a target time point or a target time period before and after the occurrence of the history event is selected in advance as a target time. Then, a video frame corresponding to the target time is determined from the video stream containing the video clip corresponding to the historical event. After the video frames corresponding to the target time are determined to be buffered, the buffered video frames corresponding to the target time are read, assembled to generate a historical video clip, and the historical video clip is stored subsequently.
Further, the minimum space of the annular groove for storing the historical event is the maximum space required when all the target video frames corresponding to the historical event are annularly written without covering the target video frames. That is, if all the target video frames corresponding to a certain event are continuous and adjacent video frames, then after the target video frames in the history video clip are written in sequence, the video frames currently buffered at each position in the annular groove can be read in sequence.
As an alternative embodiment, in this step, the target time corresponding to the same event type and the target time point or the target time period corresponding to the user selection instruction received subsequently according to the event of the event type may be equal. Furthermore, it can be understood that the video frames of the corresponding time nodes corresponding to the required landing disc are preset, when the event or the event corresponding to the event type is written in the video frame again, the index position of the target video frame written in the target annular groove can be automatically recorded, and the subsequent processing flow is triggered, so that the subsequent processing flow can be triggered without receiving a user selection instruction any more, the processing flow is correspondingly simplified, and the video frame reading and writing efficiency of the memory is improved.
The video frame storage method provided in this embodiment and the video frame writing and reading processes and the annular groove creation process related thereto will be described in detail with reference to an actual application example.
Illustratively, the present embodiment predicts the size of space required for the annular groove by the user setting the video length stored for each type of event. For example, if it is assumed that the target event of interest is an event of the type "high altitude parabolic" and the user has selected to store a 1 minute video (i.e., floor evidence for the purpose of retaining high altitude parabolic) of the event of the high altitude parabolic event; if the code rate of the video clips of the event is 500kbps, the total space size of the annular groove for buffering the event needs to be set to 29Mb; the specific calculation process comprises the following steps: (1 x 60 x 500)/1024=29 Mb.
In the present embodiment, a target video frame is written in the created corresponding annular groove; and then reading out the target video frames buffered in the target annular groove according to the reading mode of the annular array, assembling the target video frames into video clips for storage, releasing the storage space of the edge equipment, and writing in the video clips corresponding to a plurality of events.
By way of example, assume that 3 video streams are analyzed simultaneously by an edge computation program, each video stream having a code rate of 500kbps. If the video frame is processed according to the existing video clip storage mode (i.e. the video clip corresponding to the whole process of the complete occurrence of the drop disc retention recording event), the video frame is continuously retained for 24 hours a day, and a memory space (i.e. the space size) of 124GB is required, and the corresponding calculation process is as follows:
((60*60*24*500/1024)/1024)*3GB=124GB。
if the edge device has a memory (e.g., a memory card, i.e., an SD card) with a size of 16GB, which needs to be rewritten 8 times a day, the time of year will be about 2920 times, and obviously, the number of times of rewriting is far beyond the rewriting life of the common SD card in the market, so that the video frame writing manner easily causes the loss of the SD card.
By the video frame storage method provided by the embodiment, it is assumed that each event only selects a video clip of 3 minutes before and after the event occurs to carry out the disc-drop storage, which requires about 0.26GB of memory space, that is to say, about 0.26GB of memory space is required, so that the problem of memory damage caused by the read-write operation when the event of about 3 paths of streams corresponds to the video frame disc-drop storage can be solved. The memory space is specifically calculated as follows:
(((60*500*3)/1024)/1024)*3GB=0.26GB。
therefore, in this embodiment, by selecting a target time point or a video segment within a target time period corresponding to the occurrence of a target event to perform disc-drop retention, only a small memory space is used to effectively buffer and read video frames, so that the problem of memory loss caused by writing and reading operations of video frames of a multi-path video stream can be avoided, and the service life of the memory can be prolonged.
According to the embodiment of the application, on one hand, when the annular groove is arranged to buffer the video frames in an overwriting mode, the memory space required by buffering is correspondingly reduced, and when the target video frames are read out, spliced to generate video clips to be stored in a memory or uploaded to a cloud server, the required memory space is correspondingly reduced; on the other hand, by only carrying out the disc-dropping retention on the video clips corresponding to the target time points or the target time periods which are appointed before and after the occurrence of the target event, therefore, the disc-dropping retention is not required to be carried out on all the video clips corresponding to the occurrence process of the target event, the number of video frames required to be read and written is reduced, the number of times of reading and writing of a memory is further reduced, the memory is prevented from carrying out high-strength writing operation, further, the video is not required to be circularly written for a long time, the damage probability of the memory caused by long-time reading and writing is reduced, and the security of the video frames which are retained in the memory by the disc-dropping is improved. Therefore, the embodiment of the application solves the problem of damage of the memory caused by long-time reading and writing with extremely low cost; and the target video frames written in the annular groove are extracted and assembled into video clips for storage, so that the long-acting disc-falling retention of the video clips corresponding to the target events is realized, and the service life of the memory can be prolonged to a certain extent within a proper writing frequency range.
Example 2
Referring to fig. 9, an embodiment of the present application provides a video frame storage device, which includes:
a recording module 91, configured to determine, according to a user selection instruction, a target video frame in a video stream when it is determined that a target event occurs, and record an index position written in a target annular groove into the target video frame; the user selection instruction is used for selecting a target video frame corresponding to a target time point or a target time period before and after the occurrence of the target event;
a reading module 92, configured to read a target video frame from the target annular groove according to the index position;
an assembling module 93, configured to assemble the target video frame to generate and store a video clip.
The video frame storage device described above corresponds to the video frame storage method of the above embodiment; any of the alternatives in the above embodiments are also applicable to the present embodiment and will not be described in detail here.
The embodiment of the application also provides a computer device, which comprises a memory and at least one processor, wherein the memory stores a computer program, and the processor is used for executing the computer program to implement the video frame storage method of the embodiment.
The memory may include a program storage area and a data storage area, wherein the program storage area may store an operating system, at least one application program required for a function; the storage data area may store data (such as video frames, etc.) created from the use of the computer device, and so on. In addition, the memory may include high-speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid-state storage device.
The present application also provides a computer storage medium storing computer-executable instructions that, when invoked and executed by a processor, cause the processor to perform the steps of the video frame storage method of the above embodiments.
In the several embodiments provided in this application, it should be understood that the disclosed apparatus and method may be implemented in other manners as well. The apparatus embodiments described above are merely illustrative, for example, of the flow diagrams and block diagrams in the figures, which illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods and computer program products according to various embodiments of the present application. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
In addition, functional modules or units in the embodiments of the present application may be integrated together to form a single part, or each module may exist alone, or two or more modules may be integrated to form a single part.
The functions, if implemented in the form of software functional modules and sold or used as a stand-alone product, may be stored in a computer-readable storage medium. Based on such understanding, the technical solution of the present application may be embodied essentially or in a part contributing to the prior art or in a part of the technical solution, in the form of a software product stored in a storage medium, comprising several instructions for causing a computer device (which may be a smart phone, a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in the embodiments of the present application. And the aforementioned storage medium includes: a hard disk, a removable hard disk, a usb disk, a Read-only memory (ROM), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
The foregoing is merely specific embodiments of the present application, but the scope of the present application is not limited thereto, and any person skilled in the art can easily think about changes or substitutions within the technical scope of the present application, and the changes and substitutions are intended to be covered by the scope of the present application.
Claims (10)
1. A video frame storage method, applied to an edge terminal having a storage function, the edge terminal being provided with at least one annular groove, each of the annular grooves being for writing a video stream, the method comprising:
when determining that a target event occurs, determining a target video frame in the video stream according to a user selection instruction, and recording an index position written in a target annular groove into the target video frame; the user selection instruction is used for selecting a target video frame corresponding to a target time point or a target time period before and after the occurrence of the target event;
reading a target video frame from the target annular groove according to the index position;
and assembling the target video frames to generate and store video clips.
2. The video frame storage method according to claim 1, wherein determining a target video frame in the video stream and recording an index position written in a target annular groove into the target video frame according to a user selection instruction comprises:
when the video stream is written, receiving a user selection instruction, and selecting a corresponding video frame from the video stream as a target video frame according to the user selection instruction;
and writing the target video frames into a target annular groove frame by frame, and recording the index positions of the target video frames in the target annular groove.
3. The video frame storage method of claim 1, wherein the method further comprises:
acquiring stored historical video clips corresponding to historical events of different event types;
calculating the video length of each type of historical video clips;
based on the video length, a corresponding size annular groove is predicted and created.
4. A video frame storage method according to claim 3, wherein said predicting and creating a corresponding size annular groove based on said video length comprises:
according to the video length, respectively calculating the occupied space values of the historical video clips of different event types;
according to the occupied space value, predicting the space size of the annular groove required by different event types respectively;
an annular groove is created, wherein the spatial size of the annular groove is the largest of the spatial sizes of the annular grooves required for the different event types.
5. The video frame storage method according to claim 3, further comprising, before said acquiring the stored historical video clips corresponding to the historical events of different event types:
pre-selecting a target time point or a target time period before and after the occurrence of the historical event as target time;
reading a video frame corresponding to the target time from a video stream containing a video clip corresponding to the historical event;
and assembling the video frames corresponding to the target time to generate a historical video clip, and storing the historical video clip.
6. The video frame storage method of claim 1, further comprising, after said assembling said target video frame to generate and store a video clip:
if the video stream is determined to have the same type or different types of events with the target event, recording the index position written into the target annular groove and corresponding to the video frame in the video stream;
and reading and assembling the corresponding video frames from the target annular groove according to the index position, and further generating corresponding video fragments for storage.
7. The video frame storage method according to any one of claims 1 to 6, further comprising:
writing the target video frame into the target annular groove according to the clockwise direction, and registering a callback function; and the callback function is used for reading the target video frames cached in the target annular groove according to the anticlockwise direction.
8. A video frame storage device, comprising:
the recording module is used for determining a target video frame in the video stream according to a user selection instruction when determining that a target event occurs, and recording an index position written in a target annular groove into the target video frame; the user selection instruction is used for selecting a target video frame corresponding to a target time point or a target time period before and after the occurrence of the target event;
the reading module is used for reading the target video frame from the target annular groove according to the index position;
and the assembling module is used for assembling the target video frames to generate and store video clips.
9. An edge terminal comprising a memory storing a computer program and at least one processor for executing the computer program to implement the video frame storage method of any one of claims 1-7.
10. A computer storage medium, characterized in that it stores a computer program which, when executed, implements the video frame storage method according to any one of claims 1-7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310391162.1A CN116437140A (en) | 2023-04-12 | 2023-04-12 | Video frame storage method, device, edge terminal and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310391162.1A CN116437140A (en) | 2023-04-12 | 2023-04-12 | Video frame storage method, device, edge terminal and storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN116437140A true CN116437140A (en) | 2023-07-14 |
Family
ID=87084968
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202310391162.1A Pending CN116437140A (en) | 2023-04-12 | 2023-04-12 | Video frame storage method, device, edge terminal and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN116437140A (en) |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN117931098A (en) * | 2024-03-22 | 2024-04-26 | 江西云眼视界科技股份有限公司 | Edge side event storage method, system, storage medium and computer |
CN118646893A (en) * | 2024-08-19 | 2024-09-13 | 山东云海国创云计算装备产业创新中心有限公司 | A video data processing method, product, device and storage medium |
WO2025043615A1 (en) * | 2023-08-31 | 2025-03-06 | 京东方科技集团股份有限公司 | Display control method and apparatus, vehicle-mounted display system, and storage medium |
-
2023
- 2023-04-12 CN CN202310391162.1A patent/CN116437140A/en active Pending
Cited By (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2025043615A1 (en) * | 2023-08-31 | 2025-03-06 | 京东方科技集团股份有限公司 | Display control method and apparatus, vehicle-mounted display system, and storage medium |
CN117931098A (en) * | 2024-03-22 | 2024-04-26 | 江西云眼视界科技股份有限公司 | Edge side event storage method, system, storage medium and computer |
CN117931098B (en) * | 2024-03-22 | 2024-06-07 | 江西云眼视界科技股份有限公司 | Edge side event storage method, system, storage medium and computer |
CN118646893A (en) * | 2024-08-19 | 2024-09-13 | 山东云海国创云计算装备产业创新中心有限公司 | A video data processing method, product, device and storage medium |
CN118646893B (en) * | 2024-08-19 | 2025-01-03 | 山东云海国创云计算装备产业创新中心有限公司 | Video data processing method, product, equipment and storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN116437140A (en) | Video frame storage method, device, edge terminal and storage medium | |
CA2632738C (en) | Memory management in event recording systems | |
JP2017033554A (en) | Video data analysis method and device, and parking place monitoring system | |
US20060015888A1 (en) | Method of searching for clip differences in recorded video data of a surveillance system | |
CN107229418B (en) | Video file storage method and device | |
CN107566768A (en) | Video recording method and device | |
US20140280387A1 (en) | System and method for expanding storage space of network device | |
US20130162818A1 (en) | Method, system, computer program product and computer-readable recording medium for object tracking | |
US11277589B2 (en) | Image recording system | |
KR20200046249A (en) | Method and apparatus for removing hidden data based on auto-regressive generative model | |
KR101743411B1 (en) | Method and apparatus for data access | |
CN114363670A (en) | Video reading method, device, equipment and storage medium | |
US20220414382A1 (en) | Site-Based Calibration of Object Detection Parameters | |
CN114339367A (en) | Video frame processing method, device and equipment | |
CN113903105A (en) | Video circulating storage method and device, electronic equipment and storage medium | |
CN116630825A (en) | Satellite remote sensing data and monitoring video fusion method and system | |
CN112367478A (en) | Tunnel robot panoramic image processing method and device | |
CN118400499B (en) | Surveillance video synthesis method and surveillance video processing system | |
CN114852057A (en) | Automatic parking data acquisition method and device, computer equipment and storage medium | |
US20160037119A1 (en) | Video recording apparatus, and video recording method when temporary network failure occurs | |
JP7494474B2 (en) | Recording control device, recording control method, and program | |
JP7480502B2 (en) | Recording device, recording method, and program | |
US10885343B1 (en) | Repairing missing frames in recorded video with machine learning | |
KR20120118789A (en) | Image recorder and overwriting method thereof | |
CN112905821B (en) | Image display method, device, equipment and storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |