CN107734336B - Compression method and device for video storage space - Google Patents

Compression method and device for video storage space Download PDF

Info

Publication number
CN107734336B
CN107734336B CN201610658070.5A CN201610658070A CN107734336B CN 107734336 B CN107734336 B CN 107734336B CN 201610658070 A CN201610658070 A CN 201610658070A CN 107734336 B CN107734336 B CN 107734336B
Authority
CN
China
Prior art keywords
video file
preset
compressed
determining
resolution
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201610658070.5A
Other languages
Chinese (zh)
Other versions
CN107734336A (en
Inventor
夏伟强
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hangzhou Hikvision Digital Technology Co Ltd
Original Assignee
Hangzhou Hikvision Digital Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hangzhou Hikvision Digital Technology Co Ltd filed Critical Hangzhou Hikvision Digital Technology Co Ltd
Priority to CN201610658070.5A priority Critical patent/CN107734336B/en
Publication of CN107734336A publication Critical patent/CN107734336A/en
Application granted granted Critical
Publication of CN107734336B publication Critical patent/CN107734336B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/42Methods or arrangements for coding, decoding, compressing or decompressing digital video signals characterised by implementation details or hardware specially adapted for video compression or decompression, e.g. dedicated software implementation
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/134Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or criterion affecting or controlling the adaptive coding
    • H04N19/156Availability of hardware or computational resources, e.g. encoding based on power-saving criteria
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/42Methods or arrangements for coding, decoding, compressing or decompressing digital video signals characterised by implementation details or hardware specially adapted for video compression or decompression, e.g. dedicated software implementation
    • H04N19/423Methods or arrangements for coding, decoding, compressing or decompressing digital video signals characterised by implementation details or hardware specially adapted for video compression or decompression, e.g. dedicated software implementation characterised by memory arrangements
    • H04N19/426Methods or arrangements for coding, decoding, compressing or decompressing digital video signals characterised by implementation details or hardware specially adapted for video compression or decompression, e.g. dedicated software implementation characterised by memory arrangements using memory downsizing methods

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Computing Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Compression Or Coding Systems Of Tv Signals (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The embodiment of the invention provides a method and a device for compressing a video storage space. The specific implementation mode of the method comprises the following steps: determining an original video file to be compressed from the stored video files; obtaining the resolution of the original video file; according to a preset rule, reducing the resolution of the original video file to generate a compressed video file; and storing the compressed video file and deleting the original video file. The embodiment can avoid the situation that the video playing is not smooth after the video is compressed.

Description

Compression method and device for video storage space
Technical Field
The present invention relates to the field of video storage technologies, and in particular, to a method and an apparatus for compressing a video storage space.
Background
Generally, the data volume of a video file is large, and when the video is stored, the occupied space is large no matter the video is stored in a local hard disk or a cloud storage space. This problem is particularly acute when large amounts of video need to be stored. For example, the amount of video files generated by video surveillance is very large, and the space required to store video surveillance files is very large.
In order to compress the storage space occupied by the video file, the prior art adopts a mode that frames are extracted from the video according to a preset rule, for example, M frames are extracted every N frames, and then the video after frame extraction is stored in a resource pool of a local hard disk or a cloud storage space.
Although the purpose of compressing the video storage space is achieved in this way, some frames in the video are extracted, so that when playing the compressed video, the video cannot be smoothly played.
Disclosure of Invention
The embodiment of the invention aims to provide a method and a device for compressing a video storage space, which can avoid the situation that the video is not smoothly played after being compressed.
In order to achieve the above object, the present application discloses a method for compressing a video storage space, the method comprising:
determining an original video file to be compressed from the stored video files;
obtaining the resolution of the original video file;
according to a preset rule, reducing the resolution of the original video file to generate a compressed video file;
and storing the compressed video file and deleting the original video file.
Optionally, the determining an original video file to be compressed from the stored video files includes:
obtaining a first numerical value of the size of a storage space occupied by a stored video file;
judging whether the first numerical value meets a preset condition or not;
if yes, determining all or part of the stored video file as an original video file to be compressed.
Optionally, the determining whether the first value meets a preset condition is:
judging whether the first numerical value is larger than a preset storage space threshold value or not; or the like, or, alternatively,
acquiring a total value of the size of a preset storage space for storing the video file;
and judging whether the proportion of the first numerical value in the total numerical value is greater than a preset proportion threshold value.
Optionally, the video file is stored in a resource pool of a cloud storage space;
the determining an original video file to be compressed from the stored video files comprises:
determining a resource pool to be detected;
obtaining a second numerical value of the size of a storage space occupied by the video file stored in each resource pool to be detected;
respectively judging whether each second numerical value meets a preset condition;
and determining all or part of the stored video files in the resource pool meeting the preset conditions as original video files to be compressed.
Optionally, the determining the resource pool to be detected includes:
and according to a preset period, determining a preset number of resource pools from all resource pools of the cloud storage space as resource pools to be detected.
Optionally, the respectively determining whether each of the second numerical values meets a preset condition is:
respectively judging whether each second numerical value is larger than a preset storage space threshold value; or the like, or, alternatively,
obtaining a total numerical value of the storage space size of each resource pool to be detected;
and respectively judging whether the proportion of each first numerical value in the total numerical value is greater than a preset proportion threshold value.
Optionally, the determining all or part of the stored video file as an original video file to be compressed includes:
acquiring the latest access time of each stored video file, and determining the current non-accessed time length of each stored video file according to the current time;
judging whether a video file with the current time length which is not accessed and is greater than a preset time length threshold exists in the stored video files or not;
and if so, determining the video file which is not accessed currently and has the time length longer than the preset time length threshold value as the original video file to be compressed.
Optionally, the method further includes:
when the stored video files do not have video files with the current non-accessed time length larger than a preset time length threshold value, sequencing the stored video files according to the sequence of the current non-accessed time length from large to small;
determining a target video file which has longer current non-accessed time and occupies a storage space with a size reaching a target numerical value from the sorted stored video files; the target value is determined according to the video file and a preset vacated space threshold value or a preset vacated space proportion;
and determining the target video file as an original video file to be compressed.
Optionally, the reducing the resolution of the original video file according to a preset rule to generate a compressed video file includes:
and reducing the resolution of each original video file to the corresponding compressed resolution according to the preset corresponding relation between the original resolution and the compressed resolution.
Optionally, before reducing the resolution of the original video file according to a preset rule and generating a compressed video file, the method further includes:
judging whether an original video file with the resolution ratio not greater than a preset minimum resolution ratio threshold exists in the original video file;
and if so, performing frame extraction processing on the original video file with the resolution not greater than a preset minimum resolution threshold.
Optionally, the method further includes:
detecting whether a first video file which is subjected to resolution reduction processing exists in the stored video files;
if the current time length of the first video file is not accessed, acquiring the latest access time of each first video file, and determining the current time length of each first video file which is not accessed;
determining a first video file with the current non-accessed time length being greater than a preset time length threshold value as a video file to be compressed;
obtaining the resolution of the video file to be compressed;
according to a preset rule, reducing the resolution of the video file to be compressed to generate a compressed video file;
and storing the compressed video file and deleting the video file to be compressed.
In order to achieve the above object, the present application discloses an apparatus for compressing a video storage space, the apparatus comprising:
the determining module is used for determining an original video file to be compressed from the stored video files;
an obtaining module, configured to obtain a resolution of the original video file;
the compression module is used for reducing the resolution of the original video file according to a preset rule and generating a compressed video file;
and the storage module is used for storing the compressed video file and deleting the original video file.
Optionally, the determining module includes:
the first obtaining submodule is used for obtaining a first numerical value of the size of a storage space occupied by a stored video file;
the first judgment submodule is used for judging whether the first numerical value meets a preset condition or not;
and the first determining submodule is used for determining all or part of the stored video file as an original video file to be compressed when the first numerical value is judged to meet the preset condition.
Optionally, the first determining submodule is specifically configured to:
judging whether the first numerical value is larger than a preset storage space threshold value or not; or the like, or, alternatively,
acquiring a total value of the size of a preset storage space for storing the video file; and judging whether the proportion of the first numerical value in the total numerical value is greater than a preset proportion threshold value.
Optionally, the video file is stored in a resource pool of a cloud storage space; the determining module comprises:
the second determining submodule is used for determining the resource pool to be detected;
the second obtaining submodule is used for obtaining a second numerical value of the size of the storage space occupied by the video file stored in each resource pool to be detected;
the second judgment submodule is used for respectively judging whether each second numerical value meets a preset condition;
and the third determining submodule is used for determining all or part of the stored video files in the resource pool meeting the preset conditions as original video files to be compressed.
Optionally, the second determining submodule is specifically configured to:
and according to a preset period, determining a preset number of resource pools from all resource pools of the cloud storage space as resource pools to be detected.
Optionally, the second judgment sub-module is specifically configured to:
respectively judging whether each second numerical value is larger than a preset storage space threshold value; or the like, or, alternatively,
obtaining a total numerical value of the storage space size of each resource pool to be detected; and respectively judging whether the proportion of each first numerical value in the total numerical value is greater than a preset proportion threshold value.
Optionally, the first determining sub-module includes:
the first time length determining subunit is used for acquiring the latest access time of each stored video file and determining the current non-accessed time length of each stored video file according to the current time;
the first time length judging subunit is used for judging whether a video file with the current time length which is not accessed and is greater than a preset time length threshold exists in the stored video files or not;
and the first video file determining subunit is used for determining the video file with the current non-accessed time length being greater than the preset time length threshold value as the original video file to be compressed when the video file with the current non-accessed time length being greater than the preset time length threshold value exists in the stored video files.
Optionally, the first determining sub-module further includes:
the first sequencing subunit is used for sequencing the stored video files according to the sequence of the current time length which is not accessed from large to small when the video files with the current time length which is not accessed and is larger than the preset time length threshold do not exist in the stored video files;
the first target file determining subunit is used for determining a target video file which is not accessed currently and has a longer time and occupies a storage space with a size reaching a target numerical value from the sorted stored video files; the target value is determined according to the video file and a preset vacated space threshold value or a preset vacated space proportion;
and the second video file determining subunit is used for determining the target video file as an original video file to be compressed.
Optionally, the compression module is specifically configured to:
and reducing the resolution of each original video file to the corresponding compressed resolution according to the preset corresponding relation between the original resolution and the compressed resolution.
Optionally, the system further includes a frame extracting module, specifically configured to:
before reducing the resolution of the original video file according to a preset rule and generating a compressed video file, judging whether the original video file with the resolution not greater than a preset minimum resolution threshold exists in the original video file;
and if so, performing frame extraction processing on the original video file with the resolution not greater than a preset minimum resolution threshold.
Optionally, the system further comprises a detection module;
the detection module is used for detecting whether a first video file which is subjected to resolution reduction processing exists in the stored video files or not;
the determining module is further configured to, when it is detected that a first video file which has been subjected to resolution reduction processing exists in the stored video files, acquire the latest access time of each first video file, and determine, according to the current time, a current unaccessed duration of each first video file; determining a first video file with the current non-accessed time length being greater than a preset time length threshold value as a video file to be compressed;
the obtaining module is further configured to obtain a resolution of the video file to be compressed;
the compression module is further used for reducing the resolution of the video file to be compressed according to a preset rule and generating a compressed video file;
the storage module is further configured to store the compressed video file and delete the video file to be compressed.
According to the technical scheme, the resolution of the original video file to be compressed is reduced according to the resolution of the original video file and the preset rule, the compressed video file is generated, then the compressed video file is stored, and the original video file is deleted. In the embodiment of the invention, the purpose of compressing the video storage space is achieved by adopting a mode of reducing the video resolution, and different from the method of compressing the video storage space by performing frame extraction processing on the video to be compressed in the prior art, each frame in the original video file exists in the compressed video file in the embodiment of the invention, so that the situation that the video is not smoothly played after the video is compressed can be avoided.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below. It is obvious that the drawings in the following description are only some embodiments of the invention, and that for a person skilled in the art, other drawings can be derived from them without inventive effort.
Fig. 1 is a schematic flowchart of a method for compressing a video storage space according to an embodiment of the present invention;
FIG. 2 is a schematic flow chart of step S101 in FIG. 1;
fig. 3 is a schematic flowchart of another method for compressing video storage space according to an embodiment of the present invention;
fig. 4 is a schematic flowchart of another method for compressing video storage space according to an embodiment of the present invention;
fig. 5 is a schematic structural diagram of an apparatus for compressing video storage space according to an embodiment of the present invention;
fig. 6 is a schematic structural diagram of an apparatus for compressing video storage space according to an embodiment of the present invention;
fig. 7 is a schematic structural diagram of a video storage space compression apparatus according to another embodiment of the present invention;
Detailed Description
The technical solution in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention. It is to be understood that the described embodiments are merely a few embodiments of the invention, and not all embodiments. All other embodiments, which can be obtained by a person skilled in the art without any inventive step based on the embodiments of the present invention, are within the scope of the present invention.
The embodiment of the invention provides a method and a device for compressing a video storage space, which can avoid the situation that the video is not smoothly played after being compressed. The embodiment of the invention can be applied to equipment needing to compress a video storage space, such as a terminal or a cloud storage space, wherein the terminal can comprise equipment such as a computer and a mobile terminal.
The present invention will be described in detail below with reference to specific examples.
Fig. 1 is a schematic flowchart of a method for compressing a video storage space according to an embodiment of the present invention, where the method includes the following steps:
step S101: an original video file to be compressed is determined from the stored video files.
Specifically, determining the original video file to be compressed may include various embodiments, and the original video file to be compressed may be determined from the stored video files according to a preset rule. The preset rule may be that a video file with the time length not accessed in the stored video file reaching a preset threshold is used as an original video file to be compressed, or a video file with the access time within the preset time length in the stored video file being less than the preset time threshold is used as the original video file to be compressed, and the like.
It will be appreciated that after the original video file to be compressed is determined from the stored video files, a copy of the original video file may be copied to a cache or other storage space for subsequent processing.
It should be noted that, in this embodiment, a specific form of the device for storing the video file is not limited, that is, the video file may be stored in a local hard disk or other internal storage space of the terminal, and may also be stored in a resource pool of the cloud storage space.
Step S102: the resolution of the original video file is obtained.
In practical applications, graphics video processing software Adobe After Effects (AE) or video synthesis software Fusion or storm video software and the like can be used to obtain the resolution of the video file.
Step S103: and according to a preset rule, reducing the resolution of the original video file to generate a compressed video file.
The method for reducing the resolution of the video file according to the preset rule may reduce the resolution of the video file according to a preset resolution gradient, or reduce the resolution of the original video file to a preset resolution value, and the like. One specific embodiment is listed below.
In this embodiment, step S103 may include: and reducing the resolution of each original video file to the corresponding compressed resolution according to the preset corresponding relation between the original resolution and the compressed resolution.
For example, the correspondence between the original preset resolution and the compressed resolution is shown in the following table. For example, when the resolution of the original video file is greater than 1920 pixels by 1080 pixels, the resolution of the original video file is reduced to 1920 pixels by 1080 pixels.
Original resolution/pixel Resolution/pixel after compression
>1920*1080 1920*1080
1920*1080~1280*720 1280*720
1280*720~768*432 768*432
768*432~512*288 512*288
It should be noted that, the resolution of the video file is reduced to the specified resolution, and the video file may also be implemented by using video processing software or video synthesis software in the prior art, which belongs to the prior art, and the specific process is not described again.
Step S104: and storing the compressed video file and deleting the original video file.
It can be understood that after the original video file to be compressed is compressed, the original video file in the storage space of the device for storing the video file is replaced by the compressed video file, so that the video storage space can be reduced.
As can be seen from the above, according to the resolution of the original video file to be compressed and according to the preset rule, the embodiment of the present invention reduces the resolution of the original video file to generate a compressed video file, then stores the compressed video file, and deletes the original video file. In the embodiment of the invention, the purpose of compressing the video storage space is achieved by adopting a mode of reducing the video resolution, and different from the method of compressing the video storage space by performing frame extraction processing on the video to be compressed in the prior art, each frame in the original video file exists in the compressed video file in the embodiment of the invention, so that the situation that the video is not smoothly played after the video is compressed can be avoided.
In the embodiment shown in fig. 1, before step S103, that is, before the resolution of the original video file is reduced according to a preset rule to generate a compressed video file, the method may further include the following steps:
and judging whether the original video files with the resolution not greater than a preset minimum resolution threshold exist in the original video files, and if so, performing frame extraction processing on the original video files with the resolution not greater than the preset minimum resolution threshold.
The preset minimum resolution threshold may be 512 × 288 or other resolution values.
It can be understood that when the resolution of the original video file is too small, if the resolution is reduced, the resolution of the compressed original video file is too low to meet the watching requirement of the user. Therefore, when the resolution of the original video file is too small, it can be subjected to the frame decimation processing.
Specifically, the frame extraction processing on the original video file may include various embodiments, for example, all I frames of the original video file may be extracted, and the compressed video file may be generated from all the extracted I frames according to a preset code rate.
Or, according to a preset proportion, extracting an I frame of the preset proportion from the original video file, and according to a preset code rate, generating the extracted I frame into a compressed video file.
In the embodiment shown in fig. 1, step S101, namely determining an original video file to be compressed from stored video files, may be performed according to a flowchart shown in fig. 2, and specifically includes:
step S101A: a first value of the size of the storage space occupied by the stored video file is obtained.
The following description will be given taking a terminal as an example. Assuming that the video file is stored in an E-disc of the local disk, the size of the storage space occupied by the video file stored in the E-disc may be obtained, which is assumed to be 80GB, i.e. the first value is 80 GB.
Step S101B: and judging whether the first value meets a preset condition, if so, executing the step S101C, otherwise, not processing.
Specifically, the determination of whether the first value meets the preset condition may include various specific embodiments. Several specific embodiments are listed below:
one is to determine whether the first value is greater than a preset storage space threshold.
Assuming that the predetermined storage space threshold is 85GB, if the first value is greater than 85GB, it is determined that the first value satisfies the predetermined condition, i.e., it indicates that the storage space needs to be compressed.
And the other way is to obtain a total numerical value of the preset storage space for storing the video file, and then judge whether the proportion of the first numerical value in the total numerical value is larger than a preset proportion threshold value.
For example, if the total value of the obtained storage space size of the local disk E disk for storing the video file is 100GB, and the video file already stored by the E disk is 80GB, it is determined 80/100 whether 80% is greater than a preset proportion threshold, and if so, it is determined that the video file stored in the E disk is excessive and needs to be compressed.
Step S101C: and determining all or part of the stored video file as an original video file to be compressed.
As a specific implementation manner, determining all or part of the stored video file as the original video file to be compressed may include:
step 1: and acquiring the latest access time of each stored video file, and determining the current unaccessed time length of each stored video file according to the current time.
Step 2: and judging whether the stored video files have video files with the current time length which is not accessed and is greater than a preset time length threshold value, if so, executing the step 3, and if not, executing the step 4.
The preset time threshold may be 3 days or 2 days.
And step 3: and determining the video file with the current non-accessed time length being greater than a preset time length threshold value as an original video file to be compressed.
In practical application, if the current unaccessed time lengths of all the stored video files are greater than a preset time length threshold, all the stored video files are determined as original video files to be compressed. And if the current non-accessed time length of a part of the stored video files is greater than a preset time length threshold value, determining the part of the stored video files as the original video files to be compressed.
If the stored video files do not have the video files with the current time length which is not accessed and is greater than the preset time length threshold value, in order to compress the video storage space, the original video files to be compressed are determined by adopting the processes of the steps 4 to 6.
And 4, step 4: and sorting the stored video files according to the sequence of the current time length which is not accessed from large to small.
And 5: and determining the target video file which has longer current non-accessed time and occupies a storage space with a size reaching a target numerical value from the sorted stored video files.
Wherein the target value is determined according to the video file and a preset vacation space threshold value or a preset vacation space proportion.
Specifically, determining the target video file may include various specific embodiments, for example, determining, in units of a preset first numerical value, a first video file which is not accessed currently for a long time and originally occupies a first numerical value from the sorted stored video files, estimating a compressed size of the first video file, obtaining a size of a vacated space of the compressed first video file, and then comparing a size relationship between the size of the vacated space and a preset vacated space threshold.
If the former is smaller than the latter, determining the first video file which has larger current non-accessed time and originally occupies a storage space of 2 times of the first value from the sorted stored video files again, and continuing to perform the step of estimating the compressed size of the first video file.
And if the former is larger than the latter and the difference value between the size of the vacated space and the preset vacated space threshold is smaller than the preset difference value threshold, determining the first video file as the target video file.
The above process is described below by way of specific examples. Assume that the predetermined vacated space threshold is 10MB, the predetermined first value is 10MB, and the predetermined difference threshold is 5 MB. Sequencing each stored video file from long to short according to the current time length of not being accessed:
video file 1(4MB), video file 2(6MB), video file 3(10MB), video file 4(2MB), video file 5(5MB), video file 6(10MB), video file 7(10MB) …
The parenthesis represents the size of the storage space occupied by the video file. And sequentially determining a first video file which is not accessed currently and has a long time and originally occupies 10MB of storage space from the video files. Since the sum of the storage space sizes occupied by the video files 1 and 2 is 4MB +6MB to 10MB, the video files 1 and 2 are collectively referred to as a first video file.
Then, the sum of the storage space sizes occupied by the compressed video files 1 and 2 is estimated to be 6MB, and then the vacated space of the compressed video files 1 and 2 can be obtained as follows: the sum of the storage space sizes occupied by video files 1 and 2 is 10 MB-the sum of the storage space sizes occupied by video files 1 and 2 after compression is 6MB to make up 4MB of space.
And because the vacated space 4MB is less than the preset vacated space threshold value of 10MB, sequentially re-determining the first video file which has larger current non-accessed time and originally occupies the storage space of 2 times of the first value from the video files. Since the sum of the storage space sizes occupied by the video files 1, 2, and 3 is 4MB +6MB +10MB, which is 2 times the first value 20MB, the video files 1, 2, and 3 are collectively referred to as a first video file.
Then, the sum of the storage space sizes occupied by the video files 1, 2 and 3 after being compressed is estimated to be 9MB, and the vacated space of the compressed video files 1, 2 and 3 can be: sum of storage space sizes occupied by the video files 1, 2, and 3 and sum of storage space sizes occupied by the video files 1, 2, and 3 after being compressed is 20MB — sum of storage space sizes occupied by the video files 1, 2, and 3 is 9MB, which is a vacated space 11MB greater than a preset vacated space threshold of 10MB, and whose difference 11MB-10MB is 1MB less than a preset difference threshold of 5MB, so that the video files 1, 2, and 3 can be determined as target video files.
Step 6: and determining the target video file as an original video file to be compressed.
As can be seen from the above, in this embodiment, according to the current non-accessed time length of the stored video file, the video file with the current non-accessed time length greater than the preset time length threshold in the stored video file is determined as the original video file to be compressed, that is, the video file that is not frequently accessed by the user is preferentially determined as the original video file, so that the video file that is frequently accessed by the user can be prevented from being compressed, and therefore, the user experience can be improved.
To improve the efficiency of compression of the storage space of the device, the embodiment shown in fig. 1 may further include the following steps, which are shown in fig. 3.
Step S301: and detecting whether a first video file which is processed by reducing the resolution exists in the stored video files, if so, executing the step S302, otherwise, not processing.
Step S302: and acquiring the latest access time of each first video file, and determining the current non-accessed time length of each first video file according to the current time.
Step S303: and determining the first video file with the current time length which is not accessed and is greater than a preset time length threshold value as the video file to be compressed.
Step S304: and obtaining the resolution ratio of the video file to be compressed.
Step S305: and according to a preset rule, reducing the resolution of the video file to be compressed to generate a compressed video file.
Step S306: and storing the compressed video file, and deleting the video file to be compressed.
Steps S304 to S306 are basically the same as steps S102 to S104, and specific contents may be referred to each other.
As can be seen from the foregoing, in this embodiment, if there is a first video file that has been subjected to resolution reduction processing in the stored video files, and there is a video file whose current duration that is not accessed is greater than the preset duration threshold in the first video file, it indicates that the user has not high attention to this portion of video files. At this time, the video file can be determined as a video file to be compressed, and the determined video file to be compressed is compressed, so that the compression efficiency of the storage space is improved.
Fig. 4 is another schematic flow chart of a compression method of a video storage space according to an embodiment of the present invention, where a video file is stored in a resource pool of a cloud storage space. The method comprises the following steps:
step S401: and determining the resource pool to be detected.
In practical application, the cloud storage space may include a plurality of storage devices, each storage device is provided with a plurality of resource pools, and each resource pool is allocated with a unique identifier capable of determining the resource pool. Determining the resource pool to be detected may be determining the number or address information of the resource pool to be detected. And resource pool information is maintained in the cloud storage space, and the resource pool information comprises the identification of each resource pool, the total value of the storage space size of the resource pool, the size of the residual storage space of the resource pool, the storage space threshold of the resource pool, the threshold of the time length which is not accessed and the like.
The total value of the size of the storage space of the resource pool, the threshold value of the storage space of the resource pool, and the threshold value of the time length which is not accessed can be determined according to information input when a user creates the resource pool.
In this embodiment, determining the resource pool to be detected may include various embodiments:
one is to determine a preset number of resource pools as resource pools to be detected from all resource pools of the cloud storage space according to a preset period. The preset period may be 2 hours or one day. The preset number may be 1 or 2. The specific values of the preset period and the preset number may be set according to actual needs, and this embodiment does not specifically limit this.
And the other method is that according to a preset rule, a preset number of resource pools are determined from all resource pools of the cloud storage space to serve as resource pools to be detected. The preset rule may be sequentially selected according to a predetermined sequence, or may be randomly selected, which is not specifically limited in this embodiment.
Step S402: and acquiring a second numerical value of the size of the storage space occupied by the video file stored in each resource pool to be detected.
Specifically, after the resource pool to be detected is determined, the size of the storage space occupied by the video file stored in each resource pool to be detected can be obtained from the resource pool information.
Step S403: and respectively judging whether each second numerical value meets a preset condition.
Specifically, the determining whether each second value meets the preset condition may include:
one is to respectively determine whether each second value is greater than a preset storage space threshold.
And the other way is to obtain the total value of the storage space of each resource pool to be detected, and respectively judge whether the proportion of each first value in the total value is greater than a preset proportion threshold value.
For example, the total value of the storage space size of the resource pool a is 100GB, and the preset proportion threshold is 80%, then, when the second value of the video file stored in a is greater than 80GB, it may be determined that the second value satisfies the preset condition.
It can be understood that, when the sizes of the storage spaces of all the resource pools of the cloud storage space are substantially consistent, a manner of determining whether each second value is greater than a preset storage space threshold value may be adopted. When the sizes of the storage spaces of all the resource pools of the cloud storage space are uneven or different, the mode of judging whether the proportion of each first numerical value in the total numerical value is larger than the preset proportion threshold value is more reasonable.
It should be noted that the preset storage space threshold and the preset proportion threshold may be determined according to the setting of the user when the resource pool is created, or may be set by the device itself.
Step S404: and determining all or part of the stored video files in the resource pool meeting the preset conditions as original video files to be compressed.
Specifically, determining the original video file to be compressed may include multiple ways, and may determine the original video file to be compressed from a resource pool meeting a preset condition according to a preset rule. The preset rule may be that a video file whose duration of time which is not accessed in the resource pool satisfying the preset condition reaches a preset threshold is used as an original video file to be compressed, or a video file whose access times within the preset duration of the resource pool satisfying the preset condition are smaller than a preset time threshold is used as an original video file to be compressed, and the like.
It is understood that after determining the original video file to be compressed from the resource pool satisfying the preset condition, a copy of the original video file may be copied to a cache or other storage space for subsequent processing.
Step S405: the resolution of the original video file is obtained.
Step S406: and according to a preset rule, reducing the resolution of the original video file to generate a compressed video file.
In this embodiment, step S406 may specifically include: and reducing the resolution of each original video file to the corresponding compressed resolution according to the preset corresponding relation between the original resolution and the compressed resolution.
Step S407: and storing the compressed video file and deleting the original video file.
Steps S405 to S407 are the same as steps S102 to S104 in the embodiment shown in fig. 1, and the specific processes may be referred to each other.
As can be seen from the above, in the embodiment of the present invention, an original video file to be compressed is determined from a resource pool that meets a preset condition, then, according to the resolution of the original video file to be compressed, the resolution of the original video file is reduced according to a preset rule, a compressed video file is generated, and finally, the compressed video file is stored, and the original video file is deleted. Different from the embodiment shown in fig. 1, the embodiment shown in fig. 4 can perform resolution reduction processing on the video files in the resource pool of the cloud storage space, so that a situation that the video playing is not smooth after the video files in the resource pool are compressed can be avoided.
In the embodiment shown in fig. 4, before step S406, that is, before the resolution of the original video file is reduced according to the preset rule to generate the compressed video file, the method may further include the following steps:
and judging whether the original video files with the resolution not greater than a preset minimum resolution threshold exist in the original video files, and if so, performing frame extraction processing on the original video files with the resolution not greater than the preset minimum resolution threshold.
The preset minimum resolution threshold may be 512 × 288 or other resolution values.
Specifically, the frame extraction processing on the original video file may include various embodiments, for example, all I frames of the original video file may be extracted, and the compressed video file may be generated from all the extracted I frames according to a preset code rate.
Or, according to a preset proportion, extracting an I frame of the preset proportion from the original video file, and according to a preset code rate, generating the extracted I frame into a compressed video file.
It can be understood that when the resolution of the original video file is too small, if the resolution is reduced, the resolution of the compressed original video file is too low to meet the watching requirement of the user. Therefore, when the resolution of the original video file is too small, it can be subjected to the frame decimation processing.
In the embodiment shown in fig. 4, the step S404 of determining all or part of the stored video files in the resource pool meeting the preset condition as the original video files to be compressed may include:
step 1: the method comprises the steps of obtaining the last access time of each stored video file in a resource pool meeting preset conditions, and determining the current non-accessed time length of each stored video file according to the current time.
Step 2: and judging whether the stored video files have video files with the current time length which is not accessed and is greater than a preset time length threshold value, if so, executing the step 3, otherwise, executing the step 4.
And step 3: and determining the video file with the current non-accessed time length being greater than a preset time length threshold value as an original video file to be compressed.
In practical application, if the current unaccessed time lengths of all the stored video files are greater than a preset time length threshold, all the stored video files are determined as original video files to be compressed. And if the current non-accessed time length of a part of the stored video files is greater than a preset time length threshold value, determining the part of the stored video files as the original video files to be compressed.
If the stored video files do not have the video files with the current time length which is not accessed and is greater than the preset time length threshold value, in order to compress the video storage space, the original video files to be compressed are determined by adopting the processes of the steps 4 to 6.
And 4, step 4: and sorting the stored video files according to the sequence of the current time length which is not accessed from large to small.
And 5: and determining the target video file which has longer current non-accessed time and occupies a storage space with a size reaching a target numerical value from the sorted stored video files.
Wherein the target value is determined according to the video file and a preset vacation space threshold value or a preset vacation space proportion.
Specifically, determining the target video file may include various specific embodiments, for example, determining, in units of a preset first numerical value, a first video file which is not accessed currently for a long time and originally occupies a first numerical value from the sorted stored video files, estimating a compressed size of the first video file, obtaining a size of a vacated space of the compressed first video file, and then comparing a size relationship between the size of the vacated space and a preset vacated space threshold.
And if the former is smaller than the latter, re-determining the first video file which has larger current non-accessed time and originally occupies 2 times of the first value of storage space from the sorted stored video files.
And if the former is larger than the latter and the difference value between the size of the vacated space and the preset vacated space threshold is smaller than the preset difference value threshold, determining the first video file as the target video file.
Step 6: and determining the target video file as an original video file to be compressed.
As can be seen from the above, in this embodiment, according to the current non-accessed time length of the stored video files in the resource pool meeting the preset condition, the video file with the current non-accessed time length greater than the preset time length threshold in the stored video files is determined as the original video file to be compressed, that is, the video file which is not frequently accessed by the user is preferentially determined as the original video file, so that the video file which is frequently accessed by the user can be prevented from being compressed, and therefore, the user experience can be improved.
In order to improve the compression efficiency of the video files of the resource pool, the embodiment shown in fig. 4 may further include the following steps:
step 1: and detecting whether a first video file which is processed by reducing the resolution exists in the stored video files, if so, executing the step 2, otherwise, not processing.
Step 2: and acquiring the latest access time of each first video file, and determining the current non-accessed time length of each first video file according to the current time.
And step 3: and determining the first video file with the current time length which is not accessed and is greater than a preset time length threshold value as the video file to be compressed.
And 4, step 4: obtaining the resolution of a video file to be compressed;
and 5: and according to a preset rule, reducing the resolution of the video file to be compressed to generate a compressed video file.
Step 6: and storing the compressed video file and deleting the video file to be compressed.
As can be seen from the foregoing, in this embodiment, if there is a first video file that has been subjected to resolution reduction processing in the stored video files of the resource pool, and there is a video file that has not been accessed currently for a duration greater than a preset duration threshold in the first video file, it indicates that the user has low attention to this portion of video files. At this time, the video file can be determined as a video file to be compressed, the determined video file to be compressed is compressed, whether a second numerical value of the storage space occupied by the remaining stored video files of the resource pool meets the condition is not required to be executed, and if the second numerical value meets the condition, the original video file to be compressed is determined in the resource pool, so that the compression efficiency of the storage space of the resource pool can be improved.
The present application will be described in detail with reference to specific examples.
The cloud storage space comprises a resource manager SourceManager, a data manager DataManager and a Transcoder. The SourceManager is mainly responsible for managing the resource pool created by the user and making different actions according to the configuration strategy of the resource pool. The DataManager is mainly responsible for receiving video files stored by users and extracting external video files. The Transcoder is responsible for executing transcoding tasks and storing the transcoded data.
When a user uses a cloud storage space to store a video file, a resource pool needs to be created first, the size of the storage space of the resource pool and a preset time threshold value of the video file which is not accessed are set, and meanwhile, a storage space threshold value for implementing a compression strategy on the resource pool is configured. Suppose that the total value of the size of the storage space of the resource pool set by the user is 100GB, the preset duration threshold is 3 days, and the storage space threshold is 80 GB.
The SourceManager creates a resource pool A according to the input operation of a user, and records the information of the total value of the storage space of the resource pool A, the storage space threshold value of 100GB, the preset time length threshold value of 3 days and the like in a resource pool information list. That is, the resource pool information list stores resource pool information of a large number of resource pools.
The method comprises the steps that a DataManager receives a video file sent by a user, stores the video file into a corresponding resource pool, then sends information such as the size and the storage address of the video file to a Source Manager, the Source Manager updates the information into a resource pool information list, and then calculates the size of a storage space occupied by the video file stored in the resource pool and stores the storage space. When the DataManager receives an access instruction of a user to the video file in the resource pool, the video file is sent to the user, and the access time information is recorded in the resource pool information list through the SourceManager.
If the video stored by the user is generated continuously over time, such as a surveillance video, the DataManager may segment the surveillance video file sent by the user according to a certain size, such as 64MB, and record the segment information in the resource pool information list through the SourceManager.
The SourceManager periodically inspects whether the size of a storage space occupied by a stored video file of each resource pool in the resource pool information list is larger than a storage space threshold of the resource pool, if so, obtains the latest access time of each stored video file in the resource pool, determines the current non-accessed time length of each stored video file according to the current time, and determines the video file with the current non-accessed time length larger than a preset time length threshold as the original video file to be compressed.
And the SourceManager sends the address of the original video file to be compressed to the Transcoder, so that the Transcoder performs resolution reduction processing on the original video file to be compressed.
The Transcoder takes out the original video file to be compressed in the resource pool according to the received address of the original video file to be compressed, obtains the resolution of the original video file to be compressed, and carries out transcoding processing on the original video file to be compressed according to the corresponding relation between the preset original resolution and the resolution after compression, so that the resolution of the original video file to be compressed is reduced to the corresponding resolution after compression. And then, storing the compressed video file into a corresponding resource pool, and deleting the original video file to be compressed in the resource pool.
Fig. 5 is a schematic structural diagram of an apparatus for compressing a video storage space according to an embodiment of the present invention, and the apparatus includes a determining module 501, an obtaining module 502, a compressing module 503, and a storing module 504, corresponding to the embodiment of the method shown in fig. 1.
A determining module 501, configured to determine an original video file to be compressed from stored video files;
an obtaining module 502, configured to obtain a resolution of the original video file;
a compression module 503, configured to reduce the resolution of the original video file according to a preset rule, and generate a compressed video file;
a storage module 504, configured to store the compressed video file, and delete the original video file.
In the embodiment shown in fig. 5, the determining module 501 may include:
a first obtaining sub-module (not shown in the figure) for obtaining a first value of the storage space size occupied by the stored video file;
a first determining submodule (not shown in the figure) for determining whether the first value meets a preset condition;
and a first determining sub-module (not shown in the figure) configured to determine all or part of the stored video file as an original video file to be compressed when it is determined that the first value satisfies a preset condition.
In the embodiment shown in fig. 5, the first determining submodule is specifically configured to:
judging whether the first numerical value is larger than a preset storage space threshold value or not; or the like, or, alternatively,
acquiring a total value of the size of a preset storage space for storing the video file; and judging whether the proportion of the first numerical value in the total numerical value is greater than a preset proportion threshold value.
In the embodiment shown in fig. 5, the first determination sub-module includes:
a first time length determining subunit (not shown in the figure), configured to obtain a last access time of each stored video file, and determine, according to a current time, a current non-accessed time length of each stored video file;
a first time length determining subunit (not shown in the figure), configured to determine whether there is a video file in the stored video files, where a current time length of the video file that is not accessed is greater than a preset time length threshold;
a first video file determining subunit (not shown in the figure), configured to determine, when there is a video file whose current time length of time that is not accessed is greater than a preset time length threshold in the stored video files, the video file whose current time length of time that is not accessed is greater than the preset time length threshold as an original video file to be compressed.
In the embodiment shown in fig. 5, the first determination sub-module further includes:
a first sorting subunit (not shown in the figure), configured to, when there is no video file with a current time length of non-access being greater than a preset time length threshold in the stored video files, sort the stored video files in an order from a current time length of non-access being greater than a preset time length threshold;
a first target file determining subunit (not shown in the figure), configured to determine, from the sorted stored video files, a target video file that is not accessed currently for a long time and occupies a storage space of a size that reaches a target value; the target value is determined according to the video file and a preset vacated space threshold value or a preset vacated space proportion;
a second video file determination subunit (not shown in the figure) for determining the target video file as an original video file to be compressed.
In the embodiment shown in fig. 5, the compression module 503 is specifically configured to:
and reducing the resolution of each original video file to the corresponding compressed resolution according to the preset corresponding relation between the original resolution and the compressed resolution.
In the embodiment shown in fig. 5, the apparatus further comprises a frame extracting module (not shown in the figure);
the frame extracting module is used for judging whether an original video file with the resolution ratio not greater than a preset minimum resolution ratio threshold exists in the original video file before the resolution ratio of the original video file is reduced according to a preset rule and the compressed video file is generated; and if so, performing frame extraction processing on the original video file with the resolution not greater than a preset minimum resolution threshold.
Fig. 6 is a schematic structural diagram of a video storage space compression apparatus according to an embodiment of the present invention, which corresponds to the method embodiment shown in fig. 3. The determining module 601, the obtaining module 602, the compressing module 603 and the storing module 604 in the apparatus are respectively the same as the determining module 501, the obtaining module 502, the compressing module 503 and the storing module 504 in the embodiment shown in fig. 5. Also included in the apparatus is a detection module 605.
The detecting module 605 is configured to detect whether there is a first video file that has been subjected to resolution reduction processing in the stored video files;
the determining module 601 is further configured to, when it is detected that a first video file that has been subjected to resolution reduction processing exists in stored video files, obtain the latest access time of each first video file, and determine, according to the current time, a current unaccessed duration of each first video file; determining a first video file with the current non-accessed time length being greater than a preset time length threshold value as a video file to be compressed;
an obtaining module 602, configured to obtain a resolution of the video file to be compressed;
the compression module 603 is further configured to reduce the resolution of the video file to be compressed according to a preset rule, and generate a compressed video file;
the storage module 604 is further configured to store the compressed video file, and delete the video file to be compressed.
Fig. 7 is a schematic structural diagram of a compression apparatus for video storage space according to an embodiment of the present invention, and corresponding to the method embodiment shown in fig. 4, the video file is stored in a resource pool of a cloud storage space. The obtaining module 702, the compressing module 703 and the storing module 704 in the apparatus are the same as the obtaining module 502, the compressing module 503 and the storing module 504, respectively, in the embodiment shown in fig. 5.
Wherein, the determining module 701 comprises:
a second determining submodule 7011, configured to determine a resource pool to be detected;
a second obtaining sub-module 7012, configured to obtain a second numerical value of the size of the storage space occupied by the video file stored in each resource pool to be detected;
a second determining submodule 7013, configured to determine whether each of the second numerical values meets a preset condition;
a third determining sub-module 7014, configured to determine all or part of the stored video files in the resource pool that meet the preset condition as original video files to be compressed.
In the embodiment shown in fig. 7, the second determining submodule 7011 is specifically configured to:
and according to a preset period, determining a preset number of resource pools from all resource pools of the cloud storage space as resource pools to be detected.
In the embodiment shown in fig. 7, the second determining sub-module 7013 is specifically configured to:
respectively judging whether each second numerical value is larger than a preset storage space threshold value; or the like, or, alternatively,
obtaining a total numerical value of the storage space size of each resource pool to be detected; and respectively judging whether the proportion of each first numerical value in the total numerical value is greater than a preset proportion threshold value.
Since the device embodiment is obtained by the method embodiment and has the same technical effect as the method, the technical effect of the device embodiment is not described herein again.
For the apparatus embodiment, since it is substantially similar to the method embodiment, it is described relatively simply, and reference may be made to some descriptions of the method embodiment for relevant points.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
It will be understood by those skilled in the art that all or part of the steps in the above embodiments can be implemented by hardware associated with program instructions, and the program can be stored in a computer readable storage medium. The storage medium referred to herein is a ROM/RAM, a magnetic disk, an optical disk, or the like.
The above description is only for the preferred embodiment of the present invention, and is not intended to limit the scope of the present invention. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention shall fall within the protection scope of the present invention.

Claims (20)

1. A method for compressing a video storage space, the method comprising:
determining an original video file to be compressed from the stored video files;
obtaining the resolution of the original video file;
according to a preset rule, reducing the resolution of the original video file to generate a compressed video file;
storing the compressed video file and deleting the original video file;
detecting whether a first video file which is subjected to resolution reduction processing exists in the stored video files;
if the current time length of the first video file is not accessed, acquiring the latest access time of each first video file, and determining the current time length of each first video file which is not accessed;
determining a first video file with the current non-accessed time length being greater than a preset time length threshold value as a video file to be compressed;
obtaining the resolution of the video file to be compressed;
according to a preset rule, reducing the resolution of the video file to be compressed to generate a compressed video file;
and storing the compressed video file and deleting the video file to be compressed.
2. The method of claim 1, wherein determining an original video file to be compressed from the stored video files comprises:
obtaining a first numerical value of the size of a storage space occupied by a stored video file;
judging whether the first numerical value meets a preset condition or not;
if yes, determining all or part of the stored video file as an original video file to be compressed.
3. The method according to claim 2, wherein the determining whether the first value satisfies a predetermined condition is:
judging whether the first numerical value is larger than a preset storage space threshold value or not; or the like, or, alternatively,
acquiring a total value of the size of a preset storage space for storing the video file;
and judging whether the proportion of the first numerical value in the total numerical value is greater than a preset proportion threshold value.
4. The method of claim 1, wherein the video file is stored in a resource pool of cloud storage space;
the determining an original video file to be compressed from the stored video files comprises:
determining a resource pool to be detected;
obtaining a second numerical value of the size of a storage space occupied by the video file stored in each resource pool to be detected;
respectively judging whether each second numerical value meets a preset condition;
and determining all or part of the stored video files in the resource pool meeting the preset conditions as original video files to be compressed.
5. The method according to claim 4, wherein the determining the resource pool to be detected comprises:
and according to a preset period, determining a preset number of resource pools from all resource pools of the cloud storage space as resource pools to be detected.
6. The method according to claim 4, wherein the determining whether each of the second values satisfies a predetermined condition is:
respectively judging whether each second numerical value is larger than a preset storage space threshold value; or the like, or, alternatively,
obtaining a total numerical value of the storage space size of each resource pool to be detected;
and respectively judging whether the proportion of each second numerical value in the total numerical value is greater than a preset proportion threshold value.
7. The method according to claim 2, wherein determining all or part of the stored video file as an original video file to be compressed comprises:
acquiring the latest access time of each stored video file, and determining the current non-accessed time length of each stored video file according to the current time;
judging whether a video file with the current time length which is not accessed and is greater than a preset time length threshold exists in the stored video files or not;
and if so, determining the video file which is not accessed currently and has the time length longer than the preset time length threshold value as the original video file to be compressed.
8. The method of claim 7, further comprising:
when the stored video files do not have video files with the current non-accessed time length larger than a preset time length threshold value, sequencing the stored video files according to the sequence of the current non-accessed time length from large to small;
determining a target video file which has longer current non-accessed time and occupies a storage space with a size reaching a target numerical value from the sorted stored video files; the target value is determined according to the video file and a preset vacated space threshold value or a preset vacated space proportion;
and determining the target video file as an original video file to be compressed.
9. The method according to any one of claims 1 to 8, wherein the reducing the resolution of the original video file according to a preset rule to generate a compressed video file comprises:
and reducing the resolution of each original video file to the corresponding compressed resolution according to the preset corresponding relation between the original resolution and the compressed resolution.
10. The method according to any one of claims 1 to 8, further comprising, before reducing the resolution of the original video file according to a preset rule to generate a compressed video file:
judging whether an original video file with the resolution ratio not greater than a preset minimum resolution ratio threshold exists in the original video file;
and if so, performing frame extraction processing on the original video file with the resolution not greater than a preset minimum resolution threshold.
11. An apparatus for compressing a video storage space, the apparatus comprising:
the determining module is used for determining an original video file to be compressed from the stored video files;
an obtaining module, configured to obtain a resolution of the original video file;
the compression module is used for reducing the resolution of the original video file according to a preset rule and generating a compressed video file;
the storage module is used for storing the compressed video file and deleting the original video file;
the detection module is used for detecting whether a first video file which is subjected to resolution reduction processing exists in the stored video files or not;
the determining module is further configured to, when it is detected that a first video file which has been subjected to resolution reduction processing exists in the stored video files, acquire the latest access time of each first video file, and determine, according to the current time, a current unaccessed duration of each first video file; determining a first video file with the current non-accessed time length being greater than a preset time length threshold value as a video file to be compressed;
the obtaining module is further configured to obtain a resolution of the video file to be compressed;
the compression module is further used for reducing the resolution of the video file to be compressed according to a preset rule and generating a compressed video file;
the storage module is further configured to store the compressed video file and delete the video file to be compressed.
12. The apparatus of claim 11, wherein the determining module comprises:
the first obtaining submodule is used for obtaining a first numerical value of the size of a storage space occupied by a stored video file;
the first judgment submodule is used for judging whether the first numerical value meets a preset condition or not;
and the first determining submodule is used for determining all or part of the stored video file as an original video file to be compressed when the first numerical value is judged to meet the preset condition.
13. The apparatus according to claim 12, wherein the first determining submodule is specifically configured to:
judging whether the first numerical value is larger than a preset storage space threshold value or not; or the like, or, alternatively,
acquiring a total value of the size of a preset storage space for storing the video file; and judging whether the proportion of the first numerical value in the total numerical value is greater than a preset proportion threshold value.
14. The apparatus of claim 11, wherein the video file is stored in a resource pool of cloud storage space; the determining module comprises:
the second determining submodule is used for determining the resource pool to be detected;
the second obtaining submodule is used for obtaining a second numerical value of the size of the storage space occupied by the video file stored in each resource pool to be detected;
the second judgment submodule is used for respectively judging whether each second numerical value meets a preset condition;
and the third determining submodule is used for determining all or part of the stored video files in the resource pool meeting the preset conditions as original video files to be compressed.
15. The apparatus of claim 14, wherein the second determination submodule is specifically configured to:
and according to a preset period, determining a preset number of resource pools from all resource pools of the cloud storage space as resource pools to be detected.
16. The apparatus according to claim 14, wherein the second determination submodule is specifically configured to:
respectively judging whether each second numerical value is larger than a preset storage space threshold value; or the like, or, alternatively,
obtaining a total numerical value of the storage space size of each resource pool to be detected; and respectively judging whether the proportion of each second numerical value in the total numerical value is greater than a preset proportion threshold value.
17. The apparatus of claim 12, wherein the first determining submodule comprises:
the first time length determining subunit is used for acquiring the latest access time of each stored video file and determining the current non-accessed time length of each stored video file according to the current time;
the first time length judging subunit is used for judging whether a video file with the current time length which is not accessed and is greater than a preset time length threshold exists in the stored video files or not;
and the first video file determining subunit is used for determining the video file with the current non-accessed time length being greater than the preset time length threshold value as the original video file to be compressed when the video file with the current non-accessed time length being greater than the preset time length threshold value exists in the stored video files.
18. The apparatus of claim 17, wherein the first determination submodule further comprises:
the first sequencing subunit is used for sequencing the stored video files according to the sequence of the current time length which is not accessed from large to small when the video files with the current time length which is not accessed and is larger than the preset time length threshold do not exist in the stored video files;
the first target file determining subunit is used for determining a target video file which is not accessed currently and has a longer time and occupies a storage space with a size reaching a target numerical value from the sorted stored video files; the target value is determined according to the video file and a preset vacated space threshold value or a preset vacated space proportion;
and the second video file determining subunit is used for determining the target video file as an original video file to be compressed.
19. The device according to any one of claims 11 to 18, wherein the compression module is specifically configured to:
and reducing the resolution of each original video file to the corresponding compressed resolution according to the preset corresponding relation between the original resolution and the compressed resolution.
20. The apparatus according to any one of claims 11 to 18, further comprising a frame extraction module, specifically configured to:
before reducing the resolution of the original video file according to a preset rule and generating a compressed video file, judging whether the original video file with the resolution not greater than a preset minimum resolution threshold exists in the original video file;
and if so, performing frame extraction processing on the original video file with the resolution not greater than a preset minimum resolution threshold.
CN201610658070.5A 2016-08-10 2016-08-10 Compression method and device for video storage space Active CN107734336B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610658070.5A CN107734336B (en) 2016-08-10 2016-08-10 Compression method and device for video storage space

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610658070.5A CN107734336B (en) 2016-08-10 2016-08-10 Compression method and device for video storage space

Publications (2)

Publication Number Publication Date
CN107734336A CN107734336A (en) 2018-02-23
CN107734336B true CN107734336B (en) 2019-12-20

Family

ID=61200541

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610658070.5A Active CN107734336B (en) 2016-08-10 2016-08-10 Compression method and device for video storage space

Country Status (1)

Country Link
CN (1) CN107734336B (en)

Families Citing this family (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108366218A (en) * 2018-04-16 2018-08-03 上海小蚁科技有限公司 Video file forming method and device, computer readable storage medium, picture pick-up device
CN109753572B (en) * 2018-12-26 2021-03-23 维沃移动通信有限公司 Method and device for processing multimedia data
CN110958460B (en) * 2019-11-22 2022-09-16 北京软通绿城科技有限公司 Video storage method and device, electronic equipment and storage medium
CN111400264A (en) * 2019-12-06 2020-07-10 杭州海康威视***技术有限公司 Data management method and data storage system
CN111324585A (en) * 2020-02-19 2020-06-23 珠海格力电器股份有限公司 Method for storing file in electronic device, storage medium and electronic device
CN111770377B (en) * 2020-04-03 2022-04-01 北京数智鑫正科技有限公司 Compression method for video playing system
CN112463039B (en) * 2020-11-17 2023-05-12 浙江大华技术股份有限公司 Data storage method, device and storage medium
CN115022670B (en) * 2022-05-31 2023-09-05 咪咕文化科技有限公司 Video file storage method, video file restoration device, video file storage equipment and storage medium
CN117241057A (en) * 2023-09-08 2023-12-15 黄建邦 Data storage method, video system, device, medium, product and storage system

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101442674A (en) * 2007-11-19 2009-05-27 三星电子株式会社 Method and apparatus efficiently encoding and decoding moving image using image resolution adjustment
CN104506934A (en) * 2014-12-25 2015-04-08 合肥寰景信息技术有限公司 Video processing method capable of saving storage space
CN104572113A (en) * 2015-01-21 2015-04-29 深圳市中兴移动通信有限公司 Automatic storage space arranging method and mobile terminal
CN105659587A (en) * 2015-12-19 2016-06-08 张北江 A data storage method for a monitor system and a system thereof

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101442674A (en) * 2007-11-19 2009-05-27 三星电子株式会社 Method and apparatus efficiently encoding and decoding moving image using image resolution adjustment
CN104506934A (en) * 2014-12-25 2015-04-08 合肥寰景信息技术有限公司 Video processing method capable of saving storage space
CN104572113A (en) * 2015-01-21 2015-04-29 深圳市中兴移动通信有限公司 Automatic storage space arranging method and mobile terminal
CN105659587A (en) * 2015-12-19 2016-06-08 张北江 A data storage method for a monitor system and a system thereof

Also Published As

Publication number Publication date
CN107734336A (en) 2018-02-23

Similar Documents

Publication Publication Date Title
CN107734336B (en) Compression method and device for video storage space
KR101994021B1 (en) File manipulation method and apparatus
CN106470323B (en) The storage method and equipment of video data
CN104639860B (en) The storage method and device of a kind of monitoring video
US10747621B2 (en) Data management and backup for image and video media
CN103218224A (en) Method and terminal for improving utilization ratio of memory space
CN104540004A (en) Video screenshot method and video screenshot device
JP2012239085A (en) Image processor, and image processing method
CN111198856B (en) File management method, device, computer equipment and storage medium
CN107547941B (en) Method, device and system for storing media data
CN105828081A (en) Encoding method and encoding device
CN112995676A (en) Audio and video compression method, device, equipment, system and storage medium
CN113435328A (en) Video clip processing method and device, electronic equipment and readable storage medium
CN115981563A (en) Method and system for storing traffic image information
CN109597566B (en) Data reading and storing method and device
CN104424109B (en) Information processing method and electronic equipment
CN106161743B (en) Media resource processing method, device and terminal
US9894291B2 (en) Still image provision device
JP2010218390A (en) Stream accumulation control device
US20120314956A1 (en) Image processing apparatus and image processing method
CN104052767A (en) File tracking method and network communication device with applicability of the same
CN110647498A (en) File storage method, device, equipment and computer readable storage medium
CN106998436B (en) Video backup method and device
CN111246244B (en) Method and device for rapidly analyzing and processing audio and video in cluster and electronic equipment
CN104462422A (en) Object processing method and device

Legal Events

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