Video processing method and device, computer equipment and storage medium
By performing image quality degradation processing on the original video and optimizing and restoring the optimized files obtained by the authentication server, the problem that existing video encryption and decryption methods are easily cracked is solved, and the security of the video is improved.
Patent Information
- Application Number
- CN202311021634.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-14
- Publication Date
- 2025-02-21
AI Technical Summary
The existing video encryption and decryption methods are easily cracked by criminals, reducing the security of the video.
By degrading the image quality of the original video, the target video is generated, and the image quality optimization file is obtained through the authentication server during playback, and the target video is optimized and restored to ensure the security of the video.
Even if the criminals obtain the target video, they cannot play it normally. The optimization and restoration process based on the image quality optimization file makes it difficult for criminals to crack the video, improving the security of the video.
Smart Images

Figure CN119496946A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of Internet technology, and in particular to a video processing method, apparatus, computer equipment and storage medium. Background Art
[0002] At present, in the process of video processing, the video is generally encrypted with a key before transmission. After the video reaches the playback terminal, the playback terminal decrypts the video based on the key and plays the video. However, this encryption and decryption method based on the key makes it easy for criminals to crack the video after obtaining the key, which reduces the security of the video. Summary of the invention
[0003] The embodiments of the present application provide a video processing method, apparatus, computer equipment and storage medium, which can improve the security of the video.
[0004] To solve the above technical problems, the present application provides the following technical solutions:
[0005] The present application provides a video processing method, including:
[0006] Obtain a target video to be played, where the target video is obtained by degrading the original video based on the image quality degraded file;
[0007] Sending a file acquisition request to an authentication server, wherein the file acquisition request carries a terminal identifier of the terminal;
[0008] Receiving the image quality optimization file returned by the authentication server after the terminal is authenticated based on the terminal identifier;
[0009] Optimizing and restoring the target video according to the image quality optimization file to obtain the original video;
[0010] The original video is played.
[0011] According to one aspect of the present application, a video processing method is also provided, including:
[0012] Get the original video to be processed;
[0013] Acquire a file with degraded image quality matching the original video;
[0014] Performing degradation processing on the original video according to the image quality degradation file to obtain a target video;
[0015] Sending the target video to a content distribution server, and distributing the target video through the content distribution server;
[0016] Among them, the target video is used for restoration to the original video after being acquired by the terminal through optimization of the image quality file matching the image quality degraded file, and then played. The image quality optimization file is returned to the terminal after the authentication server authenticates the terminal based on the file acquisition request sent by the terminal.
[0017] According to one aspect of the present application, a video processing device is also provided, including:
[0018] A first acquisition unit is used to acquire a target video to be played, where the target video is obtained by degrading the original video based on a file with degraded image quality;
[0019] A first sending unit, configured to send a file acquisition request to an authentication server, wherein the file acquisition request carries a terminal identifier of a terminal;
[0020] A receiving unit, configured to receive a picture quality optimization file returned by the authentication server after the terminal is authenticated based on the terminal identifier;
[0021] An optimization and restoration unit, used for optimizing and restoring the target video according to the image quality optimization file to obtain the original video;
[0022] A playing unit is used to play the original video.
[0023] In some embodiments, the image quality optimization file includes a mapping relationship between degraded RGB values and original RGB values, and the original RGB values are converted from the corresponding degraded RGB values to the HSL space and adjusted based on the optimization adjustment strategy, and then restored to the RGB space.
[0024] In some embodiments, the optimization and restoration unit is specifically used to: obtain the degraded RGB value of the pixel in the target video; determine the original RGB value matching the degraded RGB value according to the mapping relationship; and optimize and restore the target video according to the original RGB value to obtain the original video.
[0025] In some implementations, the file acquisition request also carries the video identifier of the target video, and the receiving unit is specifically used to: receive the quality optimization file matching the video identifier returned by the authentication server after the terminal is authenticated based on the terminal identifier and the video identifier.
[0026] The playback unit is specifically configured to play the original video through a player that matches the video identifier.
[0027] In some implementations, the first acquisition unit is specifically configured to: send a video acquisition request to a content distribution server; and receive a target video returned by the content distribution server based on the video acquisition request.
[0028] According to one aspect of the present application, a video processing device is also provided, including:
[0029] A second acquisition unit, used to acquire the original video to be processed;
[0030] A third acquisition unit, used to acquire a file with degraded image quality matching the original video;
[0031] A degradation processing unit, used for performing degradation processing on the original video according to the image quality degradation file to obtain a target video;
[0032] A second sending unit, configured to send the target video to a content distribution server, and distribute the target video through the content distribution server;
[0033] Among them, the target video is used for restoration to the original video after being acquired by the terminal through optimization of the image quality file matching the image quality degraded file, and then played. The image quality optimization file is returned to the terminal after the authentication server authenticates the terminal based on the file acquisition request sent by the terminal.
[0034] In some embodiments, the third acquisition unit is specifically used to: obtain the video identifier of the original video; based on the video identifier of the original video, obtain a degraded image file matching the original video from a server; wherein the degraded image file includes a mapping relationship between the original RGB value and the degraded RGB value, and the degraded RGB value is converted from the corresponding original RGB value to the HSL space and adjusted based on the degradation adjustment strategy, and then restored to the RGB space.
[0035] In some implementations, the third acquisition unit includes:
[0036] An acquisition subunit, used to use the RGB value of a pixel in the original video as the original RGB value, or use the RGB value of a pixel in a preset pixel set as the original RGB value;
[0037] An adjustment subunit, configured to convert the original RGB value from the RGB space to the HSL space, and adjust the HSL value of the HSL space based on a degradation adjustment strategy to obtain a degradation-adjusted HSL value;
[0038] A space restoration subunit, configured to restore the degraded adjusted HSL value from the HSL space to the RGB space to obtain a degraded RGB value corresponding to the original RGB value;
[0039] The generating subunit is used to generate a degraded image file matching the original video according to the mapping relationship between the original RGB value and the degraded RGB value.
[0040] In some embodiments, the adjustment subunit is specifically used to: obtain video attribute information of the original video; determine a degradation adjustment strategy based on the video attribute information; adjust the HSL value of the HSL space based on the degradation adjustment strategy to obtain a degradation-adjusted HSL value.
[0041] In some implementations, the video processing device further includes:
[0042] A fourth acquisition unit, configured to use the RGB value of a pixel in the target video as a degraded RGB value, or use the RGB value of a pixel in a preset pixel set as a degraded RGB value;
[0043] An adjustment unit, configured to convert the degraded RGB value from the RGB space to the HSL space, and adjust the HSL value of the HSL space based on an optimization adjustment strategy to obtain an optimized adjusted HSL value;
[0044] A space restoration unit, used to restore the optimized and adjusted HSL value from the HSL space to the RGB space to obtain an original RGB value corresponding to the degraded RGB value;
[0045] A generating unit, configured to generate the image quality optimization file according to a mapping relationship between the degraded RGB value and the original RGB value;
[0046] A storage unit is used to store the image quality optimization file in the authentication server.
[0047] In some embodiments, the degradation processing unit is specifically used to: obtain the original RGB value of the pixel in the original video; determine the degraded RGB value matching the original RGB value according to the mapping relationship; and perform degradation processing on the original video according to the degraded RGB value to obtain the target video.
[0048] According to one aspect of the present application, a computer device is also provided, including a processor and a memory, wherein a computer program is stored in the memory, and when the processor calls the computer program in the memory, any video processing method provided in the embodiments of the present application is executed.
[0049] According to one aspect of the present application, a storage medium is also provided, wherein the storage medium is used to store a computer program, and the computer program is loaded by a processor to execute any one of the video processing methods provided in the embodiments of the present application.
[0050] According to one aspect of the present application, a computer program product is also provided, including a computer program, wherein the computer program is loaded by a processor to execute any one of the video processing methods provided in the embodiments of the present application.
[0051] In the embodiment of the present application, the target video can be obtained by degrading the original video based on the image quality degradation file before the video is transmitted. In the video playback stage, the target video is obtained, and a file acquisition request carrying the terminal identifier of the terminal is sent to the authentication server, and the image quality optimization file returned by the authentication server after the terminal authentication based on the terminal identifier is received, so that the target video can be optimized and restored according to the image quality optimization file, and the original video obtained by optimization and restoration can be played. Since the target video is obtained by degrading the original video based on the image quality degradation file, even if the criminals obtain the target video, they cannot play it normally, and the target video is optimized and restored based on the image quality optimization file matching the image quality degradation file, so that it is difficult for criminals to perceive the existence of the image quality optimization file, and the image quality optimization file can only be obtained after authentication, making it more difficult for criminals to crack the target video, thereby improving the security of the video. BRIEF DESCRIPTION OF THE DRAWINGS
[0052] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.
[0053] Figure 1 is a schematic diagram of a scenario in which the video processing method provided in an embodiment of the present application is applied;
[0054] Figure 2 It is a flowchart of a video processing method provided in an embodiment of the present application;
[0055] Figure 3 is another flow chart of the video processing method provided by an embodiment of the present application;
[0056] Figure 4 is a schematic diagram of a scenario of a video processing architecture provided in an embodiment of the present application;
[0057] Figure 5 is another flow chart of the video processing method provided by an embodiment of the present application;
[0058] Figure 6 is a schematic diagram of a 3D LUT provided in an embodiment of the present application;
[0059] Figure 7 is a schematic diagram of original video playback provided by an embodiment of the present application;
[0060] Figure 8 is a schematic diagram of a video processing device provided in an embodiment of the present application;
[0061] Fig. 9 is another schematic diagram of a video processing device provided in an embodiment of the present application;
[0062] Fig.10 It is a schematic diagram of the structure of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0063] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of this application.
[0064] In the following description of the present application, reference is made to “some embodiments”, which describe a subset of all possible embodiments, but it can be understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.
[0065] In the following description of the present application, the terms "first\second" and the like are merely used to distinguish similar objects and do not represent a specific ordering of the objects. It can be understood that "first\second" can be interchanged with a specific order or sequence where permitted, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein.
[0066] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein are only for the purpose of describing the embodiments of this application and are not intended to limit this application.
[0067] Embodiments of the present application provide a video processing method, apparatus, computer equipment, and storage medium.
[0068] See also Figure 1 , Figure 1 This is a schematic diagram of a scenario in which the video processing method provided in an embodiment of the present application is applied. The video processing method can be applied to a video processing system. The video processing system may include a terminal 10 and a server 20, etc. The server 20 may be an independent physical server, or a server cluster or distributed system composed of multiple physical servers. It may also be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDNs), as well as big data and artificial intelligence platforms, but is not limited to these.
[0069] The server 20 and the terminal 10 may be directly or indirectly connected via wired or wireless communication, which is not limited in the present application. The terminal 10 may be a mobile phone, a tablet computer, a laptop computer, a desktop computer, or a wearable device.
[0070] Among them, the server 20 may include an authentication server, a content distribution server, and a video processing server (i.e., a video transcoding server), etc. The video processing server may obtain the original video to be processed, and obtain the image quality degradation file matching the original video, and perform degradation processing on the original video according to the image quality degradation file to obtain the target video. Then, the video processing server may send the target video to the content distribution server, and distribute the target video through the content distribution server. For example, the terminal 10 may send a video acquisition request to the content distribution server, and the content distribution server may respond to the video acquisition request and send the target video to the terminal 10. After receiving the target video, the terminal 10 may send a file acquisition request carrying the terminal identifier to the authentication server, and the authentication server may respond to the file acquisition request, authenticate the terminal 10 based on the terminal identifier, and send the image quality optimization file to the terminal 10 after the authentication is passed. The terminal may optimize and restore the target video according to the image quality optimization file, obtain the original video, and play the original video through the player.
[0071] Before video transmission, the video processing server degrades the original video based on the image quality degradation file to obtain the target video, and distributes the target video through the content distribution server. Even if the criminals obtain the target video, they cannot play it normally. After the terminal receives the target video, it can request the authentication server to obtain the image quality optimization file, and optimize and restore the target video based on the image quality optimization file obtained after authentication, and play it, making it difficult for criminals to crack the target video, thereby improving the security of the video.
[0072] It should be noted that Figure 1 The scenario diagram of the application of the video processing method shown is only an example. The application of the video processing method and the scenario described in the embodiment of the present application are intended to more clearly illustrate the technical solution of the embodiment of the present application, and do not constitute a limitation on the technical solution provided by the embodiment of the present application. Ordinary technicians in this field can know that with the evolution of the application of the video processing method and the emergence of new business scenarios, the technical solution provided by the embodiment of the present application is also applicable to similar technical problems.
[0073] It should be noted that the description order of the following embodiments is not intended to limit the preferred order of the embodiments.
[0074] In this embodiment, the description will be made from the perspective of a video processing device, which may be specifically integrated into a computer device such as a terminal.
[0075] See also Figure 2 , Figure 2 : is a flow chart of a video processing method provided by an embodiment of the present application. The video processing method may include:
[0076] S101, obtaining a target video to be played, where the target video is obtained by degrading the original video based on a file with degraded image quality.
[0077] The types and specific contents of the target video and the original video can be flexibly set according to actual needs and are not limited here. The target video can be obtained by: obtaining the target video from a server storing the video, or receiving the target video sent by the sending terminal, etc. Of course, it can also be obtained by other methods, which are not limited here.
[0078] The target video is obtained by degrading the original video based on the image quality degradation file. For example, the original video to be processed and the image quality degradation file matching the original video can be obtained, and the original video is degraded according to the image quality degradation file to obtain the target video. The type and specific content of the image quality degradation file can be flexibly set according to actual needs and are not limited here.
[0079] Among them, the image quality degradation file can be obtained from the server storing the file based on the video identifier of the original video. The video identifier is used to uniquely identify the original video. The type and content of the video identifier are not limited here. The image quality degradation file may include a mapping relationship between the original RGB value and the degraded RGB value. The degraded RGB value is converted from the corresponding original RGB value to the HSL space and adjusted based on the degradation adjustment strategy, and then restored to the RGB space. The RGB value refers to the red (Red), green (Green), and blue (Blue) components of a certain color. HSL is a method of representing points in the RGB color model in a cylindrical coordinate system. HSL refers to hue (Hue), saturation (Saturation), and brightness (Lightness).
[0080] It should be noted that in addition to being converted to the HSL space, the RGB space can also be converted to other spaces such as the HSV space, which is not limited here. HSV stands for hue, saturation, and value. The following will take the conversion of the original RGB value to the HSL space and the adjustment based on the degradation adjustment strategy as an example for detailed explanation.
[0081] Specifically, the RGB value of the pixel in the original video can be used as the original RGB value, or the RGB value of the pixel in the preset pixel set can be used as the original RGB value. For example, the original RGB value (x) can be defined as: x = (x r , x g , x b ), 0≤x≤255. The preset pixel point set may include multiple pixel points, and the RGB value of each pixel point ranges from 0 to 255 (including 0 and 255). The preset pixel point set may exist in the form of a list or a 3D look-up table (LUT). Each dimension (red, green, blue) in the 3D LUT has 64 nodes, and each node has a unique RGB value.
[0082] Then, the original RGB value can be converted from the RGB space to the HSL space. For example, the original RGB value of the pixel point is converted from the RGB space to the HSL space through the HSL conversion function: h=HSL(x), wherein the value range of the HSL value (h) corresponding to the pixel point in the HSL space is:
[0083] h=(h h ,h s ,h l ), 0°≤h h ≤360°, 0%≤h s ≤100%, 0%≤h l ≤100%
[0084] At this time, the HSL value of the HSL space can be adjusted based on the degradation adjustment strategy to obtain the degradation-adjusted HSL value. Among them, the degradation adjustment strategy can be flexibly set according to actual needs, and is not limited here. For example, the degradation adjustment strategy can be determined based on video attribute information such as the video type, video format or video parameters of the original video. The degradation adjustment strategy may include adjusting at least one of the hue, saturation, and brightness based on an adjustment coefficient that matches at least one of the image quality parameters of hue, saturation, and brightness. For example, the adjustment function of hue and saturation is:
[0085] h new =Adjust(h)
[0086]
[0087] Among them, h new It represents the HSL value after degradation adjustment, 30° represents the adjustment coefficient corresponding to the color, and 30% represents the adjustment coefficient corresponding to the saturation. Of course, the adjustment coefficient corresponding to the color and the adjustment coefficient corresponding to the saturation can be set to other values according to actual needs, and are not limited here.
[0088] After obtaining the degraded adjusted HSL value, the degraded adjusted HSL value can be restored from the HSL space to the RGB space through the RGB conversion function to obtain the degraded RGB value corresponding to the original RGB value. For example, the RGB conversion function from the HSL space to the RGB space is: y=RGB(h new After each pixel is traversed, the degraded RGB value corresponding to each pixel can be obtained: y = (y r , t g ,y b ), 0≤y≤255.
[0089] After each pixel is traversed, a degraded file matching the original video can be generated based on the mapping relationship between the original RGB value and the degraded RGB value. Taking 3D LUT as an example: l(x) = (l r , l g , l b ), 0≤l≤255, traverse all possible x=(x r , x g , x b ), 0≤x≤255, a total of 256*256*256*3=50331648 possibilities, the generated 3D LUT also has 50331648 sample points (i.e. nodes), for each x i =(x ri , x gi , x bi ), use the following logic to limit the limit values of 0 and 255 to avoid unrecoverable situations. In summary, the following formula is obtained:
[0090] y=(y r ,y g ,y b )=RGB(Adjust(HSL(x)))
[0091]
[0092] After traversing all nodes in the 3D LUT, 50331648 one-to-one mappings are established, that is, the mapping relationship between the original RGB value and the degraded RGB value. l(x) can be encapsulated into a 3D LUT file, called attack.CUBE (i.e., image quality degradation file).
[0093] After obtaining the degraded file, the original RGB values of the pixels in the original video (such as the video medium origin.mp4) can be obtained, and the degraded RGB values that match the original RGB values can be determined according to the mapping relationship between the original RGB values and the degraded RGB values in the degraded file, and the original video can be degraded according to the degraded RGB values to obtain the target video. For example, a transcoding tool (such as FFMPEG) can be used to apply the degraded file (attack.CUBE) to transcode the original video to generate a target video (such as attack.mp4). The specific command can be as follows:
[0094] ffmpeg-i origin.mp4-Vf″lut3d=attack.CUBE″attack.mp4
[0095] Since the target video can be distributed through the content distribution server after it is generated, the content distribution server can be requested to obtain the target video. In some embodiments, obtaining the target video to be played includes: sending a video acquisition request to the content distribution server, and receiving the target video returned by the content distribution server based on the video acquisition request.
[0096] Among them, the content distribution server can be called a content delivery network (CDN). CDN is a distributed network system that aims to improve access speed and shorten response time by caching content (such as videos, images, text or files, etc.) on servers closer to user terminals (referred to as terminals). The CDN system can be composed of a group of servers located in different geographical locations, which can select the best server to respond based on the location of the user terminal and the requested content.
[0097] For example, a video acquisition request carrying a video identifier can be sent to a content distribution server, and the content distribution server can receive a target video matching the video identifier returned in response to the video acquisition request. The quick response of the content distribution server can improve the efficiency of acquiring the target video.
[0098] S102: Send a file acquisition request to an authentication server, where the file acquisition request carries a terminal identifier of the terminal.
[0099] Since the target video is obtained by degrading the original video based on the image quality degraded file, that is, the target video has been attacked by the image quality degraded file and has been destroyed, in order to restore the video losslessly, an authentication server that pre-stores the image quality optimization file can be requested to obtain the image quality optimization file. For example, a file acquisition request carrying a terminal identifier can be sent to the authentication server so that the authentication server can authenticate the terminal. Among them, the terminal identifier can be used to uniquely identify the terminal, and the type and content of the terminal identifier are not limited here.
[0100] S103: receiving the image quality optimization file returned by the authentication server after the terminal is authenticated based on the terminal identifier.
[0101] After sending a file acquisition request carrying a terminal identifier to an authentication server, and the authentication server authenticates the terminal based on the terminal identifier, you can receive the image quality optimization file returned by the authentication server after the terminal authentication based on the terminal identifier. If the authentication server fails to authenticate the terminal based on the terminal identifier, it means that the terminal is unauthorized and does not have the authority to obtain the image quality optimization file, and thus cannot obtain the image quality optimization file.
[0102] The type and specific content of the image quality optimization file can be flexibly set according to actual needs and are not limited here. In some embodiments, the image quality optimization file includes a mapping relationship between degraded RGB values and original RGB values, and the original RGB values are converted from the corresponding degraded RGB values to the HSL space and adjusted based on the optimization adjustment strategy, and then restored to the RGB space.
[0103] Specifically, the RGB value of the pixel in the target video may be used as the degraded RGB value, or the RGB value of the pixel in the preset pixel set may be used as the degraded RGB value. For example, the original RGB value (x) may be defined as: x = (x r , x g , x b ), 0≤x≤255. The preset pixel point set may include multiple pixel points, and the RGB value of each pixel point ranges from 0 to 255 (including 0 and 255). The preset pixel point set may exist in the form of a list or a 3D LUT, which is not limited here.
[0104] Then, the degraded RGB value can be converted from the RGB space to the HSL space. For example, the degraded RGB value of the pixel point is converted from the RGB space to the HSL space by using the HSL conversion function: h=HSL(x), wherein the value range of the HSL value (h) corresponding to the pixel point in the HSL space is:
[0105] h=(h h ,h s ,h l ), 0°≤hh ≤360°, 0%≤h s ≤100%, 0%≤h l ≤100%
[0106] At this time, the HSL value of the HSL space can be adjusted based on the optimization adjustment strategy to obtain the optimized adjusted HSL value, wherein the optimization adjustment strategy can be flexibly set according to actual needs and is not limited here. For example, the optimization adjustment strategy can be determined based on video attribute information such as the video type, video format, video parameters or video player of the original video. The optimization adjustment strategy may include adjusting the image quality parameters based on an adjustment coefficient that matches the image quality parameters in the HSL space, and the image quality parameters include at least one of hue, saturation, and brightness.
[0107] For example, the inverse adjustment functions for hue and saturation are:
[0108] h=Adjust -1 (h new )
[0109]
[0110] Among them, h new It represents the HSL value after optimization and adjustment, 30° represents the adjustment coefficient corresponding to the color, and 30% represents the adjustment coefficient corresponding to the saturation. Of course, the adjustment coefficient corresponding to the color and the adjustment coefficient corresponding to the saturation can be set to other values according to actual needs, and are not limited here.
[0111] After obtaining the optimized and adjusted HSL value, the optimized and adjusted HSL value can be restored from the HSL space to the RGB space through the RGB conversion function to obtain the original RGB value corresponding to the degraded RGB value. For example, the RGB conversion function from the HSL space to the RGB space is: y=RGB(h new After each pixel is traversed, the original RGB value corresponding to each pixel can be obtained: y = (y r ,y g ,y b ), 0≤y≤255.
[0112] After each pixel is traversed, a quality optimization file can be generated based on the mapping relationship between the degraded RGB value and the original RGB value. Take the reverse 3D LUT as an example:
[0113]
[0114] Traverse all possible x=(x r , x g , x b), 0≤x≤255, a total of 256*256*256*3=50331648 possibilities, the generated 3D LUT also has 50331648 sample points (i.e. nodes), for each x i =(x ri , x gi , x bi ), use the following logic to limit the limit values of 0 and 255 to avoid unrecoverable situations. In summary, the following formula is obtained:
[0115] y=(y r ,y g , r b )=RGB(Adjust -1 (HSL(x)))
[0116]
[0117] After traversing all nodes in the 3D LUT, 50331648 one-to-one mappings are established, that is, the reverse mapping relationship between the degraded RGB value and the original RGB value. -1 (y) Encapsulated into a 3D LUT file, called recovrey.CUBE (i.e. image quality optimization file).
[0118] After obtaining the image quality degraded file, the image quality optimized file can be stored in the authentication server. When the image quality optimized file needs to be obtained, a file acquisition request carrying the terminal identifier is sent to the authentication server, and the image quality optimized file is returned by the authentication server after the terminal is authenticated based on the terminal identifier.
[0119] It should be noted that different videos can be degraded and optimized, and can correspond to different quality degradation files and quality optimization files respectively. At this time, the server (such as an authentication server) can store the correspondence between the video identifiers of different videos and the quality degradation files and quality optimization files. When it is necessary to obtain the quality degradation file or the quality optimization file, it can be obtained from the server based on the video identifier. Alternatively, different videos can correspond to the same quality degradation file and quality optimization file. The quality degradation file contains the mapping relationship between all original RGB values and degraded RGB values, and the quality optimization file contains the reverse mapping relationship between all degraded RGB values and original RGB values. At this time, the server (such as an authentication server) can store the quality degradation file and the quality optimization file. When it is necessary to obtain the quality degradation file or the quality optimization file, it can be obtained based on the request server. Of course, the correspondence between the video and the quality degradation file and the quality optimization file is not limited to other forms, which are not limited here.
[0120] In some implementations, the file acquisition request also carries a video identifier of the target video, and the receiving authentication server returns the image quality optimization file after the terminal is authenticated based on the terminal identifier, including:
[0121] The receiving authentication server returns a picture quality optimization file matching the video identifier after the terminal is authenticated based on the terminal identifier and the video identifier.
[0122] In order to improve the reliability of authentication, dual authentication of the terminal and the video can be performed. For example, a file acquisition request carrying the terminal identifier and the video identifier can be sent to the authentication server. When the authentication server determines that the terminal is authorized to obtain the image quality optimization file based on the terminal identifier, and determines that the terminal has the right to play the target video based on the video identifier, the image quality optimization file matching the video identifier can be returned by the authentication server after the terminal authentication is passed based on the terminal identifier and the video identifier.
[0123] S104: Optimize and restore the target video according to the image quality optimization file to obtain the original video.
[0124] After obtaining the image quality optimization file, the target video may be optimized and restored according to the image quality optimization file. In some implementations, optimizing and restoring the target video according to the image quality optimization file to obtain the original video includes:
[0125] Get the degraded RGB value of the pixel in the target video;
[0126] According to the mapping relationship, determine the original RGB value that matches the degraded RGB value;
[0127] The target video is optimized and restored according to the original RGB value to obtain the original video.
[0128] Specifically, the degraded RGB values of the pixels in the target video can be obtained, and the original RGB values that match the degraded RGB values can be determined based on the reverse mapping relationship between the degraded RGB values and the original RGB values in the image quality optimization file, and the target video can be optimized and restored based on the original RGB values. For example, the target video (such as attack.mp4) is decoded, each frame is decoded, and a shader is used to draw it on the screen, and the image quality optimization file (recovrey.CUBE) is applied to each frame to restore the image quality, and the restored frame is drawn on the screen, so as to achieve lossless video recovery and normal playback.
[0129] S105: Play the original video.
[0130] After optimizing and restoring the target video to obtain the original video, the original video may be played. In some implementations, playing the original video includes: playing the original video through a player that matches the video identifier.
[0131] In order to accurately play the original video, the original video can be played by a player that matches the video identifier. For example, video A can be played by player A that matches it, video B can be played by player B that matches it, and video C can be played by player C that matches it.
[0132] In the embodiment of the present application, the target video can be obtained by degrading the original video based on the image quality degradation file before the video is transmitted. In the video playback stage, the target video is obtained, and a file acquisition request carrying the terminal identifier of the terminal is sent to the authentication server, and the image quality optimization file returned by the authentication server after the terminal authentication based on the terminal identifier is received, so that the target video can be optimized and restored according to the image quality optimization file, and the original video obtained by optimization and restoration can be played. Since the target video is obtained by degrading the original video based on the image quality degradation file, even if the criminals obtain the target video, they cannot play it normally, and the target video is optimized and restored based on the image quality optimization file matching the image quality degradation file, so that it is difficult for criminals to perceive the existence of the image quality optimization file, and the image quality optimization file can only be obtained after authentication, making it more difficult for criminals to crack the target video, thereby improving the security of the video.
[0133] In this embodiment, the description will be made from the perspective of a video processing device, which may be specifically integrated into a computer device such as a server or a terminal.
[0134] See also Figure 3 , Figure 3 : is a flow chart of a video processing method provided by an embodiment of the present application. The video processing method may include:
[0135] S201: Obtain an original video to be processed.
[0136] The method for obtaining the original video is not limited here. For example, the original video may be received from a video generation terminal, or the original video may be obtained from a server storing the video.
[0137] S202: Obtain a file with degraded image quality that matches the original video.
[0138] The type and specific content of the image quality degradation file can be flexibly set according to actual needs and are not limited here.
[0139] In some embodiments, obtaining a file with degraded image quality that matches an original video includes: obtaining a video identifier of the original video; and obtaining a file with degraded image quality that matches the original video from a server based on the video identifier of the original video.
[0140] Among them, the image quality degradation file includes the mapping relationship between the original RGB value and the degraded RGB value. The degraded RGB value is converted from the corresponding original RGB value to the HSL space (or HSV space) and adjusted based on the degradation adjustment strategy, and then restored to the RGB space. The image quality degradation file can be pre-stored in a server for storing files. When the image quality degradation file needs to be obtained, it can be quickly obtained from the server for storing files based on the video identifier of the original video, which improves the convenience of obtaining the image quality degradation file. The video identifier is used to uniquely identify the original video, and the type and content of the video identifier are not limited here.
[0141] It should be noted that the server that generates the image quality degraded file may be an authentication server or another server independent of the authentication server, which is not limited here.
[0142] When it is necessary to obtain a degraded image file, a degraded image file may be generated. In some embodiments, obtaining a degraded image file that matches the original video includes:
[0143] The RGB value of the pixel in the original video is used as the original RGB value, or the RGB value of the pixel in the preset pixel set is used as the original RGB value;
[0144] The original RGB value is converted from the RGB space to the HSL space, and the HSL value of the HSL space is adjusted based on the degradation adjustment strategy to obtain the degradation adjusted HSL value;
[0145] The degraded adjusted HSL value is restored from the HSL space to the RGB space to obtain a degraded RGB value corresponding to the original RGB value;
[0146] According to the mapping relationship between the original RGB values and the degraded RGB values, a degraded file matching the original video is generated.
[0147] Specifically, the RGB value of the pixel in the original video can be used as the original RGB value, or the RGB value of the pixel in the preset pixel set can be used as the original RGB value. For example, the original RGB value (x) can be defined as: x = (x r , x g , x b ), 0≤x≤255. The preset pixel point set may include multiple pixel points, and the RGB value of each pixel point ranges from 0 to 255 (including 0 and 255). The preset pixel point set may exist in the form of a list or a 3D look-up table (LUT). Each dimension (red, green, blue) in the 3D LUT has 64 nodes, and each node has a unique RGB value.
[0148] Then, the original RGB value can be converted from the RGB space to the HSL space. For example, the original RGB value of the pixel point is converted from the RGB space to the HSL space through the HSL conversion function: h=HSL(x), wherein the value range of the HSL value (h) corresponding to the pixel point in the HSL space is:
[0149] h=(h h ,h s ,h l ), 0°≤h h ≤360°, 0%≤h s ≤100%, 0%≤h l ≤100%
[0150] At this time, the HSL value of the HSL space can be adjusted based on the degradation adjustment strategy to obtain the degradation-adjusted HSL value. Among them, the degradation adjustment strategy can be flexibly set according to actual needs, and is not limited here. For example, the degradation adjustment strategy can be determined based on video attribute information such as the video type, video format or video parameters of the original video. The degradation adjustment strategy may include adjusting at least one of the hue, saturation, and brightness based on an adjustment coefficient that matches at least one of the image quality parameters of hue, saturation, and brightness. For example, the adjustment function of hue and saturation is:
[0151] h new =Adjust(h)
[0152]
[0153] Among them, h new It represents the HSL value after degradation adjustment, 30° represents the adjustment coefficient corresponding to the color, and 30% represents the adjustment coefficient corresponding to the saturation. Of course, the adjustment coefficient corresponding to the color and the adjustment coefficient corresponding to the saturation can be set to other values according to actual needs, and are not limited here.
[0154] After obtaining the degraded adjusted HSL value, the degraded adjusted HSL value can be restored from the HSL space to the RGB space through the RGB conversion function to obtain the degraded RGB value corresponding to the original RGB value. For example, the RGB conversion function from the HSL space to the RGB space is: y=RGB(h new After each pixel is traversed, the degraded RGB value corresponding to each pixel can be obtained: y = (y r ,y g ,y b ), 0≤y≤255.
[0155] After each pixel is traversed, a degraded file matching the original video can be generated based on the mapping relationship between the original RGB value and the degraded RGB value. Taking 3D LUT as an example: l(x) = (l r , l g , l b ), 0≤l≤255, traverse all possible x=(x r , x g , x b ), 0≤x≤255, a total of 256*256*256*3=50331648 possibilities, the generated 3D LUT also has 50331648 sample points (i.e. nodes), for each x i =(x ri , x gi , x bi ), use the following logic to limit the limit values of 0 and 255 to avoid unrecoverable situations. In summary, the following formula is obtained:
[0156] y=(y r ,y g ,y b )=RGB(Adjust(HSL(x)))
[0157]
[0158] After traversing all nodes in the 3D LUT, 50331648 one-to-one mappings are established, that is, the mapping relationship between the original RGB value and the degraded RGB value. l(x) can be encapsulated into a 3D LUT file, called attack.CUBE (i.e., image quality degradation file), which improves the accuracy and reliability of image quality degradation file generation.
[0159] In some embodiments, the HSL value of the HSL space is adjusted based on the degradation adjustment strategy to obtain the degradation-adjusted HSL value, including: obtaining video attribute information of the original video; determining the degradation adjustment strategy according to the video attribute information; adjusting the HSL value of the HSL space based on the degradation adjustment strategy to obtain the degradation-adjusted HSL value.
[0160] The video attribute information may include information such as video type, video format or video parameters, the video type may include landscape videos and character videos, and the video parameters may include resolution, frame rate and image quality parameters, etc. The degradation adjustment strategy may include adjusting at least one of hue, saturation and brightness based on an adjustment coefficient matching at least one of hue, saturation and brightness.
[0161] For example, the video attribute information of the original video can be obtained, and an adjustment coefficient matching at least one of hue, saturation, and brightness can be determined according to the video attribute information, and the HSL value of the HSL space can be adjusted based on the adjustment coefficient to obtain the HSL value after degradation adjustment. The degradation adjustment strategy can be determined through the video attribute information to perform degradation processing, thereby improving the reliability of the determination of the degradation adjustment strategy, and thus adjusting based on the degradation adjustment strategy can improve the accuracy and effect of degradation.
[0162] In the process of generating the image quality degraded file, an image quality optimized file matching the image quality degraded file may also be generated and stored. When the image quality optimized file is needed, the image quality optimized file may be quickly obtained. In some implementations, the video processing method further includes:
[0163] Using the RGB value of a pixel in the target video as a degraded RGB value, or using the RGB value of a pixel in a preset pixel set as a degraded RGB value;
[0164] The degraded RGB value is converted from the RGB space to the HSL space, and the HSL value of the HSL space is adjusted based on the optimization adjustment strategy to obtain the optimized adjusted HSL value;
[0165] The optimized and adjusted HSL value is restored from the HSL space to the RGB space to obtain the original RGB value corresponding to the degraded RGB value;
[0166] Generate a file with image quality optimization according to the mapping relationship between the degraded RGB value and the original RGB value;
[0167] The image quality optimization file is stored in the authentication server.
[0168] Specifically, the RGB value of the pixel in the target video may be used as the degraded RGB value, or the RGB value of the pixel in the preset pixel set may be used as the degraded RGB value. For example, the original RGB value (x) may be defined as: x = (x r , x g , x b ), 0≤x≤255. The preset pixel point set may include multiple pixel points, and the RGB value of each pixel point ranges from 0 to 255 (including 0 and 255). The preset pixel point set may exist in the form of a list or a 3D LUT, which is not limited here.
[0169] Then, the degraded RGB value can be converted from the RGB space to the HSL space. For example, the degraded RGB value of the pixel point is converted from the RGB space to the HSL space by using the HSL conversion function: h=HSL(x), wherein the value range of the HSL value (h) corresponding to the pixel point in the HSL space is:
[0170] h=(hh ,h s ,h l ), 0°≤h h ≤360°, 0%≤h s ≤100%, 0%≤h l ≤100%
[0171] At this time, the HSL value of the HSL space can be adjusted based on the optimization adjustment strategy to obtain the optimized adjusted HSL value, wherein the optimization adjustment strategy can be flexibly set according to actual needs and is not limited here. For example, the optimization adjustment strategy can be determined based on video attribute information such as the video type, video format, video parameters or video player of the original video. The optimization adjustment strategy may include adjusting the image quality parameters based on an adjustment coefficient that matches the image quality parameters in the HSL space, and the image quality parameters include at least one of hue, saturation, and brightness.
[0172] For example, the inverse adjustment functions for hue and saturation are:
[0173] h=Adjust -1 (h new )
[0174]
[0175] Among them, h new It represents the HSL value after optimization and adjustment, 30° represents the adjustment coefficient corresponding to the color, and 30% represents the adjustment coefficient corresponding to the saturation. Of course, the adjustment coefficient corresponding to the color and the adjustment coefficient corresponding to the saturation can be set to other values according to actual needs, and are not limited here.
[0176] After obtaining the optimized and adjusted HSL value, the optimized and adjusted HSL value can be restored from the HSL space to the RGB space through the RGB conversion function to obtain the original RGB value corresponding to the degraded RGB value. For example, the RGB conversion function from the HSL space to the RGB space is: y=RGB(h new After each pixel is traversed, the original RGB value corresponding to each pixel can be obtained: y = (y r ,y g ,y b ), 0≤y≤255.
[0177] After each pixel is traversed, a quality optimization file can be generated based on the mapping relationship between the degraded RGB value and the original RGB value. Take the reverse 3D LUT as an example:
[0178]
[0179] Traverse all possible x=(x r, x g , x b ), 0≤x≤255, a total of 256*256*256*3=50331648 possibilities, the generated 3D LUT also has 50331648 sample points (i.e. nodes), for each x i =(x ri , x gi , x bi ), use the following logic to limit the limit values of 0 and 255 to avoid unrecoverable situations. In summary, the following formula is obtained:
[0180] y=(y r ,y g ,y b )=RGB(Adjust -1 (HSL(x)))
[0181]
[0182] After traversing all nodes in the 3D LUT, 50331648 one-to-one mappings are established, that is, the reverse mapping relationship between the degraded RGB value and the original RGB value. -1 (y) Encapsulated into a 3D LUT file, called recovrey.CUBE (i.e. image quality optimization file).
[0183] After obtaining the image quality degraded file, the image quality optimized file can be stored in the authentication server. When the image quality optimized file needs to be obtained, the image quality optimized file can be obtained from the authentication server.
[0184] S203: Degrade the original video according to the image quality degradation file to obtain a target video.
[0185] After obtaining the image quality degradation file, the original video may be degraded according to the image quality degradation file. In some implementations, the original video is degraded according to the image quality degradation file to obtain the target video, including:
[0186] Get the original RGB value of the pixel in the original video;
[0187] According to the mapping relationship, a degraded RGB value matching the original RGB value is determined;
[0188] The original video is degraded according to the degraded RGB value to obtain the target video.
[0189] After obtaining the degraded file, the original RGB values of the pixels in the original video (such as the video medium origin.mp4) can be obtained, and the degraded RGB values that match the original RGB values can be determined according to the mapping relationship between the original RGB values and the degraded RGB values in the degraded file, and the original video can be degraded according to the degraded RGB values to obtain the target video. For example, a transcoding tool (such as FFMPEG) can be used to apply the degraded file (attack.CUBE) to transcode the original video to generate a target video (such as attack.mp4). The specific command can be as follows:
[0190] ffmpeg -i origin.mp4 -vf"lut3d=attack.CUBE"attack.mp4
[0191] S204: Send the target video to a content distribution server, and distribute the target video through the content distribution server.
[0192] After obtaining the target video, it can be distributed through the content distribution server (CDN), which consists of a group of servers located in different geographical locations. These servers can select the best server to respond based on the location of the terminal and the requested content. By caching the target video on a server closer to the terminal, the access speed is improved and the response time is shortened.
[0193] It should be noted that the target video can be further encrypted by an encryption algorithm according to actual needs, and the encrypted target video is sent to a content distribution server, and the encrypted target video is distributed by the content distribution server. After the terminal obtains the encrypted target video, it can decrypt the encrypted target video by a decryption algorithm matching the encryption algorithm to obtain the target video, and then optimize and restore the target video. By degrading the original video and encrypting the target video obtained by the degraded processing before transmitting it, the security of video transmission is greatly increased.
[0194] When the terminal needs to obtain the target video, the terminal can send a video acquisition request to the content distribution server, and receive the target video returned by the content distribution server based on the video acquisition request, wherein the target video is used for the terminal to obtain and then restore to the original video for playback through an image quality optimization file that matches the image quality degraded file, and the image quality optimization file is returned to the terminal after the authentication server authenticates the terminal based on the file acquisition request sent by the terminal.
[0195] In the embodiments of the present application, the description of each embodiment has its own focus. For the parts that are not described in detail in a certain embodiment, please refer to the detailed description of the video processing method above, and will not be repeated here.
[0196] In an embodiment of the present application, the original video to be processed and the image quality degradation file can be obtained. Before the original video is transmitted, the original video is degraded by the image quality degradation file to obtain the target video, and the target video is sent to the content distribution server, and the target video is distributed by the content distribution server. After receiving the target video, the playback end optimizes, restores and plays the target video according to the image quality optimization file. Since the target video is obtained by degrading the original video based on the image quality degradation file, even if the criminals obtain the target video, they cannot play it normally, and the target video is optimized and restored based on the image quality optimization file that matches the image quality degradation file, making it difficult for criminals to perceive the existence of the image quality optimization file, and the image quality optimization file can only be obtained after authentication, making it more difficult for criminals to crack the target video, thereby improving the security of the video.
[0197] The method described in the above embodiment is further described in detail below with examples.
[0198] This embodiment takes the video processing system processing a video as an example. Figure 4 As shown, the video processing system includes an authentication server, a video transcoding server (i.e., a video processing server), a content distribution server, and a terminal, etc., and the authentication server can generate a quality degradation file and a quality optimization file through a generation algorithm (including a degradation adjustment strategy and an optimization adjustment strategy, etc.), and store the quality degradation file and the quality optimization file. When the video transcoding server needs to degrade the original video, the video transcoding server can request the authentication server to obtain the quality degradation file, and apply the quality degradation file to degrade the original video through a transcoding tool (such as FFMPEG) to obtain a damaged video (i.e., a target video), and then distribute the damaged video through a content distribution server CND. When the terminal receives the damaged video, it can request the authentication server for authentication and obtain the quality optimization file, and decode the damaged video to obtain a damaged picture frame, and apply the quality optimization file to optimize and restore the damaged picture frame through a picture quality recovery module to obtain a restored picture frame (i.e., a restored picture frame), so that the video can be played normally. However, in the process of CND distributing the damaged video, when the pirated video platform illegally obtains the damaged video, it cannot crack the damaged video, so it cannot play the video normally, which improves the security of the video. The following will explain in detail the interaction between the authentication server, video transcoding server, content distribution server and terminal.
[0199] See also Figure 5 , Figure 5 A schematic diagram of a video processing method provided in an embodiment of the present application. The method may include:
[0200] S301: The authentication server generates a quality degradation file based on a degradation adjustment strategy, and generates a quality optimization file based on an optimization adjustment strategy.
[0201] The authentication server may use the RGB value of a pixel in a preset pixel set as the original RGB value, wherein the preset pixel set may include multiple pixels, and the RGB value of each pixel ranges from 0 to 255 (including 0 and 255), such as Figure 6 As shown, the preset pixel point set can exist in the form of a 3D LUT, where LUT is a pre-calculated data table for storing data and improving calculation speed, and is used to quickly find results during the calculation process instead of real-time calculation. LUT is often used in image processing, computer graphics, color correction and color grading, etc. In these fields, LUT can help realize operations such as color space conversion, color correction and color grading, and improve processing speed and efficiency.
[0202] A 64×64×64 3D LUT is a cube with 64 nodes in each dimension (red, green, blue). The cube represents a discrete color space where each node has a unique RGB value. In this cube, the red channel is along the X axis, the green channel is along the Y axis, and the blue channel is along the Z axis. In this color space, the RGB values between each node are linearly interpolated, and the color values transition smoothly as you move through this cube. For example, in the process of going from one corner (0,0,0) to another corner (1,1,1), the color value will transition from black to white.
[0203] Then, the original RGB value can be converted from the RGB space to the HSL space through the HSL conversion function, and the HSL value of the HSL space is adjusted based on the degradation adjustment strategy to obtain the degradation-adjusted HSL value. The degradation adjustment strategy may include adjusting at least one of the hue, saturation, and brightness based on an adjustment coefficient matching at least one of the image quality parameters of hue, saturation, and brightness.
[0204] After obtaining the degraded adjusted HSL value, the degraded adjusted HSL value can be restored from the HSL space to the RGB space through the RGB conversion function to obtain the degraded RGB value corresponding to the original RGB value. After each pixel point in the 3D LUT is traversed, a degraded image file (attack.CUBE) matching the original video can be generated based on the mapping relationship between the original RGB value and the degraded RGB value.
[0205] The method of generating the image quality optimization file is similar to the method of generating the image quality degradation file. The RGB value of the pixel point in the preset pixel point set 3D LUT can be used as the degraded RGB value, and the degraded RGB value can be converted from the RGB space to the HSL space through the HSL conversion function. The HSL value of the HSL space can be adjusted based on the optimization adjustment strategy to obtain the optimized adjusted HSL value. The optimization adjustment strategy can include adjusting the image quality parameters based on the adjustment coefficient matching the image quality parameters in the HSL space, and the image quality parameters include at least one of hue, saturation, and brightness.
[0206] After obtaining the optimized and adjusted HSL value, the optimized and adjusted HSL value can be restored from the HSL space to the RGB space through the RGB conversion function to obtain the original RGB value corresponding to the degraded RGB value. After each pixel point in the 3D LUT is traversed, the image quality optimization file (recovrey.CUBE) can be generated according to the mapping relationship between the degraded RGB value and the original RGB value.
[0207] S302: The authentication server stores the image quality degradation file and the image quality optimization file.
[0208] S303: The video transcoding server obtains the original video.
[0209] For example, the video transcoding server may receive the original video sent by the video generation terminal.
[0210] S304: The video transcoding server sends a request for obtaining a file with degraded image quality to the authentication server.
[0211] S305: The authentication server returns the file with degraded image quality to the video transcoding server in response to the request for obtaining the file with degraded image quality.
[0212] The request for obtaining the degraded file may carry a file identifier, and the authentication server may respond to the request for obtaining the degraded file, search for the degraded file based on the file identifier, and return the degraded file to the video transcoding server.
[0213] The request for obtaining the file with degraded image quality may also carry the server identifier of the video transcoding server. The authentication server may respond to the request for obtaining the file with degraded image quality, authenticate the video transcoding server based on the server identifier, and after the video transcoding server is authenticated, search for the file with degraded image quality based on the file identifier and return the file with degraded image quality to the video transcoding server.
[0214] S306: The video transcoding server performs degradation processing on the original video according to the image quality degradation file to obtain a target video (ie, a damaged video).
[0215] After obtaining the degraded file, the video transcoding server can obtain the original RGB values of the pixels in the original video (such as the video medium origin.mp4), determine the degraded RGB values that match the original RGB values according to the mapping relationship between the original RGB values and the degraded RGB values in the degraded file, and degrade the original video according to the degraded RGB values to obtain the target video. For example, a transcoding tool (such as FFMPEG) can be used to apply the degraded file (attack.CUBE) to transcode the original video to generate a target video (such as attack.mp4).
[0216] S307: The video transcoding server sends the target video to the content distribution server.
[0217] S308: The content distribution server stores the target video to distribute the target video.
[0218] The content distribution server CDN can be composed of a group of servers located in different geographical locations, which can select the best server to respond based on the location of the terminal and the requested content.
[0219] S309: The terminal sends a video acquisition request to the content distribution server.
[0220] S310: The content distribution server returns the target video to the terminal in response to the video acquisition request.
[0221] For example, the terminal can send a video acquisition request carrying a video identifier to the content distribution server, and receive a target video matching the video identifier returned by the content distribution server in response to the video acquisition request. The quick response of the content distribution server improves the efficiency of acquiring the target video.
[0222] S311. The terminal sends a request for obtaining an image quality optimization file to an authentication server.
[0223] S312: The authentication server responds to the request for obtaining the image quality optimization file and returns the image quality optimization file to the terminal after the terminal is authenticated.
[0224] Since the target video is obtained by degrading the original video based on the image quality degradation file, that is, the target video has been attacked by the image quality degradation file and has been destroyed, in order to restore the video losslessly, you can request the authentication server that pre-stores the image quality optimization file to obtain the image quality optimization file. For example, the terminal can send a file acquisition request carrying the terminal identifier to the authentication server, and the authentication server authenticates the terminal based on the terminal identifier. After the authentication server authenticates the terminal, it returns the image quality optimization file to the terminal. If the authentication server fails to authenticate the terminal based on the terminal identifier, it means that the terminal is unauthorized and does not have the authority to obtain the image quality optimization file, and thus cannot obtain the image quality optimization file.
[0225] S313: The terminal optimizes and restores the target video according to the image quality optimization file to obtain the original video.
[0226] The terminal can obtain the degraded RGB values of the pixels in the target video, determine the original RGB values that match the degraded RGB values according to the reverse mapping relationship between the degraded RGB values and the original RGB values in the image quality optimization file, and optimize and restore the target video according to the original RGB values. For example, the target video (such as attack.mp4) is decoded, each frame is decoded, and waits for the shader to be used to draw it on the screen, and the image quality optimization file (recovrey.CUBE) is applied to each frame to restore the image quality, and after restoration, it is drawn on the screen, so as to achieve lossless video recovery and normal playback.
[0227] S314: The terminal plays the original video.
[0228] like Figure 7 As shown, after optimizing and restoring the target video to obtain the original video, the terminal can play the original video through a player.
[0229] In the above embodiments, the description of each embodiment has its own emphasis. For the part that is not described in detail in a certain embodiment, please refer to the detailed description of the video processing method above, and will not be repeated here.
[0230] It is understandable that in the specific implementation of this application, related data such as videos and logos are involved. When the above embodiments of this application are applied to specific products or technologies, user permission or consent is required, and the collection, use and processing of relevant data need to comply with relevant laws, regulations and standards of relevant countries and regions.
[0231] In the embodiment of the present application, the authentication server can pre-generate a picture quality degradation file and a picture quality optimization file. Before the video is distributed, the video transcoding server can request the authentication server to obtain the picture quality degradation file, and degrade the original video based on the picture quality degradation file to obtain the target video, so that the target video can be distributed through the content distribution server. In the video playback stage, after the terminal obtains the target video distributed by the content distribution server, it can request the authentication server to obtain the picture quality optimization file, and optimize and restore the target video according to the picture quality optimization file, and play the original video obtained by optimization and restoration. Since the target video is obtained by degrading the original video based on the picture quality degradation file, even if the criminals obtain the target video, they cannot play it normally, and the target video is optimized and restored based on the picture quality optimization file matching the picture quality degradation file, making it difficult for criminals to perceive the existence of the picture quality optimization file, and the picture quality optimization file can only be obtained after authentication, making it more difficult for criminals to crack the target video, thereby improving the security of the video.
[0232] In order to better implement the video processing method provided in the embodiment of the present application, the embodiment of the present application also provides a device based on the above video processing method. The meanings of the terms are the same as those in the above video processing method, and the specific implementation details can refer to the description in the method embodiment.
[0233] See also Figure 8 , Figure 8 A structural schematic diagram of a video processing device provided in an embodiment of the present application, wherein the video processing device 400 may include a first acquisition unit 401, a first sending unit 402, a receiving unit 403, an optimization and restoration unit 404, and a playback unit 405, etc.
[0234] The first acquisition unit 401 is used to acquire a target video to be played, where the target video is obtained by degrading the original video based on a file with degraded image quality.
[0235] The first sending unit 402 is used to send a file acquisition request to an authentication server, where the file acquisition request carries a terminal identifier of the terminal.
[0236] The receiving unit 403 is used to receive the image quality optimization file returned by the authentication server after the terminal is authenticated based on the terminal identifier.
[0237] The optimization and restoration unit 404 is used to optimize and restore the target video according to the image quality optimization file to obtain the original video.
[0238] The playback unit 405 is used to play the original video.
[0239] In some embodiments, the image quality optimization file includes a mapping relationship between degraded RGB values and original RGB values, and the original RGB values are converted from the corresponding degraded RGB values to the HSL space and adjusted based on the optimization adjustment strategy, and then restored to the RGB space.
[0240] In some implementations, the optimization and restoration unit 404 is specifically used to: obtain the degraded RGB value of the pixel in the target video; determine the original RGB value matching the degraded RGB value according to the mapping relationship; and optimize and restore the target video according to the original RGB value to obtain the original video.
[0241] In some implementations, the file acquisition request also carries the video identifier of the target video, and the receiving unit 403 is specifically used to: receive the quality optimization file matching the video identifier returned by the authentication server after the terminal is authenticated based on the terminal identifier and the video identifier.
[0242] The playing unit 405 is specifically used to play the original video through a player matching the video identifier.
[0243] In some implementations, the first acquisition unit 401 is specifically configured to: send a video acquisition request to a content distribution server; and receive a target video returned by the content distribution server based on the video acquisition request.
[0244] In the embodiment of the present application, the target video can be obtained by degrading the original video based on the image quality degradation file before the video is transmitted. In the video playback stage, the target video is obtained by the first acquisition unit 401, and the first sending unit 402 sends a file acquisition request carrying the terminal identifier of the terminal to the authentication server, and the receiving unit 403 receives the image quality optimization file returned by the authentication server after the terminal authentication is passed based on the terminal identifier, so that the optimization and restoration unit 404 can optimize and restore the target video according to the image quality optimization file, and the playback unit 405 plays the original video obtained by optimization and restoration. Since the target video is obtained by degrading the original video based on the image quality degradation file, even if the criminals obtain the target video, they cannot play it normally, and the target video is optimized and restored based on the image quality optimization file matching the image quality degradation file, so that it is difficult for criminals to perceive the existence of the image quality optimization file, and the image quality optimization file can only be obtained after authentication, making it more difficult for criminals to crack the target video, thereby improving the security of the video.
[0245] In order to better implement the video processing method provided in the embodiment of the present application, the embodiment of the present application also provides a device based on the above video processing method. The meanings of the terms are the same as those in the above video processing method, and the specific implementation details can refer to the description in the method embodiment.
[0246] See also Fig. 9 , Fig. 9 A schematic diagram of the structure of a video processing device provided in an embodiment of the present application, wherein the video processing device 500 may include a second acquisition unit 501, a third acquisition unit 502, a degradation processing unit 503, and a second sending unit 504, etc.
[0247] The second acquisition unit 501 is used to acquire the original video to be processed.
[0248] The third acquisition unit 502 is used to acquire a file with degraded image quality that matches the original video.
[0249] The degradation processing unit 503 is used to perform degradation processing on the original video according to the image quality degradation file to obtain a target video.
[0250] The second sending unit 504 is used to send the target video to the content distribution server, and distribute the target video through the content distribution server.
[0251] Among them, the target video is used for the terminal to obtain and then restore it to the original video through the image quality optimization file matching the image quality degraded file for playback. The image quality optimization file is returned to the terminal after the authentication server authenticates the terminal based on the file acquisition request sent by the terminal.
[0252] In some embodiments, the third acquisition unit 502 is specifically used to: obtain the video identifier of the original video; based on the video identifier of the original video, obtain a degraded image file matching the original video from a server; wherein the degraded image file includes a mapping relationship between the original RGB value and the degraded RGB value, and the degraded RGB value is converted from the corresponding original RGB value to the HSL space and adjusted based on the degradation adjustment strategy, and then restored to the RGB space.
[0253] In some implementations, the third obtaining unit 502 includes:
[0254] The acquisition subunit is used to use the RGB value of the pixel in the original video as the original RGB value, or use the RGB value of the pixel in the preset pixel set as the original RGB value;
[0255] An adjustment subunit, used for converting the original RGB value from the RGB space to the HSL space, and adjusting the HSL value of the HSL space based on the degradation adjustment strategy to obtain a degradation-adjusted HSL value;
[0256] A space restoration subunit, used to restore the degraded adjusted HSL value from the HSL space to the RGB space to obtain a degraded RGB value corresponding to the original RGB value;
[0257] The generating subunit is used to generate a degraded image file matching the original video according to the mapping relationship between the original RGB value and the degraded RGB value.
[0258] In some implementations, the adjustment subunit is specifically used to: obtain video attribute information of the original video; determine a degradation adjustment strategy according to the video attribute information; and adjust the HSL value of the HSL space based on the degradation adjustment strategy to obtain a degradation-adjusted HSL value.
[0259] In some implementations, the video processing device 500 further includes:
[0260] A fourth acquisition unit, used to use the RGB value of a pixel point in the target video as a degraded RGB value, or use the RGB value of a pixel point in a preset pixel point set as a degraded RGB value;
[0261] An adjustment unit, used for converting the degraded RGB value from the RGB space to the HSL space, and adjusting the HSL value of the HSL space based on the optimization adjustment strategy to obtain an optimized adjusted HSL value;
[0262] A space restoration unit, used for restoring the optimized and adjusted HSL value from the HSL space to the RGB space to obtain an original RGB value corresponding to the degraded RGB value;
[0263] A generating unit, used for generating a file with image quality optimization according to a mapping relationship between degraded RGB values and original RGB values;
[0264] The storage unit is used to store the image quality optimization file in the authentication server.
[0265] In some implementations, the degradation processing unit 503 is specifically used to: obtain the original RGB value of the pixel in the original video; determine the degraded RGB value matching the original RGB value according to the mapping relationship; and perform degradation processing on the original video according to the degraded RGB value to obtain the target video.
[0266] In the embodiment of the present application, the second acquisition unit 501 can acquire the original video to be processed and the quality degradation file can be acquired by the third acquisition unit 502. Before the original video is transmitted, the degradation processing unit 503 degrades the original video through the quality degradation file to obtain the target video, and the second sending unit 504 sends the target video to the content distribution server, and distributes the target video through the content distribution server. After receiving the target video, the playback end optimizes, restores and plays the target video according to the quality optimization file. Since the target video is obtained by degrading the original video based on the quality degradation file, even if the criminals obtain the target video, they cannot play it normally, and the target video is optimized and restored based on the quality optimization file matching the quality degradation file, making it difficult for criminals to perceive the existence of the quality optimization file, and the quality optimization file can only be obtained after authentication, making it more difficult for criminals to crack the target video, thereby improving the security of the video.
[0267] The present application also provides a computer device, which may be a terminal or a server, etc. Fig.10 As shown, it shows a schematic diagram of the structure of the computer device involved in the embodiment of the present application, specifically:
[0268] The computer device may include components such as a processor 601 with one or more processing cores, a memory 602 with one or more computer-readable storage media, a power supply 603, and an input unit 604. Those skilled in the art will appreciate that Fig.10 The computer device structure shown in the figure does not constitute a limitation on the computer device, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently. Among them:
[0269] The processor 601 is the control center of the computer device, and uses various interfaces and lines to connect various parts of the entire computer device. By running or executing software programs and / or modules stored in the memory 602, and calling data stored in the memory 602, the processor 601 performs various functions of the computer device and processes data. Optionally, the processor 601 may include one or more processing cores; preferably, the processor 601 may integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user interface, and application programs, and the modem processor mainly processes wireless communications. It is understandable that the above-mentioned modem processor may not be integrated into the processor 601.
[0270] The memory 602 can be used to store software programs and modules. The processor 601 executes various functional applications and data processing by running the software programs and modules stored in the memory 602. The memory 602 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area may store data created according to the use of the computer device, etc. In addition, the memory 602 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage devices. Accordingly, the memory 602 may also include a memory controller to provide the processor 601 with access to the memory 602.
[0271] The computer device also includes a power supply 603 for supplying power to various components. Preferably, the power supply 603 can be logically connected to the processor 601 through a power management system, so as to manage charging, discharging, and power consumption through the power management system. The power supply 603 can also include any components such as one or more DC or AC power supplies, recharging systems, power failure detection circuits, power converters or inverters, and power status indicators.
[0272] The computer device may further include an input unit 604, which may be used to receive input digital or character information and generate keyboard, mouse, joystick, optical or trackball signal input related to user settings and function control.
[0273] Although not shown, the computer device may further include a display unit, etc., which will not be described in detail herein. Specifically in this embodiment, the processor 601 in the computer device will load the executable files corresponding to the processes of one or more application programs into the memory 602 according to the following instructions, and the processor 601 will run the application programs stored in the memory 602, thereby realizing various functions, as follows:
[0274] Obtain a target video to be played, where the target video is obtained by degrading the original video based on a picture quality degradation file; send a file acquisition request to an authentication server, where the file acquisition request carries a terminal identifier of the terminal; receive a picture quality optimization file returned by the authentication server after the terminal authentication is passed based on the terminal identifier; optimize and restore the target video according to the picture quality optimization file to obtain the original video; and play the original video.
[0275] Alternatively, an original video to be processed is obtained; a file with degraded image quality matching the original video is obtained; the original video is degraded according to the file with degraded image quality to obtain a target video; the target video is sent to a content distribution server, and the target video is distributed through the content distribution server; wherein the target video is used for the terminal to obtain, and then is restored to the original video for playback after being optimized by a quality optimization file matching the file with degraded image quality, and the quality optimization file is returned to the terminal after the authentication server authenticates the terminal based on a file acquisition request sent by the terminal.
[0276] Since the target video is obtained by degrading the original video based on the image quality degraded file, even if the criminals obtain the target video, they will not be able to play it normally. In addition, the target video is optimized and restored based on the image quality optimization file that matches the image quality degraded file, making it difficult for criminals to perceive the existence of the image quality optimization file, and the image quality optimization file can only be obtained after authentication, making it more difficult for criminals to crack the target video, thereby improving the security of the video.
[0277] In the above embodiments, the description of each embodiment has its own emphasis. For the part that is not described in detail in a certain embodiment, please refer to the detailed description of the video processing method above, and will not be repeated here.
[0278] According to one aspect of the present application, a computer program product or a computer program is provided, the computer program product or the computer program including computer instructions, the computer instructions being stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the methods provided in various optional implementations in the above-mentioned embodiments.
[0279] Those skilled in the art will appreciate that all or part of the steps in the various methods of the above embodiments may be completed by computer instructions, or by controlling related hardware through computer instructions, and the computer instructions may be stored in a computer-readable storage medium (i.e., storage medium) and loaded and executed by a processor. To this end, an embodiment of the present application provides a storage medium in which a computer program is stored, and the computer program may include computer instructions, and the computer program may be loaded by a processor to execute any of the video processing methods provided in the embodiments of the present application.
[0280] The specific implementation of the above operations can be found in the previous embodiments, which will not be described in detail here.
[0281] The storage medium may include: a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.
[0282] Since the instructions stored in the storage medium can execute the steps in any video processing method provided in the embodiments of the present application, the beneficial effects that can be achieved by any video processing method provided in the embodiments of the present application can be achieved. Please refer to the previous embodiments for details and will not be repeated here.
[0283] The above is a detailed introduction to a video processing method, device, computer equipment and storage medium provided in the embodiments of the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea; at the same time, for technical personnel in this field, according to the ideas of the present application, there will be changes in the specific implementation methods and application scopes. In summary, the content of this specification should not be understood as a limitation on the present application.
Claims
1. A video processing method, characterized in that: include: Obtain a target video to be played, where the target video is obtained by degrading the original video based on the image quality degraded file; Sending a file acquisition request to an authentication server, wherein the file acquisition request carries a terminal identifier of the terminal; Receiving the image quality optimization file returned by the authentication server after the terminal is authenticated based on the terminal identifier; Optimizing and restoring the target video according to the image quality optimization file to obtain the original video; The original video is played.
2. The video processing method according to claim 1, characterized in that: The image quality optimization file includes a mapping relationship between degraded RGB values and original RGB values, and the original RGB values are converted from the corresponding degraded RGB values to the HSL space and adjusted based on the optimization adjustment strategy, and then restored to the RGB space.
3. The video processing method according to claim 2, characterized in that: The optimizing and restoring the target video according to the image quality optimization file to obtain the original video includes: Obtaining degraded RGB values of pixels in the target video; Determining, according to the mapping relationship, an original RGB value that matches the degraded RGB value; The target video is optimized and restored according to the original RGB values to obtain the original video.
4. The video processing method according to claim 1, characterized in that: The file acquisition request also carries the video identifier of the target video, and receiving the image quality optimization file returned by the authentication server after the terminal is authenticated based on the terminal identifier, includes: Receiving a picture quality optimization file matching the video identifier, which is returned by the authentication server after the terminal is authenticated based on the terminal identifier and the video identifier; Playing the original video includes: The original video is played through a player matching the video identifier.
5. The video processing method according to any one of claims 1 to 4, characterized in that: The step of obtaining a target video to be played includes: Send a video acquisition request to a content distribution server; Receive the target video returned by the content distribution server based on the video acquisition request.
6. A video processing method, characterized in that: The method comprises: Get the original video to be processed; Acquire a file with degraded image quality matching the original video; Performing degradation processing on the original video according to the image quality degradation file to obtain a target video; Sending the target video to a content distribution server, and distributing the target video through the content distribution server; Among them, the target video is used for restoration to the original video after being acquired by the terminal through optimization of the image quality file matching the image quality degraded file, and then played. The image quality optimization file is returned to the terminal after the authentication server authenticates the terminal based on the file acquisition request sent by the terminal.
7. The video processing method according to claim 6, characterized in that: The step of obtaining a file with degraded image quality matching the original video includes: Obtaining a video identifier of the original video; Based on the video identifier of the original video, obtaining a file with degraded image quality matching the original video from a server; The image quality degradation file includes a mapping relationship between original RGB values and degraded RGB values, and the degraded RGB values are obtained by converting the corresponding original RGB values into the HSL space and adjusting them based on the degradation adjustment strategy, and then restoring them to the RGB space.
8. The video processing method according to claim 6, characterized in that: The step of obtaining a file with degraded image quality matching the original video includes: Taking the RGB value of the pixel in the original video as the original RGB value, or taking the RGB value of the pixel in the preset pixel set as the original RGB value; Converting the original RGB value from the RGB space to the HSL space, and adjusting the HSL value of the HSL space based on a degradation adjustment strategy to obtain a degradation-adjusted HSL value; Restoring the degraded adjusted HSL value from the HSL space to the RGB space to obtain a degraded RGB value corresponding to the original RGB value; According to the mapping relationship between the original RGB value and the degraded RGB value, a degraded image file matching the original video is generated.
9. The video processing method according to claim 8, characterized in that: The step of adjusting the HSL value of the HSL space based on the degradation adjustment strategy to obtain the degradation-adjusted HSL value includes: Obtaining video attribute information of the original video; Determining a degradation adjustment strategy according to the video attribute information; The HSL value of the HSL space is adjusted based on the degradation adjustment strategy to obtain a degradation-adjusted HSL value.
10. The video processing method according to claim 8, characterized in that: The method further comprises: Using the RGB value of a pixel in the target video as a degraded RGB value, or using the RGB value of a pixel in a preset pixel set as a degraded RGB value; Converting the degraded RGB value from the RGB space to the HSL space, and adjusting the HSL value of the HSL space based on an optimization adjustment strategy to obtain an optimized adjusted HSL value; Restoring the optimized and adjusted HSL value from the HSL space to the RGB space to obtain an original RGB value corresponding to the degraded RGB value; Generate the image quality optimization file according to the mapping relationship between the degraded RGB value and the original RGB value; The image quality optimization file is stored in the authentication server.
11. The video processing method according to any one of claims 7 to 10, characterized in that: The step of performing degradation processing on the original video according to the image quality degradation file to obtain a target video includes: Obtaining the original RGB value of the pixel in the original video; Determine, according to the mapping relationship, a degraded RGB value that matches the original RGB value; The original video is degraded according to the degraded RGB value to obtain a target video.
12. A video processing device, characterized in that: include: A first acquisition unit is used to acquire a target video to be played, where the target video is obtained by degrading the original video based on a file with degraded image quality; A first sending unit, configured to send a file acquisition request to an authentication server, wherein the file acquisition request carries a terminal identifier of a terminal; A receiving unit, configured to receive a picture quality optimization file returned by the authentication server after the terminal is authenticated based on the terminal identifier; An optimization and restoration unit, used for optimizing and restoring the target video according to the image quality optimization file to obtain the original video; A playing unit is used to play the original video.
13. A video processing device, characterized in that: include: A second acquisition unit, used to acquire the original video to be processed; A third acquisition unit, used to acquire a file with degraded image quality matching the original video; A degradation processing unit, used for performing degradation processing on the original video according to the image quality degradation file to obtain a target video; A second sending unit, configured to send the target video to a content distribution server, and distribute the target video through the content distribution server; Among them, the target video is used for restoration to the original video after being acquired by the terminal through optimization of the image quality file matching the image quality degraded file, and then played. The image quality optimization file is returned to the terminal after the authentication server authenticates the terminal based on the file acquisition request sent by the terminal.
14. A storage medium, characterized in that: The storage medium is used to store a computer program, and the computer program is loaded by a processor to execute the video processing method according to any one of claims 1 to 5, or to execute the video processing method according to any one of claims 6 to 11.