Video file storage methods, devices, computer equipment and storage media
By obtaining the block binary matrix of the video file, counting the number of element features, and determining the compression ratio based on the degree of clustering, the problem of wasted computing resources in video file storage is solved, achieving more efficient compression and storage.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- INDUSTRIAL AND COMMERCIAL BANK OF CHINA
- Filing Date
- 2023-04-19
- Publication Date
- 2026-08-04
AI Technical Summary
In existing video file storage methods, compression processing with a fixed compression rate can easily lead to over-compression or under-compression of certain parts of the image, resulting in excessive consumption of computing resources.
By acquiring the block binary matrix of the video image, counting the number of element features, determining the compression ratio of each image block based on the degree of clustering, and performing personalized compression processing.
It achieves different compression ratios for different image blocks based on the degree of clustering, avoiding local over-compression or under-compression, and reducing the computational resource consumption of storage and compression processes.
Smart Images

Figure CN116418985B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular to a method, apparatus, computer equipment, storage medium, and computer program product for storing video files. Background Technology
[0002] With the development of computer technology, a technology for storing video files has emerged. For example, during the transfer of resource objects, in order to ensure the legality of the transfer process, it is often necessary to record the process and store the recording to guarantee its legitimacy.
[0003] Currently, the storage of video files usually requires compression before storage. However, this storage method typically uses a fixed compression rate, which may result in over-compression or under-compression of certain parts of the video. This can lead to excessive computing resources being consumed during the storage or compression process. Summary of the Invention
[0004] Therefore, it is necessary to provide a video file storage method, apparatus, computer equipment, computer-readable storage medium, and computer program product that can reduce the computational resource consumption of the storage or compression process, in order to address the above-mentioned technical problems.
[0005] In a first aspect, this application provides a method for storing video recording files, the method comprising:
[0006] Obtain video images recorded during the user's execution of resource object transfer, and obtain multiple image frame blocks contained in the video images;
[0007] Obtain the block binary matrix corresponding to each of the image frames, and obtain the element features corresponding to each of the image frames based on the matrix elements contained in each of the block binary matrices;
[0008] The number of each element feature is counted, and the clustering degree of each image block is obtained based on the number of element features;
[0009] Based on the clustering degree, the compression ratio corresponding to each image block is obtained, and each image block is compressed according to the compression ratio. The compressed video image is then stored.
[0010] In one embodiment, the element features are represented by a tuple; obtaining the element features corresponding to each image frame block based on the matrix elements contained in each of the block binary matrices includes: obtaining the current image frame block and the current block binary matrix corresponding to the current image frame block; determining the current tuple corresponding to the current image frame block based on the element values of the matrix elements contained in the current block binary matrix and the arrangement of the matrix elements.
[0011] In one embodiment, determining the current tuple corresponding to the current image block based on the element values of the matrix elements contained in the current block binary matrix and the arrangement of the matrix elements includes: obtaining, based on the element values, a first matrix element with an element value of 1 and a second matrix element with an element value of 0 from the matrix elements contained in the current block binary matrix; determining the number of elements in the target element set contained in the current block binary matrix based on the first matrix element, the second matrix element, and the arrangement; the target element set is a set of elements consisting of a first matrix element and a second matrix element, wherein the second matrix element is arranged before the first matrix element; and obtaining the current tuple based on the number of elements in the first matrix element and the number of elements in the set.
[0012] In one embodiment, the step of counting the number of each element feature and obtaining the clustering degree of each image segment based on the number of element features includes: obtaining the binary elements contained in each binary tuple, counting the number of binary tuples corresponding to each binary tuple with the same binary elements; using the number of binary tuples corresponding to each binary tuple to perform clustering processing on each binary tuple to obtain the clustering degree of each binary tuple; and using the clustering degree of each binary tuple as the clustering degree of the image segment corresponding to each binary tuple.
[0013] In one embodiment, the step of clustering each pair of tuples using the number of pairs corresponding to each pair to obtain the clustering degree of each pair includes: obtaining a pre-constructed correspondence between the number range of pairs of tuples and the clustering degree; obtaining the number range of pairs of tuples corresponding to each pair of tuples using the number of pairs of tuples corresponding to each pair of tuples; and determining the clustering degree of each pair of tuples based on the number range of pairs of tuples corresponding to each pair of tuples and the correspondence.
[0014] In one embodiment, obtaining the compression ratio corresponding to each of the image segments based on the clustering degree includes: obtaining a pre-set correspondence between the clustering degree and the compression ratio; wherein the clustering degree and the compression ratio are negatively correlated; and obtaining the compression ratio corresponding to each of the image segments based on the correspondence and the clustering degree corresponding to each of the image segments.
[0015] In one embodiment, obtaining the multiple image frame blocks contained in the video image includes: performing binary reading on the video image to obtain an image binary matrix corresponding to the video image; performing matrix block processing on the image binary matrix according to a preset block length to obtain multiple block binary matrices corresponding to the video image; and using the image frames corresponding to the multiple block binary matrices as the multiple image frame blocks contained in the video image.
[0016] Secondly, this application also provides a video recording file storage device. The device includes:
[0017] The video image segmentation module is used to acquire video images recorded during the user's resource object transfer process, and to acquire multiple image frames contained in the video images;
[0018] The block feature acquisition module is used to acquire the block binary matrix corresponding to each of the image blocks, and to obtain the element features corresponding to each of the image blocks based on the matrix elements contained in each of the block binary matrices.
[0019] The clustering degree acquisition module is used to count the number of each element feature and obtain the clustering degree of each image block based on the number of element features.
[0020] The video image storage module is used to obtain the compression ratio corresponding to each of the image frames based on the clustering degree, compress each of the image frames according to the compression ratio, and store the compressed video image.
[0021] Thirdly, this application also provides a computer device. The computer device includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to perform the following steps:
[0022] Obtain video images recorded during the user's execution of resource object transfer, and obtain multiple image frame blocks contained in the video images;
[0023] Obtain the block binary matrix corresponding to each of the image frames, and obtain the element features corresponding to each of the image frames based on the matrix elements contained in each of the block binary matrices;
[0024] The number of each element feature is counted, and the clustering degree of each image block is obtained based on the number of element features;
[0025] Based on the clustering degree, the compression ratio corresponding to each image block is obtained, and each image block is compressed according to the compression ratio. The compressed video image is then stored.
[0026] Fourthly, this application also provides a computer-readable storage medium. The computer-readable storage medium stores a computer program thereon, which, when executed by a processor, performs the following steps:
[0027] Obtain video images recorded during the user's execution of resource object transfer, and obtain multiple image frame blocks contained in the video images;
[0028] Obtain the block binary matrix corresponding to each of the image frames, and obtain the element features corresponding to each of the image frames based on the matrix elements contained in each of the block binary matrices;
[0029] The number of each element feature is counted, and the clustering degree of each image block is obtained based on the number of element features;
[0030] Based on the clustering degree, the compression ratio corresponding to each image block is obtained, and each image block is compressed according to the compression ratio. The compressed video image is then stored.
[0031] Fifthly, this application also provides a computer program product. The computer program product includes a computer program that, when executed by a processor, performs the following steps:
[0032] Obtain video images recorded during the user's execution of resource object transfer, and obtain multiple image frame blocks contained in the video images;
[0033] Obtain the block binary matrix corresponding to each of the image frames, and obtain the element features corresponding to each of the image frames based on the matrix elements contained in each of the block binary matrices;
[0034] The number of each element feature is counted, and the clustering degree of each image block is obtained based on the number of element features;
[0035] Based on the clustering degree, the compression ratio corresponding to each image block is obtained, and each image block is compressed according to the compression ratio. The compressed video image is then stored.
[0036] The aforementioned video file storage method, apparatus, computer equipment, storage medium, and computer program product acquire video images recorded during the user's execution of resource object transfer, and acquire multiple image frame blocks contained in the video images; acquire the block binary matrix corresponding to each image frame block, and obtain the element features corresponding to each image frame block based on the matrix elements contained in each block binary matrix; count the number of each element feature, and obtain the clustering degree of each image frame block based on the number of element features; obtain the compression ratio corresponding to each image frame block based on the clustering degree, compress each image frame block according to the compression ratio, and store the compressed video images. This application can segment video images during the storage process of recording the user's execution of resource object transfer. Furthermore, based on the element characteristics of the elements in the binary matrix corresponding to each image segment, the clustering degree of each image segment can be obtained. The compression ratio for each video image segment can then be determined based on the clustering degree. Each image segment is then compressed according to the compression ratio before storage. This method allows different image segments to be compressed using different compression ratios based on the clustering degree, thus avoiding over-compression or under-compression of certain parts of the video image. Therefore, it can reduce the computational resource consumption during storage or compression. Attached Figure Description
[0037] Figure 1 This is a flowchart illustrating a video file storage method in one embodiment;
[0038] Figure 2 This is a flowchart illustrating the process of obtaining element features corresponding to each image block in one embodiment;
[0039] Figure 3 This is a schematic diagram of the process for determining the current binary pair in one embodiment;
[0040] Figure 4 This is a schematic diagram of the process for obtaining the clustering degree of each image block in one embodiment;
[0041] Figure 5 This is a schematic diagram of the process of obtaining multiple image frames contained in a video image in one embodiment;
[0042] Figure 6 This is a structural block diagram of a video file storage device in one embodiment;
[0043] Figure 7 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation
[0044] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0045] In one embodiment, such as Figure 1 As shown, a method for storing video files is provided. This embodiment illustrates the application of this method to a terminal. It is understood that this method can also be applied to a server, and further to a system including both a terminal and a server, and is implemented through interaction between the terminal and the server. In this embodiment, the method includes the following steps:
[0046] Step S101: Obtain video images recorded during the user's resource object transfer process, and obtain multiple image frames contained in the video images.
[0047] The process of a user transferring a resource object can be either the user acquiring the resource object or another user recommending a resource object to the user. Generally, the process can begin with another user recommending or introducing a transferable resource object, after which the user can determine whether to acquire the resource based on the information provided. In this embodiment, the video image refers to a video image recording the above process. Image segmentation refers to multiple image segment regions contained within the recorded video image.
[0048] Specifically, after the terminal completes the recording of the user's resource object transfer process and obtains the corresponding video image, the obtained video image can be processed into image blocks to obtain multiple image frames contained in the aforementioned video image.
[0049] Step S102: Obtain the block binary matrix corresponding to each image block, and obtain the element features corresponding to each image block based on the matrix elements contained in each block binary matrix.
[0050] A block binary matrix refers to the binary matrix corresponding to a block of an image frame. This binary matrix can be implemented by reading the image frame blocks in binary format. Matrix elements refer to the matrix elements contained in the block binary matrix, and element features are the characteristics of the elements contained in the block binary matrix. For example, it can include the arrangement of elements in the binary matrix and the composition of elements, etc. Since there is a one-to-one correspondence between image frame blocks and block binary matrices, the element features of each block binary matrix can also be used as the element features of the corresponding image frame block.
[0051] Step S103: Count the number of each element feature and obtain the clustering degree of each image block based on the number of element features.
[0052] The number of element features refers to the number of element features of the same kind. Since two block binary matrices may contain similar elements, element features of the same kind may appear. Therefore, after obtaining the element features corresponding to each image block, the terminal can also count the number of each element feature. Then, it can bind each image block and the number of element features corresponding to the image block, thereby obtaining the clustering degree of each image block based on the number of element features.
[0053] For example, an image frame is divided into three blocks: block 1, block 2, and block 3. The element features corresponding to blocks 1 and 3 are element features A, while the element features corresponding to block 2 are element features B. The number of element features A is 2, and the number of element features B is 1. Therefore, the number of element features corresponding to blocks 1 and 3 is 2, while the number of element features corresponding to block 2 is 1. Thus, the terminal can determine the clustering degree of each image frame block based on the number of element features. Generally speaking, the more dense the clustering, the higher the number of element features.
[0054] Step S104: Obtain the compression ratio corresponding to each image block based on the clustering degree, compress each image block according to the compression ratio, and store the compressed video image.
[0055] The compression ratio refers to the compression ratio used for compression processing. This compression ratio can be determined based on the clustering degree of image frame blocks. Specifically, after the terminal determines the clustering degree of each image frame block in step S103, it can further determine the compression ratio of each image frame block. Then, each image frame block is compressed using the compression ratio to achieve video image compression. After that, the compressed video image can be stored.
[0056] In the above-mentioned video file storage method, the video images recorded during the user's resource object transfer process are obtained, and multiple image frame blocks contained in the video images are obtained; the block binary matrix corresponding to each image frame block is obtained, and the element features corresponding to each image frame block are obtained according to the matrix elements contained in each block binary matrix; the number of each element feature is counted, and the clustering degree of each image frame block is obtained according to the number of element features; the compression ratio corresponding to each image frame block is obtained based on the clustering degree, and each image frame block is compressed according to the compression ratio, and the compressed video images are stored. This application can segment video images during the storage process of recording the user's execution of resource object transfer. Furthermore, based on the element characteristics of the elements in the binary matrix corresponding to each image segment, the clustering degree of each image segment can be obtained. The compression ratio for each video image segment can then be determined based on the clustering degree. Each image segment is then compressed according to the compression ratio before storage. This method allows different image segments to be compressed using different compression ratios based on the clustering degree, thus avoiding over-compression or under-compression of certain parts of the video image. Therefore, it can reduce the computational resource consumption during storage or compression.
[0057] In one embodiment, element features are represented in the form of binary tuples; such as Figure 2 As shown, step S102 may further include:
[0058] Step S201: Obtain the current image frame block and the current block binary matrix corresponding to the current image frame block.
[0059] A tuple refers to a combination of two elements. In this embodiment, element features can be represented using tuples. The current image frame segment refers to any one of the multiple image frame segments contained in the video image, and the current segment binary matrix is the segment binary matrix corresponding to the current image frame segment. Specifically, the terminal can select one of the multiple image frame segments as the current image frame segment and obtain the segment binary matrix corresponding to that current image frame segment, which is then used as the current segment binary matrix.
[0060] Step S202: Determine the current tuple corresponding to the current image block based on the element values of the matrix elements contained in the current block binary matrix and the arrangement of the matrix elements.
[0061] The element value refers to the numerical value of each matrix element contained in the current segmented binary matrix. Since the current segmented binary matrix is a type of binary matrix, all its matrix elements have a value of either 0 or 1. The arrangement refers to the arrangement of the matrix elements, that is, the arrangement of the 0 and 1 elements. The current tuple refers to the tuple corresponding to the current image segment. After obtaining the current segmented binary matrix, the terminal can determine the element values of each matrix element contained in the current segmented binary matrix, as well as the arrangement of the matrix elements. Using these element values and arrangement, the terminal can then determine the tuple corresponding to the current image segment, i.e., the current tuple.
[0062] In this embodiment, the terminal can obtain the current tuple that represents the current image block based on the element values of the matrix elements contained in the current block binary matrix corresponding to the current image block, as well as the arrangement of the matrix elements. This allows the terminal to represent the matrix element features of the current block binary matrix through the current tuple, thereby further improving the accuracy of obtaining the element features corresponding to the image block.
[0063] Furthermore, such as Figure 3 As shown, step S202 may further include:
[0064] Step S301: Based on the element value, obtain the first matrix element with an element value of 1 and the second matrix element with an element value of 0 from the matrix elements contained in the current block binary matrix.
[0065] The first matrix element refers to the matrix element with a value of 1 in the current block binary matrix, while the second matrix element refers to the matrix element with a value of 0 in the current block binary matrix. In this embodiment, the matrix elements contained in the current block binary matrix mainly include two types: the first matrix element with a value of 1 and the second matrix element with a value of 0. The terminal can determine whether each specific matrix element is a first matrix element or a second matrix element based on its element value.
[0066] Step S302: Determine the number of elements in the target element set contained in the current block binary matrix based on the first matrix element, the second matrix element, and the arrangement method; the target element set is a set of elements consisting of a first matrix element and a second matrix element, wherein the second matrix element is arranged before the first matrix element.
[0067] The target element set refers to the set of elements consisting of a first matrix element and a second matrix element, with the second matrix element arranged before the first matrix element. That is, the set of elements consisting of matrix elements "01". The number of element sets refers to the number of target element sets contained in the current block binary matrix.
[0068] For example, the current binary block contains 10 matrix elements, arranged in the order 0111011000. The target element set refers to the set of elements formed by the second matrix element with a value of 0 and the two matrix elements preceding the first matrix element with a value of 1, i.e., the set of elements is "01". Since there are two sets of "01" in the current binary block, the number of target element sets for this current binary block is 2. However, if the current binary block contains 3*3 matrix elements (3 elements per column, 3 rows in total), with the first row containing 100, the second row containing 101, and the third row containing 010, then the terminal can first arrange the matrix elements according to the order of each row, forming a sequence of 100101010. Then, the number of "01" sets can be counted, which is 3. Therefore, the number of target element sets for this current binary block is 3.
[0069] Step S303: Based on the number of elements in the first matrix and the number of elements in the set, obtain the current tuple.
[0070] Then, the terminal can determine the current tuple based on the number of elements in the first matrix element, that is, the number of matrix elements with a value of 1 in the current block binary matrix, and the number of the target element set obtained in step S302, that is, the number of the "01" set in the current block binary matrix. This can be done by taking the number of matrix elements with a value of 1 as the first element of the current tuple and taking the number of the "01" set as the second element of the first tuple, thus obtaining the current tuple.
[0071] Taking the current block binary matrix as 0111011000 as an example, the number of matrix elements with a value of 1 is 5, and the number of sets of "01" is 2. Therefore, the tuple of the current block binary matrix, i.e., the current tuple, is (5,2). Taking the current block binary matrix as an example, the matrix elements in the first row are 100, the matrix elements in the second row are 101, and the matrix elements in the third row are 010. Therefore, the number of matrix elements with a value of 1 is 4, and the number of sets of "01" is 3. Therefore, the tuple of the current block binary matrix, i.e., the current tuple, is (4,3).
[0072] In this embodiment, the determination of the current binary tuple can be based on the number of elements of the first matrix element with an element value of 1, and the number of elements of the set of the second matrix element with an element value of 0 that are located before the first matrix element with an element value of 1, i.e., the set of "01", so that the element characteristics of the current block binary matrix can be accurately obtained.
[0073] In one embodiment, such as Figure 4 As shown, step S103 may further include:
[0074] Step S401: Obtain the elements contained in each pair of pairs, and count the number of pairs corresponding to pairs with the same elements.
[0075] In this embodiment, since element features are represented by tuples, the number of element features can be counted by counting the number of tuples with the same tuple element. For example, if a tuple is (5,2), the terminal can find the tuples with the same tuple element from the tuples corresponding to each image block, that is, find all tuples with (5,2) and count the number of tuples with (5,2). Thus, the number of tuples corresponding to each tuple can be obtained in the above way.
[0076] For example, an image frame may be divided into three blocks: block 1, block 2, and block 3. The tuple corresponding to block 1 and block 3 is (5,2), while the tuple corresponding to block 2 is (4,3). Therefore, for the tuple (5,2), there are 2 tuples, meaning there are 2 tuples corresponding to blocks 1 and 3. However, for the tuple (4,3), there is 1 tuple, meaning there is 1 tuple corresponding to block 2.
[0077] Step S402: Using the number of pairs corresponding to each pair, perform clustering processing on each pair to obtain the clustering degree of each pair.
[0078] Step S403: The clustering degree of each binary tuple is used as the clustering degree of the image block corresponding to each binary tuple.
[0079] After obtaining the number of pairs corresponding to each pair through step S401, clustering can be performed on each pair based on the number of pairs to determine the degree of clustering of each pair. Since each pair corresponds to each block binary matrix, and each block binary matrix can be used to represent the corresponding image block, the terminal can determine the degree of clustering of the corresponding image block by the degree of clustering of the pairs.
[0080] In this embodiment, the terminal can count the number of tuples corresponding to each image frame block, and then use the number of tuples to perform clustering processing on the tuples, and use the clustering degree of the tuples as the clustering degree of the corresponding image frame block. In this way, the accuracy of determining the clustering degree of the image frame block can be improved.
[0081] Furthermore, step S402 may further include: obtaining the correspondence between the pre-constructed range of the number of pairs and the degree of clustering; obtaining the range of the number of pairs corresponding to each pair using the number of pairs corresponding to each pair; and determining the degree of clustering of each pair based on the range of the number of pairs corresponding to each pair and the correspondence.
[0082] The intervals for the number of binary pairs are pre-constructed and used to distinguish the number of binary pairs. In this embodiment, the degree of clustering can include multiple intervals, each characterized by a different clustering degree label. Each clustering degree label can be pre-assigned to a interval for the number of binary pairs. Generally, the intervals for the number of binary pairs and the degree of clustering are positively correlated; that is, the larger the interval for the number of binary pairs, the greater the degree of clustering it represents. For example, the intervals for the number of binary pairs can include intervals A, B, and C, where interval A corresponds to clustering degree A, interval B corresponds to clustering degree B, and interval C corresponds to clustering degree C.
[0083] After obtaining the number of pairs corresponding to each pair, the terminal can determine the range of pairs that each pair falls within. This range is then used as the clustering degree of each pair. For example, if the number of pairs in block 1 satisfies range A, then the clustering degree of this pair is clustering degree A. Similarly, if the number of pairs in block 2 satisfies range B, then the clustering degree of this pair is clustering degree B.
[0084] In this embodiment, the terminal can pre-construct the correspondence between the number range of binary pairs and the degree of clustering. After obtaining the number of binary pairs corresponding to each binary pair, the corresponding number range of binary pairs can be determined to obtain the degree of clustering of the corresponding binary pairs. The above method can improve the efficiency of determining the degree of clustering of binary pairs.
[0085] In addition, step S104 may further include: obtaining a pre-set correspondence between clustering degree and compression ratio; wherein, clustering degree and compression ratio are negatively correlated; and obtaining the compression ratio corresponding to each image block based on the correspondence and the clustering degree corresponding to each image block.
[0086] Similarly, a pre-defined relationship can be established between clustering degree and compression ratio. Since different clustering degrees correspond to different compression ratios, a pre-constructed relationship between clustering degree and compression ratio can also be established. This relationship must satisfy the condition that clustering degree and compression ratio are negatively correlated; that is, the higher the clustering degree, the lower the compression ratio, and vice versa. After obtaining the clustering degree corresponding to the current image frame block, the terminal can further determine the compression ratio corresponding to the current image frame block based on the aforementioned relationship, thus obtaining the compression ratio for each image frame block in the above manner.
[0087] For example, the terminal can pre-build a correspondence between clustering degree A and compression ratio 1, clustering degree B and compression ratio 2, and clustering degree C and compression ratio 3. After obtaining the clustering degree corresponding to each image block, the terminal can determine the compression ratio of each image block based on the above correspondence. For example, if the clustering degree of an image block 1 is clustering degree A, then the compression ratio corresponding to block 1 is compression ratio 1, that is, block 1 can be compressed using compression ratio 1. And if the clustering degree of image block 2 is clustering degree B, then the compression ratio corresponding to block 2 is compression ratio 2, that is, block 2 can be compressed using compression ratio 2.
[0088] In this embodiment, the terminal can pre-set the correspondence between each clustering degree and the compression ratio. After determining the clustering degree corresponding to each image block, the terminal can further obtain the compression ratio corresponding to each image block based on the above correspondence, thereby improving the efficiency of determining the compression ratio and thus improving the efficiency of video image compression.
[0089] In one embodiment, such as Figure 5 As shown, step S101 may further include:
[0090] Step S501: Perform binary reading on the video image to obtain the image binary matrix corresponding to the video image.
[0091] The image binary matrix refers to the binary matrix corresponding to the video image. After obtaining the video image, the terminal can obtain the binary matrix corresponding to the video image, that is, obtain the image binary matrix.
[0092] Step S502: Perform matrix block processing on the image binary matrix according to the preset block length to obtain multiple block binary matrices corresponding to the video image.
[0093] Step S503: The image frames corresponding to the multiple block binary matrices are used as multiple image frame blocks contained in the video image.
[0094] The block length refers to the pre-set length used for block processing of the image binary matrix. In this embodiment, the block processing of the video image can be achieved by block processing of the image binary matrix. The terminal can perform matrix block processing on the image binary matrix corresponding to the video image according to the pre-set block length, thereby dividing the image binary matrix into multiple block binary matrices, which are used as multiple block binary matrices corresponding to the video image. Since each block binary matrix corresponds to a part of the image frame, after obtaining multiple block binary matrices of the video image, the terminal can also use the image frame corresponding to each block binary matrix as a block of multiple image frames contained in the video image.
[0095] For example, the terminal can divide the image binary matrix corresponding to the video image into blocks according to the set block length, and obtain block binary matrix A, block binary matrix B and block binary matrix C respectively. Then, the image frame corresponding to each block binary matrix can be used as the various image frame blocks contained in the video image. That is, the obtained image frame blocks can include block A corresponding to block binary matrix A, block B corresponding to block binary matrix B and block C corresponding to block binary matrix C.
[0096] In this embodiment, the terminal can first read the video image into binary form to obtain the image binary matrix. Then, it can use the set block length to perform block processing on the image binary matrix. After obtaining the block binary matrix, the image frame corresponding to each block binary matrix can be used as a block of multiple image frames contained in the video image, thereby achieving accurate block segmentation of the video image and further improving the accuracy of video image block segmentation.
[0097] In one embodiment, a dual-recording video file storage method is also provided. This method improves the intelligence of dual-recording file compression processing by compressing different parts of the video frame using different compression ratios / sampling ratios. Based on statistical characteristics, the degree of clustering of the image information is characterized, and an appropriate compression ratio is selected according to the clustering degree to achieve the process of compressing different parts of the image using different compression ratios. Specifically, this method may include the following steps:
[0098] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.
[0099] Step 1: Obtain the dual-recording video file to be processed.
[0100] The dual-recording video file to be stored refers to the dual-recording video file that needs to be processed. After the dual-recording video file is recorded, the recorded dual-recording file can be used as the dual-recording file to be processed.
[0101] Step 2: Read the dual-recorded video footage in binary format to obtain the corresponding 01 matrix. Then, divide the 01 matrix into blocks according to the set length to obtain multiple sub-matrices corresponding to the dual-recorded file.
[0102] Step 3: Determine the degree of information clustering for each submatrix. Obtaining the information clustering degree identifier may specifically include the following process:
[0103] Step 3.1: Count the number of "1"s and "01"s in each submatrix, and denote them as p and q respectively, thus obtaining a pair (p, q). The pair represents the x and y coordinates of a point in the two-dimensional vector space corresponding to the submatrix, thus obtaining the correspondence between each point and the submatrix.
[0104] Step 3.2: Count the number of sub-matrices contained in the same coordinate point to form the thermodynamic statistical distribution of each coordinate point. That is, the number of pairs with the same p and q values is denoted as n, thus obtaining a triple (p, q, n). The larger the value of n, the more matrices that meet the statistical characteristics.
[0105] Step 3.3: Points with similar coordinate values share similar statistical characteristics, thus possessing certain commonalities. Based on this method, different blocks of an image are clustered, and the clustering identifies "dense" and "sparse" parts. Specifically, the submatrix can be arranged from largest to smallest based on the value of n. The submatrix with the highest n value can be considered dense, and the submatrix with the lowest n value can be considered sparse. Furthermore, the corresponding compression strategy can be determined based on the available compression level.
[0106] Step 4: For segments corresponding to dense subsequences, use a low compression ratio for compression; for segments corresponding to sparse subsequences, use a high compression ratio for compression.
[0107] This embodiment allows for segmented compression processing by applying different compression ratios to different parts of a dual-recorded video file. This avoids over-compression or under-compression of certain parts of the image, thereby improving the utilization of storage and network transmission resources and reducing the computational resources consumed during the compression process.
[0108] Based on the same inventive concept, this application also provides a video file storage device for implementing the video file storage method described above. The solution provided by this device is similar to the solution described in the above method; therefore, the specific limitations in one or more video file storage device embodiments provided below can be found in the limitations of the video file storage method described above, and will not be repeated here.
[0109] In one embodiment, such as Figure 6 As shown, a video file storage device is provided, including: a video image segmentation module 601, a segmentation feature acquisition module 602, a clustering degree acquisition module 603, and a video image storage module 604, wherein:
[0110] The video image segmentation module 601 is used to acquire video images recorded during the user's execution of resource object transfer, and to acquire multiple image frames contained in the video images;
[0111] The block feature acquisition module 602 is used to acquire the block binary matrix corresponding to each image block, and obtain the element features corresponding to each image block based on the matrix elements contained in each block binary matrix.
[0112] The clustering degree acquisition module 603 is used to count the number of features of each element and obtain the clustering degree of each image block based on the number of features of each element.
[0113] The video image storage module 604 is used to obtain the compression ratio corresponding to each image block based on the clustering degree, compress each image block according to the compression ratio, and store the compressed video image.
[0114] In one embodiment, element features are represented by a tuple; the block feature acquisition module 602 is further used to acquire the current image block and the current block binary matrix corresponding to the current image block; and determine the current tuple corresponding to the current image block based on the element values of the matrix elements contained in the current block binary matrix and the arrangement of the matrix elements.
[0115] In one embodiment, the block feature acquisition module 602 is further configured to: acquire, based on element values, a first matrix element with an element value of 1 and a second matrix element with an element value of 0 from the matrix elements contained in the current block binary matrix; determine the number of elements in the target element set contained in the current block binary matrix based on the first matrix element, the second matrix element, and the arrangement; the target element set is a set of elements consisting of a first matrix element and a second matrix element, wherein the second matrix element is arranged before the first matrix element; and obtain the current tuple based on the number of elements in the first matrix element and the number of elements in the set.
[0116] In one embodiment, the clustering degree acquisition module 603 is further configured to acquire the elements contained in each tuple, count the number of tuples corresponding to each tuple with the same elements, perform clustering processing on each tuple using the number of tuples corresponding to each tuple, and obtain the clustering degree of each tuple; and use the clustering degree of each tuple as the clustering degree of the image block corresponding to each tuple.
[0117] In one embodiment, the clustering degree acquisition module 603 is further used to acquire the correspondence between the pre-constructed range of the number of tuples and the clustering degree; to acquire the range of the number of tuples corresponding to each tuple using the number of tuples corresponding to each tuple; and to determine the clustering degree of each tuple based on the range of the number of tuples corresponding to each tuple and the correspondence.
[0118] In one embodiment, the video image storage module 604 is further configured to obtain a pre-defined correspondence between clustering degree and compression ratio; wherein, the clustering degree and compression ratio are negatively correlated; based on the correspondence and the clustering degree corresponding to each image block, the compression ratio corresponding to each image block is obtained.
[0119] In one embodiment, the video image segmentation module 601 is further configured to perform binary reading on the video image to obtain the image binary matrix corresponding to the video image; perform matrix segmentation processing on the image binary matrix according to a preset segmentation length to obtain multiple segmented binary matrices corresponding to the video image; and use the image frames corresponding to the multiple segmented binary matrices as multiple image frame blocks contained in the video image.
[0120] Each module in the aforementioned video file storage device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device, or stored in the memory of a computer device as software, so that the processor can call and execute the operations corresponding to each module.
[0121] In one embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be as follows: Figure 7 As shown, the computer device includes a processor, memory, communication interface, display screen, and input devices connected via a system bus. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The communication interface is used for wired or wireless communication with external terminals; wireless communication can be achieved through Wi-Fi, mobile cellular networks, NFC (Near Field Communication), or other technologies. When the computer program is executed by the processor, it implements various methods for storing video files. The display screen can be an LCD screen or an e-ink screen. The input devices can be a touch layer covering the display screen, buttons, a trackball, or a touchpad on the computer device's casing, or an external keyboard, touchpad, or mouse.
[0122] Those skilled in the art will understand that Figure 7 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0123] In one embodiment, a computer device is also provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps in the above method embodiments.
[0124] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon that, when executed by a processor, implements the steps in the above method embodiments.
[0125] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps in the above method embodiments.
[0126] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties.
[0127] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.
[0128] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0129] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.
Claims
1. A video file storage method characterized by comprising: The method includes: Obtain video images recorded during the user's execution of resource object transfer, and obtain multiple image frame blocks contained in the video images; Obtain the block binary matrix corresponding to each of the image frames, and obtain the element features corresponding to each of the image frames based on the matrix elements contained in each of the block binary matrices. The element features are represented in the form of tuples. The number of each element feature is counted, and the clustering degree of each image block is obtained based on the number of element features; Based on the clustering degree, the compression ratio corresponding to each image block is obtained, and each image block is compressed according to the compression ratio. The compressed video image is then stored. The step of obtaining the element features corresponding to each image block based on the matrix elements contained in each of the segmented binary matrices includes: Obtain the current image frame block and the corresponding current block binary matrix; Based on the element values of the matrix elements contained in the current block binary matrix and the arrangement of the matrix elements, the current tuple corresponding to the current image block is determined.
2. The method according to claim 1, characterized in that, The step of determining the current tuple corresponding to the current image block based on the element values of the matrix elements contained in the current block binary matrix and the arrangement of the matrix elements includes: Based on the element value, obtain the first matrix element with an element value of 1 and the second matrix element with an element value of 0 from the matrix elements contained in the current block binary matrix; Based on the first matrix element, the second matrix element, and the arrangement, determine the number of elements in the target element set contained in the current block binary matrix; the target element set is a set of elements consisting of a first matrix element and a second matrix element, wherein the second matrix element is arranged before the first matrix element. The current tuple is obtained based on the number of elements in the first matrix and the number of elements in the set.
3. The method according to claim 1, characterized in that, The step of counting the number of each element feature and obtaining the clustering degree of each image segment based on the number of element features includes: Obtain the elements contained in each of the given pairs, and count the number of pairs corresponding to the pairs with the same elements; Using the number of pairs corresponding to each pair, clustering is performed on each pair to obtain the clustering degree of each pair; The clustering degree of each of the binary groups is used as the clustering degree of the image block corresponding to each binary group.
4. The method according to claim 3, characterized in that, The step of clustering each pair of pairs using the number of pairs corresponding to each pair to obtain the clustering degree of each pair includes: Obtain the correspondence between the pre-constructed range of the number of binary pairs and the degree of clustering; By utilizing the number of pairs corresponding to each pair, the range of the number of pairs corresponding to each pair can be obtained; The clustering degree of each pair is determined based on the range of the number of pairs corresponding to each pair and the corresponding relationship.
5. The method according to claim 1, characterized in that, The step of obtaining the compression ratio corresponding to each image block based on the clustering degree includes: Obtain the pre-defined relationship between clustering degree and compression ratio; wherein, the clustering degree and the compression ratio are negatively correlated; Based on the correspondence and the clustering degree of each image segment, the compression ratio of each image segment is obtained.
6. The method according to any one of claims 1 to 5, characterized in that, The process of acquiring multiple image frame blocks contained in the video image includes: The video image is read in binary form to obtain the image binary matrix corresponding to the video image; The image binary matrix is divided into blocks according to a preset block length to obtain multiple block binary matrices corresponding to the video image. The image frames corresponding to the multiple binary blocks are used as the multiple image frame blocks contained in the video image.
7. A video recording file storage device, characterized in that, The device includes: The video image segmentation module is used to acquire video images recorded during the user's resource object transfer process, and to acquire multiple image frames contained in the video images; The block feature acquisition module is used to acquire the block binary matrix corresponding to each of the image frame blocks, and obtain the element features corresponding to each of the image frame blocks based on the matrix elements contained in each of the block binary matrices. The element features are represented in the form of tuples. The step of obtaining the element features corresponding to each of the image frame blocks based on the matrix elements contained in each of the block binary matrices includes: acquiring the current image frame block and the current block binary matrix corresponding to the current image frame block; and determining the current tuple corresponding to the current image frame block based on the element values of the matrix elements contained in the current block binary matrix and the arrangement of the matrix elements. The clustering degree acquisition module is used to count the number of each element feature and obtain the clustering degree of each image block based on the number of element features. The video image storage module is used to obtain the compression ratio corresponding to each of the image frames based on the clustering degree, compress each of the image frames according to the compression ratio, and store the compressed video image.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 6.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 6.
10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 6.