Processing method of mov file index table

Through the methods of difference calculation and segmentation compression, the problem of excessive memory occupancy of mov file index table is solved, saving storage space and maintaining retrieval efficiency, and improving the video processing performance of embedded systems.

CN119577182APending Publication Date: 2025-03-07ZHUHAI HI-CHIP SEMICON LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411625961.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-14
Publication Date
2025-03-07

AI Technical Summary

Technical Problem

In the prior art, the complete storage of the mov file index table leads to excessive memory usage, especially when processing long video files, which limits the resource-intensive embedded systems.

Method used

Through the strategy of difference calculation and segmentation compression, only part of the index table and its difference value are recorded, and the data is compressed in segmentation to generate a segmentation compressed index table. Compute the complete index table by decompressing the data during use.

Benefits of technology

It significantly reduces the use of storage space, while maintaining retrieval efficiency, and improving the overall performance of embedded systems when processing mov files.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119577182A_ABST
    Figure CN119577182A_ABST
Patent Text Reader

Abstract

The invention discloses a mov file index table processing method. The method comprises the following steps: reading index information in a mov file; according to a preset interval number, generating a segmented index header which comprises complete index information corresponding to the current frame; calculating a difference value index table according to the segmented index head and index information read from the mov file; segmenting the segmentation index head and the difference value index table, compressing the segmented index head and the difference value index table, then storing the segmented index head and the difference value index table, storing beginning index information of each segment of compressed data by using a compressed index head, generating a segmented compressed index table, and recording time information in the segmented index head by using the compressed index head. The invention further provides a method for playing the mov file. According to the method, only part of the index table and the difference value of the index table are recorded, and the data are subjected to segmented compression, so that the storage requirement of the index table is reduced, the complete index table can be calculated by decompressing the data during use, the occupied storage space is remarkably reduced, the retrieval efficiency is maintained, and the overall performance of an embedded system during mov file processing is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the field of digital video processing, and in particular to a method for processing a mov file index table. Background Art

[0002] In digital video processing technology, the mov format has become a common format in the field of video editing and content publishing due to its wide compatibility and rich functions. The data of the mov file is stored separately from the index header information and the audio and video data. The basic elements of playing mov files are index information and playback data. The common method of storing index information is complete storage, which has a significant problem: the complete storage of index information will take up a lot of memory, especially when processing long video files, which has great limitations for embedded systems with tight resources.

[0003] In the multimedia processing framework, the index table of mov format is usually processed in the following ways:

[0004] (1) Complete storage method: All index information in the mov file will be stored completely. The position and timestamp of each video frame or audio sample will be saved in the index table. When playing or fast forwarding or rewinding, you can quickly find the corresponding position by time to extract data, and all index information can be directly accessed.

[0005] (2) Skip table storage method: Skip table storage method is a structured storage method based on jump nodes. Time jump nodes are introduced into the index table to accelerate data search. Jump nodes store key location information at larger intervals, allowing irrelevant data to be quickly skipped, reducing search time.

[0006] The above-mentioned prior art mov index table storage method has the following disadvantages:

[0007] (1) The storage format of mov files is an index table plus data. These two pieces of data are separate. Therefore, the general practice to play mov files normally is to read, analyze and store the index table completely. The size of the index table is affected by the video quality and time length. The better the quality and the longer the time, the larger the index table. This will take up a lot of memory in resource-constrained embedded systems, so other applications in the system will fail to run due to lack of resources during operation. If there is not enough memory, the mov file will not be played normally. The complete storage method can store all the index information originally contained in the file, and can be directly located during playback and search. However, for long bit streams, it will take up a lot of memory space and affect the operation of other programs.

[0008] (2) The skip table storage index table adds partial time data on the basis of complete storage. When searching, the corresponding position can be quickly found according to the stored time table. In essence, it still stores all the index information and occupies a large amount of memory.

[0009] How to reduce the index table storage of mov format files, solve the problem of excessive memory usage of mov index information, and improve the utilization of memory resources in embedded systems is of great significance for digital video processing. Summary of the invention

[0010] The present invention provides a new method for processing a mov file index table, which reduces the storage requirement of the index table through a strategy of difference calculation and segment compression. The method only records part of the index table and its difference and compresses the data in segments, and when used, the complete index table can be calculated by decompressing the data. This optimization can significantly reduce the storage space occupied, and can also maintain the efficiency of retrieval to a certain extent, thereby improving the overall performance of the embedded system when processing mov files.

[0011] A method for processing an index table of a mov file comprises: step 1, reading index information in a mov file; step 2, generating a segment index header according to a preset interval number, wherein the segment index header contains complete index information corresponding to a current frame, wherein the complete index information corresponding to the current frame includes a frame position, a timestamp, a frame size, a frame flag, and a frame interval number between a current frame and a previous key frame; step 3, calculating a difference index table according to the segment index header and the index information read from the mov file, wherein the difference index table records the difference information between each index information in the segment and the segment index header of the segment, which includes a frame position difference, a time difference, a frame size, and a frame flag; and step 4, segmenting the segment index header and the difference index table, compressing and storing them, storing the beginning index information of each segment of compressed data with a compressed index header, and generating a segment compressed index table, wherein the compressed index header records the time information in the segment index header.

[0012] Furthermore, step 1 also includes reading the trak information in the mov file, and allocating memory capable of storing the segment index header and the difference index table according to the index information in the trak information. If the allocation is successful, step 2 and subsequent steps are executed sequentially; if the allocation fails, the trak information is cleared, and if the current trak is not the last one, the next one is read, otherwise the index table processing is exited.

[0013] Furthermore, the segment index header in step 2 stores complete index information of the corresponding sequence number index at every predetermined interval, and all the generated segment index headers together constitute a sequence table.

[0014] Furthermore, in step 3, the difference index information is calculated according to each index information in the same segment and the corresponding segment index header, and all the difference index information generates a difference index table, and the number of indexes in the difference index table is the same as the number of index information in the current segment.

[0015] Furthermore, in step 3, the frame position difference is the difference between the file position of the current frame and the corresponding frame recorded in the corresponding segment index header; the time difference is the difference between the current frame and the corresponding playback time in the corresponding segment index header; the mov file trak information includes stts box information, which stores the total number of indexes of the trak and the time scale difference time_stts between each index. The time scale difference time_stts is the time scale difference between frames based on the code stream time base timea. The time difference needs to be converted to a time base, and the calculation formula is:

[0016] diff_dts = (time_stts / timea)*(timeb)*(m-1), where timeb is the time base of the system that needs to play the mov code stream and is converted to the same time unit as the time base timea; m is the serial number of the difference index, and diff_dts is the time difference.

[0017] Furthermore, in step 4, the segment index header and the corresponding difference index table are segmented and compressed, and each segment of compressed data contains several segment index headers and corresponding difference index information. The compressed index header records the timestamp information of the first index information in each segment of the segment compression.

[0018] A method for playing a mov file according to an index table generated by the method described in any one of claims 1 to 7, comprising: step 1, determining the corresponding segmented compressed index table according to the playback time and decompressing it; step 2, judging whether it is drag playback, if not, obtaining the index number required for the current playback frame, searching for the corresponding segmented index header and difference index through the index number, calculating the index information according to the segmented index header and the difference index table, and determining the file playback position; if yes, searching for the corresponding difference index table according to the drag playback time and the segmented index header to determine the file playback position; step 3, playing the mov file according to the determined file playback position.

[0019] The corresponding difference index table is searched according to the drag playback time and the segment index header, and further includes: judging whether it is a video stream. If not, searching for the audio frame closest to the drag playback time and ending the drag playback; if so, searching for the first video key frame in the segment difference index table, and further judging whether it contains an audio stream. If not, ending the drag playback, otherwise searching for the audio frame closest to the time of the video key frame to synchronize the audio and video, and ending the drag playback after completion.

[0020] The improved scheme of the present invention is to store a partially complete index table, which is a segmented index header, and calculate a difference index table through this partial index table and the complete index table, and finally compress and store the difference index table in segments to achieve the effect of saving a lot of memory. When in use, only the corresponding compressed segment needs to be decompressed and the real index information can be calculated to find the required data. The present invention reduces the space required for storing the mov index table, and has segmented index header information, so that the file position can be located more quickly when searching for the index. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] Figure 1 It is a logic block diagram of the mov file index table processing process of the present invention;

[0022] Figure 2 It is a flow chart of the mov file index table processing method of the present invention;

[0023] Figure 3 It is a flow chart of generating a segment index header and a difference index table of the present invention;

[0024] Figure 4 It is a flow chart of the index table generated when the present invention plays a mov file;

[0025] Figure 5 It is a schematic diagram of the inclusion relationship between boxes in the mov file of the present invention. DETAILED DESCRIPTION

[0026] Figure 1 It is a logic block diagram of the mov file index table processing process to which the solution of the present invention is applicable.

[0027] The process of building and using the index table of mov files is as follows:

[0028] (1) Read the index information in the mov file;

[0029] (2) Generate a segment index header, which contains complete index information corresponding to the current frame. Here, "frame" refers to the segment index frame, that is, a frame that stores index information once every 50 times. The segment index information is recorded once every 50 times. The index stored in the segment index information is complete, including frame position, timestamp, frame size, frame flag, and the number of frame intervals between the current frame and the previous key frame.

[0030] The index information in the mov file represents the native index data of the file itself. The segment index information contains complete frame information, which is different from the difference index information below. The complete frame index information is what is needed in the end, so the difference index information needs to be calculated based on the segment index information to get the complete index information.

[0031] (3) Calculate a difference index table according to the segment index header and the mov index information. The difference index table records the difference information between each index information in the segment and the segment index header of the segment, including frame position difference, time difference, frame size, and frame flag;

[0032] (4) The segmented index header and the difference index table are compressed and stored in segments, and the beginning index information of each compressed data is stored with a compressed index header to generate a segmented compressed index table. For example, if 1000 index information are read out from a mov file, and the segmented index information is recorded every 50 index information, 20 segmented index headers and 1000 difference index information are generated after the above processing, and they can be equally divided into 5 segments, that is, each segment contains 4 segmented index headers and 200 difference index information, and these 5 segments are compressed and stored separately, then the compressed index header only needs to save the time information in the segmented index headers numbered 1, 5, 9, 13, and 17. The number of equally divided paragraphs is not fixed and should be set according to the actual index information. For example, the smaller the difference in timestamps recorded between the segmented index headers, the fewer the number of segments can be set, and the larger the difference in timestamps recorded between the segmented index headers, the more the number of segments can be set;

[0033] (5) The segmented compressed index table to be used is determined by compressing the index header, and the segmented compressed index table to be used (which represents the compressed index table data corresponding to the segment) is decompressed and used, and the used index table continues to be compressed and stored.

[0034] For example, the above mentioned five segments are equally divided, and the time stored in the index headers of segments 1, 5, 9, 13, and 17 is 0s, 5s, 9s, 13s, and 17s. When the video starts playing, the first compressed index data is needed, and when the video needs to play to 10s, the third compressed index data is needed. Therefore, the compressed index header only needs to record the time information in the segment index header. The corresponding relationship between the compressed index header, the segment index header, and the difference index is shown in Table 1.

[0035] Table 1

[0036]

[0037] The present invention uses a method of storing segmented difference indexes and segmented compressed indexes to solve the problem that the mov file index table occupies too much memory.

[0038] Figure 2 It is a flow chart of a method for processing a mov file index table to which the solution of the present invention is applicable.

[0039] (1) After opening the mov file, the trak information (including index information) in the mov file must be read first. In a standard mov file, the header information of audio and video is stored in trak. The number of trak is equal to the number of audio and video streams in the file. The trak contains information such as the file format, video width and height, audio sampling rate, and the number of index tables. Because the index information and data information of the mov file are separate, the data packet cannot be correctly read and played without the index information, so the important information in trak must be read in the first step.

[0040] (2) Allocate memory that can store the segment index header and the difference index table. When reading the trak information, record the total number of index information. According to the size of each index information, calculate the total memory space required for the index. First allocate space and then record the index. If the allocation fails, abandon the index analysis of the trak. If successful, build the segment index header and the difference index table for segmented compression storage.

[0041] The process of generating segment index header and difference index table is as follows Figure 3 shown.

[0042] (1) Read the trak index information. In the system, each segment index header is stored as 16 bytes, and the difference index table is stored as 8 bytes. If the total number of audio trak and video trak index information in a mov file is 10,000, then storing the segment index header and the difference index table requires (10,000 / 50)*16+10,000*8=83,200 bytes.

[0043] (2) Allocate 83200 bytes of space in the memory. If the allocation is successful, the index table construction will begin. If the allocation fails, clear the trak information and try again.

[0044] (3) Segment index header, that is, a complete index information is saved every 50 indexes. In these 10,000 indexes, a complete information is saved every 50 indexes, that is, the index information is calculated starting from 0, and the indexes corresponding to the serial numbers 0, 50, 100, 150... are completely saved (these 200 segment index headers are put together to form a sequence table), and the difference index table is generated by the saved segment index headers.

[0045] (4) Difference index table: Based on the recorded segment index header and the read trak information, the difference index information is calculated through each index information in the same segment and the corresponding segment index header to generate a difference index table.

[0046] (5) Segment index header and difference index table.

[0047] The relationship between the segment index header and the difference index table is shown in Table 2, where Index0 (index0 is used to calculate the difference index diff index0-49, and the difference index needs to be calculated with index0 during use to calculate the complete index information such as time and size), Index50... are the segment index headers, and Diff Index0 (the difference between the original complete index 0 and the segment index header Index0), Diff Index50... are the difference index tables.

[0048] Table 2

[0049]

[0050] The structure of the segment index header and difference index table data storage is as follows.

[0051] a) Segment Index Header

[0052]

[0053] The structure of the segment index header occupies 16 bytes, which includes the frame interval number, frame position, frame flag, timestamp, and frame size, as described below:

[0054] ①min_distance: the minimum frame interval between the current frame and the previous key frame;

[0055] ②pos: the file position corresponding to this frame of data;

[0056] ③flags: whether it is a key frame;

[0057] ④times tamp: the time corresponding to this frame of data;

[0058] ⑤size: the data size of this frame of data;

[0059] The frame interval number occupies 27 bits, and can represent a maximum of 67108864 intervals; the frame position occupies 37 bits, and can represent a maximum of 64G bytes of files; the frame flag occupies 2 bits, and only needs to represent 0 and 1, that is, whether it is a key frame; the timestamp occupies 38 bits, and can represent a maximum of 1374389534712. The timestamp here is dts, that is, the time scale, which can represent a maximum of 137438953471 time scales; the frame size occupies 24 bits, and can represent a maximum of 8M bytes of data.

[0060] b) Difference index table

[0061]

[0062] The structure of the difference index table occupies 8 bytes and is an unsigned integer type. It contains the frame position difference, time difference, frame size, and frame flag. The description is as follows:

[0063] ①diff_pos: the difference between the current frame and the pos in the corresponding segment index header;

[0064] ②diff_dts: The difference between the current frame and the corresponding timestamp in the corresponding segment index header, in milliseconds. It records the specific time difference. That is, if the time converted from the timestamp in the segment index header is 0s, the difference recorded here may be 20ms.

[0065] The frame position difference occupies 28 bits, which can represent a maximum length of 256M bytes; the time difference occupies 12 bits, which can represent a maximum of 4095ms; the frame size occupies 22 bits, which can represent a maximum of 4M bytes of data; the frame flag occupies 2 bits, which only needs to represent 0 and 1, that is, whether it is a key frame;

[0066] The generation process of the segment index header and difference index table is as follows.

[0067] According to international standards, the mov format contains various boxes, such as Figure 5 As shown, the box stores information such as index and video data. For example, there are boxes such as trak and stts. Their stts in the file is the content in the trak box, which records the number of indexes of this trak. Trak also has audio trak and video trak. For example, if there are 100 frames in the video stream, then the number recorded by sttts is 100. In the file, for example, in the trak box, there will be four bytes in the file data to record the four letters trak, indicating that this box has been read, and this box also contains stts and other boxes. In each trak, there are different boxes to represent different index information, and the index table is constructed by reading these box information.

[0068] s tts stores the total number of indexes of the trak and the time scale difference between each index;

[0069] s tss records which index numbers correspond to key frames;

[0070] s tsz stores the data size of each frame;

[0071] s tco stores the file location corresponding to each frame.

[0072] Here we assume that the total number of indexes stored in stts is 10000, which is recorded as time_stts (the time scale difference is the time difference between each frame, which is a fixed value); the key frame numbers recorded in stss are an arithmetic sequence of 1, 51, 101, 151, ..., 9951 with a difference of 50; the data sizes stored in stsz are size1, size2, size3, ..., size10000; the positions stored in stco are pos1, pos2, pos 3, ..., pos10000; and the time base of the code stream is timea, and the time base of this system is timeb. This system is a system that needs to play mov code streams. If a hardware media player is such as an MP4 digital player, the MP4 here can refer to this system, and this system can also be described as a system that needs to play mov code streams.

[0073] First, generate segment index header 1. Segment index header 1 is the first index, so timestamp is recorded as 0; read stss to check whether index number 1 is a key frame and record it in flags of segment index header 1. If it is a key frame, min_distance is 0 and flags is 1. If it is not a key frame, min_distance is not recorded until the next key frame is found, and flags is 0; read stsz to check the data size of the first frame and record it in size of segment index header 1; read stco to check the file position corresponding to the first frame and record it in pos of segment index header 1, so the information of segment index header 1 is:

[0074] Index[1].min_di s tance=0,

[0075] Index[1].pos = pos 1,

[0076] Index[1].flags=1,

[0077] Index[1].times tamp=0,

[0078] Index[1].size=size1.

[0079] The meaning of segment index header 1 is that it is the first segment index header generated based on the mov file. This segment corresponds to 1-50 in the complete index information, a total of 50 index information; since segment index header 1 is the first index, the time timestamp corresponding to this frame of data is 0; the first index has a sequence number of 1. If it is a key frame, the minimum frame interval min_distance between the current frame and the previous key frame is 0, and the key frame identification bit flags is 1; the file position corresponding to the first frame data is pos 1; the data size of the first frame is size1.

[0080] After generating segment index header 1, generate the difference index table. Each time a segment index header is generated, 50 difference index information should be continuously generated, that is, each time a segment index header is generated, 50 difference indexes must be "managed" by this segment index header, so it is necessary to continuously generate 50 difference indexes, and then generate another segment index header and the corresponding 50 difference indexes, and repeat this cycle until the end. The difference index table records the difference between each index in the current segment and the segment index header. The diff_pos of difference index 1 is 0; diff_dts is 0; size is size1 of stsz; flags is the value of the index number recorded in st ts, which is 1, so the information of difference index 1 is:

[0081] MOVDiffIndex[1].diff_pos=0,

[0082] MOVDiffIndex[1].diff_dts=0,

[0083] MOVDiffIndex[1].size=size1,

[0084] MOVDiffIndex[1].flags=1;

[0085] Its meaning is: difference index 1 is the difference between the first index and segment index header 1, diff_pos is the difference between the current frame and the pos in the corresponding segment index header 1 (the file position corresponding to this frame of data), which is 0; the difference diff_dts between the current frame and the corresponding playback time in the corresponding segment index header is 0; the corresponding data size of the current frame is size1, and the key frame identification flags is 1.

[0086] The diff_pos of difference index 2 is the difference between the pos of the second index of stco and the pos of segment index header 1, that is, pos2-Index[1].pos=pos2-pos1. This involves the conversion of the time base. Since the time scale difference time_stts in the stts directly read is based on the time scale difference of the code stream time base time, its value is time_stts.

[0087] Generally, the time base is expressed as the number of seconds each time scale occupies. If you want to record the specific time on another time base, you need to go through the time base conversion. Since the time will accumulate longer and longer, and the diff_dts in the difference index table only occupies 12 bits and the maximum representation number is 4095, so diff_dts directly records the time after the time base conversion and converts the time to milliseconds. The formula for converting time_stts from the time base timea to the time base timeb is time_stts / timea*timeb. The time base of this system is in microseconds, so the formula for converting time_stts to milliseconds is (time_stts / timea)*(timeb / 1000), so the diff_dts of the difference index 2 = (time_stts / timea)*(timeb / 1000)*(2-1); flags = 0;

[0088] diff_pos of difference index 3 = pos 3 - pos 1;

[0089] diff_dts=(time_s tts / timea)*(timeb / 1000)*(3-1);

[0090] size = size3 - size1;

[0091] flags=0.

[0092] Since time_stts is the time scale difference between two consecutive frames and is fixed, 2-1 represents the serial number difference between the second difference index and the first difference index (can also be the segment index header). There is only one time_stts between 1 and 2, and there are 2 time_stts between 1 and 3. This time needs to be converted in time base, so the above formula is obtained.

[0093] timeb is determined by software design. For example, a hardware MP4 player needs to have a media player software. This media player software needs to set a time base timeb to calculate the time required to play the bitstream. timea can be directly obtained from the mov file and exists in the file.

[0094] Thus, the data of segment index header n is stored as:

[0095] Index[n].pos=pos((n-1)*50+1),

[0096] Index[n].t imes tamp=((n-1)*50+1)*t imes_s tts,

[0097] Index[n].size=size((n-1)*50+1)

[0098] Among them, min_distance and flags need to be recorded according to the data in stss. For example, if the index number 100 in stss is marked as a key frame, when n=3, Index[3].min_distance=1, and the index number of the segment index header number n corresponding to the file is ((n-1)*50+1).

[0099] The data of the difference index m is stored as:

[0100] MOVDiffIndex[m].diff_pos=posm-Index[m / 50+1].pos,

[0101] MOVDiffIndex[m].diff_dts=(time_stts / timea)*(timeb / 1000)*(m-1)%50 (here, %50 is the C language notation, indicating the remainder after dividing by 50).

[0102] MOVDiffIndex[m].size=sizem,

[0103] MOVDiffIndex[m].flags=m∈s tss? 1:0.

[0104] Therefore, 10000 / 50=200 segment index headers and 10000 difference index information will be recorded in the trak of this mov file.

[0105] (6) Segmented compression index header.

[0106] The segmented compression index header needs to record the start time of each segment of compressed data, continuing the assumption in (5): the total number of indexes is 10,000, and a complete piece of information is saved every 50 intervals, generating 200 segmented index headers; there are a total of 10,000 differential index information.

[0107] If the segmented index header and difference index table constructed by the trak are divided into 10 segments for compressed storage, each segment of compressed data contains 20 segmented index headers and 1000 difference index information. The data recorded in these 10 compressed index headers are the time scale dts of the 1st, 1001, 2001, ..., 9001 index information. Any compression algorithm can be used here, such as gzip compression, to directly compress and store the 10 segments of data; the compression algorithm is not limited, as long as it can compress the data to save storage space.

[0108] The flowchart of the process of using the generated index table when playing mov files is as follows Figure 4 shown.

[0109] (1) Find the corresponding compressed index segment according to the playback time and decompress it. The number of index information in each segment is determined by the number of index information. For example, a constructed difference index table contains 10,000 index information, which is divided into ten segments, and each segment has 1,000 index information. The segmented compressed index is to find the index segment to be decompressed based on time. Then the start time of the first compressed index is the time of index record No. 1, and the end time is the time of index record No. 1000. The index segment corresponding to the playback time is determined by the time period included in each compressed index segment, so as to decompress the index segment. After segmented compression, the original index data will become compressed data, but each compressed data needs a segmented compressed index header to mark it. For example, the compressed index header of compressed segment 1 indicates the time of 0s, and the compressed index header of compressed segment 2 indicates the time of 10s. This compressed index header will form a new index.

[0110] (2) If it is seek (drag to play the video), for the video stream, it is necessary to find the index information of the key frame and modify the corresponding seek time for the audio stream to search in order to ensure audio and video synchronization; if it is not a seek situation, normal decompression and search can be performed.

[0111] Determine whether it is a drag play. If not, obtain the index number required for the current play frame, use the index number to find the corresponding segment index header and difference index, calculate the index information based on the segment index header and difference index table, and determine the file play position; if yes, find the corresponding difference index table based on the drag play time and the segment index header to determine the file play position. Further determine whether it is a video stream. If not, find the audio frame closest to the drag play time and end the drag play; if yes, find the first video key frame in the difference index table of the segment, further determine whether it contains an audio stream, if not, end the drag play, otherwise find the audio frame closest to the time of the video key frame to synchronize the audio and video, and end the drag play after completion.

[0112] (3) Play the mov file according to the determined file playback position. Calculate the complete index information based on the segment index header and the difference index table. The segment index header and the difference index table are two separate index tables. The segment index header is generated by the complete index table at intervals of 50 index information and contains the complete index information. The difference index table is calculated, and the total number of difference index tables is the number of index information contained in the mov file. When playing, the corresponding index information is searched according to the index sequence number, and the maximum value of the sequence number is the total number.

[0113] The beneficial effect of the present invention is that the memory occupied by the index table of the mov file is reduced through a new index structure and storage method, the mov file with longer time and higher quality can be played, and the saved memory can also be used by other programs in the system, greatly improving the operating efficiency of the system. The present invention effectively reduces the memory limitation of the embedded system for the long-term high-quality mov file.

[0114] Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solution of the present invention can be modified or replaced by equivalents without departing from the spirit and scope of the technical solution of the present invention.

Claims

1. A method for processing a mov file index table, comprising: Step 1, read the index information in the mov file; Step 2, generating a segment index header according to a preset interval number, wherein the segment index header contains complete index information corresponding to the current frame, and the complete index information corresponding to the current frame includes a frame position, a timestamp, a frame size, a frame flag, and a frame interval number between the current frame and the previous key frame; Step 3, calculating a difference index table according to the segment index header and the index information read from the mov file, wherein the difference index table records the difference information between each index information in the segment and the segment index header of the segment, including frame position difference, time difference, frame size, and frame flag; Step 4, segment the segment index header and the difference index table and store them after compression, store the beginning index information of each segment of compressed data with the compressed index header, and generate a segment compressed index table, wherein the compressed index header records the time information in the segment index header.

2. The method for processing the mov file index table as described in claim 1, further, step 1 also includes reading the trak information in the mov file, and allocating memory capable of storing the segment index header and the difference index table according to the index information in the trak information, and if the allocation is successful, executing step 2 and subsequent steps in sequence; if the allocation fails, clearing the trak information, if the current trak is not the last one, reading the next one, otherwise exiting the index table processing.

3. The method for processing the mov file index table as described in claim 1, further, the segment index header in step 2 is a complete index information of the corresponding serial number index stored every predetermined number of intervals, and all the generated segment index headers together constitute a sequence table.

4. The method for processing the mov file index table as described in claim 1, further, in step 3, the difference index information is calculated according to each index information in the same segment and the corresponding segment index header, and the difference index table is generated by all the difference index information, and the number of indexes in the difference index table is the same as the number of index information in the current segment.

5. The method for processing the mov file index table as described in claim 1, further, in step 3, the frame position difference is the difference between the file position of the current frame and the corresponding frame recorded in the corresponding segment index header; the time difference is the difference between the current frame and the corresponding playback time in the corresponding segment index header; the mov file trak information includes stts box information, which stores the total number of indexes of the trak and the time scale difference time_stts between each index, and the time scale difference time_stts is the time scale difference between frames based on the code stream time base timea.

6. The processing method of the mov file index table as described in claim 5, wherein the time difference needs to be converted to a time base, and the calculation formula is diff_dts=(time_stts / timea)*(timeb)*(m-1), wherein timeb is the time base of the system that needs to play the mov code stream, and is converted to the same time unit as the time base timea; m is the serial number of the difference index, and diff_dts is the time difference.

7. The method for processing the mov file index table as described in claim 1, further, in step 4, the segment index header and the corresponding difference index table are segmented and compressed, each segment of compressed data contains a plurality of segment index headers and corresponding difference index information, and the compressed index header records the timestamp information of the first index information in each segment of the segment compression.

8. A method for playing a mov file using an index table generated by the method according to any one of claims 1 to 7, comprising: Step 1, determine the corresponding segment compression index table according to the playback time and decompress it; Step 2, determine whether it is drag play, if not, obtain the index number required for the current play frame, find the corresponding segment index header and difference index through the index number, calculate the index information according to the segment index header and difference index table, and determine the file play position; If yes, then search the corresponding difference index table according to the drag play time and the segment index header to determine the file play position; Step 3, play the mov file according to the determined file playback position.

9. The method for playing mov files as described in claim 8, wherein the corresponding difference index table is searched according to the drag-play time and the segment index header, and further includes: determining whether it is a video stream, if not, searching for the audio frame closest to the drag-play time, and ending the drag-play; if so, searching for the first video key frame in the segment difference index table, and further determining whether it contains an audio stream, and ending the drag-play if it does not contain it, otherwise searching for the audio frame closest to the time of the video key frame to synchronize the audio and video, and ending the drag-play after completion.