CN111866514B - Method and device for compressing video and decompressing video - Google Patents

Method and device for compressing video and decompressing video Download PDF

Info

Publication number
CN111866514B
CN111866514B CN201910338463.1A CN201910338463A CN111866514B CN 111866514 B CN111866514 B CN 111866514B CN 201910338463 A CN201910338463 A CN 201910338463A CN 111866514 B CN111866514 B CN 111866514B
Authority
CN
China
Prior art keywords
image frame
reference image
target
compressed
video
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
CN201910338463.1A
Other languages
Chinese (zh)
Other versions
CN111866514A (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.)
China Mobile Communications Group Co Ltd
China Mobile Group Guizhou Co Ltd
Original Assignee
China Mobile Communications Group Co Ltd
China Mobile Group Guizhou 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 China Mobile Communications Group Co Ltd, China Mobile Group Guizhou Co Ltd filed Critical China Mobile Communications Group Co Ltd
Priority to CN201910338463.1A priority Critical patent/CN111866514B/en
Publication of CN111866514A publication Critical patent/CN111866514A/en
Application granted granted Critical
Publication of CN111866514B publication Critical patent/CN111866514B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

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/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
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/20Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
    • H04N21/23Processing of content or additional data; Elementary server operations; Server middleware
    • H04N21/234Processing of video elementary streams, e.g. splicing of video streams or manipulating encoded video stream scene graphs
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
    • H04N21/433Content storage operation, e.g. storage operation in response to a pause request, caching operations
    • H04N21/4334Recording operations
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
    • H04N21/44Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream or rendering scenes according to encoded video stream scene graphs

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Compression Or Coding Systems Of Tv Signals (AREA)

Abstract

The invention discloses a method and a device for compressing and decompressing videos, which are used for solving the problem that the storage resources occupied by video file storage are large. The scheme provided by the application comprises the following steps: determining a plurality of reference image frames in a target video; generating a compressed image frame corresponding to at least one non-reference image frame of a target reference image frame in the plurality of reference image frames; and generating a compressed target video based on the plurality of reference image frames and a compressed image frame corresponding to at least one non-reference image frame of each reference image frame. By the method, the non-reference image frames in the target video can be compressed, the compressed target video with small data volume is generated, and storage resources occupied by the stored target video are saved.

Description

Method and device for compressing video and decompressing video
Technical Field
The present invention relates to the field of data processing, and in particular, to a method and an apparatus for compressing and decompressing a video.
Background
A video may be understood as a dynamic image composed of a plurality of continuous images, and in an electronic device, a video is usually stored in a form of a video file, and a user may invoke to play the video file according to a requirement.
The data volume of the video file is usually large, and large storage resources are often consumed for storing the video file, and large network resources are also consumed when the video file is transmitted through a network. How to compress video and reduce the data volume of video files is a technical problem to be solved by the application.
Disclosure of Invention
The embodiment of the application aims to provide a method and a device for compressing and decompressing videos, which are used for solving the problem that the storage resource amount occupied by storing video files is large.
In a first aspect, a method for compressing video is provided, including:
determining a plurality of reference image frames in a target video;
generating a compressed image frame corresponding to at least one non-reference image frame of a target reference image frame in the plurality of reference image frames, wherein the at least one non-reference image frame of the target reference image frame is an image frame after the target reference image frame and before a next reference image frame of the target reference image frame in the target video;
and generating a compressed target video based on the plurality of reference image frames and a compressed image frame corresponding to at least one non-reference image frame of each reference image frame.
In a second aspect, a method for decompressing video is provided, including:
determining a plurality of reference image frames in the compressed target video;
decompressing at least one compressed image frame of a target reference image frame in the plurality of reference image frames to generate a non-reference image frame corresponding to the at least one compressed image frame, wherein the at least one compressed image frame of the target reference image frame is an image frame after the target reference image frame and before a next reference image frame of the target reference image frame in the target video;
and generating a decompressed target video based on the plurality of reference image frames and non-reference image frames corresponding to at least one compressed image frame of each reference image frame.
In a third aspect, an apparatus for compressing video is provided, including:
the determining module is used for determining a plurality of reference image frames in the target video;
a first generating module, configured to generate a compressed image frame corresponding to at least one non-reference image frame of a target reference image frame in the plurality of reference image frames, where the at least one non-reference image frame of the target reference image frame is an image frame after the target reference image frame and before a next reference image frame of the target reference image frame in the target video;
and the second generation module generates a compressed target video based on the plurality of reference image frames and a compressed image frame corresponding to at least one non-reference image frame of each reference image frame.
In a fourth aspect, there is provided an apparatus for decompressing video, comprising:
the second determination module is used for determining a plurality of reference image frames in the compressed target video;
a third generating module, configured to perform decompression on at least one compressed image frame of a target reference image frame in the multiple reference image frames, and generate a non-reference image frame corresponding to the at least one compressed image frame, where the at least one compressed image frame of the target reference image frame is an image frame after the target reference image frame in the target video and before a next reference image frame of the target reference image frame;
and the fourth generation module generates a decompressed target video based on the plurality of reference image frames and the non-reference image frame corresponding to at least one compressed image frame of each reference image frame.
In a fifth aspect, a mobile terminal is provided, the mobile terminal comprising a processor, a memory and a computer program stored on the memory and executable on the processor, the computer program, when executed by the processor, implementing the steps of the method according to the first and/or second aspect.
A sixth aspect provides a computer readable storage medium having stored thereon a computer program which, when executed by a processor, performs the steps of the method of the first and/or second aspect.
In the embodiment of the application, a plurality of reference image frames in a target video are determined; compressing at least one non-reference image frame of a target reference image frame in the plurality of reference image frames to generate a compressed image frame corresponding to the at least one non-reference image frame; and generating a compressed target video based on the plurality of reference image frames and compressed image frames corresponding to at least one non-reference image frame of each compressed reference image frame. By the scheme, the target video can be compressed, so that the data volume of the compressed target video is smaller than that of the original target video, and the storage resource volume occupied by the stored target video is reduced.
Drawings
The accompanying drawings, which are included to provide a further understanding of the invention and are incorporated in and constitute a part of this specification, illustrate embodiments of the invention and together with the description serve to explain the invention and not to limit the invention. In the drawings:
FIG. 1 is a flow chart of a method for compressing video according to the present invention;
FIG. 2a is a second flowchart of a method for compressing video according to the present invention;
FIG. 2b is a schematic diagram of a plurality of reference image frames in time relationship;
FIG. 3 is a third flowchart illustrating a method of compressing video according to the present invention;
FIG. 4 is a fourth flowchart illustrating a method of compressing video according to the present invention;
FIG. 5 is a fifth flowchart illustrating a method of compressing video according to the present invention;
FIG. 6 is a sixth flowchart illustrating a method of compressing video according to the present invention;
FIG. 7 is a schematic diagram of an apparatus for compressing video according to the present invention;
fig. 8 is a schematic diagram of an apparatus for decompressing video according to the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention. The reference numbers in the present application are only used for distinguishing the steps in the scheme, and are not used for limiting the execution sequence of the steps, and the specific execution sequence is subject to the description in the specification.
In order to solve the problems in the prior art, the present application provides a method for compressing video, as shown in fig. 1, including the following steps:
s11: determining a plurality of reference image frames in a target video;
s12: generating a compressed image frame corresponding to at least one non-reference image frame of a target reference image frame in the plurality of reference image frames, wherein the at least one non-reference image frame of the target reference image frame is an image frame after the target reference image frame and before a next reference image frame of the target reference image frame in the target video;
s13: and generating a compressed target video based on the plurality of reference image frames and a compressed image frame corresponding to at least one non-reference image frame of each reference image frame.
In step S11, the time intervals between adjacent reference image frames in the plurality of reference image frames may be equal or unequal. Preferably, the determined time intervals of the adjacent reference image frames are equal, and a plurality of reference image frames can be determined according to actual requirements, for example, when the target video needs to be compressed quickly, the number of the determined reference image frames can be large; the number of reference image frames determined may be small when the data amount of the target video needs to be compressed as small as possible.
After determining the reference image frame in the target video, other image frames in the target video may be determined as non-reference image frames. The number of the determined reference image frames and the non-reference image frames may be equal to the number of image frames in the target video. In addition, in order to further compress the target video, the non-reference image frames can be screened, and only the non-reference image frames meeting the preset conditions are reserved, so that the target video is further compressed, and the data volume of the compressed target video is reduced.
The non-reference image frames may then be compressed, and different compression methods may be employed for the non-reference image frames in different types of video files. Specifically, the compressed image frame may be generated by reducing the data amount of the non-reference image frame in such a manner that the resolution of the non-reference image frame is reduced.
And finally, generating a compressed target video according to the compressed image frame and the plurality of reference image frames. The compressed image frame and the reference image frame may be synthesized into a compressed target video based on time.
In the embodiment of the application, a plurality of reference image frames in a target video are determined; compressing at least one non-reference image frame of a target reference image frame in the plurality of reference image frames to generate a compressed image frame corresponding to the at least one non-reference image frame; and generating a compressed target video based on the plurality of reference image frames and compressed image frames corresponding to at least one non-reference image frame of each compressed reference image frame. The scheme can compress the target video, so that the data volume of the compressed target video is smaller than that of the original target video, and the storage resource volume occupied by the stored target video is reduced.
Based on the solution provided by the foregoing embodiment, preferably, as shown in fig. 2a, the foregoing step S11 includes:
s111: determining a first reference image frame in a target video;
s112: determining a first reference time length according to the first reference image frame;
s113: and determining at least one second reference image frame after a first reference image frame in the target video according to the first reference time length, wherein the interval time length between any second reference image frame and the previous reference image frame is the first reference time length.
In the following, the present solution is described by taking terminal screen recording as an example, and in the process of recording the terminal screen picture, the first reference image frame may be determined according to the screen picture. For example, when the screen does not include a preset software interface, recording is not performed; and starting recording when the screen picture comprises a preset software interface. And determining a first image frame in the recorded target video as a first reference image frame, and determining a first reference time length according to the first reference image frame. The first reference duration may be used to determine a reference image frame subsequent to the first reference image frame.
Specifically, the first reference duration may be determined according to a level of preset software in the first reference image frame, and a user may preset the preset software and the level of the preset software according to a requirement. For example, the preset software includes a transaction plug-in, the level of the transaction plug-in is a first level, the preset software further includes a video playing plug-in, and the level of the video playing plug-in is a second level. Subsequently, if the preset software in the first reference image frame is the primary preset software, the determined first reference time length may be shorter, and if the preset software in the first reference image frame is the secondary preset software, the determined first reference time length may be longer.
After determining the first reference duration, at least one second reference image frame following the first reference image frame is determined according to the first reference duration. And the interval duration of any second reference image frame and the previous reference image frame is the first reference duration. Specifically, as shown in fig. 2b, the horizontal axis t represents the time axis in the target video, and the first reference time length t is determined from the first reference image frame a by the above scheme1After the first reference image frame a, by a first reference time period t1For the interval, the determined second reference image frame is b1、b2、b3. Wherein the second reference image frame b1The interval duration from the first reference image frame a is the first reference duration t1Second reference image frame b2The interval duration from the first reference image frame a is the first reference duration t1Second reference image frame b3The interval duration from the first reference image frame a is the first reference duration t1
According to the scheme provided by the application, the determined interval time of the adjacent reference image frames is the first reference duration, and the continuity of the compressed target video image is ensured. In addition, the first reference time length is determined according to the first reference image frame, the first reference time length can be made to be suitable for the first reference image frame, and then the second reference image frame is determined according to the proper time step length.
Based on the solution provided by the foregoing embodiment, preferably, as shown in fig. 3, the foregoing step S111 includes:
s1111: judging whether a target image frame in the target video comprises at least one preset safety identification or not;
s1112: when the target image frame comprises at least one preset safety identification, determining the target image frame as a first reference image frame;
wherein, the step S112 includes:
s1121: and determining the first reference time length according to at least one preset safety mark in the first reference image frame.
The preset security identifier may be preset by a user according to a requirement, for example, the preset security identifier may include characters related to a transaction, such as "transfer," "card number," "password," and the like, and may also include a pattern related to the transaction. Specifically, in the process of recording the terminal screen, images and characters in image frames of the target video can be recognized, and when the image frames include the at least one preset safety mark, the image frames are determined to be first reference image frames.
After the first reference image frame is determined, a first reference time length is determined according to a preset safety mark in the first reference image frame. Specifically, the corresponding relationship between the preset safety marks and the time length may be preset, for example, the preset unit time length is T, and the first reference time length is related to the number of the preset safety marks in the first reference image frame. For example, when n preset security markers are included in the first reference image frame, the first reference time duration may be T/n. In addition, the level of the safety mark can be predefined to distinguish the safety marks of different levels, and then the first reference time length is determined according to the level of the safety mark in the first reference image frame.
Through the scheme provided by the application, the first reference image frame can be determined from the target video according to the preset safety mark, and the first reference time length can be determined according to the preset safety mark in the first reference image frame. Enabling determination of at least one second reference image frame from the content of the first reference image frame, the determined second reference image frame being associated with the content of the first reference image frame. In practical application, a user may preset the preset security identifier according to a requirement to control the determined first reference image frame.
Based on the solution provided by the foregoing embodiment, preferably, as shown in fig. 4, the foregoing step S12 includes:
s121: determining image features of at least one non-reference image frame of the target reference image frame based on the target reference image frame, the image features including features of pixel points in the at least one non-reference image frame that are different from pixel points of the target reference image frame;
s122: and generating a compressed image frame corresponding to the at least one non-reference image frame according to the image characteristics of the at least one non-reference image frame.
In a video, adjacent image frames are usually similar, and especially in a monitoring video and a terminal screen recorded video, the pictures usually do not change suddenly. In step S121, features of pixels of a non-reference image frame different from the reference image frame are determined based on the target reference image frame, and image features are generated according to the features of the pixels. The image characteristics may include positions of the pixels and colors of the pixels, the positions of the pixels may be in a coordinate form, and the colors of the pixels may be in a numerical value form. The image characteristics can reflect the difference between the non-reference image frame and the reference image frame, and the non-reference image frame can be obtained according to the image characteristics and the reference image frame.
In step S122, a compressed image frame corresponding to the non-reference image frame is generated according to the image features obtained in the above steps, and the compressed image frame may be an image or a numerical value. Specifically, when the compressed image frame is in an image form, the compressed image frame may include different pixel points between the non-reference image frame and the target reference image frame, and the pixel points may not be adjacent to each other. When the compressed image frame is in a numerical form, the compressed image frame may include colors and positions of different pixel points of the non-reference image frame and the target reference image frame, and the numerical form of the compressed image frame may be, for example, "abscissa-ordinate-RGB color value". The compressed image frame may be in other forms such as a character string and a table.
When the number of the non-reference image frames of the target reference image frame is multiple, the above operation may be performed on each non-reference image frame, and the image feature of each non-reference image frame is determined based on the target reference image frame, so as to obtain compressed image frames corresponding to the multiple non-reference image frames one to one.
According to the scheme provided by the application, the non-reference image frame can be compressed according to the target reference image frame, the obtained compressed image frame contains the characteristics of different pixel points of the non-reference image frame relative to the target reference image frame, and the non-reference image frame can be obtained according to the compressed image frame and the target reference image frame. According to the scheme, the target video can be compressed, the data volume of the compressed target video is reduced, the compressed non-reference image frame can be restored in a decompression mode according to the compressed image frame and the target reference image frame, and image frame distortion in the video is avoided.
Based on the solution provided by the foregoing embodiment, preferably, as shown in fig. 5, the foregoing step S121 includes:
s1211: determining binary data of pixel points in the target reference image frame;
s1212: determining binary data for pixel points in the at least one non-reference image frame;
s1213: determining a binary data difference of the at least one non-reference image frame relative to the target reference image frame according to the binary data of the pixel points in the target reference image frame and the binary data of the pixel points in the at least one non-reference image frame;
wherein, the step S122 includes:
s1221: and generating a compressed image frame corresponding to the at least one non-reference image frame according to the binary data difference of the at least one non-reference image frame relative to the target reference image frame.
In the scheme, binary data of pixel points of a target reference image frame and at least one non-reference image frame of the target reference image frame are determined respectively. And according to the color of the target video, the occupied space of the binary data of the determined pixel points is different. If the image frame in the target video is an 8-bit gray scale image (such as a black-and-white movie), each pixel can be represented by an 8-bit binary, and 1-bit space can be occupied to store the color of one pixel. If the image frame in the target video is a 24-bit true color image, 24-bit space (3 bytes) can be occupied to store the color of one pixel point. In general, the lengths of the binary data of the pixels of each image frame determined by the above steps S1211 and S1212 of the present invention are the same, and in this example, it is assumed that 1 bit of space is required to store the binary data of one pixel, and one image frame includes 100 pixels, and at least 100 bits of space are required to store one image frame before compression.
In this example, assuming that the number of non-reference image frames of the target reference image frame is 1, in step S1213 of this scheme, a binary data difference of one non-reference image frame with respect to the target reference image frame is determined. Specifically, the binary data of 100 pixels in the non-reference image frame may be compared with the binary data of 100 pixels in the target reference image frame one by one, and the binary data difference between the non-reference image frame and the target reference image frame may be calculated by subtracting.
Specifically, the pixels in the non-reference image frame and the target reference image frame may be subtracted one by one based on the coordinates of the pixels, and the data difference may be calculated for the pixels with the same position, that is, the subtraction result between 100 pixels in the non-reference image frame and 100 pixels in the target reference image frame is 100. If the subtraction value of the binary data of one pixel point in the non-reference image frame and the binary data of one pixel point in the target reference image frame is 0, the pixel point of the non-reference image frame is the same as the pixel point in the target reference image frame in color.
Subsequently, step S1221 is performed to generate a compressed image frame corresponding to the non-reference image frame according to the binary data difference obtained in the above step. The binary data of the pixel points in the non-reference image frame, which are the same as the pixel points in the target reference image frame, may not be stored, or only 0 may be stored. The compressed image frame corresponding to the non-reference image frame generated in the step comprises the characteristics of pixel points different from the target reference image frame, and the non-reference image frame corresponding to the compressed image frame can be obtained by decompression and restoration according to the compressed image frame and the target reference image frame.
By means of the scheme provided by the application, the target video is compressed, the difference between the non-reference image frame and the target reference image frame is reserved in the compression process, and the space occupied by storing the non-reference image frame is effectively reduced. Moreover, the non-reference image frame corresponding to the compressed image frame can be obtained by decompressing and restoring according to the compressed image frame and the target reference image frame. The scheme provided by the application effectively reduces the space occupied by the stored video on the premise of ensuring the video picture quality.
In order to solve the problems in the prior art, the present application further provides a method for decompressing a video, which can be used for decompressing a compressed target video obtained by the above method. As shown in fig. 6, the method provided by the present application includes:
s14: determining a plurality of reference image frames in the compressed target video;
s15: decompressing at least one compressed image frame of a target reference image frame in the plurality of reference image frames to generate a non-reference image frame corresponding to the at least one compressed image frame, wherein the at least one compressed image frame of the target reference image frame is an image frame after the target reference image frame and before a next reference image frame of the target reference image frame in the target video;
s16: and generating a decompressed target video based on the plurality of reference image frames and the non-reference image frame corresponding to at least one compressed image frame of each reference image frame.
In this example, decompression may be performed based on the at least one compressed image frame and the target reference image frame to obtain a non-reference image frame. Specifically, reference image frames are determined from the compressed target video, and the reference image frames are uncompressed image frames. Then, decompression is performed on the compressed image frame according to the determined reference image frame, and a non-reference image frame corresponding to the compressed image frame is obtained.
And then, generating a decompressed target video according to the decompressed non-reference image frame and the compressed target video. Specifically, the decompressed non-reference image frames may be overlaid on the corresponding compressed image frames based on the compressed target video, and the compressed image frames may be replaced with the non-reference image frames, so that the compressed target video including the compressed image frames and the reference image frames may be decompressed into the decompressed target video including the non-reference image frames and the reference image frames.
By the scheme provided by the application, the compressed image frame can be decompressed into the non-reference image frame, and the decompressed target video can be obtained. By the scheme, the target video can be stored in a smaller storage space, and the compressed target video can be decompressed when the target video needs to be played. On the premise of ensuring the quality of the target video, the storage space occupied by storing the target video is reduced.
The scheme provided by the application can be applied to various fields, can compress the existing video file, and can also compress the video file being generated. For example, for a surveillance video, a terminal screen recorded video, compression may be performed at intervals of unit time. Assuming that the unit time is 1 minute, recording is started from 8:00, the recorded video is compressed once every full 1 minute, the recorded video in the previous minute is obtained through compression, and then the recorded video can be stored, and the uncompressed recorded video can be temporarily stored in a cache. The scheme provided by the application can reduce the storage resource amount occupied by the storage target video and simultaneously ensure the quality of the original video. According to actual requirements, the target video can be compressed or decompressed, and the method has better flexibility.
In order to solve the problems in the prior art, as shown in fig. 7, the present application further provides an apparatus 70 for compressing video, comprising:
a first determination module 71 that determines a plurality of reference image frames in the target video;
a first generating module 72, configured to generate a compressed image frame corresponding to at least one non-reference image frame of a target reference image frame in the plurality of reference image frames, where the at least one non-reference image frame of the target reference image frame is an image frame after the target reference image frame and before a next reference image frame of the target reference image frame in the target video;
the second generating module 73 generates a compressed target video based on the plurality of reference image frames and a compressed image frame corresponding to at least one non-reference image frame of each reference image frame.
Based on the solutions provided in the foregoing embodiments, preferably, the first determining module 71 is configured to:
determining a first reference image frame in a target video;
determining a first reference time length according to the first reference image frame;
and determining at least one second reference image frame after the first reference image frame in the target video according to the first reference time length, wherein the interval time length between any second reference image frame and the previous reference image frame is the first reference time length.
Based on the solutions provided in the foregoing embodiments, preferably, the first determining module 71 is configured to:
judging whether a target image frame in the target video comprises at least one preset safety identification or not;
when the target image frame comprises at least one preset safety identification, determining the target image frame as a first reference image frame;
and determining the first reference time length according to at least one preset safety mark in the first reference image frame.
Based on the solutions provided in the foregoing embodiments, preferably, the first generating module 72 is configured to:
determining image features of at least one non-reference image frame of the target reference image frame based on the target reference image frame, the image features including features of pixel points in the at least one non-reference image frame that are different from pixel points of the target reference image frame;
and generating a compressed image frame corresponding to the at least one non-reference image frame according to the image characteristics of the at least one non-reference image frame.
Based on the solutions provided in the foregoing embodiments, preferably, the first generating module 72 is configured to:
determining binary data of pixel points in the target reference image frame;
determining binary data for pixel points in the at least one non-reference image frame;
determining a binary data difference of the at least one non-reference image frame relative to the target reference image frame according to the binary data of the pixel points in the target reference image frame and the binary data of the pixel points in the at least one non-reference image frame;
and generating a compressed image frame corresponding to the at least one non-reference image frame according to the binary data difference of the at least one non-reference image frame relative to the target reference image frame.
In order to solve the problems in the prior art, as shown in fig. 8, the present application further provides an apparatus 80 for decompressing a video, comprising:
a second determining module 81, configured to determine a plurality of reference image frames in the compressed target video;
a third generating module 82, configured to perform decompression on at least one compressed image frame of a target reference image frame in the plurality of reference image frames, and generate a non-reference image frame corresponding to the at least one compressed image frame, where the at least one compressed image frame of the target reference image frame is an image frame after the target reference image frame and before a next reference image frame of the target reference image frame in the target video;
and a fourth generating module 83, configured to generate the decompressed target video based on the plurality of reference image frames and a non-reference image frame corresponding to at least one compressed image frame of each reference image frame.
In the embodiment of the application, a plurality of reference image frames in a target video are determined; compressing at least one non-reference image frame of a target reference image frame in the plurality of reference image frames to generate a compressed image frame corresponding to the at least one non-reference image frame; and generating a compressed target video based on the plurality of reference image frames and compressed image frames corresponding to at least one non-reference image frame of each compressed reference image frame. By the scheme, the target video can be compressed, so that the data volume of the compressed target video is smaller than that of the original target video, and the storage resource volume occupied by the stored target video is reduced.
Preferably, an embodiment of the present invention further provides a mobile terminal, which includes a processor, a memory, and a computer program stored in the memory and capable of running on the processor, where the computer program, when executed by the processor, implements each process of the above-mentioned method for compressing a video and/or the embodiment of the method for decompressing a video, and can achieve the same technical effect, and in order to avoid repetition, details are not repeated here.
An embodiment of the present invention further provides a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the computer program implements each process of the above-mentioned method for compressing a video and/or the above-mentioned method for decompressing a video, and can achieve the same technical effect, and in order to avoid repetition, details are not repeated here. The computer-readable storage medium may be a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk.
It should be noted that, in this document, 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 like elements in a process, method, article, or apparatus that comprises the element.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner. Based on such understanding, the technical solutions of the present invention may be embodied in the form of a software product, which is stored in a storage medium (such as ROM/RAM, magnetic disk, optical disk) and includes instructions for enabling a terminal (such as a mobile phone, a computer, a server, an air conditioner, or a network device) to execute the method according to the embodiments of the present invention.
While the present invention has been described with reference to the embodiments shown in the drawings, the present invention is not limited to the embodiments, which are illustrative and not restrictive, and it will be apparent to those skilled in the art that various changes and modifications can be made therein without departing from the spirit and scope of the invention as defined in the appended claims.

Claims (10)

1. A method of compressing video, comprising:
determining a plurality of reference image frames in a target video;
generating a compressed image frame corresponding to at least one non-reference image frame of a target reference image frame in the plurality of reference image frames, wherein the at least one non-reference image frame of the target reference image frame is an image frame after the target reference image frame and before a next reference image frame of the target reference image frame in the target video;
generating a compressed target video based on the plurality of reference image frames and compressed image frames corresponding to at least one non-reference image frame of each reference image frame;
the determining a plurality of reference image frames in the target video comprises:
judging whether a target image frame in the target video comprises at least one preset safety identification or not;
and when the target image frame comprises at least one preset safety identification, determining the target image frame as a first reference image frame.
2. The method of claim 1, wherein said determining a plurality of reference image frames in a target video comprises:
determining a first reference image frame in a target video;
determining a first reference time length according to the first reference image frame;
and determining at least one second reference image frame after a first reference image frame in the target video according to the first reference time length, wherein the interval time length between any second reference image frame and the previous reference image frame is the first reference time length.
3. The method of claim 2,
wherein the determining a first reference duration from the first reference image frame comprises:
and determining the first reference time length according to at least one preset safety mark in the first reference image frame.
4. A method as claimed in any one of claims 1 to 3, wherein generating a compressed image frame corresponding to at least one non-reference image frame of a target reference image frame from among the plurality of reference image frames comprises:
determining image features of at least one non-reference image frame of the target reference image frame based on the target reference image frame, the image features including features of pixel points in the at least one non-reference image frame that are different from pixel points of the target reference image frame;
and generating a compressed image frame corresponding to the at least one non-reference image frame according to the image characteristics of the at least one non-reference image frame.
5. The method as recited in claim 4, wherein said determining image features of at least one non-reference image frame of said target reference image frame based on said target reference image frame comprises:
determining binary data of pixel points in the target reference image frame;
determining binary data for pixel points in the at least one non-reference image frame;
determining a binary data difference of the at least one non-reference image frame relative to the target reference image frame according to the binary data of the pixel points in the target reference image frame and the binary data of the pixel points in the at least one non-reference image frame;
wherein the generating of the compressed image frame corresponding to the at least one non-reference image frame according to the image features of the at least one non-reference image frame comprises:
and generating a compressed image frame corresponding to the at least one non-reference image frame according to the binary data difference of the at least one non-reference image frame relative to the target reference image frame.
6. A method for decompressing video, applied to the compressed target video obtained by the method for compressing video according to any one of claims 1 to 5, the method for decompressing video comprising:
determining a plurality of reference image frames in the compressed target video;
decompressing at least one compressed image frame of a target reference image frame in the plurality of reference image frames to generate a non-reference image frame corresponding to the at least one compressed image frame, wherein the at least one compressed image frame of the target reference image frame is an image frame after the target reference image frame and before a next reference image frame of the target reference image frame in the target video;
and generating a decompressed target video based on the plurality of reference image frames and the non-reference image frame corresponding to at least one compressed image frame of each reference image frame.
7. An apparatus for compressing video, comprising:
the first determination module is used for determining a plurality of reference image frames in the target video;
a first generating module, configured to generate a compressed image frame corresponding to at least one non-reference image frame of a target reference image frame in the plurality of reference image frames, where the at least one non-reference image frame of the target reference image frame is an image frame after the target reference image frame and before a next reference image frame of the target reference image frame in the target video;
the second generation module generates a compressed target video based on the plurality of reference image frames and a compressed image frame corresponding to at least one non-reference image frame of each reference image frame;
the first determination module is to:
judging whether a target image frame in the target video comprises at least one preset safety identification or not;
and when the target image frame comprises at least one preset safety identification, determining the target image frame as a first reference image frame.
8. An apparatus for decompressing the compressed target video obtained in claim 7, the apparatus for decompressing the video comprising:
the second determination module is used for determining a plurality of reference image frames in the compressed target video;
a third generating module, configured to perform decompression on at least one compressed image frame of a target reference image frame in the multiple reference image frames, and generate a non-reference image frame corresponding to the at least one compressed image frame, where the at least one compressed image frame of the target reference image frame is an image frame after the target reference image frame in the target video and before a next reference image frame of the target reference image frame;
and the fourth generation module generates a decompressed target video based on the plurality of reference image frames and the non-reference image frame corresponding to at least one compressed image frame of each reference image frame.
9. A mobile terminal, comprising: memory, processor and computer program stored on the memory and executable on the processor, which computer program, when executed by the processor, carries out the steps of the method according to any one of claims 1 to 6.
10. A computer-readable storage medium, characterized in that a computer program is stored on the computer-readable storage medium, which computer program, when being executed by a processor, carries out the steps of the method according to any one of claims 1 to 6.
CN201910338463.1A 2019-04-25 2019-04-25 Method and device for compressing video and decompressing video Active CN111866514B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910338463.1A CN111866514B (en) 2019-04-25 2019-04-25 Method and device for compressing video and decompressing video

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910338463.1A CN111866514B (en) 2019-04-25 2019-04-25 Method and device for compressing video and decompressing video

Publications (2)

Publication Number Publication Date
CN111866514A CN111866514A (en) 2020-10-30
CN111866514B true CN111866514B (en) 2022-06-03

Family

ID=72951293

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910338463.1A Active CN111866514B (en) 2019-04-25 2019-04-25 Method and device for compressing video and decompressing video

Country Status (1)

Country Link
CN (1) CN111866514B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116600137B (en) * 2023-07-17 2023-11-17 深圳市东明炬创电子股份有限公司 Video image compression storage or decompression method, device, equipment and medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106792272A (en) * 2016-11-28 2017-05-31 维沃移动通信有限公司 The generation method and mobile terminal of a kind of video thumbnails
CN108282654A (en) * 2018-02-08 2018-07-13 李锐 A kind of compression of digital video and decompression method
CN108337551A (en) * 2018-01-22 2018-07-27 深圳壹账通智能科技有限公司 A kind of screen recording method, storage medium and terminal device
CN109547786A (en) * 2017-09-22 2019-03-29 阿里巴巴集团控股有限公司 Video coding and the decoded method, apparatus of video

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9251435B2 (en) * 2013-09-20 2016-02-02 Oracle International Corporation Screenshot database for application verification

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106792272A (en) * 2016-11-28 2017-05-31 维沃移动通信有限公司 The generation method and mobile terminal of a kind of video thumbnails
CN109547786A (en) * 2017-09-22 2019-03-29 阿里巴巴集团控股有限公司 Video coding and the decoded method, apparatus of video
CN108337551A (en) * 2018-01-22 2018-07-27 深圳壹账通智能科技有限公司 A kind of screen recording method, storage medium and terminal device
CN108282654A (en) * 2018-02-08 2018-07-13 李锐 A kind of compression of digital video and decompression method

Also Published As

Publication number Publication date
CN111866514A (en) 2020-10-30

Similar Documents

Publication Publication Date Title
CN110392306B (en) Data processing method and equipment
CN113068040A (en) Image compression method and device, electronic equipment and readable storage medium
CN107509115A (en) A kind of method and device for obtaining live middle Wonderful time picture of playing
CN110740316A (en) Data coding method and device
CN111294651A (en) Still picture anti-afterimage method and device based on play data stream and storage medium
CN116109469B (en) Baseboard management controller, image display method, device and computer medium
CN111866514B (en) Method and device for compressing video and decompressing video
CN114466228B (en) Method, equipment and storage medium for improving smoothness of screen projection display
JP6123893B2 (en) Information processing device, terminal device, information processing program, and information processing method
CN114418825B (en) Image processing method, image processing device, computer equipment and storage medium
CN108924624B (en) Information processing method and device
CN110572713B (en) Transcoding method and processing terminal for adaptive video bandwidth ratio
CN113395475B (en) Data processing method and device, electronic equipment and storage equipment
CN110941413B (en) Display screen generation method and related device
CN112492248B (en) Video verification method and device
CN113596449B (en) Image processing method and device
CN113473184A (en) Video color ring tone blocking processing method, terminal equipment and storage medium
CN113822785A (en) Resource copyright setting method, resource copyright checking device and electronic equipment
CN111353133B (en) Image processing method, device and readable storage medium
CN110662088B (en) Duplicate removal method and processing terminal for preventing video from being transcoded repeatedly
CN104573413B (en) A kind of guard method of multimedia resource and device
CN110837575B (en) Method and device for generating transmission characteristic information of video image
CN109874015B (en) Video steganography method with variable bit number, user equipment, storage medium and device
CN109543678B (en) Sensitive image identification method and device
CN110022480B (en) H265 hardware coding method based on AMD display card and live broadcast platform

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