CN114003763A - Method and device for storing video data and readable storage medium - Google Patents

Method and device for storing video data and readable storage medium Download PDF

Info

Publication number
CN114003763A
CN114003763A CN202111169753.1A CN202111169753A CN114003763A CN 114003763 A CN114003763 A CN 114003763A CN 202111169753 A CN202111169753 A CN 202111169753A CN 114003763 A CN114003763 A CN 114003763A
Authority
CN
China
Prior art keywords
code stream
index information
frame
frame index
written
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
CN202111169753.1A
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.)
Zhejiang Dahua Technology Co Ltd
Original Assignee
Zhejiang Dahua Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Zhejiang Dahua Technology Co Ltd filed Critical Zhejiang Dahua Technology Co Ltd
Priority to CN202111169753.1A priority Critical patent/CN114003763A/en
Publication of CN114003763A publication Critical patent/CN114003763A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/70Information retrieval; Database structures therefor; File system structures therefor of video data
    • G06F16/71Indexing; Data structures therefor; Storage structures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/70Information retrieval; Database structures therefor; File system structures therefor of video data
    • G06F16/78Retrieval characterised by using metadata, e.g. metadata not derived from the content or metadata generated manually
    • G06F16/7867Retrieval characterised by using metadata, e.g. metadata not derived from the content or metadata generated manually using information manually generated, e.g. tags, keywords, comments, title and artist information, manually generated time, location and usage information, user ratings
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N5/00Details of television systems
    • H04N5/76Television signal recording

Abstract

The application discloses a method and a device for storing video data and a readable storage medium, which are used for solving the problem that a storage space is occupied by a video data file due to a hollow frame in the prior art. The method comprises the following steps: writing a code stream frame in the current code stream data set, and determining the code stream length of the current code stream data set; judging whether a new I frame index information set is written or not based on the code stream length of the current code stream data set and the preset code stream length and by combining the code stream length of the code stream frame to be written; if yes, generating a new I frame index information set and writing the new I frame index information set; and if not, writing the code stream to be written in. According to the method, the preset code stream length is combined with the code stream length of the code stream frame to be written, and the writing position of the I frame index information set in the video data piece is flexibly adjusted, so that empty frames in the video data file are avoided, and the storage space occupied by the video file is saved.

Description

Method and device for storing video data and readable storage medium
Technical Field
The present application relates to the field of video storage, and in particular, to a method and an apparatus for storing video data, and a readable storage medium.
Background
The core function of a Network Video Recorder (NVR) is to store video data files collected by a front-end encoder. Video data is in units of a bitstream frame, which is composed of I frames, P frames, and B frames. Wherein, an I frame can independently decode a complete image without depending on other frames, and P frame and B frame can decode a complete image only depending on adjacent I frame.
In the process of storing a video data file in a hard disk, in addition to writing a bitstream frame, all I frame index information in the bitstream frame, i.e. an I frame index information set, needs to be written for fast playback positioning. The I frame index information records the specific position of the corresponding I frame in the code stream frame, the code stream length of the I frame and the time information of the I frame.
In the video playback process, when a user needs to position a video at a certain time point, the video data at the time point can be conveniently found according to the I frame index information in the I frame index information set, and the video data does not need to be found by traversing the whole video data file. Therefore, a video data file is constructed based on the bitstream frames and the I-frame index information.
In the prior art, an I-frame index information set records I-frame index information of an I-frame in a subsequent code stream data set and a writing position of a next I-frame index information set. Therefore, the position of the set of I-frame index information in the video data file is determined. When the code stream length of the code stream frame to be written exceeds the residual space between the current code stream data set and the next I frame index information set, the I frame to be written cannot be written, and a null frame with the size consistent with the residual space is inserted. The insertion of the empty frame can ensure that the video data file is not interrupted, but the existence of the empty frame increases the code stream length of the video data file, so that the storage space occupied by the video data file is increased.
Disclosure of Invention
The invention provides a method and a device for storing video data and a readable storage medium, which can accurately position when playing back a video data file and avoid writing in empty frames.
In a first aspect, to solve the above technical problem, the present invention provides a method for storing video data, including:
writing a code stream frame in a current code stream data set, and determining the code stream length of the current code stream data set; wherein, the current code stream data set comprises at least one code stream frame;
judging whether a new I frame index information set is written or not based on the code stream length of the current code stream data set and a preset code stream length and in combination with the code stream length of a code stream frame to be written;
if so, generating and writing a new I frame index information set based on the position information of the last written I frame index information set and the I frame in the current code stream data set, wherein the I frame index information set is used for recording the I frame index information of all I frames in the corresponding code stream data set and the position information of the adjacent last I frame index information set;
and if not, writing the code stream frame to be written in.
According to the method, the code stream frame in the video data file can be accurately positioned, and meanwhile, the insertion of invalid empty frames is avoided, so that the situation that the storage space is excessively occupied due to the fact that invalid data are written in the video data file is avoided.
A possible implementation manner, where the determining whether to write a new I-frame index information set based on the code stream length of the current code stream data set and a preset code stream length in combination with the code stream length of a code stream frame to be written includes:
when the sum of the code stream length of the current code stream data set and the code stream length of the code stream frame to be written is greater than or equal to a preset code stream length, determining the absolute value of the difference value between the code stream length of the current code stream data set and the preset code stream length as a first difference value;
determining the sum of the code stream length of the current code stream data set and the code stream length of the code stream frame to be written, wherein the absolute value of the difference value between the sum and the preset code stream length is a second difference value;
and judging whether a new I frame index information set is written or not according to whether the first difference value is smaller than or equal to the second difference value or not.
In a possible implementation manner, the position information of the previous adjacent I frame index information set is the code stream lengths of all code stream data sets before the previous adjacent I frame index information set; and if the new I frame index information set is the first I frame index information set in the video data file, the position information of the adjacent last I frame index information set of the I frame index information set is 0.
A possible implementation manner, after writing the to-be-written code stream, includes:
when the video data file which is abnormally closed is reprocessed, the current code stream data set is analyzed, and unwritten code stream frames and the corresponding I frame index information set are continuously written at the end of the current code stream data set.
A possible implementation manner, after generating and writing the new I-frame index information set based on the position information of the last written I-frame index information set and the I-frame in the current code stream data set, includes:
when a video data file is played back, sequentially reading each I frame index information set at the end of the video data file;
and positioning and playing back the video data file according to all the I frame index information in the video data file.
In a second aspect, the present application provides an apparatus for storing video data, the apparatus comprising:
a determination unit: the device is used for writing a code stream frame in a current code stream data set and determining the code stream length of the current code stream data set; wherein, the current code stream data set comprises at least one code stream frame;
a judging unit: the device is used for judging whether a new I frame index information set is written or not based on the code stream length of the current code stream data set and a preset code stream length and in combination with the code stream length of a code stream frame to be written;
a writing unit: the device comprises a code stream data set and a storage unit, wherein the code stream data set is used for storing I frame index information of all I frames in the code stream data set and position information of an adjacent previous I frame index information set; and writing the code stream frame to be written in when judging that a new I frame index information set is not written in.
In one possible implementation, the apparatus further includes:
and the repair unit is used for analyzing the current code stream data set when the abnormally closed video data file is reprocessed, and continuously writing the unwritten code stream frames and the corresponding I frame index information set at the end of the current code stream data set.
In one possible implementation, the apparatus further includes:
the reading unit is used for reading each I frame index information set at the end of the video data file in sequence when the video data file is played back; and positioning and playing back the video data file according to all the I frame index information in the video data file.
In a possible implementation manner, the determining unit is specifically configured to determine that an absolute value of a difference between a code stream length of the current code stream data set and a preset code stream length is a first difference when a sum of the code stream length of the current code stream data set and the code stream length of the to-be-written code stream frame is greater than or equal to the preset code stream length;
determining the sum of the code stream length of the current code stream data set and the code stream length of the code stream frame to be written, wherein the absolute value of the difference value between the sum and the preset code stream length is a second difference value;
and judging whether a new I frame index information set is written or not according to whether the first difference value is smaller than or equal to the second difference value or not.
In a third aspect, the present application provides a readable storage medium, comprising:
a memory for storing a plurality of data to be transmitted,
the memory is configured to store instructions that, when executed by the processor, cause an apparatus comprising the readable storage medium to perform the method according to the first aspect and any one of the embodiments.
Drawings
FIG. 1 is a diagram illustrating a structure of a video data file in the prior art;
fig. 2 is a schematic structural diagram of a video data file provided in the present application;
fig. 3 is a schematic diagram of a method for storing video data according to the present application;
FIG. 4 is a schematic structural diagram of an abnormally closed video data file according to the present application;
fig. 5 is a schematic structural diagram of an apparatus for storing video data files according to the present application.
Detailed Description
Fig. 1 is a schematic diagram illustrating a structure of a video data file in the prior art. As shown in fig. 1, in a video data file structure, a certain space is allocated in a file header space as a file header, only one file header is in the whole video data file, and a writing position of a first code stream data set in the video data file and a writing position of a first I-frame index information set are recorded. Each I frame index information set records the writing position, time information and frame length of all I frames in the video data file in the corresponding code stream data set, and also records the position information of the next adjacent I frame index information set to form a one-way circular linked list structure. When no I frame exists in the code stream data set needing to be recorded, the I frame index information set records 0 piece of I frame index information; when the code stream data set needing to be recorded contains at least one I frame, the I frame index information set records at least one piece of I frame index information. The empty frame shown in fig. 1 is an invalid frame, and when the code stream length of the code stream frame to be written exceeds the remaining space between the current code stream data set and the next I frame index information set, the I frame to be written cannot be written, and an empty frame with the size consistent with the remaining space is inserted.
In the current method for storing video data files, the existence of empty frames affects the length of the video data files, so that the video data files occupy unnecessary storage space.
In order to solve the problem, an embodiment of the present application provides a method for storing a video data file, in which a preset code stream length is combined with a code stream length of a to-be-written code stream frame, and a writing position of an I-frame index information set in the video data file is flexibly adjusted, so that an empty frame is prevented from occurring in the video data file, and a storage space occupied by the video file is saved.
In order to make the objects, technical solutions and advantages of the present invention clearer, the present invention will be described in further detail with reference to the accompanying drawings, and it is apparent that the described embodiments are only a part of the embodiments of the present invention, not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Fig. 2 is a schematic view of a video data file structure according to an embodiment of the present invention.
In the video data file structure provided by the embodiment of the present invention, a certain space is allocated at the beginning of a video data file to write a file header, where the file header is a file that does not necessarily exist and can be used to record an encoding format of the video data file, and for example, the file header can record h.264, h.265, and the like. After the file header, the code stream frame and the I frame index information set are written in sequence. And a code stream data set is arranged between the file header and the I frame index information set 1 or between two adjacent I frame index information sets, wherein the code stream data set at least comprises 1 code stream frame. As shown in fig. 2, the codestream data set 1, the codestream data set 2, and the codestream data set n may include 1 or more codestream frames.
Based on the above video data file structure, when a bitstream frame is written in a video data file, it needs to be determined whether to write an I-frame index information set, and the specific determination process refers to fig. 3, which includes:
step 301: writing a code stream frame in a current code stream data set, and determining the code stream length of the current code stream data set;
the current code stream data set indicates a set formed by all the code stream frames from the end of the last I frame index information set to the last written code stream frame in the video data file.
After each time of writing a code stream frame, it is necessary to determine whether the code stream frame is an I frame. If the code stream frame is an I frame, buffering I frame index information of the I frame. The I-frame index information includes: the specific location, length, time information of the I-frame in the video data file.
In particular, for the case that a file header is written in a video data file, and an I-frame index information set is not yet written, the file header needs to be regarded as a part of a current code stream data set. That is, before the 1 st I frame index information set is written, the current code stream data set includes the file header and the code stream frame written after the file header, and the length of the current code stream data set is the sum of the lengths of the file header and the code stream frame written after the file header.
Step 302: and judging whether a new I frame index information set is written or not based on the code stream length of the current code stream data set and a preset code stream length and by combining the code stream length of the code stream frame to be written.
And comparing the sum of the code stream length of the current code stream data set and the code stream length of the code stream frame to be written with the size of the preset code stream length.
And when the sum of the length of the current code stream data set and the length of the code stream frame to be written is smaller than the preset code stream length, judging that a new I frame index information set is not written, and executing the step 304.
For example, in a certain video data file, the preset code stream length is 100MB, the current code stream data set length is 95MB, if the to-be-written code stream frame is 4MB, the sum 95+4 of the lengths of the current code stream data set and the to-be-written code stream frame is 99MB smaller than the preset code stream length 100MB, it is determined that no new I-frame index information set is written, and step 304 is executed.
And when the sum of the code stream length of the current code stream data set and the code stream length of the code stream frame to be written is greater than or equal to a preset code stream length, determining the absolute value of the difference value between the code stream length of the current code stream data set and the preset code stream length as a first difference value.
And determining the sum of the code stream length of the current code stream data set and the code stream length of the code stream frame to be written, wherein the absolute value of the difference value between the sum and the preset code stream length is a second difference value.
And judging whether a new I frame index information set is written or not according to whether the first difference value is smaller than or equal to the second difference value or not.
If the first difference is smaller than or equal to the second difference, step 303 is executed, and if the first difference is smaller than or equal to the second difference, step 304 is executed.
For example, in a certain video data file, the preset code stream length is 100MB, and the current code stream data set length is 95MB, then the first difference value is 5.
If the code stream length of the code stream frame to be written is 11MB, the sum of the code stream length of the current code stream data set and the code stream length of the code stream frame to be written is 95+11 ═ 106, and the second difference is 6, the first difference is smaller than the second difference, and step 303 is executed.
If the code stream length of the code stream frame to be written is 8MB, the sum 95+8 of the code stream length of the current code stream data set and the code stream length of the code stream frame to be written is 103, and the second difference is 3, the first difference is greater than the second difference, and step 304 is executed.
Step 303: generating and writing the new I frame index information set based on the position information of the last written I frame index information set and the I frame in the current code stream data set;
the I frame index information set is used for recording the I frame index information of all I frames in the corresponding code stream data set and the position information of the adjacent previous I frame index information set.
And packaging the I frame index information of all I frames in the corresponding code stream data set to generate an I frame index information set, and storing the position information of the last I frame index information set in the I frame index information set. And the position information of the last I frame index information set is the code stream length of all code stream data sets before the last I frame index information set.
The code stream data set corresponding to each I frame index information set refers to the code stream data set between the previous adjacent I frame index information set before the I frame index information set. When the code stream data set corresponding to the I frame index information set does not contain an I frame, 0 piece of I frame index information is recorded in the I frame index information set. When the code stream data set needing to be recorded contains at least one I frame, the I frame index information set records at least one piece of I frame index information. The I frame index information comprises the writing position, time information and file length of the I frame in the video data file.
For example, the code stream data set corresponding to the I frame index information set 2 in fig. 2 is the code stream data set 2, and the I frame index information set 2 records the I frame index information of all I frames in the code stream data set 2 and the position information of the I frame index information set 1.
In particular, for the first I frame index frame in the video data file, the position information of its last I frame index frame may be set to 0.
The writing-in of the I frame index information set can ensure that the last I frame index information set is read from the tail of the file after the video file is opened during video playback, all I frame positions in the code stream data corresponding to the I frame index information set and the position of the last I frame index information set are obtained, and the rest is repeated, so that all I frame index information sets in the video data file can be read, and further all I frame index information in the video data file is obtained.
Step 304: and writing the code stream frame to be written.
It should be noted that the above steps may be executed in a loop to complete the storage of all the bitstream frames and the corresponding I-frame index information sets. Specifically, after step 303 is executed, if there is still a code stream frame that has not been written, go to step 301 to execute; after step 304 is executed, go to step 302 for execution.
In the embodiment of the application, whether a new I frame index information set is written is determined by adding the judging step, so that the writing position of the I frame index information set in the video data file becomes flexible, and the insertion of an invalid empty frame can be avoided, thereby ensuring that the condition that the storage space is excessively occupied due to the writing of invalid data in the video data file does not occur.
Further, after all the bitstream frames and the corresponding I frame index information sets are written, when playing back a video data file, the positions of the I frame index information sets need to be sequentially located according to the I frame index information set at the end of the video data file, and then the position information and the time information of all the I frames in the video data file can be located according to the information in the I frame index information sets. And then video playback is carried out according to the requirement. For example, the user only needs to watch the video for a certain period of time, and the video can be positioned and played back according to the I frame index information set.
Particularly, in the process of storing video data, the video data file is abnormally closed due to power failure, equipment restart and the like, which causes that an I frame included in a code stream data set written into the file before the video data file is closed is not recorded in an I frame index information set, and the unrecorded I frame cannot be timely and accurately found according to the index information in the file reading and video playback processes. Fig. 4 is a schematic structural diagram of an abnormally closed video data file according to an embodiment of the present application.
For the video data file which is not normally closed, when the video data file is reprocessed, a current code stream data set needs to be analyzed, and the code stream length of the current code stream data set and I frames and I frame index information in the current code stream data set are determined; and continuing to write the unwritten code stream frame and the corresponding I frame index information set at the end of the current code stream data set, and completing the repair of the video data file.
Based on the same inventive concept, an embodiment of the present application provides an apparatus for storing video data, where the apparatus corresponds to the method for storing video data shown in fig. 3, and a specific implementation of the apparatus may refer to the description of the foregoing method embodiment, and repeated descriptions are omitted, referring to fig. 5, and the apparatus includes:
the determination unit 501: and the method is used for writing a code stream frame in the current code stream data set and determining the code stream length of the current code stream data set.
Wherein the current code stream data set comprises at least one code stream frame.
The judgment unit 502: and the I-frame index information processing unit is used for judging whether to write a new I-frame index information set or not based on the code stream length of the current code stream data set and a preset code stream length and in combination with the code stream length of a code stream frame to be written.
Specifically, when the sum of the code stream length of the current code stream data set and the code stream length of the code stream frame to be written is greater than or equal to a preset code stream length, determining that the absolute value of the difference value between the code stream length of the current code stream data set and the preset code stream length is a first difference value. And determining the sum of the code stream length of the current code stream data set and the code stream length of the code stream frame to be written, wherein the absolute value of the difference value between the sum and the preset code stream length is a second difference value.
And judging whether a new I frame index information set is written or not according to whether the first difference value is smaller than or equal to the second difference value or not.
The writing unit 503: the device comprises a code stream data set and a storage unit, wherein the code stream data set is used for storing I frame index information of all I frames in the code stream data set and position information of an adjacent previous I frame index information set; and writing the code stream frame to be written in when judging that a new I frame index information set is not written in.
The apparatus for storing video data further comprises a repair unit: and the device is used for analyzing the current code stream data set when the abnormally closed video data file is reprocessed, and continuously writing the unwritten code stream frames and the corresponding I frame index information set at the end of the current code stream data set.
The apparatus for storing video data further comprises a reading unit: when the video data file is played back, reading each I frame index information set at the end of the video data file in sequence; and positioning and playing back the video data file according to all the I frame index information in the video data file.
Based on the same inventive concept, an embodiment of the present application further provides a readable storage medium, including:
a memory for storing a plurality of data to be transmitted,
the memory is for storing instructions that, when executed by the processor, cause an apparatus comprising the readable storage medium to perform a method of storing video data as described above.
It will be clear to those skilled in the art that, for convenience and simplicity of description, the foregoing division of the functional modules is merely used as an example, and in practical applications, the above function distribution may be performed by different functional modules according to needs, that is, the internal structure of the device is divided into different functional modules to perform all or part of the above described functions. For the specific working processes of the system, the apparatus and the unit described above, reference may be made to the corresponding processes in the foregoing method embodiments, and details are not described here again.
In the embodiments provided in the present invention, it should be understood that the disclosed apparatus and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the modules or units is only one logical division, and there may be other divisions when actually implemented, for example, a plurality of units or components may be combined or may be integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit 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 substantially implemented or contributed by the prior art, or all or part of the technical solution may be embodied in a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, a network device, or the like) or a processor (processor) to execute all or part of the steps of the method according to the embodiments of the present application. And the aforementioned storage medium includes: various media capable of storing program codes, such as a Universal Serial Bus flash disk (usb flash disk), a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, and an optical disk.
It will be apparent to those skilled in the art that various changes and modifications may be made in the present invention without departing from the spirit and scope of the invention. Thus, if such modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include such modifications and variations.

Claims (10)

1. A method of storing video data, comprising:
writing a code stream frame in a current code stream data set, and determining the code stream length of the current code stream data set; wherein, the current code stream data set comprises at least one code stream frame;
judging whether a new I frame index information set is written or not based on the code stream length of the current code stream data set and a preset code stream length and in combination with the code stream length of a code stream frame to be written;
if so, generating and writing a new I frame index information set based on the position information of the last written I frame index information set and the I frame in the current code stream data set, wherein the I frame index information set is used for recording the I frame index information of all I frames in the corresponding code stream data set and the position information of the adjacent last I frame index information set;
and if not, writing the code stream frame to be written in.
2. The method of claim 1, wherein the determining whether to write a new I-frame index information set based on the code stream length of the current code stream data set and a preset code stream length in combination with the code stream length of a code stream frame to be written comprises:
when the sum of the code stream length of the current code stream data set and the code stream length of the code stream frame to be written is greater than or equal to a preset code stream length, determining the absolute value of the difference value between the code stream length of the current code stream data set and the preset code stream length as a first difference value;
determining the sum of the code stream length of the current code stream data set and the code stream length of the code stream frame to be written, wherein the absolute value of the difference value between the sum and the preset code stream length is a second difference value;
and judging whether a new I frame index information set is written or not according to whether the first difference value is smaller than or equal to the second difference value or not.
3. The method of claim 1, wherein the position information of the previous adjacent I frame index information set is a code stream length of all code stream data sets before the previous adjacent I frame index information set; and if the new I frame index information set is the first I frame index information set in the video data file, the position information of the adjacent last I frame index information set of the I frame index information set is 0.
4. The method of claim 1, wherein after writing the codestream to be written, comprising:
when the video data file which is abnormally closed is reprocessed, the current code stream data set is analyzed, and unwritten code stream frames and the corresponding I frame index information set are continuously written at the end of the current code stream data set.
5. The method of claim 1, wherein after generating and writing the new set of I frame index information based on the location information of the last written set of I frame index information and the I frame in the current codestream data set, comprising:
when a video data file is played back, sequentially reading each I frame index information set at the end of the video data file;
and positioning and playing back the video data file according to all the I frame index information in the video data file.
6. An apparatus for storing video data, comprising:
a determining unit, configured to write a bitstream frame in a current bitstream data set, and determine a bitstream length of the current bitstream data set; wherein, the current code stream data set comprises at least one code stream frame;
a judging unit, configured to judge whether to write a new I-frame index information set based on the code stream length of the current code stream data set and a preset code stream length, in combination with the code stream length of a code stream frame to be written;
a writing unit, configured to, when it is determined to write a new I-frame index information set, generate and write the new I-frame index information set based on location information of a last written I-frame index information set and an I-frame in the current code stream data set, where the I-frame index information set is used to record I-frame index information of all I-frames in a corresponding code stream data set; and the position information of the adjacent last I frame index information set; and writing the code stream frame to be written in when judging that a new I frame index information set is not written in.
7. The apparatus of claim 6, wherein the apparatus further comprises:
and the repair unit is used for analyzing the current code stream data set when the abnormally closed video data file is reprocessed, and continuously writing the unwritten code stream frames and the corresponding I frame index information set at the end of the current code stream data set.
8. The apparatus of claim 6, wherein the apparatus further comprises:
the reading unit is used for reading each I frame index information set at the end of the video data file in sequence when the video data file is played back; and positioning and playing back the video data file according to all the I frame index information in the video data file.
9. The apparatus according to claim 6, wherein the determining unit is specifically configured to determine that an absolute value of a difference between the code stream length of the current code stream data set and the preset code stream length is a first difference when a sum of the code stream length of the current code stream data set and the code stream length of the to-be-written code stream frame is greater than or equal to a preset code stream length; determining the sum of the code stream length of the current code stream data set and the code stream length of the code stream frame to be written, wherein the absolute value of the difference value between the sum and the preset code stream length is a second difference value; and judging whether a new I frame index information set is written or not according to whether the first difference value is smaller than or equal to the second difference value or not.
10. A readable storage medium, comprising:
a memory for storing a plurality of data to be transmitted,
the memory is for storing instructions that, when executed by the processor, cause an apparatus comprising the readable storage medium to perform the method of any of claims 1-5.
CN202111169753.1A 2021-10-08 2021-10-08 Method and device for storing video data and readable storage medium Pending CN114003763A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111169753.1A CN114003763A (en) 2021-10-08 2021-10-08 Method and device for storing video data and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111169753.1A CN114003763A (en) 2021-10-08 2021-10-08 Method and device for storing video data and readable storage medium

Publications (1)

Publication Number Publication Date
CN114003763A true CN114003763A (en) 2022-02-01

Family

ID=79922311

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111169753.1A Pending CN114003763A (en) 2021-10-08 2021-10-08 Method and device for storing video data and readable storage medium

Country Status (1)

Country Link
CN (1) CN114003763A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114430469A (en) * 2022-04-01 2022-05-03 浙江大华技术股份有限公司 Video data storage method, video data reading method, electronic device and readable storage medium

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114430469A (en) * 2022-04-01 2022-05-03 浙江大华技术股份有限公司 Video data storage method, video data reading method, electronic device and readable storage medium

Similar Documents

Publication Publication Date Title
US20140359233A1 (en) Read-write control method for memory, and corresponding memory and server
CN107168651B (en) Small file aggregation storage processing method
US8213104B2 (en) Apparatus and method for writing data onto a tape
CN110012358B (en) Examination information processing method and device
CN101872639B (en) Method and device for storing and retrieving image data on digital hard disk video recorder
US11250888B1 (en) Flash memory and method for storing and retrieving embedded audio video data
US11750784B2 (en) Automatic video file repair method and system
JP2002529884A (en) Signal processing on information files to obtain characteristic point information sequences
CN108833817B (en) Video data storage method and device
CN114003763A (en) Method and device for storing video data and readable storage medium
JP2019509547A (en) GPU resource reconstruction method, user device, system, and storage medium
JP5394394B2 (en) File management / editing method and apparatus in file system
CN113507625B (en) Self-adaptive video restoration method
US20130013846A1 (en) Method for storing data and electronic apparatus using the same
CN110825652B (en) Method, device and equipment for eliminating cache data on disk block
US20070230895A1 (en) Processing of scalable compressed video data formats for nonlinear video editing systems
US8515250B2 (en) Video recording device, video reproduction device, and method thereof
CN103795955B (en) Electronic equipment, dynamic image regenerator, dynamic image decoding method
CN115729557B (en) Script processing method and device
CN115801019B (en) Parallel acceleration LZ77 decoding method and device and electronic equipment
CN110786020A (en) Video processing method and device and computer readable storage medium
CN113068064B (en) Method, device, computer equipment and storage medium for processing transmission stream media file
US10950274B2 (en) Image recording apparatus, method for controlling same, and non-transitory computer-readable storage medium
CN111435285B (en) Data writing method and device for storage volume, electronic equipment and machine-readable storage medium
CN115114246A (en) File format, parsing method and device for picture storage and readable storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination