CN113672761A - Video processing method and device - Google Patents

Video processing method and device Download PDF

Info

Publication number
CN113672761A
CN113672761A CN202110807535.XA CN202110807535A CN113672761A CN 113672761 A CN113672761 A CN 113672761A CN 202110807535 A CN202110807535 A CN 202110807535A CN 113672761 A CN113672761 A CN 113672761A
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.)
Granted
Application number
CN202110807535.XA
Other languages
Chinese (zh)
Other versions
CN113672761B (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

Images

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 a video processing device, wherein the video processing method comprises the following steps: acquiring video element information in an image frame of a video, wherein the video element information comprises video elements and display information of the video elements; determining a video element image for displaying the video element in the image frame according to the display information; carrying out binarization processing on the video element image to obtain a binarized image; carrying out Hash coding on the binary image and the display information to obtain a Hash coding value; and embedding the hash coding numerical value into the corresponding image frame to obtain a coded video. According to the embodiment of the invention, the Hash code 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 the Hash code 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
Subtitles refer to non-video contents such as dialogue and dialogue displayed in a video such as movie and art in a text format, generally refer to text in a video, and are generally displayed below a screen. At present, two processing schemes for subtitles in a video exist, wherein the first scheme is to embed the subtitles into an image frame, and the second scheme is to plug-in the subtitles.
However, the first scheme may damage an original region of an image frame and lose partial image information, the second scheme requires adding a plug-in subtitle file, but the subtitle file is easily lost and is not easy to store, and in addition, the second scheme also has a condition that a decoder analyzes errors to cause misalignment between subtitles and the image frame, and audience watching experience is not good.
At present, the post processing of videos such as movie and television and comprehensive art is common, for example, posters, dynamic covers and highlights are added and edited, subtitles are not needed any more, if the subtitles are embedded in the videos, the post processing is inconvenient, the subtitles need to be removed firstly, the restoration of the subtitle area is involved again, and time and labor are wasted.
Therefore, how to process subtitles in a video, without destroying image frames in an original video, and being capable of conveniently performing post-processing on the video is a problem to be solved urgently.
Disclosure of Invention
An object of embodiments 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 without destroying image frames in an original video, and facilitate 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 video elements and display information of the video elements;
determining a video element image for displaying the video element in the image frame according to the display information;
carrying out binarization processing on the video element image to obtain a binarized image;
carrying out Hash coding on the binary image and the display information to obtain a Hash coding value;
and embedding the hash coding numerical value into the corresponding image frame to obtain a coded video.
Optionally, the performing hash coding on the binarized image and the display information to obtain a hash coded value includes:
a binarization array is extracted from the binarization image by skipping;
converting the numerical value of each column of the binary array into a decimal numerical value according to a rule of binary decimal conversion;
and converting the decimal value and the display information into a hash coding value according to a hash mapping table counted in advance.
Optionally, the embedding the hash code value into the corresponding image frame to obtain an encoded video includes:
and storing the hash coding value into an alpha channel of the corresponding image frame.
Optionally, the storing the hash code value into 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 value into the corresponding alpha channel of the image frame;
when data are stored in an alpha channel of the image frame, storing a designated start identifier, the hash code value and a designated end identifier to the end of the data in the alpha channel of the corresponding image frame.
Optionally, the embedding the hash code value into the corresponding image frame to obtain an encoded video includes:
and adjusting the parity of the pixel values in the designated area in the image frame according to the hash coding value to obtain a 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 a coded video;
extracting a Hash code value from the image frame of the coded video;
generating a binary image and display information according to the hash coding value;
and converting the binary image into a video element image, and displaying the video element image in the image frame according to the display information.
Optionally, the extracting a hash code value from the image frame of the encoded video includes:
and extracting a Hash code value from an alpha channel of an image frame of the coded video.
Optionally, the extracting a hash code value from the image frame of the encoded video includes:
extracting pixel values from a designated area of an image frame of the encoded video;
and obtaining a hash coding value according to the parity of the pixel value.
Optionally, the generating a binarized image and display information according to the hash code value includes:
converting the hash coding value according to a hash mapping table which is counted in advance to obtain a decimal value and the display information;
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 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 video elements and display information of the video elements;
a video element image determining module, configured to determine, according to the display information, a video element image in the image frame, where the video element is displayed;
a binarization image obtaining module, configured to perform binarization processing on the video element image to obtain a binarization image;
a hash coding value obtaining module, configured to perform hash coding on the binarized image and the display information to obtain a hash coding value;
and the coded video obtaining module is used for embedding the hash coding numerical value into the corresponding image frame to obtain a coded video.
In a fourth aspect of the present invention, there is also provided a video processing apparatus comprising:
the coded video acquisition module is used for acquiring a coded video;
the Hash code value extraction module is used for extracting a Hash code value from the image frame of the coded video;
the image information generation module is used for generating a binary image and display information according to the hash coding value;
and the video element image display module is used for converting the binary 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 stored therein instructions, which when run on a computer, cause the computer to execute any of the above-described video processing methods.
In yet another aspect of the present 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.
The video processing method provided by the embodiment of the invention obtains the video element information in the image frame of the video, wherein the video element information comprises the video elements and the display information of the video elements, determines the video element image for displaying the video elements in the image frame according to the display information, then carries out binarization processing on the video element image to obtain a binarized image, carries out hash coding on the binarized image and the display information to obtain a hash coding value, and embeds the hash coding value into the corresponding image frame to obtain the coded video. According to the embodiment of the invention, the Hash code 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 the Hash code 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 illustrating 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 displaying subtitles in an image frame according to an embodiment of the present 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 provided in an embodiment of the present invention;
fig. 5 is a schematic flowchart of a subtitle information embedded video image frame provided in an embodiment of the present invention;
FIG. 6 is a flow chart 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 provided in the embodiment of the present invention;
fig. 9 is a block diagram of an electronic device provided in 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 drawings in the embodiments of the present invention.
At present, most video elements of videos such as an art, a movie and the like, such as subtitles, icons and the like, are basically in a pure (white) color structure and have no texture, so that image information existing at the position in an image frame of the video is erased when the video is displayed, and recovery during use is difficult. In view of the foregoing problems, embodiments of the present invention provide a video processing method, in which video element information of a video element may be converted into a hash code value, and then embedded into a certain layer of a corresponding image frame of a video, display and hiding of the video element are achieved through specific coding and decoding of an algorithm without affecting picture content, and a subtitle region is compressed and encoded by using an information redundancy characteristic of a monochrome subtitle and is stored in the image frame of the video.
Referring to fig. 1, which is a flowchart illustrating steps of a video processing method provided in an embodiment of the present invention, as shown in fig. 1, the method may specifically include the following steps:
step 101, obtaining video element information in an image frame of a video, wherein the video element information comprises video elements and display information of the video elements.
The video may refer to video works such as movies and art works.
The video element at least comprises one of a subtitle and an icon, and the display information comprises the display position and the size of the video element. Specifically, the subtitle may refer to a text in a video, such as a video name, a dialog between persons, or a voice guide of a video, and the icon may refer to an icon displayed on a video, such as LOGO (trademark); the display information indicates a display position and a size of a subtitle or an icon displayed in an image frame of the video, for example, the subtitle is displayed at a lower position in the image frame, and the size of the subtitle is 100 × 100.
And 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 displaying a video element in an image frame, such as an image displaying a subtitle or an image displaying an icon. Specifically, referring to fig. 2, there is shown a schematic diagram of a video element image displaying subtitles in an image frame, wherein "only this gesture" in the figure is the subtitles.
In the embodiment of the invention, after the video element information corresponding to the image frame of each frame is acquired, 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 a middle lower portion of the image frame, and the size is 100 × 100, it may be determined that a subtitle of the size 100 × 100 will be displayed at the middle lower portion of the image frame.
And 103, performing binarization processing on the video element image to obtain a binarized image.
The value range of the pixel value of the image frame is 0-255, and the binarization is to set the pixel value of a pixel point on the image to be 0 or 1. 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, and 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 having a 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 image is in a pure color, so that the subtitle image can be easily binarized, and the binarized subtitle image is converted into an image with only two values, namely 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 a Hash, or a transliteration into a Hash, and the Hash encoding is to transform an input value of any length into an output of a fixed length through a Hash algorithm, where the output is a Hash value (Hash encoding value). Hash coding is a kind of compression mapping, and the memory space of hash-coded values is usually much smaller than that of input values. Briefly, hash coding is a function that compresses an input of arbitrary length to a message digest that is compressed to some fixed length.
In the embodiment of the invention, the binarized image and the display information corresponding to the image frame are subjected to the 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 binarized image and the display information, so that the binarized image and the display information of the image frame are subjected to the hash coding, and a large amount of memory space can be saved.
And 105, embedding the hash coding numerical value into the corresponding image frame to obtain a coded video.
In the embodiment of the invention, the binaryzation image and the display information corresponding to each image frame are subjected to hash coding to obtain the hash coding value, the hash coding value is embedded into the corresponding image frame, and the coded video can be obtained after the hash coding processing of all the image frames in the video is completed.
In the video processing method, video element information in an image frame of a video is acquired, the video element information includes video elements and display information of the video elements, a video element image displaying the video elements in the image frame is determined according to the display information, then binarization processing is performed on the video element image to obtain a binarized image, hash coding is performed on the binarized image and the display information to obtain a hash coding value, and the hash coding value is embedded into a corresponding image frame to obtain a coded video. According to the embodiment of the invention, the Hash code 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 the Hash code 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 coding on the binarized image and the display information to obtain a hash coded value may include:
a binarization array is extracted from the binarization image by skipping;
converting the numerical value of each column of the binary array into a decimal numerical value according to a rule of binary decimal conversion;
and converting the decimal value and the display information into a hash coding value according to a hash mapping table counted in advance.
Among them, a Hash table (also called Hash table) is a data structure that is directly accessed according to a Key value (Key value). In short, it accesses the 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 binarized image and the display information can be mapped to a key code value (namely, a hash coding value) based on the hash mapping table, and the length of the array can be compressed by representing the hash coding value, so that the purpose of space compression is achieved.
In the embodiment of the present invention, the scaling process is performed on the binarized image first. Specifically, the binarized image is scaled, typically down to 1/2 in the original size, assuming, for example, that the binarized image is fixedly reduced to the specified number of lines 64. Specifically, the binary image is subjected to line skipping to extract a binary array, then the value of each column in the binary array is taken as a binary value, and the binary value is subjected to decimal conversion, so that the decimal value can be subjected to decimal conversion, and a standard array is formed, as shown in fig. 4, 14 "" 19 "" 35 "" 6 "at the tail of the array is the converted decimal value. And finally, based on a hash mapping table which is counted in advance, converting the decimal value and the display information in the array into a hash coding value.
In the above embodiment, a binary array is extracted by skipping the lines of the binary image, then each column of numerical values of the binary array is converted into decimal numerical values according to a rule of binary to decimal conversion, so as to obtain an array formed by the decimal numerical values, and finally the decimal numerical values and the display information are converted into hash coding numerical values according to a 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, the size of the coded video is further reduced, and 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 an encoded video may include:
and storing the hash coding value into an alpha channel of the corresponding image frame.
In an embodiment of the present invention, the hash code value may be stored into an Alpha channel (Alpha channel) of the corresponding image frame. In an exemplary embodiment of the present invention, the storing the hash code value into 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 value into the corresponding alpha channel of the image frame;
when data are stored in an alpha channel of the image frame, storing a designated start identifier, the hash code value and a designated 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 can be directly stored in the Alpha channel of the unused image frame by writing; if the alpha channel of the image frame is already in use (has data already stored), for example, when depth information has already been stored in the alpha channel, the hash-coded value and the specified start identifier and the specified end identifier for indicating the start position and the end position of the hash-coded value may be stored to the end of the depth information of the alpha channel at the end of the alpha channel.
In the above embodiment, the hash code value is stored in the alpha channel of the corresponding image frame, and therefore, the hash code value is not affected by the original image information of the image frame because the hash code value is stored in the alpha channel of the image frame, and even if data is already stored in the alpha channel of the image frame, the hash code value can be extracted from the alpha channel by specifying 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 an encoded video includes:
and adjusting the parity of the pixel values in the designated area in the image frame according to the hash coding value to obtain a coded video.
In an embodiment of the present invention, a hash-coded value is embedded in an image frame using a pixel value parity representation in which the parity of pixel values of pixels in a specified area in the image frame is changed. 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 designated area is adjusted based on the original parity of the pixel value of the designated area in the image frame and the hash code value so that the parity of the pixel value in the designated area corresponds to the hash code value, wherein changing the parity is adding 1 to the pixel value, that is, changing to an even number by adding 1 when the pixel value is an odd number, and changing to an odd number by adding 1 when the pixel value is an even number, so that the hash code value is embedded in the image frame. After the addition of the hash code values to all the image frames in the video in the designated area is completed, the coded video can be obtained.
For example, assuming that the area is designated as being lower in the middle of the image frame, the pixel values of the lower in 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 for which the parity is adjusted will be 81, 83, 84, 85. It is understood that although the pixel values of a part of the image frame are changed, since 1 is added on the basis of the original pixel value, the display effect of the whole image frame is not greatly influenced.
In the above embodiment, the pixel values of the designated 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 designated area corresponds to the parity of the hash code value, and although the pixel values of the part in the image frame are adjusted, because only 1 is added on the basis of the original pixel values, the original image information of the image frame is not affected.
In order to make the embodiment of the present invention better understood, a specific scheme is adopted below to describe the video processing, and specifically, referring to fig. 5, a flow chart of embedding subtitle information into image frames of a video according to the present invention is shown, which includes the following steps:
step 501, acquiring video and subtitle information; the subtitle information may include subtitles and display information;
step 502, determining the display position and size of the subtitle according to the display information;
step 503, generating a binary image from the image frame of the video;
step 504, zooming the binary image, specifically extracting a binary numerical value through line skipping, and then compressing the binary numerical value into a single-column array; wherein the numerical decimal values in the array;
505, carrying out hash coding on the decimal value based on a hash mapping table to obtain a hash coding value; the hash mapping table is generated by counting a large number of videos and stored in an encoder;
step 506, performing hash coding on the display information based on a hash mapping table to obtain a hash coding value;
in step 507, the hash code value is embedded in an alpha channel of the image frame.
In the embodiment of the invention, the subtitle information is subjected to the 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 way of embedding into the image frame does not influence the original image information of the image frame.
Referring to fig. 6, which is a flowchart illustrating steps of a video processing method provided in an embodiment of the present invention, as shown in fig. 6, the method may specifically include the following steps:
step 601, obtaining a coded video.
Step 602, extracting a hash code value from the image frame of the coded video.
Step 603, generating a binary 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, a coded video is obtained, a Hash code value is extracted from an image frame of the coded video, a binary image and display information are generated according to the Hash code value, the binary image is converted into a video element image, and the video element image is displayed in the image frame according to the display information. In the embodiment of the invention, the hash coding value of the video element is embedded in the image frame, the corresponding hash coding value can be decoded from the image frame, and then the binary image and the display information of the video element are restored.
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 a coding mode, and the display and the hiding of the video element are controlled by the decoder, so that the original image frame is not damaged, and meanwhile, convenience is provided for subsequent processing, for example, the post-production of the video can be facilitated, and the troubles of subtitle erasing and image restoration are avoided.
In an exemplary embodiment of the present invention, the step 602, extracting a hash code value from an image frame of the encoded video, may include:
and extracting a Hash code value from an alpha channel of an image frame of the coded video.
In the embodiment of the present invention, when the hash code value of the current video element is embedded in an alpha channel of an 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 in the first place, the hash code value may be extracted from the corresponding position of the alpha channel based on the specified start flag and the specified end flag.
In another exemplary embodiment of the present invention, the step 602 of extracting a hash code value from an image frame of the encoded video may include:
extracting pixel values from a designated area of an image frame of the encoded video;
and obtaining a hash coding value according to the parity of the pixel value.
In the embodiment of the invention, pixel values are extracted from a specified area of an 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 value of the video element is restored 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 designated area, and the parity of these pixel values is odd, even, odd, the hash code values 1, 0, 1 can be restored.
In the embodiment of the present invention, the hash code value of the video element may be embedded in an alpha channel of the image frame, or may be embedded in a designated area of the image frame, and the two ways have no influence or negligible influence on the display effect of the original image frame.
In an exemplary embodiment of the present invention, the step 603 of generating a binarized image and display information according to the hash code value may include:
converting the hash coding value according to a hash mapping table which is counted in advance to obtain a decimal value and the display information;
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 invention, after the hash coding value is obtained, the decimal value and the display information can be obtained through conversion according to the hash mapping table counted in advance, wherein, the decimal value can be converted according to the rule of decimal to binary to obtain a binary array, wherein, since the binary data is obtained by skipping the line extraction from the binary image of the video element, therefore, the embodiment of the invention can reduce the number of rows of the binarization array to the number of rows of the original binarization image, assuming, for example, that the binarized array is reduced to 1/2 for the binarized image, if the number of rows in the binarized array is 64, it may be reduced to 64 x 2 rows, then, for each pixel value in the newly inserted line, interpolation processing can be performed based on the pixel values around the newly inserted line to obtain corresponding pixel values, and the corresponding pixel values are filled in, and then the binary image is obtained through restoration.
In the above embodiment, the hash coding values of the video elements extracted from the image frame may be converted to obtain decimal values and display information based on a hash mapping table counted in advance, then the decimal values are converted to obtain a binary array according to rules of decimal to binary, and then the binary array is interpolated to obtain a binary image of the video elements.
Referring to fig. 7, which is a block diagram of a video processing apparatus provided in 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, where the video element is displayed;
a binarization image obtaining module 703, configured to perform binarization processing on the video element image to obtain a binarization image;
a hash coding value obtaining module 704, configured to perform hash coding on the binarized image and the display information to obtain a hash coding value;
an encoded video obtaining module 705, 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 extract a binarization array from the binarization image by skipping; converting the numerical value of each column of the binary array into a decimal numerical value according to a rule of binary decimal conversion; and converting the decimal value and the display information into a hash coding value according to a hash mapping table counted in advance.
In an exemplary embodiment of the invention, the encoded video obtaining module 705 is configured to store the hash code value into 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, when no data is stored in an alpha channel of the image frame, store the hash code value into the alpha channel of the corresponding image frame; when data are stored in an alpha channel of the image frame, storing a designated start identifier, the hash code value and a designated 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 parity of pixel values in a specified area in the image frame according to the hash code value to obtain an 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 structure of a video processing apparatus provided in the 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;
a video element image display module 804, 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 invention, the hash code value extracting 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 area of an image frame of the encoded video; and obtaining a hash coding 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 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 device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and for the relevant points, refer to the partial description of the method embodiment.
An embodiment of the present invention further provides an electronic device, as shown in fig. 9, which includes a processor 91, a communication interface 92, a memory 93, and a communication bus 94, where the processor 91, the communication interface 92, and the memory 93 complete mutual communication through the communication bus 94,
a memory 93 for storing a computer program;
the processor 91, when executing the program stored in the memory 93, implements the following steps:
acquiring video element information in an image frame of a video, wherein the video element information comprises video elements and display information of the video elements;
determining a video element image for displaying the video element in the image frame according to the display information;
carrying out binarization processing on the video element image to obtain a binarized image;
carrying out Hash coding on the binary image and the display information to obtain a Hash coding value;
and embedding the hash coding numerical value into the corresponding image frame to obtain a coded video.
Optionally, the performing hash coding on the binarized image and the display information to obtain a hash coded value includes:
a binarization array is extracted from the binarization image by skipping;
converting the numerical value of each column of the binary array into a decimal numerical value according to a rule of binary decimal conversion;
and converting the decimal value and the display information into a hash coding value according to a hash mapping table counted in advance.
Optionally, the embedding the hash code value into the corresponding image frame to obtain an encoded video includes:
and storing the hash coding value into an alpha channel of the corresponding image frame.
Optionally, the storing the hash code value into 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 value into the corresponding alpha channel of the image frame;
when data are stored in an alpha channel of the image frame, storing a designated start identifier, the hash code value and a designated end identifier to the end of the data in the alpha channel of the corresponding image frame.
Optionally, the embedding the hash code value into the corresponding image frame to obtain an encoded video includes:
and adjusting the parity of the pixel values in the designated area in the image frame according to the hash coding value to obtain a 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 a coded video;
extracting a Hash code value from the image frame of the coded video;
generating a binary image and display information according to the hash coding value;
and converting the binary image into a video element image, and displaying the video element image in the image frame according to the display information.
Optionally, the extracting a hash code value from the image frame of the encoded video includes:
and extracting a Hash code value from an alpha channel of an image frame of the coded video.
Optionally, the extracting a hash code value from the image frame of the encoded video includes:
extracting pixel values from a designated area of an image frame of the encoded video;
and obtaining a hash coding value according to the parity of the pixel value.
Optionally, the generating a binarized image and display information according to the hash code value includes:
converting the hash coding value according to a hash mapping table which is counted in advance to obtain a decimal value and the display information;
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 in the above terminal may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The communication bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown, but this does not mean that there is only one bus or one type of bus.
The communication interface is used for communication between the terminal and other equipment.
The Memory may include a Random Access Memory (RAM) or a 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 processor.
The Processor may be a general-purpose Processor, and includes a Central Processing Unit (CPU), a Network Processor (NP), and the like; the Integrated Circuit may also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, a discrete Gate or transistor logic device, or a discrete hardware component.
In yet another embodiment of the present invention, a computer-readable storage medium is further provided, which has instructions stored therein, and when the instructions are executed on a computer, the computer is caused to execute the video processing method described in any of the above embodiments.
In a further embodiment of the present invention, there is also provided a computer program product containing instructions which, when run on a computer, cause the computer to perform the video processing method of any of the above embodiments.
In the above embodiments, the implementation may be wholly or partially realized 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, cause the processes or functions described in accordance with the embodiments of the invention to occur, in whole or in part. The computer may be a general purpose computer, a special purpose computer, a network of computers, or other programmable device. The computer instructions may be stored in a computer readable storage medium or transmitted from one computer readable storage medium to another, for example, from one website site, computer, server, or data center to another website site, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, Digital Subscriber Line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device, such as a server, a data center, etc., that incorporates one or more of the 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)), among others.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
All the embodiments in the present specification are described in a related manner, and the same and similar parts among the embodiments may be referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the system embodiment, since it is substantially similar to the method embodiment, the description is simple, and for the relevant points, reference may be made to the partial description of the method embodiment.
The above description is only for the preferred embodiment of the present invention, and is not intended to limit the scope of the present invention. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention shall fall within the protection scope of the present invention.

Claims (14)

1. A video processing method, comprising:
acquiring video element information in an image frame of a video, wherein the video element information comprises video elements and display information of the video elements;
determining a video element image for displaying the video element in the image frame according to the display information;
carrying out binarization processing on the video element image to obtain a binarized image;
carrying out Hash coding on the binary image and the display information to obtain a Hash coding value;
and embedding the hash coding numerical value into the corresponding image frame to obtain a coded video.
2. The method according to claim 1, wherein said hash-coding the binarized image and the display information to obtain a hash-coded value comprises:
a binarization array is extracted from the binarization image by skipping;
converting the numerical value of each column of the binary array into a decimal numerical value according to a rule of binary decimal conversion;
and converting the decimal value and the display information into a hash coding value according to a hash mapping table counted in advance.
3. The method of claim 1, wherein said embedding the hash code value into the corresponding image frame, resulting in an encoded video, comprises:
and storing the hash coding value into an alpha channel of the corresponding image frame.
4. The method of claim 3, wherein said storing said hash code value into an alpha channel of said corresponding image frame comprises:
when no data is stored in an alpha channel in the image frame, storing the hash coding value into the corresponding alpha channel of the image frame;
when data are stored in an alpha channel of the image frame, storing a designated start identifier, the hash code value and a designated end identifier to the end of the data in the alpha channel of the corresponding image frame.
5. The method of claim 1, wherein said embedding the hash code value into the corresponding image frame, resulting in an encoded video, comprises:
and adjusting the parity of the pixel values in the designated area in the image frame according to the hash coding value to obtain a coded video.
6. The method of claim 1, wherein the video element comprises at least one of a subtitle and an icon, and wherein the display information comprises a display position and a size of the video element.
7. A video processing method, comprising:
acquiring a coded video;
extracting a Hash code value from the image frame of the coded video;
generating a binary image and display information according to the hash coding value;
and converting the binary 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 the hash code value from the image frames of the encoded video comprises:
and extracting a Hash code value from an alpha channel of an image frame of the coded video.
9. The method of claim 7, wherein extracting the hash code value from the image frames of the encoded video comprises:
extracting pixel values from a designated area of an image frame of the encoded video;
and obtaining a hash coding value according to the parity of the pixel value.
10. The method of claim 7, wherein said generating a binarized image and display information based on said hash-coded values comprises:
converting the hash coding value according to a hash mapping table which is counted in advance to obtain a decimal value and the display information;
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 video elements and display information of the video elements;
a video element image determining module, configured to determine, according to the display information, a video element image in the image frame, where the video element is displayed;
a binarization image obtaining module, configured to perform binarization processing on the video element image to obtain a binarization image;
a hash coding value obtaining module, configured to perform hash coding on the binarized image and the display information to obtain a hash coding value;
and the coded video obtaining module is used for embedding the hash coding numerical value into the corresponding image frame to obtain a coded video.
12. A video processing apparatus, comprising:
the coded video acquisition module is used for acquiring a coded video;
the Hash code value extraction module is used for extracting a Hash code value from the image frame of the coded video;
the image information generation module is used for generating a binary image and display information according to the hash coding value;
and the video element image display module is used for converting the binary image into a video element image and displaying the video element image in the image frame according to the display information.
13. An electronic device is characterized by comprising a processor, a communication interface, a memory and a communication bus, wherein the processor and the communication interface are used for realizing mutual communication by the memory through the communication bus;
a memory for storing a computer program;
a processor for implementing the method steps of any of claims 1-10 when executing a program stored in the memory.
14. A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out 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 true CN113672761A (en) 2021-11-19
CN113672761B 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 (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130114693A1 (en) * 2011-11-04 2013-05-09 Futurewei Technologies, Co. Binarization of Prediction Residuals for Lossless Video Coding
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
US20190171665A1 (en) * 2017-12-05 2019-06-06 Salk Institute For Biological Studies Image similarity search via hashes with expanded dimensionality and sparsification
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
US20210144394A1 (en) * 2019-11-07 2021-05-13 LINE Plus Corporation Method and system for hybrid video coding

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130114693A1 (en) * 2011-11-04 2013-05-09 Futurewei Technologies, Co. Binarization of Prediction Residuals for Lossless Video Coding
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
US20190171665A1 (en) * 2017-12-05 2019-06-06 Salk Institute For Biological Studies Image similarity search via hashes with expanded dimensionality and sparsification
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
US20210144394A1 (en) * 2019-11-07 2021-05-13 LINE Plus Corporation Method and system for hybrid video coding
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
聂秀山;王舒婷;尹义龙;: "基于特征融合和曼哈顿量化的视频哈希学习方法", 南京大学学报(自然科学), no. 04 *

Also Published As

Publication number Publication date
CN113672761B (en) 2023-07-25

Similar Documents

Publication Publication Date Title
CN108495185B (en) Video title generation method and device
CN110868625A (en) Video playing method and device, electronic equipment and storage medium
CN101729840A (en) Storage processing method utilizing video image characteristic sequence
CN104618803A (en) Information push method, information push device, terminal and server
CN111669615B (en) Video stream processing method and device
CN106791854A (en) Image Coding, coding/decoding method and device
CN113068040A (en) Image compression method and device, electronic equipment and readable storage medium
CN111787398A (en) Video compression method, device, equipment and storage device
CN111145202B (en) Model generation method, image processing method, device, equipment and storage medium
US20240064388A1 (en) Decoding a video stream within a browser
CN111836054B (en) Video anti-piracy method, electronic device and computer readable storage medium
CN111193928B (en) Method and apparatus for delivering region of interest information in video
CN110572713B (en) Transcoding method and processing terminal for adaptive video bandwidth ratio
CN111263211B (en) Method for caching video data and terminal equipment
CN113672761B (en) Video processing method and device
CN111246249A (en) Image encoding method, encoding device, decoding method, decoding device and storage medium
CN110958460B (en) Video storage method and device, electronic equipment and storage medium
EP3985989A1 (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
CN113747159A (en) Method, device and related assembly for generating variable frame rate video media file
CN107357906B (en) Data processing method and device and image acquisition equipment
CN114760503B (en) Video playing method, device, system, electronic equipment and storage medium
CN111147954A (en) Thumbnail extraction method and device
CN112911299A (en) Video code rate control method and device, electronic equipment and storage medium

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