CN113672761B - Video processing method and device - Google Patents

Video processing method and device Download PDF

Info

Publication number
CN113672761B
CN113672761B CN202110807535.XA CN202110807535A CN113672761B CN 113672761 B CN113672761 B CN 113672761B CN 202110807535 A CN202110807535 A CN 202110807535A CN 113672761 B CN113672761 B CN 113672761B
Authority
CN
China
Prior art keywords
video
image
image frame
hash
value
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
CN202110807535.XA
Other languages
Chinese (zh)
Other versions
CN113672761A (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.)
Beijing QIYI Century Science and Technology Co Ltd
Original Assignee
Beijing QIYI Century Science and 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 Beijing QIYI Century Science and Technology Co Ltd filed Critical Beijing QIYI Century Science and Technology Co Ltd
Priority to CN202110807535.XA priority Critical patent/CN113672761B/en
Publication of CN113672761A publication Critical patent/CN113672761A/en
Application granted granted Critical
Publication of CN113672761B publication Critical patent/CN113672761B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/70Information retrieval; Database structures therefor; File system structures therefor of video data
    • G06F16/71Indexing; Data structures therefor; Storage structures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/70Information retrieval; Database structures therefor; File system structures therefor of video data
    • G06F16/78Retrieval characterised by using metadata, e.g. metadata not derived from the content or metadata generated manually
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/11Region-based segmentation
    • 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/47End-user applications
    • H04N21/488Data services, e.g. news ticker
    • H04N21/4884Data services, e.g. news ticker for displaying subtitles

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Multimedia (AREA)
  • General Physics & Mathematics (AREA)
  • Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Library & Information Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Signal Processing (AREA)
  • Software Systems (AREA)
  • Two-Way Televisions, Distribution Of Moving Picture Or The Like (AREA)
  • Editing Of Facsimile Originals (AREA)

Abstract

The embodiment of the invention provides a video processing method and device, comprising the following steps: acquiring video element information in an image frame of a video, wherein the video element information comprises a video element and display information of the video element; determining a video element image for displaying the video element in the image frame according to the display information; performing binarization processing on the video element image to obtain a binarized image; carrying out hash coding on the binarized image and the display information to obtain a hash coding value; and embedding the hash coding value into the corresponding image frame to obtain a coded video. According to the embodiment of the invention, the hash coding value of the video element information is embedded into the image frame of the video, so that the image frame in the original video is not damaged, and meanwhile, the hash coding value is conveniently extracted from the image frame, thereby facilitating the post-processing of the video.

Description

Video processing method and device
Technical Field
Embodiments of the present invention relate to the field of video processing technologies, and in particular, to a video processing method, a video processing apparatus, an electronic device, and a computer readable storage medium.
Background
The subtitles refer to non-visual contents such as conversations and side notes displayed in the form of characters in videos such as movies and shows, and generally refer to characters in videos, which are generally displayed under a screen. At present, two processing schemes for subtitles in video exist, wherein the first scheme is embedding the subtitles into image frames, and the second scheme is externally hung subtitles.
However, the first scheme damages the original area of the image frame, loses part of image information, and the second scheme needs to add an externally hung subtitle file, but the subtitle file is easy to lose and difficult to store, and in addition, the second scheme also has the condition that the decoder analysis errors cause the dislocation of the subtitle and the image frame, so that the watching experience of the audience is poor.
At present, the post processing of videos such as film and television and variety is common, for example, when a poster is added and manufactured, a dynamic cover is added, and a highlight is edited, a subtitle is not needed, if the subtitle is embedded in the video, the post processing is inconvenient, the subtitle needs to be removed first, and the repair of a subtitle area is also involved, so that the method is time-consuming and labor-consuming.
Therefore, how to process subtitles in video without damaging image frames in original video and to facilitate post-processing of video is a problem to be solved.
Disclosure of Invention
An object of an embodiment of the present invention is to provide a video processing method, a video processing apparatus, an electronic device, and a computer readable storage medium, so as to implement processing of subtitles in a video, not to destroy image frames in the original video, and to enable convenient post-processing of the video.
The specific technical scheme is as follows:
in a first aspect of the present invention, there is provided a video processing method, including:
acquiring video element information in an image frame of a video, wherein the video element information comprises a video element and display information of the video element;
determining a video element image for displaying the video element in the image frame according to the display information;
performing binarization processing on the video element image to obtain a binarized image;
carrying out hash coding on the binarized image and the display information to obtain a hash coding value;
and embedding the hash coding value into the corresponding image frame to obtain a coded video.
Optionally, the hash coding is performed on the binarized image and the display information to obtain a hash coding value, which includes:
Skipping from the binarized image to extract a binarized array;
converting the numerical value of each column of the binarization array into decimal numerical values according to a rule of binary decimal conversion;
and converting the decimal value and the display information into hash coding values according to a hash mapping table which is counted in advance.
Optionally, the embedding the hash coding value into the corresponding image frame to obtain a coded video includes:
and storing the hash code value into an alpha channel of the corresponding image frame.
Optionally, the storing the hash code value in an alpha channel of the corresponding image frame includes:
when no data is stored in an alpha channel in the image frame, storing the hash coding numerical value into the corresponding alpha channel of the image frame;
when data is stored in an alpha channel in the image frame, storing a specified start identifier, the hash code value and a specified end identifier to the end of the data in the alpha channel of the corresponding image frame.
Optionally, the embedding the hash coding value into the corresponding image frame to obtain a coded video includes:
And adjusting the parity of the pixel value in the appointed area in the image frame according to the hash coding value to obtain the coded video.
Optionally, the video element includes at least one of a subtitle and an icon, and the display information includes a display position and a size of the video element.
In a second aspect of the present invention, there is also provided a video processing method, including:
acquiring an encoded video;
extracting hash coding values from image frames of the coded video;
generating a binarized image and display information according to the hash code value;
and converting the binarized image into a video element image, and displaying the video element image in the image frame according to the display information.
Optionally, the extracting the hash code value from the image frame of the encoded video includes:
hash code values are extracted from an alpha channel of an image frame of the encoded video.
Optionally, the extracting the hash code value from the image frame of the encoded video includes:
extracting pixel values from a designated region of an image frame of the encoded video;
and obtaining a hash code value according to the parity of the pixel value.
Optionally, the generating the binarized image and the display information according to the hash code value includes:
converting the hash code value into a decimal value and the display information according to a hash mapping table counted in advance;
converting the decimal value according to a rule of converting decimal into binary to obtain a binary array;
and carrying out interpolation processing on the binarization array to obtain a binarization image.
In a third aspect of the present invention, there is also provided a video processing apparatus, including:
the video element information acquisition module is used for acquiring video element information in an image frame of a video, wherein the video element information comprises a video element and display information of the video element;
the video element image determining module is used for determining a video element image for displaying the video element in the image frame according to the display information;
the binarization image obtaining module is used for carrying out binarization processing on the video element image to obtain a binarization image;
the hash code value obtaining module is used for carrying out hash coding on the binarized image and the display information to obtain a hash code value;
and the coded video obtaining module is used for embedding the hash code value into the corresponding image frame to obtain the coded video.
In a fourth aspect of the present invention, there is also provided a video processing apparatus, including:
the coded video acquisition module is used for acquiring coded video;
the hash code value extraction module is used for extracting hash code values from image frames of the coded video;
the image information generation module is used for generating a binarized image and display information according to the hash code value;
and the video element image display module is used for converting the binarized image into a video element image and displaying the video element image in the image frame according to the display information.
In yet another aspect of the present invention, there is also provided a computer readable storage medium having instructions stored therein, which when run on a computer, cause the computer to perform any of the video processing methods described above.
In yet another aspect of the invention, there is also provided a computer program product containing instructions which, when run on a computer, cause the computer to perform any of the video processing methods described above.
According to the video processing method provided by the embodiment of the invention, the video element information in the image frames of the video is obtained, the video element information comprises the video element and the display information of the video element, the video element image of the video element displayed in the image frames is determined according to the display information, then the video element image is subjected to binarization processing to obtain a binarized image, the binarized image and the display information are subjected to hash coding to obtain a hash coding value, and the hash coding value is embedded into the corresponding image frame to obtain the coded video. According to the embodiment of the invention, the hash coding value of the video element information is embedded into the image frame of the video, so that the image frame in the original video is not damaged, and meanwhile, the hash coding value is conveniently extracted from the image frame, thereby facilitating the post-processing of the video.
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.
Fig. 1 is a flowchart of steps of a video processing method according to an embodiment of the present invention;
fig. 2 is a schematic diagram of a video element image for displaying subtitles in an image frame according to an embodiment of the invention;
fig. 3 is a schematic diagram of a binarized image of a subtitle according to an embodiment of the present invention;
FIG. 4 is a schematic diagram of an array of decimal values in accordance with one embodiment of the present invention;
fig. 5 is a schematic flow chart of an image frame of a video with subtitle information embedded therein according to an embodiment of the present invention;
FIG. 6 is a flowchart illustrating steps of another video processing method according to an embodiment of the present invention;
fig. 7 is a block diagram of a video processing apparatus according to an embodiment of the present invention;
fig. 8 is a block diagram of another video processing apparatus according to an embodiment of the present invention;
fig. 9 is a block diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be described below with reference to the accompanying drawings in the embodiments of the present invention.
At present, most of video elements of videos such as various kinds of products, dramas, movies, etc., for example, subtitles, icons, etc., have a substantially pure (white) structure, and do not have textures, and therefore, when displayed, it is equivalent to erasing original image information at the position in an image frame of the video, and thus, recovery at the time of use is difficult. In view of the above problems, an embodiment of the present invention provides a video processing method, in which video element information of a video element may be converted into a hash coding value, and then embedded into a layer of a corresponding image frame of a video, so that display and concealment of the video element are achieved through specific encoding and decoding of an algorithm without affecting picture content, and a caption area is compression-coded by using information redundancy characteristics of a monochrome caption, and is simultaneously stored in an image frame of the video.
Referring to fig. 1, a flowchart of steps of a video processing method according to an embodiment of the present invention is shown in fig. 1, where the method specifically includes the following steps:
step 101, obtaining video element information in an image frame of a video, wherein the video element information comprises a video element and display information of the video element.
The video may refer to video works such as film and television, variety and the like.
The video element at least comprises one of a subtitle and an icon, and the display information comprises the display position and the display size of the video element. Specifically, the subtitle may refer to a text in a video, such as a video name, a dialogue between characters, or a bystanding of the video, and the icon may refer to an icon displayed on a video such as LOGO (trademark); the display information refers to a display position and a size of a caption or an icon displayed in an image frame of a video, for example, the caption is displayed in the middle-lower part of the image frame, and the size of the caption is 100×100.
Step 102, determining a video element image for displaying the video element in the image frame according to the display information.
The video element image refers to an image in which a video element is displayed in an image frame, for example, an image in which a subtitle is displayed, or an image in which an icon is displayed. Specifically, referring to fig. 2, a schematic diagram of a video element image displaying a subtitle in an image frame is shown, where "only this gesture" in the figure is the subtitle.
In the embodiment of the invention, after the video element information corresponding to the image frame of each frame is obtained, the video element image of the video element information in the image frame is determined according to the display information of the video element information. Specifically, assuming that the video element is a subtitle, the display information is the middle lower part of the image frame and the size is 100×100, it may be determined that a subtitle with the size of 100×100 will be displayed at the middle lower part of the image frame.
And 103, performing binarization processing on the video element image to obtain a binarized image.
The pixel value of the pixel point on the image is set to be 0 or 1 in the binarization. Specifically, assuming that the image threshold is 128, if the pixel value in the video element image is less than 128, the pixel value is set to 0, if the pixel value in the video element image is greater than or equal to 128, the pixel value is set to 1, and after the binarization processing of all the pixel values in the video element image is completed, a binarized image with the pixel value of 0 or 1 can be obtained.
Referring to fig. 3, a schematic diagram of a binarized image of a subtitle is shown, wherein the subtitle displayed in the figure is solid, so that the subtitle image is easy to perform binarization processing, and the subtitle image after binarization processing is converted into an image with only two values of 0 and 1.
And 104, carrying out hash coding on the binarized image and the display information to obtain a hash coding value.
The Hash is generally translated into Hash, or transliterated into Hash, and Hash coding is to transform an input value with any length into an output with a fixed length through a Hash algorithm, and the output is a Hash value (Hash code value). Hash coding is a compressed mapping in which the memory space of the hash code values is typically much smaller than the memory space of the input values. In summary, hash coding is simply a function of compressing an arbitrary length of input to a message digest of a fixed length.
In the embodiment of the invention, the binary image and the display information corresponding to the image frame are subjected to hash coding to obtain the hash coding value, and it can be understood that the space of the hash coding value is usually far smaller than the memory space of the binary image and the display information, so that the hash coding is performed on the binary image and the display information of the image frame, and a large amount of memory space can be saved.
And step 105, embedding the hash code value into the corresponding image frame to obtain the coded video.
In the embodiment of the invention, the binary image and the display information corresponding to each frame of image frame are subjected to hash coding, after the hash coding value is obtained, the hash coding value is embedded into the corresponding image frame, and after the hash coding processing of all the image frames in the video is completed, the coded video can be obtained.
In the video processing method, the video element information in the image frame of the video is obtained, the video element information comprises the video element and the display information of the video element, the video element image of the video element displayed in the image frame is determined according to the display information, then binarization processing is carried out on the video element image to obtain a binarized image, hash encoding is carried out on the binarized image and the display information to obtain a hash encoding value, and the hash encoding value is embedded into the corresponding image frame to obtain the encoded video. According to the embodiment of the invention, the hash coding value of the video element information is embedded into the image frame of the video, so that the image frame in the original video is not damaged, and meanwhile, the hash coding value is conveniently extracted from the image frame, thereby facilitating the post-processing of the video.
In an exemplary embodiment of the present invention, the step 104 of performing hash encoding on the binarized image and the display information to obtain a hash encoded value may include:
skipping from the binarized image to extract a binarized array;
converting the numerical value of each column of the binarization array into decimal numerical values according to a rule of binary decimal conversion;
and converting the decimal value and the display information into hash coding values according to a hash mapping table which is counted in advance.
A Hash table (also called a Hash table) is a data structure that is directly accessed according to a Key value (Key value). In short, it accesses a record by mapping the key value to a location in the table to speed up the lookup. In the embodiment of the invention, a hash mapping table is counted in advance, the binary image and the display information can be mapped to a key code value (namely hash code value) based on the hash mapping table, the length of the array can be compressed by expressing the hash code value, and the purpose of space compression is achieved.
In the embodiment of the invention, the binary image is scaled first. Specifically, the binary image is scaled, typically 1/2 of the original size, for example, assuming that the binary image is fixedly scaled down to a specified line number 64. Specifically, the binary image is skipped to extract a binary array, then the value of each column in the binary array is used as a binary value, and the binary value is decimal, so that the decimal value can be converted, and a standard array is formed, as shown in fig. 4, "14", "19", "35" and "6" at the end of the array are converted decimal values. Finally, based on the hash mapping table counted in advance, the decimal value and the display information in the array are converted into hash coding values.
In the above embodiment, the binary array is extracted from the binary image skip, then the numerical value of each column of the binary array is converted into the decimal value according to the rule of binary decimal conversion, so as to obtain the array formed by the decimal values, finally the decimal value and the display information are converted into the hash coding numerical value according to the hash mapping table counted in advance, so that the compression processing of the binary image and the display information is realized, the size of the video element image embedded into the image frame is reduced, and the size of the coded video is further reduced, so that the coded video is easy to transmit on the internet.
In an exemplary embodiment of the present invention, the step 105 of embedding the hash code value into the corresponding image frame to obtain the encoded video may include:
and storing the hash code value into an alpha channel of the corresponding image frame.
In the embodiment of the present invention, the hash code value may be stored in an Alpha channel (Alpha channel) of the corresponding image frame. In an exemplary embodiment of the present invention, the storing the hash code value in an alpha channel of the corresponding image frame includes:
When no data is stored in an alpha channel in the image frame, storing the hash coding numerical value into the corresponding alpha channel of the image frame;
when data is stored in an alpha channel in the image frame, storing a specified start identifier, the hash code value and a specified end identifier to the end of the data in the alpha channel of the corresponding image frame.
Specifically, if the Alpha channel of the image frame is not used, the hash code value may be directly stored in the Alpha channel of the unused image frame by means of writing; if the alpha channel of the image frame has been used (has data stored), then, for example, when depth information has been stored in the alpha channel, the hash code value and the specified start identifier (identifier) and the specified end identifier (identifier) for representing the start position and the end position of the hash code value may be stored at the end of the alpha channel to the end of the depth information of the alpha channel.
In the above embodiment, the hash code value is stored in the alpha channel of the corresponding image frame, and is stored in the alpha channel of the image frame, so that the original image information of the image frame is not affected, and even if the data is already stored in the alpha channel of the image frame, the hash code value can be extracted from the alpha channel by designating the start identifier and the end identifier.
In an exemplary embodiment of the present invention, the embedding the hash code value into the corresponding image frame to obtain the encoded video includes:
and adjusting the parity of the pixel value in the appointed area in the image frame according to the hash coding value to obtain the coded video.
In an embodiment of the present invention, hash code values are embedded into an image frame using a pixel value parity representation, which is a parity of pixel values that change pixels in a specified region in the image frame. Specifically, the hash code value is 0 or 1, 0 is regarded as an even number, 1 is regarded as an odd number, and then the pixel value of the specified area is adjusted based on the original parity of the pixel value of the specified area in the image frame and the hash code value so that the parity of the pixel value in the specified area corresponds to the hash code value, wherein the parity is changed by adding 1 to the pixel value, that is, by adding 1 to the even number when the pixel value is an odd number, and by adding 1 to the odd number when the pixel value is an even number, so that the hash code value is embedded in the image frame. After all the image frames in the video are added to the hash code value in the specified area, the encoded video can be obtained.
For example, assuming that the specified region is at the middle-lower side of the image frame, the pixel values at the middle-lower side of the image frame are 81, 82, 83, 84, and the hash-code values are 1, 0, 1, the parity of the pixel values should be odd, even, odd, and the pixel values adjusting the parity will be changed to 81, 83, 84, 85. It will be appreciated that although the pixel values of portions in the image frame vary, the effect of the display on the image frame as a whole is not significantly affected, since 1 is merely added to the original pixel values.
In the above embodiment, the pixel values of the specified area in the image frame are adjusted according to the parity of the hash code value so that the parity of the pixel values in the specified area corresponds to the parity of the hash code value, and although the pixel values of part of the image frame are adjusted, since 1 is added only on the basis of the original pixel value, the original image information of the image frame is not affected.
For better understanding of the embodiments of the present invention, a specific scheme is used below to describe video processing, specifically referring to fig. 5, a flowchart of embedding subtitle information into an image frame of a video according to the present invention is shown, and the method includes the following steps:
Step 501, obtaining video and caption information; wherein, the caption information may include caption and display information;
step 502, determining the display position and size of the caption according to the display information;
step 503, generating a binarized image from an image frame of the video;
step 504, scaling the binary image, specifically, extracting a binary value through skipping, and then compressing the binary value into a single-column array; wherein, the numerical decimal values in the array;
step 505, hash-coding the decimal value based on the Ha Xiying table to obtain a hash-coded value; the hash mapping table is generated by counting a large number of videos and is stored in the encoder;
step 506, hash coding is carried out on the display information based on the Ha Xiying table to obtain a hash coding value;
step 507, embedding the hash code value into an alpha channel of the image frame.
In the embodiment of the invention, the subtitle information is subjected to hash coding to obtain the hash coding value, and then the hash coding value is embedded into the alpha channel of the image frame, so that the original image information of the image frame is not influenced by the way of embedding the hash coding value into the image frame.
Referring to fig. 6, a flowchart of steps of a video processing method according to an embodiment of the present invention, as shown in fig. 6, may specifically include the following steps:
step 601, an encoded video is acquired.
Step 602, extracting hash code values from image frames of the encoded video.
And 603, generating a binarized image and display information according to the hash code value.
Step 604, converting the binarized image into a video element image, and displaying the video element image in the image frame according to the display information.
In the video processing method, the encoded video is acquired, the hash code value is extracted from the image frame of the encoded video, then the binary image and the display information are generated according to the hash code value, the binary image is converted into the video element image, and then the video element image is displayed in the image frame according to the display information. In the embodiment of the invention, the hash coding values of the video elements are embedded in the image frames, and the corresponding hash coding values can be decoded from the image frames so as to restore the binarized images and the display information of the video elements.
In the embodiment of the invention, the video element information of the video element is directly embedded into each frame of image frame of the video in an encoding mode, the display and the hiding of the video element are controlled through the decoder, the original image frame is not destroyed, and meanwhile, the invention provides convenience for the subsequent processing, for example, the post-production of the video can be facilitated, and the trouble of caption erasure and image recovery is avoided.
In an exemplary embodiment of the present invention, the extracting the hash code value from the image frame of the encoded video in step 602 may include:
hash code values are extracted from an alpha channel of an image frame of the encoded video.
In the embodiment of the present invention, when the hash code value of the current video element is embedded in the alpha channel of the image frame, the hash code value may be extracted from the alpha channel of the image frame of the encoded video. Alternatively, if data has been stored in the alpha channel originally, hash-code values may be extracted from the corresponding positions of the alpha channel based on the specified start identifier and the specified end identifier.
In another exemplary embodiment of the present invention, the extracting the hash code value from the image frame of the encoded video in step 602 may include:
Extracting pixel values from a designated region of an image frame of the encoded video;
and obtaining a hash code value according to the parity of the pixel value.
In the embodiment of the invention, the pixel values are extracted from the appointed area of the image frame of the coded video, for example, the pixel values can be extracted from the middle lower part of the image frame, and then the hash coding values of the video elements are restored and obtained according to the parity of the pixel values. For example, assuming that 0 is even and 1 is odd, if pixel values 81, 83, 84, 85 are extracted from the specified region, and the parity of these pixel values is odd, even, odd, then hash code values of 1, 0, 1 can be restored.
In the embodiment of the present invention, the hash coding values of the video elements may be embedded in the alpha channel of the image frame or may be embedded in the designated area of the image frame, and the two modes have no effect or negligible effect on the display effect of the original image frame, and in practical application, the embedding mode of the corresponding hash coding values may be selected according to the actual requirements, which is not limited in the embodiment of the present invention.
In an exemplary embodiment of the present invention, the generating the binarized image and the display information according to the hash code value in step 603 may include:
Converting the hash code value into a decimal value and the display information according to a hash mapping table counted in advance;
converting the decimal value according to a rule of converting decimal into binary to obtain a binary array;
and carrying out interpolation processing on the binarization array to obtain a binarization image.
In the embodiment of the present invention, after the hash code value is obtained, a decimal value and display information may be obtained by converting according to a hash mapping table that is counted in advance, where the decimal value may be converted according to a rule that a decimal system is converted into a binary system, so as to obtain a binary array, where, because the binary data is obtained by skipping a binary image of a video element, the line number of the binary array may be restored to the line number of the original binary image, for example, it is assumed that the binary array is reduced to 1/2 of the binary image, if the line number of the binary array is 64, it may be restored to 64×2 lines, then, for each pixel value in the newly inserted line, interpolation processing may be performed based on pixel values around the binary value, so as to obtain a corresponding pixel value, and then restoration may obtain the binary image.
In the above embodiment, the hash code values of the video elements extracted from the image frames may be converted to obtain decimal values and display information based on a hash mapping table that is counted in advance, then the decimal values are converted to obtain a binary array according to a rule of decimal to binary, and then the binary array is subjected to interpolation processing to obtain a binary image of the video elements.
Referring to fig. 7, which is a block diagram of a video processing apparatus according to an embodiment of the present invention, as shown in fig. 7, the apparatus 70 may specifically include the following modules:
a video element information obtaining module 701, configured to obtain video element information in an image frame of a video, where the video element information includes a video element and display information of the video element;
a video element image determining module 702, configured to determine, according to the display information, a video element image in the image frame in which the video element is displayed;
a binarized image obtaining module 703, configured to perform binarization processing on the video element image to obtain a binarized image;
a hash code value obtaining module 704, configured to perform hash coding on the binarized image and the display information to obtain a hash code value;
And the encoded video obtaining module 705 is configured to embed the hash code value into the corresponding image frame to obtain an encoded video.
In an exemplary embodiment of the present invention, the hash code value obtaining module 704 is configured to skip a row from the binary image to extract a binary array; converting the numerical value of each column of the binarization array into decimal numerical values according to a rule of binary decimal conversion; and converting the decimal value and the display information into hash coding values according to a hash mapping table which is counted in advance.
In an exemplary embodiment of the present invention, the encoded video obtaining module 705 is configured to store the hash code value in an alpha channel of a corresponding image frame.
In an exemplary embodiment of the present invention, the encoded video obtaining module 705 is configured to store the hash code value into an alpha channel of the corresponding image frame when no data is stored in the alpha channel of the image frame; when data is stored in an alpha channel in the image frame, storing a specified start identifier, the hash code value and a specified end identifier to the end of the data in the alpha channel of the corresponding image frame.
In an exemplary embodiment of the present invention, the encoded video obtaining module 705 is configured to adjust the parity of the pixel values in the specified area in the image frame according to the hash code value, so as to obtain the encoded video.
In an exemplary embodiment of the present invention, the video element includes at least one of a subtitle and an icon, and the display information includes a display position and a size of the video element.
Referring to fig. 8, which is a block diagram of another video processing apparatus according to an embodiment of the present invention, as shown in fig. 8, the apparatus 80 may specifically include the following modules:
an encoded video acquisition module 801, configured to acquire an encoded video;
a hash code value extraction module 802, configured to extract a hash code value from an image frame of the encoded video;
an image information generating module 803, configured to generate a binarized image and display information according to the hash code value;
the video element image display module 804 is configured to convert the binarized image into a video element image, and display the video element image in the image frame according to the display information.
In an exemplary embodiment of the present invention, the hash code value extraction module 802 is configured to extract a hash code value from an alpha channel of an image frame of the encoded video.
In an exemplary embodiment of the present invention, the hash code value extraction module 802 is configured to extract pixel values from a specified region of an image frame of the encoded video; and obtaining a hash code value according to the parity of the pixel value.
In an exemplary embodiment of the present invention, the image information generating module 803 is configured to convert the hash code value into a decimal value and the display information according to a hash mapping table that is counted in advance; converting the decimal value according to a rule of converting decimal into binary to obtain a binary array; and carrying out interpolation processing on the binarization array to obtain a binarization image.
In an exemplary embodiment of the present invention, the video element includes at least one of a subtitle and an icon, and the display information includes a display position and a size of the video element.
For the above-described device embodiments, the description is relatively simple, as it is substantially similar to the method embodiments, with reference to the description of the method embodiments in part.
The embodiment of the invention also provides an electronic device, as shown in fig. 9, which comprises a processor 91, a communication interface 92, a memory 93 and a communication bus 94, wherein the processor 91, the communication interface 92 and the memory 93 complete communication with each other through the communication bus 94,
A memory 93 for storing a computer program;
the processor 91 is configured to execute the program stored in the memory 93, and implement the following steps:
acquiring video element information in an image frame of a video, wherein the video element information comprises a video element and display information of the video element;
determining a video element image for displaying the video element in the image frame according to the display information;
performing binarization processing on the video element image to obtain a binarized image;
carrying out hash coding on the binarized image and the display information to obtain a hash coding value;
and embedding the hash coding value into the corresponding image frame to obtain a coded video.
Optionally, the hash coding is performed on the binarized image and the display information to obtain a hash coding value, which includes:
skipping from the binarized image to extract a binarized array;
converting the numerical value of each column of the binarization array into decimal numerical values according to a rule of binary decimal conversion;
and converting the decimal value and the display information into hash coding values according to a hash mapping table which is counted in advance.
Optionally, the embedding the hash coding value into the corresponding image frame to obtain a coded video includes:
and storing the hash code value into an alpha channel of the corresponding image frame.
Optionally, the storing the hash code value in an alpha channel of the corresponding image frame includes:
when no data is stored in an alpha channel in the image frame, storing the hash coding numerical value into the corresponding alpha channel of the image frame;
when data is stored in an alpha channel in the image frame, storing a specified start identifier, the hash code value and a specified end identifier to the end of the data in the alpha channel of the corresponding image frame.
Optionally, the embedding the hash coding value into the corresponding image frame to obtain a coded video includes:
and adjusting the parity of the pixel value in the appointed area in the image frame according to the hash coding value to obtain the coded video.
Optionally, the video element includes at least one of a subtitle and an icon, and the display information includes a display position and a size of the video element.
The processor 91, when executing the program stored in the memory 93, may further implement the following steps:
acquiring an encoded video;
extracting hash coding values from image frames of the coded video;
generating a binarized image and display information according to the hash code value;
and converting the binarized image into a video element image, and displaying the video element image in the image frame according to the display information.
Optionally, the extracting the hash code value from the image frame of the encoded video includes:
hash code values are extracted from an alpha channel of an image frame of the encoded video.
Optionally, the extracting the hash code value from the image frame of the encoded video includes:
extracting pixel values from a designated region of an image frame of the encoded video;
and obtaining a hash code value according to the parity of the pixel value.
Optionally, the generating the binarized image and the display information according to the hash code value includes:
converting the hash code value into a decimal value and the display information according to a hash mapping table counted in advance;
converting the decimal value according to a rule of converting decimal into binary to obtain a binary array;
And carrying out interpolation processing on the binarization array to obtain a binarization image.
The communication bus mentioned by the above terminal may be a peripheral component interconnect standard (Peripheral Component Interconnect, abbreviated as PCI) bus or an extended industry standard architecture (Extended Industry Standard Architecture, abbreviated as EISA) bus, etc. The communication bus may be classified as an address bus, a data bus, a control bus, or the like. For ease of illustration, the figures are shown with only one bold line, but not with only one bus or one type of bus.
The communication interface is used for communication between the terminal and other devices.
The memory may include random access memory (Random Access Memory, RAM) or non-volatile memory (non-volatile memory), such as at least one disk memory. Optionally, the memory may also be at least one memory device located remotely from the aforementioned processor.
The processor may be a general-purpose processor, including a central processing unit (Central Processing Unit, CPU for short), a network processor (Network Processor, NP for short), etc.; but also digital signal processors (Digital Signal Processing, DSP for short), application specific integrated circuits (Application Specific Integrated Circuit, ASIC for short), field-programmable gate arrays (Field-Programmable Gate Array, FPGA for short) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
In yet another embodiment of the present invention, a computer readable storage medium is provided, in which instructions are stored, which when run on a computer, cause the computer to perform the video processing method according to any one of the above embodiments.
In yet another embodiment of the present invention, a computer program product comprising instructions which, when run on a computer, cause the computer to perform the video processing method of any of the above embodiments is also provided.
In the above embodiments, it may be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When loaded and executed on a computer, produces a flow or function in accordance with embodiments of the present invention, in whole or in part. The computer may be a general purpose computer, a special purpose computer, a computer network, or other programmable apparatus. The computer instructions may be stored in or transmitted from one computer-readable storage medium to another, for example, by wired (e.g., coaxial cable, optical fiber, digital Subscriber Line (DSL)), or wireless (e.g., infrared, wireless, microwave, etc.). The computer readable storage medium may be any available medium that can be accessed by a computer or a data storage device such as a server, data center, etc. that contains an integration of one or more available media. The usable medium may be a magnetic medium (e.g., floppy Disk, hard Disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid State Disk (SSD)), etc.
It is noted that relational terms such as first and second, and the like are 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. Moreover, 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 one … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
In this specification, each embodiment is described in a related manner, and identical and similar parts of each embodiment are all referred to each other, and each embodiment mainly describes differences from other embodiments. In particular, for system embodiments, since they are substantially similar to method embodiments, the description is relatively simple, as relevant to see a section of the description of method embodiments.
The foregoing description is only of the preferred embodiments of the present invention and is not intended to limit the scope of the present invention. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention are included in the protection scope of the present invention.

Claims (14)

1. A video processing method, comprising:
acquiring video element information in an image frame of a video, wherein the video element information comprises a video element and display information of the video element;
determining a video element image for displaying the video element in the image frame according to the display information;
performing binarization processing on the video element image to obtain a binarized image;
carrying out hash coding on the binarized image and the display information to obtain a hash coding value;
and embedding the hash coding value into the corresponding image frame to obtain a coded video.
2. The method of claim 1, wherein hashing the binarized image and the display information to obtain a hash-coded value comprises:
skipping from the binarized image to extract a binarized array;
converting the numerical value of each column of the binarization array into decimal numerical values according to a rule of binary decimal conversion;
And converting the decimal value and the display information into hash coding values according to a hash mapping table which is counted in advance.
3. The method of claim 1, wherein embedding the hash code value into the corresponding image frame results in a coded video, comprising:
and storing the hash code value into an alpha channel of the corresponding image frame.
4. A method according to claim 3, wherein said storing said hash code value into the alpha channel of the corresponding image frame comprises:
when no data is stored in an alpha channel in the image frame, storing the hash coding numerical value into the corresponding alpha channel of the image frame;
when data is stored in an alpha channel in the image frame, storing a specified start identifier, the hash code value and a specified end identifier to the end of the data in the alpha channel of the corresponding image frame.
5. The method of claim 1, wherein embedding the hash code value into the corresponding image frame results in a coded video, comprising:
And adjusting the parity of the pixel value in the appointed area in the image frame according to the hash coding value to obtain the coded video.
6. The method of claim 1, wherein the video element comprises at least one of a subtitle and an icon, and the display information comprises a display position and a size of the video element.
7. A video processing method, comprising:
acquiring an encoded video; the encoded video being an encoded video generated using the method of any one of claims 1 to 6;
extracting hash coding values from image frames of the coded video;
generating a binarized image and display information according to the hash code value;
and converting the binarized image into a video element image, and displaying the video element image in the image frame according to the display information.
8. The method of claim 7, wherein extracting hash code values from image frames of the encoded video comprises:
hash code values are extracted from an alpha channel of an image frame of the encoded video.
9. The method of claim 7, wherein extracting hash code values from image frames of the encoded video comprises:
Extracting pixel values from a designated region of an image frame of the encoded video;
and obtaining a hash code value according to the parity of the pixel value.
10. The method of claim 7, wherein generating the binarized image and the display information from the hash-coded value comprises:
converting the hash code value into a decimal value and the display information according to a hash mapping table counted in advance;
converting the decimal value according to a rule of converting decimal into binary to obtain a binary array;
and carrying out interpolation processing on the binarization array to obtain a binarization image.
11. A video processing apparatus, comprising:
the video element information acquisition module is used for acquiring video element information in an image frame of a video, wherein the video element information comprises a video element and display information of the video element;
the video element image determining module is used for determining a video element image for displaying the video element in the image frame according to the display information;
the binarization image obtaining module is used for carrying out binarization processing on the video element image to obtain a binarization image;
The hash code value obtaining module is used for carrying out hash coding on the binarized image and the display information to obtain a hash code value;
and the coded video obtaining module is used for embedding the hash code value into the corresponding image frame to obtain the coded video.
12. A video processing apparatus, comprising:
the coded video acquisition module is used for acquiring coded video; the encoded video being encoded video generated using the apparatus of claim 11;
the hash code value extraction module is used for extracting hash code values from image frames of the coded video;
the image information generation module is used for generating a binarized image and display information according to the hash code value;
and the video element image display module is used for converting the binarized image into a video element image and displaying the video element image in the image frame according to the display information.
13. The electronic equipment is characterized by comprising a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory are communicated with each other through the communication bus;
A memory for storing a computer program;
a processor for carrying out the method steps of any one of claims 1-10 when executing a program stored on a memory.
14. A computer readable storage medium, on which a computer program is stored, characterized in that the program, when being executed by a processor, implements the method according to any one of claims 1-10.
CN202110807535.XA 2021-07-16 2021-07-16 Video processing method and device Active CN113672761B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110807535.XA CN113672761B (en) 2021-07-16 2021-07-16 Video processing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110807535.XA CN113672761B (en) 2021-07-16 2021-07-16 Video processing method and device

Publications (2)

Publication Number Publication Date
CN113672761A CN113672761A (en) 2021-11-19
CN113672761B true CN113672761B (en) 2023-07-25

Family

ID=78539566

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110807535.XA Active CN113672761B (en) 2021-07-16 2021-07-16 Video processing method and device

Country Status (1)

Country Link
CN (1) CN113672761B (en)

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2016082277A1 (en) * 2014-11-28 2016-06-02 安科智慧城市技术(中国)有限公司 Video authentication method and apparatus
CN106570166A (en) * 2016-11-07 2017-04-19 北京航空航天大学 Video retrieval method and apparatus based on multiple partial sensitive hash tables
CN107509080A (en) * 2017-08-18 2017-12-22 北京奇艺世纪科技有限公司 A kind of coded image display methods, device and electronic equipment
CN110275991A (en) * 2019-06-03 2019-09-24 腾讯科技(深圳)有限公司 The determination method and apparatus of cryptographic Hash, storage medium, electronic device
CN111382298A (en) * 2018-12-30 2020-07-07 贝壳技术有限公司 Image retrieval method and device based on picture content and electronic equipment
CN111669615A (en) * 2020-05-13 2020-09-15 北京奇艺世纪科技有限公司 Video stream processing method and device
CN112329851A (en) * 2020-11-05 2021-02-05 腾讯科技(深圳)有限公司 Icon detection method and device and computer readable storage medium

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2013067436A1 (en) * 2011-11-04 2013-05-10 Huawei Technologies Co., Ltd. Binarization of prediction residuals for lossless video coding
US20190171665A1 (en) * 2017-12-05 2019-06-06 Salk Institute For Biological Studies Image similarity search via hashes with expanded dimensionality and sparsification
KR20210055278A (en) * 2019-11-07 2021-05-17 라인플러스 주식회사 Method and system for hybrid video coding

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2016082277A1 (en) * 2014-11-28 2016-06-02 安科智慧城市技术(中国)有限公司 Video authentication method and apparatus
CN106570166A (en) * 2016-11-07 2017-04-19 北京航空航天大学 Video retrieval method and apparatus based on multiple partial sensitive hash tables
CN107509080A (en) * 2017-08-18 2017-12-22 北京奇艺世纪科技有限公司 A kind of coded image display methods, device and electronic equipment
CN111382298A (en) * 2018-12-30 2020-07-07 贝壳技术有限公司 Image retrieval method and device based on picture content and electronic equipment
CN110275991A (en) * 2019-06-03 2019-09-24 腾讯科技(深圳)有限公司 The determination method and apparatus of cryptographic Hash, storage medium, electronic device
CN111669615A (en) * 2020-05-13 2020-09-15 北京奇艺世纪科技有限公司 Video stream processing method and device
CN112329851A (en) * 2020-11-05 2021-02-05 腾讯科技(深圳)有限公司 Icon detection method and device and computer readable storage medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
基于特征融合和曼哈顿量化的视频哈希学习方法;聂秀山;王舒婷;尹义龙;;南京大学学报(自然科学)(04);全文 *

Also Published As

Publication number Publication date
CN113672761A (en) 2021-11-19

Similar Documents

Publication Publication Date Title
CN108495185B (en) Video title generation method and device
US8648858B1 (en) Hybrid text and image based encoding
CN104618803A (en) Information push method, information push device, terminal and server
CN101729840A (en) Storage processing method utilizing video image characteristic sequence
CN111669615B (en) Video stream processing method and device
CN113068040A (en) Image compression method and device, electronic equipment and readable storage medium
Pizzolante et al. Copyright protection for images on mobile devices
CN111193928B (en) Method and apparatus for delivering region of interest information in video
CN111145202B (en) Model generation method, image processing method, device, equipment and storage medium
CN111131654B (en) Watermark embedding method and device and coder-decoder
CN111836054B (en) Video anti-piracy method, electronic device and computer readable storage medium
CN113672761B (en) Video processing method and device
CN110572713B (en) Transcoding method and processing terminal for adaptive video bandwidth ratio
CN111263211B (en) Method for caching video data and terminal equipment
CN110730277B (en) Information coding and method and device for acquiring coded information
US11809532B2 (en) Detection of modification of an item of content
CN113919997A (en) Watermark processing method and device, electronic equipment and storage medium
CN113423016A (en) Video playing method, device, terminal and server
US9307259B2 (en) Image decoding methods and image decoding devices
CN114299089A (en) Image processing method, image processing device, electronic equipment and storage medium
CN110958460A (en) Video storage method and device, electronic equipment and storage medium
CN111147954A (en) Thumbnail extraction method and device
CN107357906B (en) Data processing method and device and image acquisition equipment
CN114760503B (en) Video playing method, device, system, electronic equipment and storage medium
Sakamoto et al. Application for generating re-accessible screenshots of web pages using histogram shrinkage

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