Video processing method and apparatus, device, and medium
The server calculates the target theme color of video key frames and sends it to the client, which solves the problem of insufficient background processing methods on the video playback page and time-consuming client color selection algorithm, achieves efficient video background rendering, and improves user experience.
Patent Information
- Application Number
- PCT/CN2024/087307
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-04-18
- Filing Date
- 2024-04-11
- Publication Date
- 2024-10-24
AI Technical Summary
The existing video playback page background processing method has insufficient fixed color settings. The client-side color selection algorithm is time-consuming and not suitable for rapidly changing video frames. Moreover, the integration of the algorithm on the client increases the burden and installation package size, and the color selection algorithm is difficult to adapt. For videos, theme colors that do not meet user needs are often selected.
Obtain the key frames of the video through the server, calculate its color density sorting results and determine the target theme color based on preset conditions, and send it to the client to render the playback page background, avoiding the client's own calculations, reducing the size of the installation package and improving rendering efficiency.
Effectively save client computing resources, reduce the size of the installation package, ensure the accuracy and reliability of theme colors, improve user video viewing experience, match the background with the video, and reduce the burden on the client.
Smart Images

Figure CN2024087307_24102024_PF_FP_ABST
Abstract
Description
Video processing method, device, equipment and medium
[0001] This application claims priority to the Chinese invention patent application entitled “Video processing method, device, equipment and medium” and application number 202310418380X, filed on April 18, 2023. The entire contents of that application are incorporated by reference into this application. Technical Field
[0002] The present disclosure relates to the field of video processing technology, and in particular to a video processing method, apparatus, device, and medium. Background Art
[0003] With the prevalence of multimedia, video has become an indispensable information carrier in people's daily lives and work. Users can watch video images displayed on a video playback page. The inventors have found that in related technologies, the processing method for the video playback page background (i.e., the background of the video playback page other than the video image) needs to be improved.
[0004] Summary of the Invention
[0005] The present disclosure provides a video processing method, apparatus, device, and medium.
[0006] An embodiment of the present disclosure provides a video processing method, which is applied to a server, including: obtaining key frames of a target video; obtaining color density sorting results of the key frames, and determining a target theme color corresponding to the key frames based on the color density sorting results and preset theme color selection conditions; and sending information on the target theme color of the key frames to a client, so that the client renders the playback page background of the target video based on the target theme color.
[0007] The embodiment of the present disclosure also provides a video processing device, which is applied to a server and includes: a key frame acquisition module, which is used to acquire the key frames of a target video; a target theme color determination module, which is used to acquire the color density sorting results of the key frames, and determine the target theme color corresponding to the key frames based on the color density sorting results and preset theme color selection conditions; and a background rendering module, which is used to send information about the target theme color of the key frames to a client, so that the client renders the playback page background of the target video based on the target theme color.
[0008] An embodiment of the present disclosure further provides an electronic device, comprising: a processor; a memory for storing instructions executable by the processor; the processor for reading the executable instructions from the memory and executing the instructions to implement the video processing method provided by the embodiment of the present disclosure.
[0009] An embodiment of the present disclosure further provides a computer-readable storage medium, wherein the storage medium stores a computer program, and the computer program is used to execute the video processing method provided by the embodiment of the present disclosure.
[0010] The embodiments of the present disclosure further provide a computer program product, including a computer program. When the computer program is executed by a processor, the video processing method provided by the embodiments of the present disclosure is implemented.
[0011] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present disclosure, nor are they intended to limit the scope of the present disclosure. Other features of the present disclosure will become readily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.
[0013] In order to more clearly illustrate the embodiments of the present disclosure or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0014] FIG1 is a flow chart of a video processing method provided by an embodiment of the present disclosure;
[0015] FIG2 is a flow chart of a method for determining a target theme color provided by an embodiment of the present disclosure;
[0016] FIG3 is a schematic structural diagram of a video processing device provided by an embodiment of the present disclosure;
[0017] FIG4 is a schematic structural diagram of an electronic device provided by an embodiment of the present disclosure. DETAILED DESCRIPTION
[0018] In order to more clearly understand the above-mentioned objectives, features and advantages of the present disclosure, the scheme of the present disclosure will be further described below. It should be noted that the embodiments of the present disclosure and the features therein can be combined with each other in the absence of conflict.
[0019] In the following description, many specific details are set forth to facilitate a full understanding of the present disclosure, but the present disclosure may also be implemented in other ways different from those described herein; it is obvious that the embodiments in the specification are only part of the embodiments of the present disclosure, rather than all of the embodiments.
[0020] The inventors have discovered that in related technologies, the processing methods for the background of video playback pages need to be improved. Specifically, some related technologies directly set the playback page background to a fixed color such as black or gray, resulting in a single background display that cannot meet user needs. Other related technologies use the client to execute a theme color determination algorithm (which can be simply referred to as a color selection algorithm) to determine the theme color of the playback page background based on the target video being played. However, running the color selection algorithm on the client is usually time-consuming, especially for rapidly changing video frames (such as those greater than 24fps), which may cause problems with delayed processing, resulting in the current background color not being able to match the video playback screen well. In addition, the color selection algorithm is integrated into the client, which not only burdens the client's CPU but also makes the client's installation package larger, which is not conducive to transmission and subsequent updates and iterations. In addition, the color selection algorithm used by the client also needs to be improved. It is mainly based on algorithms such as the binary color selection algorithm and the octree color selection algorithm that extract theme colors for static images. Not only is it difficult to adapt to videos, but it is also easy to select theme colors that do not meet user needs, which also presents a poor viewing experience to users.
[0021] To improve at least one of the above problems, the present disclosure provides a video processing method, apparatus, device, and medium, which are described in detail as follows:
[0022] FIG1 is a flow chart of a video processing method provided by an embodiment of the present disclosure. The method may be executed by a video processing device, wherein the device may be implemented using software and / or hardware and may generally be integrated into an electronic device, which may be a server. As shown in FIG1 , the method mainly includes the following steps S102 to S106:
[0023] Step S102: Acquire key frames of the target video.
[0024] The disclosed embodiments do not limit the type and content of the target video. The number of key frames of the target video can be multiple. Specifically, the video can be regarded as a collection of several pictures containing timing information. In some embodiments, key frames can be extracted from the target video according to a preset time interval, and the time interval can be flexibly set according to demand. For example, assuming that the time interval is t and the number of frames played per second is f, the key frames obtained for the target video can include the [0, f*t, 2*f*t, ..., n*f*t]th frames. By extracting key frames according to a preset time interval, compared to analyzing and processing all frames of the target video, the required processing resources can be better reduced, and the waste of processing resources due to the small difference between adjacent frames can be avoided. It can also improve processing efficiency. Moreover, the method of extracting key frames according to a preset time interval is more convenient and easier to implement. The obtained key frames have a certain degree of representativeness, which helps to reasonably and reliably determine the background of the video playback page based on the key frames in the future.
[0025] Step S104 : obtaining a sorting result of the color density of the key frames, and determining a target theme color corresponding to the key frames based on the sorting result of the color density and a preset theme color selection condition.
[0026] In practical applications, the keyframes can first be tensorized, such as converting the keyframes into a tensor of dimension [W, H, C], where W represents width, H represents height, and C represents the number of channels. For example, a color image can be converted into a tensor of 480*360*3, where 3 represents the number of channels, corresponding to the three color channels of Red, Green, and Blue, which can be specifically referred to as R channel, G channel, and B channel. The disclosed embodiment can obtain the color density of the keyframes and sort the color density of the keyframes to determine the color that dominates the keyframe (i.e., the theme color), and then determine the target theme color of the keyframe based on the sorting result of the color density, and the target theme color meets the theme color selection condition.
[0027] In some implementation examples, the preset theme color selection conditions include: a quantity constraint condition for target theme colors. For example, the quantity constraint condition indicates that N target theme colors need to be selected, where N is a positive integer. The specific setting can be flexibly determined based on needs and is not limited here. For example, N can be 2.
[0028] In some implementation examples, the preset theme color selection conditions also include: color value constraints of the target theme color. For example, the color value conditions that the target theme color needs to meet can be limited according to needs, thereby filtering out color values that are not desired to be selected, such as black and white, to ensure that the target theme color finally selected conforms to the public aesthetic or has a better scene performance effect. Exemplarily, the color value constraints may include: the color value of the R channel, the color value of the G channel, and the color value of the B channel of the target theme color are not all less than a preset threshold value (which can be flexibly set according to actual needs, such as 30). In other words, the color value constraint condition can filter out the theme color whose R channel color value, G channel color value and B channel color value differences are all less than the preset threshold. That is, colors with similar R, G, and B values are filtered out, such as colors with similar R, G, and B values such as nearly pure black and nearly pure white. However, using such colors as the background color of the video playback page will only give a single scene presentation effect, which cannot meet user needs. Therefore, by setting the color value constraint condition, the background presentation effect of the video playback page rendered based on the final selected target theme color can be effectively guaranteed, thereby ensuring the user's viewing experience.
[0029] In actual applications, the server may also associate the target theme color corresponding to the key frame of the target video with the information of the target video and store it in a database. The specific storage method is not limited here.
[0030] Step S106 : sending the target theme color information of the key frame to the client, so that the client renders the playback page background of the target video based on the target theme color.
[0031] For example, in response to receiving a video information acquisition request initiated by a client for a target video, the target video material and the target theme color information of the keyframes are sent to the client, so that the client can directly use the target theme color of the keyframes predetermined by the server to render the playback page background of the target video. In actual applications, the number of keyframes can be multiple, and each keyframe can also have one or more target theme colors. The target theme colors of each keyframe can be sent together with the video material in the form of an RGB list, so that when the client plays the target video based on the video material, it can process the playback page background of the target video based on the RGB list to achieve effects such as dynamic color change.
[0032] In summary, the above-mentioned video processing method provided by the embodiment of the present disclosure mainly has one or more of the following advantages: 1) The target theme color of the key frame of the target video is determined by the server, and the client does not need to determine the target theme color of the key frame by itself, so the client's computing resources can be fully saved, and it also helps the client to render in time. 2) There is no need to integrate an algorithm for determining the target theme color of the video key frame for the client, which not only effectively reduces the size of the installation package corresponding to the client, but also facilitates the server to optimize and adjust the above algorithm in the future. 3) The target theme color is determined based on the sorting results of the color density of the key frame and the theme color selection conditions, which can effectively ensure the accuracy and reliability of the target theme color while ensuring that the target theme color meets the requirements. 4) The playback page background of the target video is rendered based on the target theme color, so that the playback page background matches the target video, effectively improving the user's video viewing experience.
[0033] In some implementations, the embodiments of the present disclosure provide an implementation example of obtaining a sorting result of color density of key frames, which can be performed with reference to the following steps A to C:
[0034] Step A projects the pixels in the keyframe into a preset initial color space. This initial color space can be, for example, an RGB color space (also referred to as an RGB color space), which represents colors in a cubic form by establishing the color values of the three color channels, R, G, and B, in a Cartesian coordinate system. The specific construction of the color space can be found in related art and will not be further described here.
[0035] Step B, obtains the pixel information of the key frame, and divides the initial color space according to the pixel information to obtain multiple target color spaces. In practical applications, the number of target color spaces is a multiple of 2, such as 64, 128, etc., and the specific number can be flexibly set according to demand. For example, based on the pixel information, at least one splitting operation can be performed on the initial color space until a preset number of target color spaces are obtained. The splitting operation is used to divide each current color space into two color spaces, and the current color space corresponding to the first splitting operation is the initial color space, and the current color space corresponding to the non-first splitting operation is the color space obtained by the previous splitting operation. For example, an initial color space B is first divided to obtain two color spaces B1 and B2, and then the two color spaces are divided separately, B1 is divided into B1.1 and B1.2, and B2 is divided into B2.1 and B2.2. Then, B1.1, B1.2, B2.1, and B2.2 are further divided respectively, and so on, until a preset number of color spaces are obtained. The final color space is the target color space.
[0036] Through the above method, the pixel mapping results corresponding to multiple target color spaces in the key frame can be obtained. The pixels in the key frame can be classified through the target color space, and then the pixel colors in the key frame can be analyzed in units of the target color space. This is not only convenient and efficient, but also the theme color of the key frame can be extracted more accurately.
[0037] In some specific implementation examples, the above segmentation is performed according to steps 1 to 3:
[0038] Step 1, determine the color value information of multiple target pixels projected from the key frame into the current color space and the distribution number of each target pixel in the current color space; as mentioned above, the current color space corresponding to the first segmentation operation is the initial color space, and the current color space corresponding to the non-first segmentation operation is the color space obtained by the previous segmentation operation. For example, the color values of different target pixels are different. The color value information includes the color value of the R channel, the color value of the G channel, and the color value of the B channel. In addition, in the key frame image, a pixel of a certain color value may appear more than once. For example, there may be n pixels in the key frame that are all (255, 255, 255). The distribution number can be understood as the number of times a certain color appears.
[0039] Step 2: Determine the target channel from the R channel, G channel, and B channel based on the color value information of the multiple target pixels; wherein the color value difference corresponding to the multiple target pixels in the target channel is greater than the color value difference corresponding to the multiple target pixels in other channels. It can be understood that each target pixel corresponds to an R color value, a G color value, and a B color value. The maximum color value difference corresponding to the R channel is the difference between the maximum and minimum R color values in the multiple target pixels, assuming it is Rd; the maximum color value difference corresponding to the G channel is the difference between the maximum and minimum G color values in the multiple target pixels, assuming it is Gd; the maximum color value difference corresponding to the B channel is the difference between the maximum and minimum B color values in the multiple target pixels, assuming it is Bd. Then, the color channel corresponding to the maximum value among Rd, Gd, and Bd is used as the target channel. Through the above method, the target channel with the largest color value difference can be effectively determined, so that the current color space can be subsequently segmented based on the target channel.
[0040] Step 3: Obtain the color value sorting results of the target pixels corresponding to the target channel, and divide the current color space based on the color value sorting results and the distribution number of each target pixel in the current color space.
[0041] Assuming that the target channel is the R channel, multiple target pixels are sorted in descending order based on the R color value of each target pixel, thereby obtaining a color value sorting result. Furthermore, the current color space can be divided based on the color value sorting result and the distribution number of each target pixel to obtain two divided color spaces corresponding to the current color space. In some specific implementation examples, the median color value of the color value sorting result can be determined, and based on the median color value and the distribution number of each target pixel in the current color space, the current color space can be divided to obtain two new color spaces. Among them, the color values of the target pixels corresponding to the target channel in a new color space are all greater than the median color value, and the color values of the target pixels corresponding to the target channel in another new color space are all not greater than the median color value; and the number of target pixels contained in each new color space is equal to the distribution number of each target pixel in the current color space. For ease of understanding, the specific implementation can refer to the following steps 3.1 and 3.2:
[0042] Step 3.1: Determine the median color value of the color value sorting result, and divide the plurality of target pixels into two pixel groups based on the median color value.
[0043] The median color value is the color value in the middle of the color value sorting result. For example, the color value sorting result is a descending order of color values. Based on the median color value, the color value sorting result can be divided into two groups. Accordingly, multiple target pixels can be divided into two pixel groups: the color values of the target pixels in the target channel in one pixel group are all greater than the median color value, while the color values of the target pixels in the target channel in the other pixel group are all less than the median color value. In other words, the pixels in the current color space are divided into two groups based on color value, facilitating subsequent reasonable segmentation of the current color space based on the pixel segmentation results.
[0044] Step 3.2, based on the two pixel groups and the distribution number of each target pixel in the current color space, the current color space is divided into two new color spaces; wherein, the pixel groups and the new color spaces correspond one to one, and the number of each target pixel in the corresponding pixel group contained in the new color space is equal to the distribution number of each target pixel in the current color space. That is, assuming that the number of target pixels A contained in the current color space is N1, and the number of target pixels B is N2, assuming that the pixel group to which target pixel A belongs corresponds to a new color space, then the number of target pixels A contained in this color space is N1. Assuming that the pixel group to which target pixel B belongs corresponds to another new color space, then the number of target pixels B contained in this color space is N2. Through the above method, the pixels in the current color space can be reasonably and reliably classified, the two new color spaces obtained by division can be determined, and the dominant color can be extracted based on the distribution number of target pixels.
[0045] Step C, sorting the key frames based on the color density corresponding to each of the multiple target color spaces to obtain the sorting results of the color density of the key frames. Color density can be understood as pixel density, specifically, it can be understood as the density of the target pixels of the key frames contained in the target color space. Sorting the color densities corresponding to the multiple target color spaces in descending order can obtain the descending sorting results of the color density of the key frames. The colors at the top of the descending sorting results can be regarded as occupying a dominant position in the key frames, so that on this basis, the theme color of the key frames can be reasonably and reliably determined.
[0046] Furthermore, when determining the target theme color corresponding to the key frame based on the color density sorting result and the preset theme color selection condition, the following steps a to c may be referred to:
[0047] Step a: obtaining the centroid colors of the plurality of target color spaces, and determining the corresponding theme colors of the plurality of target color spaces based on the centroid colors.
[0048] In the disclosed embodiments, the centroid color of the target color space can be directly used as the theme color of the target color space. For example, the centroid color can be obtained by separately calculating the R mean, G mean, and B mean of the target color space. Specifically, the color values of all pixels in the target color space on the R channel can be averaged to obtain the R mean. The G mean and B mean are also calculated in the same way and will not be further described here. In this way, the theme color corresponding to each target color space can be obtained quickly and conveniently.
[0049] Step b: Based on the color density sorting results, obtain descending sorting results for the theme colors corresponding to the multiple target color spaces. Assuming that the color density sorting result is in descending order, the descending sorting result for the theme colors is consistent with the descending sorting result for the color density. For example, if the color density of target color space 1 is greater than the color density of target color space 2, which is greater than the color density of target color space 3, then the descending sorting results for the theme colors are, from front to back, the theme color of target color space 1, the theme color of target color space 2, and the theme color of target color space 3.
[0050] Step c: based on the descending sorting results, select a target theme color that meets the preset theme color selection conditions. For example, the target theme colors that meet the preset theme color selection conditions can be selected from front to back.
[0051] The descending sorting result can be represented in the form of a theme color list. Starting from the first theme color, it is determined whether the theme color selection conditions are met. If so, the theme color is used as the target theme color. Then, it is determined whether the second theme color meets the theme color selection conditions, and so on, until all target theme colors that meet the theme color selection conditions are selected. For example, the theme color selection conditions include quantity constraints (such as the need to select N target theme colors) and color value constraints (the conditions that the R color value, G color value, and B color value of the target theme color need to meet). In the above way, based on the descending sorting results of the theme colors, the first N theme colors that meet the color value constraints are selected as the target theme colors.
[0052] Through the above method, a required number of target theme colors can be selected, and the color values of the selected target theme colors can meet the requirements, thereby ensuring the user's viewing experience.
[0053] Based on the above, a method for determining a target theme color can be referred to as a flowchart shown in FIG2 , which mainly includes the following steps S202 to S210:
[0054] Step S202: extract key frames from the target video at preset time intervals.
[0055] Step S204: Projecting the pixels in the key frame into a preset initial color space.
[0056] Step S206, determining the color value information of multiple target pixels projected from the key frame into the current color space and the distribution number of each target pixel in the current color space; wherein, different target pixels have different color values; in the first segmentation operation, the current color space is the initial color space; in a non-first segmentation operation, the current color space is the color space obtained by the previous segmentation.
[0057] Step S208, determining a target channel from the R channel, the G channel, and the B channel based on the color value information of the multiple target pixels; wherein the color value difference corresponding to the multiple target pixels in the target channel is greater than the color value difference corresponding to the multiple target pixels in other channels.
[0058] Step S210 , obtaining a color value sorting result corresponding to a plurality of target pixels in a target channel, and dividing the current color space into two color spaces based on the color value sorting result and the distribution number of each target pixel in the current color space.
[0059] Step S212: Determine whether the number of existing color spaces has reached a preset number. If so, execute step S214; if not, return to step S206. The color space is continuously divided through the above recursive method until the desired preset number of target color spaces is reached.
[0060] Step S214 , sorting the color densities of the key frames corresponding to the preset number of target color spaces obtained by segmentation to obtain a sorting result of the color densities of the key frames.
[0061] Step S216 , obtaining the centroid colors of the plurality of target color spaces, and determining the theme colors corresponding to the plurality of target color spaces based on the centroid colors.
[0062] Step S218 : obtaining descending sorting results of the theme colors corresponding to the plurality of target color spaces based on the sorting results of the color densities.
[0063] Step S220 : Based on the descending sorting result of the theme colors, a target theme color that meets the preset theme color selection conditions is selected from front to back.
[0064] Through the above method, the target theme color of the key frame of the target video can be reasonably and reliably selected by the server. The specific implementation of the above steps can refer to the above related content and is not limited here.
[0065] After the server determines the target theme color corresponding to the key frame of the target video using the above-mentioned method provided by the embodiment of the present disclosure, it can send the target theme color corresponding to the key frame to the client, so that the client can directly render the playback page background of the target video based on the target theme color. For example, the embodiment of the present disclosure provides a specific implementation method for the client to render the playback page background of the target video based on the target theme color, such as, it can include the following steps 1) to 3):
[0066] Step 1) Determine the video time information corresponding to the target theme color of the key frame based on the total duration of the target video and the number of key frames. It is understandable that the server in the embodiment of the present disclosure may not attach a timestamp to each key frame, or may not inform the client of the specific time interval for extracting key frames. Instead, the client calculates the timestamp information corresponding to the target theme color of each key frame based on the total duration of the target video and the number of key frames. In specific implementation, the server and the client may pre-agree to extract key frames at equal intervals, but the server does not need to send the specific time interval used to extract key frames or the time of each key frame to the client. The client can directly determine the time interval between adjacent key frames through the ratio of the total duration of the target video to the number of key frames, and then determine the video time corresponding to the target theme color of each key frame. This not only saves storage and bandwidth, but also facilitates the server to dynamically adjust the frame extraction interval.
[0067] Step 2) Determine the theme color information corresponding to the time period between adjacent key frames based on the video time information corresponding to the target theme color. Specifically, based on the target theme colors corresponding to the adjacent key frames, a color gradient algorithm can be used to determine the theme color for each specified moment in the time period between the adjacent key frames. The specified moment can be determined based on, for example, the ratio of the time period to a preset time interval, or based on the playback time of the target video frame contained in the adjacent key frames. The specific setting can be flexibly determined according to needs.
[0068] For ease of understanding, it is assumed that adjacent key frames include key frame A at time T1 and key frame B at time T2, key frame A corresponds to theme color A, and key frame B corresponds to theme color B. At this time, based on theme color A and theme color B, the gradient theme colors corresponding to multiple moments in the period between time T1 and time T2 can be determined, so that the theme color A at time T1 can be gradually and dynamically faded to the theme color B at time T2, ensuring the user's visual experience.
[0069] Step 3) Render the playback page background of the target video according to the target theme color corresponding to the key frame and the theme color information corresponding to the time period between adjacent key frames.
[0070] By rendering the playback page background of the target video in the above manner, the playback page background can be dynamically matched with the target video, presenting an immersive experience for users watching the target video and greatly improving the user experience.
[0071] The above technical solution provided by the embodiment of the present disclosure can obtain the key frames of the target video through the server, and determine the target theme color corresponding to the key frames based on the sorting results of the color density of the key frames and the theme color selection conditions, and send it to the client, which helps the client to directly render the playback page background of the target video based on the target theme color of the key frames. The above method mainly has one or more of the following advantages: 1) The target theme color of the key frames of the target video is determined by the server, and the client does not need to determine the target theme color of the key frames itself, thereby fully saving the client's computing resources and also helping the client to render in time. 2) There is no need to integrate the algorithm for determining the target theme color of the video key frames into the client, which not only effectively reduces the size of the installation package corresponding to the client, but also facilitates the server to subsequently optimize and adjust the above algorithm. 3) The target theme color is determined based on the sorting results of the color density of the key frames and the theme color selection conditions, which effectively guarantees the accuracy and reliability of the target theme color while ensuring that the target theme color meets the requirements. 4) The playback page background of the target video is rendered based on the target theme color, so that the playback page background matches the target video, effectively improving the user's video viewing experience. In summary, the rendering method of the video playback page background provided by the embodiment of the present disclosure is better. While reducing the burden on the client, it can effectively ensure the rendering effect and better improve the user's video viewing experience.
[0072] Corresponding to the aforementioned video processing method, FIG3 is a schematic structural diagram of a video processing device provided by an embodiment of the present disclosure. The device can be implemented by software and / or hardware, and can generally be integrated into an electronic device and applied to a server. As shown in FIG3 , the device includes:
[0073] A key frame acquisition module 302 is used to acquire key frames of a target video;
[0074] The target theme color determination module 304 is configured to obtain the color density sorting results of the key frames and determine the target theme color corresponding to the key frames based on the color density sorting results and a preset theme color selection condition;
[0075] The background rendering module 306 is configured to send information about the target theme color of the key frame to the client, so that the client renders the background of the playback page of the target video based on the target theme color.
[0076] The above method mainly has one or more of the following advantages: 1) The target theme color of the key frame of the target video is determined by the server, and the client does not need to determine the target theme color of the key frame by itself, so the client's computing resources can be fully saved, and it also helps the client to render in time. 2) There is no need to integrate an algorithm for determining the target theme color of the video key frame for the client, which not only effectively reduces the size of the installation package corresponding to the client, but also facilitates the server to optimize and adjust the above algorithm in the future. 3) The target theme color is determined based on the sorting results of the color density of the key frame and the theme color selection conditions, which can effectively ensure the accuracy and reliability of the target theme color while ensuring that the target theme color meets the requirements. 4) The playback page background of the target video is rendered based on the target theme color, so that the playback page background matches the target video, effectively improving the user's video viewing experience.
[0077] In some embodiments, the target theme color determination module 304 is specifically used to: project the pixels in the key frame to a preset initial color space; obtain pixel information of the key frame, and divide the initial color space according to the pixel information to obtain multiple target color spaces; sort the key frames based on the color density corresponding to each of the multiple target color spaces to obtain a sorting result of the color density of the key frames.
[0078] In some embodiments, the target theme color determination module 304 is specifically configured to perform at least one splitting operation on the initial color space based on the pixel information until a predetermined number of target color spaces are obtained. The splitting operation is configured to split each current color space into two color spaces, with the current color space corresponding to the first splitting operation being the initial color space, and the current color space corresponding to a non-first splitting operation being the color space obtained by the previous splitting operation.
[0079] In some embodiments, the segmentation operation includes: determining the color value information of multiple target pixels projected from the key frame into the current color space and the distribution number of each target pixel in the current color space; determining the target channel from the R channel, the G channel, and the B channel based on the color value information of the multiple target pixels; wherein the color value difference corresponding to the multiple target pixels in the target channel is greater than the color value difference corresponding to the multiple target pixels in other channels; obtaining the color value sorting results corresponding to the multiple target pixels in the target channel, and segmenting the current color space based on the color value sorting results and the distribution number of each target pixel in the current color space.
[0080] In some embodiments, the splitting operation further includes: determining a median color value of the color value sorting result, and based on the median color value and the distribution number of each target pixel in the current color space, splitting the current color space into two new color spaces.
[0081] In some embodiments, the target theme color determination module 304 is specifically used to: obtain the centroid color of each of the multiple target color spaces, and determine the theme colors corresponding to each of the multiple target color spaces based on the centroid color; obtain the descending sorting results of the theme colors corresponding to each of the multiple target color spaces based on the sorting results of color density; based on the descending sorting results, select the target theme color that meets the preset theme color selection conditions.
[0082] In some implementations, the preset theme color selection conditions include: a quantity constraint condition for target theme colors.
[0083] In some implementations, the preset theme color selection conditions further include: color value constraints of the target theme color.
[0084] In some embodiments, the color value constraint condition includes: the differences between the color values of the R channel, the G channel, and the B channel of the target theme color are not all less than a preset threshold.
[0085] In some implementations, the key frame acquisition module 302 is specifically configured to extract key frames from the target video at preset time intervals.
[0086] In some embodiments, the background rendering module 306 is specifically used to: determine the video time information corresponding to the target theme color of the key frame based on the total length of the target video and the number of key frames; determine the theme color information corresponding to the time period between adjacent key frames based on the video time information corresponding to the target theme color; render the playback page background of the target video according to the target theme color corresponding to the key frame and the theme color information corresponding to the time period between adjacent key frames.
[0087] The video processing device provided in the embodiments of the present disclosure can execute the video processing method provided in any embodiment of the present disclosure, and has the corresponding functional modules and beneficial effects of the execution method.
[0088] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the above-described device embodiment can refer to the corresponding process in the method embodiment, and will not be repeated here.
[0089] FIG4 is a schematic diagram of the structure of an electronic device provided by an embodiment of the present disclosure. As shown in FIG4 , the electronic device 400 includes one or more processors 401 and a memory 402 .
[0090] The processor 401 may be a central processing unit (CPU) or other forms of processing units having data processing capabilities and / or instruction execution capabilities, and may control other components in the electronic device 400 to perform desired functions.
[0091] The memory 402 may include one or more computer program products, which may include various forms of computer-readable storage media, such as volatile memory and / or non-volatile memory. The volatile memory may include, for example, random access memory (RAM) and / or cache memory. The non-volatile memory may include, for example, read-only memory (ROM), a hard disk, a flash memory, etc. One or more computer program instructions may be stored on the computer-readable storage medium, and the processor 401 may execute the program instructions to implement the video processing method of the embodiment of the present disclosure described above and / or other desired functions. Various contents such as input signals, signal components, noise components, etc. may also be stored in the computer-readable storage medium.
[0092] In one example, the electronic device 400 may further include an input device 403 and an output device 404 , and these components are interconnected via a bus system and / or other forms of connection mechanisms (not shown).
[0093] In addition, the input device 403 may also include, for example, a keyboard, a mouse, and the like.
[0094] The output device 404 can output various information to the outside, including determined distance information, direction information, etc. The output device 404 can include, for example, a display, a speaker, a printer, a communication network and its connected remote output device, etc.
[0095] Of course, for simplicity, FIG4 only shows some of the components related to the present disclosure in the electronic device 400, omitting components such as buses, input / output interfaces, etc. In addition, the electronic device 400 may further include any other appropriate components according to specific application scenarios.
[0096] In addition to the above-mentioned method and device, the embodiment of the present disclosure may also be a computer program product, which includes computer program instructions. When the computer program instructions are executed by a processor, the processor executes the video processing method provided by the embodiment of the present disclosure.
[0097] The computer program product may be written in any combination of one or more programming languages to implement the operations of the disclosed embodiments, including object-oriented programming languages such as Java, C++, and conventional procedural programming languages such as C or similar programming languages. The program code may be executed entirely on the user's computing device, partially on the user's computing device, as a standalone software package, partially on the user's computing device and partially on a remote computing device, or entirely on a remote computing device or server.
[0098] In addition, the embodiment of the present disclosure may also be a computer-readable storage medium having computer program instructions stored thereon. When the computer program instructions are executed by a processor, the processor is enabled to execute the video processing method provided by the embodiment of the present disclosure.
[0099] The computer-readable storage medium can adopt any combination of one or more readable media. The readable medium can be a readable signal medium or a readable storage medium. The readable storage medium can, for example, include but is not limited to a system, device or component of electricity, magnetism, light, electromagnetic, infrared, or semiconductor, or any combination thereof. More specific examples (non-exhaustive list) of readable storage media include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof.
[0100] The embodiments of the present disclosure further provide a computer program product, including a computer program / instruction, which implements the video processing method in the embodiments of the present disclosure when executed by a processor.
[0101] It is understandable that before using the technical solutions disclosed in the various embodiments of this disclosure, the type, scope of use, usage scenarios, etc. of the personal information involved in this disclosure should be informed to the user and the user's authorization should be obtained in an appropriate manner in accordance with relevant laws and regulations.
[0102] For example, in response to a user's active request, a prompt message is sent to the user to clearly inform the user that the operation requested will require the acquisition and use of the user's personal information. This allows the user to independently choose whether to provide personal information to the electronic device, application, server, storage medium, or other software or hardware that performs the operations of the disclosed technical solution based on the prompt message.
[0103] As an optional but non-limiting implementation, in response to receiving a user's active request, the prompt information may be sent to the user in the form of a pop-up window, in which the prompt information may be presented in text form. Furthermore, the pop-up window may also contain a selection control for the user to select "agree" or "disagree" to provide personal information to the electronic device.
[0104] It is understandable that the above notification and user authorization process are merely illustrative and do not constitute a limitation on the implementation of the present disclosure. Other methods that comply with relevant laws and regulations may also be applied to the implementation of the present disclosure.
[0105] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article, or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or device. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of other identical elements in the process, method, article, or device comprising the element.
[0106] The foregoing description is intended only to provide specific embodiments of the present disclosure, intended to enable those skilled in the art to understand and implement the present disclosure. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present disclosure. Therefore, the present disclosure is not intended to be limited to the embodiments described herein, but rather to be construed in the broadest manner consistent with the principles and novel features disclosed herein.
Claims
1. A video processing method, characterized in that: Applicable to servers, including: Get the key frame of the target video; Obtaining a sorting result of the color density of the key frame, and determining a target theme color corresponding to the key frame based on the sorting result of the color density and a preset theme color selection condition; The target theme color information of the key frame is sent to the client, so that the client renders the playback page background of the target video based on the target theme color.
2. The method according to claim 1, characterized in that The step of obtaining the sorting result of the color density of the key frames includes: Projecting pixels in the key frame to a preset initial color space; Acquiring pixel information of the key frame, and dividing the initial color space according to the pixel information to obtain a plurality of target color spaces; The key frames corresponding to the multiple target color spaces are sorted based on their color densities to obtain sorting results of the color densities of the key frames.
3. The method according to claim 2, characterized in that The dividing the initial color space according to the pixel information to obtain a plurality of target color spaces includes: According to the pixel information, at least one segmentation operation is performed on the initial color space until a preset number of target color spaces are obtained.
4. The method according to claim 2 or 3, characterized in that: The segmentation is performed according to the following steps: Determine the color value information of multiple target pixels projected from the key frame into the current color space and the distribution quantity of each target pixel in the current color space; wherein the current color space corresponding to the first segmentation operation is the initial color space, and the current color space corresponding to the non-first segmentation operation is the color space obtained by the last segmentation operation; Determine a target channel from the R channel, the G channel, and the B channel according to the color value information of the multiple target pixels; wherein the color value difference corresponding to the multiple target pixels in the target channel is greater than the color value difference corresponding to the multiple target pixels in other channels; Obtain color value sorting results corresponding to the plurality of target pixels in the target channel, and divide the current color space based on the color value sorting results and the distribution quantity of each of the target pixels in the current color space.
5. The method according to claim 4, characterized in that The dividing the current color space based on the color value sorting result and the distribution quantity of each of the target pixels in the current color space includes: The median color value of the color value sorting result is determined, and based on the median color value and the distribution quantity of each of the target pixels in the current color space, the current color space is divided into two new color spaces.
6. The method according to claim 2, characterized in that Determining a target theme color corresponding to the key frame based on the sorting result of the color density and a preset theme color selection condition includes: Acquire the centroid color of each of the plurality of target color spaces, and determine the theme color corresponding to each of the plurality of target color spaces based on the centroid color; Based on the sorting results of the color densities, obtaining descending sorting results of the theme colors corresponding to the multiple target color spaces; Based on the descending sorting result, a target theme color that meets the preset theme color selection condition is selected.
7. The method according to claim 1, characterized in that The preset theme color selection condition includes: a quantity constraint condition of the target theme color.
8. The method according to claim 7, characterized in that The preset theme color selection condition also includes: a color value constraint condition of the target theme color.
9. The method according to claim 8, characterized in that The color value constraint condition includes: the differences between the color values of the R channel, the G channel, and the B channel of the target theme color are not all less than a preset threshold.
10. The method according to claim 1, characterized in that The step of obtaining a key frame of a target video includes: Extract key frames from the target video at preset time intervals.
11. The method according to claim 1, characterized in that: The rendering of the playback page background of the target video based on the target theme color includes: Based on the total duration of the target video and the number of the key frames, determining the video time information corresponding to the target theme color of the key frame; Determine the theme color information corresponding to the time period between adjacent key frames based on the video time information corresponding to the target theme color; The playback page background of the target video is rendered according to the target theme color corresponding to the key frame and the theme color information corresponding to the time period between the adjacent key frames.
12. A video processing device, characterized in that: Applicable to servers, including: A key frame acquisition module is used to acquire the key frames of the target video; A target theme color determination module, used to obtain the sorting result of the color density of the key frame, and determine the target theme color corresponding to the key frame based on the sorting result of the color density and a preset theme color selection condition; The background rendering module is used to send information of the target theme color of the key frame to the client, so that the client renders the playback page background of the target video based on the target theme color.
13. An electronic device, characterized in that: The electronic device comprises: processor; a memory for storing instructions executable by the processor; The processor is used to read the executable instructions from the memory and execute the instructions to implement the video processing method described in any one of claims 1-11.
14. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, and the computer program is used to execute the video processing method described in any one of claims 1 to 11.
15. A computer program product, characterized in that The invention comprises a computer program, which implements the video processing method according to any one of claims 1 to 11 when being executed by a processor.
Citation Information
Patent Citations
Video processing method and device, equipment and medium
CN118828091A
Video playing method and system based on virtual reality technology
CN107135420A
Color adjustment method and device for interface assembly, equipment and medium
CN109783178A
Character color adjusting method, system and device and machine readable medium
CN111125999A
Page display method and device and electronic equipment
CN112256366A
