Video encoding method, device, equipment and storage medium
By filtering and optimizing video frames and filling gaps in the video sequence, combined with appropriate encoding parameters, the quality problem of video encoding in different network and device environments is solved, and the video transmission quality and user experience are improved.
Patent Information
- Application Number
- CN202411045792.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-01
- Publication Date
- 2024-10-29
- Estimated Expiration
- 2044-08-01
AI Technical Summary
Existing video encoding methods can easily lead to a decrease in video quality and affect the user's viewing experience in video transmission environments under different network conditions and user equipment performance.
By screening key frames, optimizing key frames, and filling gaps in the intermediate video sequence, and finally using appropriate encoding parameters to encode the target video sequence, the network environment and user equipment performance are comprehensively considered to optimize the video transmission process.
Maintain optimal video quality and improve users' video viewing experience under different network conditions and limited user equipment performance.
Smart Images

Figure CN118573870B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of video encoding technology, and in particular to a video encoding method, device, equipment and storage medium. Background Art
[0002] With the rapid development of the Internet and emerging technologies, the volume of video data has increased dramatically, placing higher demands on transmission bandwidth and storage space. In order to meet these challenges and achieve high-quality video transmission, video coding optimization has become an important research field.
[0003] Although existing video encoding methods can provide higher quality videos, they have extremely high requirements on computing resources and are easily limited by user device performance and network conditions, which leads to a decrease in video quality during video transmission, thereby affecting the user's video viewing experience. Summary of the invention
[0004] The present invention provides a video encoding method, apparatus, device and storage medium to improve the video quality in a video transmission environment with different network conditions and different user equipment performances, thereby improving the video viewing experience of different users.
[0005] According to one aspect of the present invention, a video encoding method is provided, the method comprising:
[0006] Filtering at least one key frame from the original video sequence according to current network conditions of the current encoding cycle, payload data of the decoder decoding the video frame in the original video sequence, and image quality data of the video frame;
[0007] Optimize each key frame according to the current network conditions to obtain an optimized frame corresponding to each key frame and an intermediate video sequence including each optimized frame;
[0008] Filling the visual blanks in the intermediate video sequence to obtain the target video sequence;
[0009] The target video sequence is encoded using the current encoding parameters of the current encoding cycle.
[0010] According to another aspect of the present invention, a video encoding device is provided, the device comprising:
[0011] A key frame screening module, configured to screen out at least one key frame from the original video sequence according to the current network conditions of the current encoding cycle, the load data of the decoder decoding the video frame in the original video sequence, and the image quality data of the video frame;
[0012] An intermediate video sequence determination module is used to optimize each key frame according to the current network conditions to obtain an optimized frame corresponding to each key frame and an intermediate video sequence including each optimized frame;
[0013] A target video sequence determination module is used to fill in the visual blanks in the intermediate video sequence to obtain a target video sequence;
[0014] The video encoding module is used to encode the target video sequence using the current encoding parameters of the current encoding cycle.
[0015] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising:
[0016] at least one processor; and
[0017] a memory communicatively connected to at least one processor; wherein,
[0018] The memory stores a computer program that can be executed by at least one processor. The computer program is executed by the at least one processor so that the at least one processor can execute the video encoding method according to any embodiment of the present invention.
[0019] According to another aspect of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the video encoding method of any embodiment of the present invention when executed.
[0020] According to another aspect of the present invention, a computer program product is provided, including a computer program, and when the computer program is executed by a processor, the video encoding method according to any embodiment of the present invention is implemented.
[0021] The technical solution of the embodiment of the present invention is to select at least one key frame from the original video sequence according to the current network conditions of the current encoding cycle, the load data of the decoder decoding the video frames in the original video sequence, and the image quality data of the video frames; optimize each key frame according to the current network conditions to obtain the optimized frames corresponding to each key frame, and the intermediate video sequence including each optimized frame; fill the visual blanks in the intermediate video sequence to obtain the target video sequence; and encode the target video sequence using the current encoding parameters of the current encoding cycle. The above technical solution comprehensively considers the influence of the network environment and the user equipment performance on the video encoding during the video transmission process, and optimizes the original video sequence by analyzing the influence of the current network conditions of the current encoding cycle and the user equipment performance data on the video frames to obtain the target video sequence, so that the obtained target video sequence can maintain the best video quality in the video transmission environment with limited current network conditions and user equipment performance, thereby improving the video quality in the video transmission environment with different network conditions and different user equipment performance, thereby improving the video viewing experience of different users.
[0022] 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 invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0024] Figure 1 is a flowchart of a video encoding method provided according to Embodiment 1 of the present invention;
[0025] Figure 2 is a flowchart of a video encoding method provided according to Embodiment 2 of the present invention;
[0026] Figure 3 is a structural schematic diagram of a video encoding device provided according to Embodiment 3 of the present invention;
[0027] Figure 4 It is a structural schematic diagram of an electronic device for implementing the video encoding method according to an embodiment of the present invention. DETAILED DESCRIPTION
[0028] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0029] It should be noted that the terms "original", "intermediate", "target", "first" and "second" in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0030] In addition, it should be noted that in the technical solution of the present invention, the collection, storage, use, processing, transmission, provision and disclosure of the current network conditions, the load data of the decoder to decode the video frames in the original video sequence, the picture quality data of the video frames, and the current encoding parameters, etc., all comply with the provisions of relevant laws and regulations and do not violate public order and good morals.
[0031] Embodiment 1
[0032] Figure 1 This is a flowchart of a video encoding method provided in the first embodiment of the present invention. This embodiment is applicable to the case of encoding a video in a variable video transmission environment, especially to the case of encoding a video in a video transmission environment with an unstable network environment or limited user equipment performance. The method can be executed by a video encoding device, which can be implemented in the form of hardware and / or software and can be configured in an electronic device. Figure 1 As shown, the method includes:
[0033] S101. Filter out at least one key frame from an original video sequence according to a current network condition of a current encoding cycle, payload data of a decoder decoding a video frame in an original video sequence, and image quality data of the video frame.
[0034] Among them, the current encoding cycle refers to the encoding cycle for encoding the original video sequence. The original video sequence refers to an uncompressed video sequence. The current network condition refers to the network condition for video transmission in the current encoding cycle; optionally, the current network condition includes but is not limited to network bandwidth, network delay and packet loss rate. It should be noted that the decoder refers to a video decoder used to decode the video in the user device. The user device refers to a device that can receive, parse and play videos, for example, the user device can be a mobile phone or a laptop. Load data refers to the relevant data generated when the decoder decodes the video frames in the original video sequence; optionally, the load data includes but is not limited to CPU usage and memory occupancy. Image quality data refers to data that affects the picture quality of the video frame; optionally, the image quality data includes but is not limited to the content complexity and historical usage frequency of the video frame; wherein the historical usage frequency refers to the frequency at which the video frame was used in the historical encoding cycle. Key frame refers to a representative video frame in the original video sequence.
[0035] Specifically, for each video frame in the original video sequence, the cost value corresponding to the video frame can be calculated based on the cost function according to the current network conditions of the current encoding cycle, the load data of the decoder decoding the video frame, and the image quality data of the video frame, so that the cost value corresponding to each video frame in the original video sequence can be obtained; according to the cost value corresponding to each video frame, the video frame with a cost value less than a preset cost value in each video frame is used as a key frame. Among them, the cost function can be pre-constructed according to actual business needs, and the embodiment of the present invention does not make specific limitations on it. The preset cost value can be pre-set according to the experience of those skilled in the art, and the embodiment of the present invention does not make specific limitations on it.
[0036] It can be understood that by analyzing the current network conditions of the current encoding cycle and the device performance data of the user device (i.e., the load data of the decoder decoding the video frames in the original video sequence), key frames that are more adaptable to the current conditions are selected from the original video sequence, thereby improving the video quality and reducing the encoding workload in the video transmission process, thereby ensuring that the original video sequence can maintain the best video quality under different network conditions and on different user devices.
[0037] S102: Optimize each key frame according to the current network condition to obtain an optimized frame corresponding to each key frame and an intermediate video sequence including each optimized frame.
[0038] The optimized frame refers to a video frame obtained after the key frame is optimized, and the intermediate video sequence refers to a video sequence consisting of at least two optimized frames.
[0039] Specifically, for each key frame, based on the correspondence between the network condition and the video sharpening function, the current video sharpening function corresponding to the current network condition is determined; based on the current video sharpening function and the preset video noise reduction function, the key frame is optimized by the following formula to obtain the optimized frame corresponding to the key frame:
[0040] ;
[0041] in, is the optimized frame corresponding to the key frame, is a key frame, is the preset video noise reduction function. is the current video sharpening function, and alpha is the optimization emphasis coefficient. It should be noted that alpha can be obtained by repeatedly optimizing key frames under different network conditions and different user equipment conditions.
[0042] Based on the above principle, the optimized frames corresponding to each key frame can be obtained; then, according to the frame position of each key frame in the original video sequence, the obtained optimized frames are arranged in order to obtain an intermediate video sequence.
[0043] It can be understood that by optimizing the key frames according to the current network conditions, the visual quality of the key frames is improved without increasing the burden of video transmission, so that the obtained optimized frames can better adapt to the ever-changing network environment, and the video transmission can maintain the best video quality even when the bandwidth is limited, so that users under different network conditions can get the best visual experience, thereby improving the visual quality and image clarity of the intermediate video sequence, and to a certain extent, can better resist the quality loss in the subsequent encoding process.
[0044] S103: Fill the visual blanks in the intermediate video sequence to obtain a target video sequence.
[0045] The visual blank refers to the black or white blank screen that appears in the middle video sequence. The target video sequence refers to the video sequence obtained after the blank is filled in the middle video sequence.
[0046] Specifically, for each visual blank in the intermediate video sequence, determine the blank position of the visual blank in the intermediate video sequence; according to the blank position, determine a first reference frame located before the blank position and a second reference frame located after the blank position; wherein the frame positions of the first reference frame and the second reference frame are both adjacent to the blank position; generate an intermediate frame between the first reference frame and the second reference frame to fill the visual blank with the intermediate frame. Similarly, all visual blanks in the intermediate video sequence can be filled, thereby obtaining a target video sequence.
[0047] The generating of the intermediate frame between the first reference frame and the second reference frame may include: calculating the actual pixel difference between the second reference frame and the first reference frame; determining the prediction error compensation of the predicted pixel difference and the actual pixel difference in the process of transitioning from the first reference frame to the second reference frame; and generating the intermediate frame between the first reference frame and the second reference frame by the following formula according to the first reference frame, the actual pixel difference and the prediction error compensation:
[0048] ;
[0049] in, is the middle frame, is the first reference frame, is the second reference frame, is the actual pixel difference, is prediction error compensation; lambda is a frame position adjustment coefficient, which is used to adjust the relative position of the intermediate frame between the first reference frame and the second reference frame; gamma is a control coefficient, which is used to control the influence of prediction error compensation on blank filling. It should be noted that lambda can be determined through repeated experiments, and gamma can be preset according to the experience of those skilled in the art.
[0050] It can be understood that by filling the visual gaps in the intermediate video sequence, the smoothness between consecutive video frames in the intermediate video sequence can be enhanced, the visual jitter or visual blur caused by frame jumping can be reduced, and the visual artifacts can be reduced, thereby improving the visual quality and visual coherence of the target video sequence.
[0051] S104: Encode the target video sequence using the current encoding parameters of the current encoding cycle.
[0052] Among them, the current encoding parameters refer to the encoding parameters of the encoder in the current encoding cycle; optionally, the current encoding parameters include but are not limited to video bit rate, video frame rate and video resolution.
[0053] Specifically, for each video frame in the target video sequence, a target coding layer corresponding to the video frame is determined from at least two preset coding layers of the encoder; the video frame is encoded in the target coding layer using the current coding parameters of the current coding cycle. The preset coding layer can be preset based on the experience of those skilled in the art; optionally, the preset coding layer can include a high-quality coding layer and a low-quality coding layer. The target coding layer refers to the preset coding layer actually used to encode the video frame.
[0054] More specifically, for each video frame in the target video sequence, according to the expected coding efficiency and expected bandwidth consumption of each preset coding layer in the encoder for the video frame, a comprehensive processing score of encoding the video frame by each preset coding layer is determined; according to the comprehensive processing score of encoding the video frame by each preset coding layer, a target coding layer corresponding to the video frame is determined from at least two preset coding layers of the encoder by the following formula;
[0055] ;
[0056] in, is the target processing layer corresponding to the jth video frame in the target video sequence, is the comprehensive processing score of the i-th preset coding layer in the encoder encoding the j-th video frame in the target video sequence, Used to determine a preset coding layer with the largest comprehensive processing score from at least two preset coding layers of the encoder. It should be noted that i and j are both positive integers.
[0057] Afterwards, the video frame is encoded at the target encoding layer using the current encoding parameters of the current encoding cycle, so that each video frame in the target video sequence can be encoded in the most appropriate manner.
[0058] The technical solution of the embodiment of the present invention is to select at least one key frame from the original video sequence according to the current network conditions of the current encoding cycle, the load data of the decoder decoding the video frames in the original video sequence, and the image quality data of the video frames; optimize each key frame according to the current network conditions to obtain the optimized frames corresponding to each key frame, and the intermediate video sequence including each optimized frame; fill the visual blanks in the intermediate video sequence to obtain the target video sequence; and encode the target video sequence using the current encoding parameters of the current encoding cycle. The above technical solution comprehensively considers the influence of the network environment and the user equipment performance on the video encoding during the video transmission process, and optimizes the original video sequence by analyzing the influence of the current network conditions of the current encoding cycle and the user equipment performance data on the video frames to obtain the target video sequence, so that the obtained target video sequence can maintain the best video quality in the video transmission environment with limited current network conditions and user equipment performance, thereby improving the video quality in the video transmission environment with different network conditions and different user equipment performance, thereby improving the video viewing experience of different users.
[0059] Embodiment 2
[0060] Figure 2This is a flowchart of a video encoding method provided in Example 2 of the present invention. Based on the above-mentioned example, this example further optimizes "selecting at least one key frame from the original video sequence according to the current network conditions of the current encoding cycle, the load data of the decoder decoding the video frames in the original video sequence, and the image quality data of the video frames", and provides an optional implementation scheme. It should be noted that for the parts not described in detail in the examples of the present invention, reference can be made to the relevant descriptions of other examples. Figure 2 As shown, the method includes:
[0061] S201. Determine a network score corresponding to a video frame in an original video sequence according to a current network condition in a current encoding cycle; wherein the current network condition includes a network delay and a packet loss rate.
[0062] The network score is used to reflect the impact of the current network condition on the video frame. Optionally, the current network condition may also include network bandwidth.
[0063] Specifically, for each video frame in the original video sequence, the expected network delay and expected packet loss rate corresponding to the video frame under the current network conditions are determined through a preset network prediction model according to the current network conditions of the current encoding cycle; the first information entropy of the expected network delay and the second information entropy of the expected packet loss rate are calculated with the expected network delay and the expected packet loss rate as network indicators, and the first weight corresponding to the expected network delay and the second weight corresponding to the expected packet loss rate are determined according to the first information entropy and the second information entropy; according to the first weight and the second weight, the expected network delay and the expected packet loss rate are weighted and averaged by the following formula to obtain the network score corresponding to the video frame:
[0064] ;
[0065] in, is the network score corresponding to the video frame, n is the current network condition, is the expected network delay corresponding to the video frame under the current network conditions, is the expected packet loss rate corresponding to the video frame under the current network conditions; is the first weight corresponding to the expected network delay, is the second weight corresponding to the expected packet loss rate.
[0066] It should be noted that the expected network delay refers to the network delay obtained by prediction for transmitting the video frame under the current network conditions in the current coding cycle; correspondingly, the expected packet loss rate refers to the ratio of the number of times the video frame is lost during the transmission of the video frame under the current network conditions in the current coding cycle to the total number of times the video frame is sent. Based on the above principle, the network score corresponding to each video frame in the original video sequence can be obtained.
[0067] S202: Determine a device load score corresponding to a video frame according to load data obtained by decoding a video frame in an original video sequence by a decoder.
[0068] The device load score is used to reflect the load capacity of the decoder in the user device to decode the video frames in the original video sequence. The user device refers to a device that can receive, parse and play videos, for example, a mobile phone or a laptop.
[0069] Specifically, for each video frame in the original video sequence, the decoder load capacity corresponding to the video frame is determined according to the CPU usage and memory occupancy when the decoder decodes the video frame; based on the correspondence between the device load capacity and the device load score, the device load score corresponding to the video frame is determined according to the decoder load capacity.
[0070] More specifically, for each video frame in the original video sequence, the product of the CPU usage and memory occupancy when the decoder decodes the video frame can be calculated, and the product can be used as the decoder load capacity corresponding to the video frame; based on the correspondence between the device load capacity and the device load score, the decoder load capacity is used as the retrieval condition, and the device load score corresponding to the video frame is determined from the device load score table. Among them, the device load score table can be obtained through a large number of experiments combined with the experience of technical personnel in this field. It should be noted that the device load score table includes a device load capacity field and a device load score field.
[0071] Based on the above principle, the device load score corresponding to each video frame in the original video sequence can be obtained.
[0072] S203. Determine a quality restoration potential score corresponding to the video frame according to the image quality data of the video frame; wherein the image quality data includes content complexity and historical usage frequency.
[0073] The image quality data refers to the data that affects the image quality of the video frame. The content complexity refers to the content complexity of the video frame. The historical usage frequency refers to the frequency at which the video frame is used in the historical encoding cycle.
[0074] Specifically, for each video frame in the original video sequence, the content complexity and historical usage frequency of the video frame can be weighted and summed to obtain the image quality restoration potential score corresponding to the video frame. Based on the above principle, the image quality restoration potential score corresponding to each video frame in the original video sequence can be obtained.
[0075] S204: Filter out at least one key frame from the original video sequence according to the network score, device load score, and image quality restoration potential score corresponding to each video frame.
[0076] Specifically, for each video frame, the network score, device load score, and image quality restoration potential score corresponding to the video frame are weighted and summed to obtain a comprehensive score corresponding to the video frame; and at least one key frame is selected from the original video sequence according to a preset score threshold and the comprehensive score corresponding to each video frame. The preset score threshold can be preset according to actual business needs or the experience of those skilled in the art, and the embodiment of the present invention does not specifically limit it.
[0077] More specifically, for each video frame in the original video sequence, the network score, device load score, and image quality restoration potential score corresponding to the video frame are weighted and summed using the following formula to obtain a comprehensive score corresponding to the video frame:
[0078] ;
[0079] in, is the comprehensive score corresponding to the i-th video frame in the original video sequence, is the i-th video frame in the original video sequence, for The corresponding network score, n is the current network condition, for The corresponding device load score, d is the user device, for The corresponding image quality restoration potential score, , and is the weight coefficient. It should be noted that , and It can be preset according to actual business needs and combined with the experience of technical personnel in this field, and the present invention does not make any specific limitation on it.
[0080] Based on the above principle, a comprehensive score corresponding to each video frame in the original video sequence can be obtained; for each comprehensive score, if the comprehensive score is greater than a preset score threshold, the video frame corresponding to the comprehensive score is determined as a key frame, so that at least one key frame can be screened out from the original video sequence.
[0081] S205 . Optimize each key frame according to the current network condition to obtain an optimized frame corresponding to each key frame and an intermediate video sequence including each optimized frame.
[0082] S206: Fill the visual blanks in the intermediate video sequence to obtain a target video sequence.
[0083] S207: Encode the target video sequence using the current encoding parameters of the current encoding cycle.
[0084] The technical solution of the embodiment of the present invention determines the network score corresponding to the video frame in the original video sequence according to the current network condition of the current encoding cycle; wherein the current network condition includes network delay and packet loss rate; determines the device load score corresponding to the video frame according to the load data of the decoder decoding the video frame in the original video sequence; determines the image quality restoration potential score corresponding to the video frame according to the image quality data of the video frame; wherein the image quality data includes content complexity and historical usage frequency; selects at least one key frame from the original video sequence according to the network score, device load score and image quality restoration potential score corresponding to each video frame; optimizes each key frame according to the current network condition to obtain an optimized frame corresponding to each key frame, and an intermediate video sequence including each optimized frame; fills the visual blanks in the intermediate video sequence to obtain a target video sequence; and encodes the target video sequence using the current encoding parameters of the current encoding cycle. The above technical scheme comprehensively considers the influence of network environment and user equipment performance on video encoding during video transmission, optimizes the original video sequence by analyzing the influence of current network conditions and user equipment performance data on video frames in the current encoding cycle, and obtains the target video sequence, so that the obtained target video sequence can maintain the best video quality in the video transmission environment with limited current network conditions and user equipment performance, improves the video quality in video transmission environments with different network conditions and different user equipment performance, thereby improving the video viewing experience of different users.
[0085] On the basis of the above embodiments, as an optional method of the embodiments of the present invention, it is also possible to: receive at least one feedback signal sent by the decoder, and update the current encoding parameters according to each feedback signal to obtain new encoding parameters, so as to adopt the new encoding parameters to encode the target video sequence.
[0086] The feedback signal includes, but is not limited to, video playback quality, video buffer status, and packet loss rate. The video buffer status is used to indicate the status of the buffer in the decoder.
[0087] Optionally, the current coding parameter is updated according to each feedback signal to obtain a new coding parameter, which may be: according to the current coding parameter and each feedback signal, the current coding parameter is updated by the following formula to obtain a new coding parameter:
[0088] ;
[0089] in, is the new encoding parameter, is the current coding parameter; beta is the overall adjustment factor, which is used to control the influence of the feedback signal on the adjustment of the current coding parameter, and can be preset according to actual business needs and the experience of technicians in this field; sum() is a summation formula, which is used to accumulate the influence of all feedback signals on the current coding parameter; is the i-th feedback signal, i is a positive integer; Adjust the function for preset encoding parameters.
[0090] It can be understood that during the video transmission process, the current encoding parameters of the encoder are adjusted in real time according to the feedback signal of the decoder to obtain new encoding parameters, so that the new encoding parameters can dynamically adapt to the video transmission environment of different user equipment performance under different network conditions, thereby improving the video quality of the video during the video transmission process and improving the efficiency of video transmission.
[0091] Embodiment 3
[0092] Figure 3 This is a schematic diagram of the structure of a video encoding device provided in the third embodiment of the present invention. This embodiment is applicable to the case of encoding videos in a variable video transmission environment, especially to the case of encoding videos in a video transmission environment with an unstable network environment or limited user equipment performance. The device can be implemented in the form of hardware and / or software and can be configured in an electronic device. Figure 3 As shown, the device comprises:
[0093] The key frame screening module 301 is used to screen out at least one key frame from the original video sequence according to the current network conditions of the current encoding cycle, the load data of the decoder decoding the video frame in the original video sequence, and the image quality data of the video frame;
[0094] The intermediate video sequence determination module 302 is used to optimize each key frame according to the current network conditions to obtain an optimized frame corresponding to each key frame and an intermediate video sequence including each optimized frame;
[0095] A target video sequence determination module 303 is used to fill the visual blanks in the intermediate video sequence to obtain a target video sequence;
[0096] The video encoding module 304 is used to encode the target video sequence using the current encoding parameters of the current encoding cycle.
[0097] The technical solution of the embodiment of the present invention is to select at least one key frame from the original video sequence according to the current network conditions of the current encoding cycle, the load data of the decoder decoding the video frames in the original video sequence, and the image quality data of the video frames; optimize each key frame according to the current network conditions to obtain the optimized frames corresponding to each key frame, and the intermediate video sequence including each optimized frame; fill the visual blanks in the intermediate video sequence to obtain the target video sequence; and encode the target video sequence using the current encoding parameters of the current encoding cycle. The above technical solution comprehensively considers the influence of the network environment and the user equipment performance on the video encoding during the video transmission process, and optimizes the original video sequence by analyzing the influence of the current network conditions of the current encoding cycle and the user equipment performance data on the video frames to obtain the target video sequence, so that the obtained target video sequence can maintain the best video quality in the video transmission environment with limited current network conditions and user equipment performance, thereby improving the video quality in the video transmission environment with different network conditions and different user equipment performance, thereby improving the video viewing experience of different users.
[0098] Optionally, the key frame screening module 301 includes:
[0099] A network score determination unit, configured to determine a network score corresponding to a video frame in an original video sequence according to a current network condition in a current encoding cycle; wherein the current network condition includes a network delay and a packet loss rate;
[0100] a device load score determination unit, configured to determine a device load score of a video frame according to load data obtained by decoding a video frame in an original video sequence by a decoder;
[0101] A picture quality restoration potential score determination unit, used to determine a picture quality restoration potential score corresponding to a video frame according to picture quality data of the video frame; wherein the picture quality data includes content complexity and historical usage frequency;
[0102] The key frame screening unit is used to screen out at least one key frame from the original video sequence according to the network score, device load score and image quality restoration potential score corresponding to each video frame.
[0103] Optionally, a device load score determination unit is used to:
[0104] For each video frame in the original video sequence, the decoder load capacity corresponding to the video frame is determined according to the CPU usage and memory occupancy when the decoder decodes the video frame;
[0105] According to the corresponding relationship between the device load capacity and the device load score, and according to the decoder load capacity, the device load score corresponding to the video frame is determined.
[0106] Optional key frame filtering unit, specifically used for:
[0107] For each video frame, a weighted sum of the network score, device load score, and image quality restoration potential score corresponding to the video frame is performed to obtain a comprehensive score corresponding to the video frame;
[0108] At least one key frame is selected from the original video sequence according to a preset score threshold and a comprehensive score of each video frame.
[0109] Optionally, the target video sequence determination module 303 is specifically configured to:
[0110] For each visual blank in the middle video sequence, determining a blank position of the visual blank in the middle video sequence;
[0111] According to the blank position, determining a first reference frame located before the blank position and a second reference frame located after the blank position; wherein the frame positions of the first reference frame and the second reference frame are both adjacent to the blank position;
[0112] An intermediate frame is generated between the first reference frame and the second reference frame to fill the visual gap with the intermediate frame.
[0113] Optionally, the video encoding module 304 is specifically used for:
[0114] For each video frame in the target video sequence, determining a target coding layer corresponding to the video frame from at least two preset coding layers of the encoder;
[0115] The video frame is encoded at the target coding layer using the current coding parameters of the current coding cycle.
[0116] Optionally, the device further comprises:
[0117] The new encoding parameter determination module is used to receive at least one feedback signal sent by the decoder, and update the current encoding parameters according to each feedback signal to obtain new encoding parameters, so as to encode the target video sequence using the new encoding parameters.
[0118] The video encoding device provided in the embodiment of the present invention can execute the video encoding method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects for executing each video encoding method.
[0119] According to an embodiment of the present invention, the present invention also provides an electronic device, a readable storage medium and a computer program product.
[0120] Embodiment 4
[0121] Figure 4A schematic diagram of the structure of an electronic device 10 that can be used to implement an embodiment of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.
[0122] like Figure 4 As shown, the electronic device 10 includes at least one processor 11, and a memory connected to the at least one processor 11 in communication, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 to the random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, ROM 12 and RAM 13 are connected to each other through a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0123] A number of components in the electronic device 10 are connected to the I / O interface 15, including: an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0124] The processor 11 may be a variety of general and / or dedicated processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 11 performs the various methods and processes described above, such as a video encoding method.
[0125] In some embodiments, the video encoding method may be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 10 via the ROM 12 and / or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the video encoding method described above may be performed. Alternatively, in other embodiments, the processor 11 may be configured to perform the video encoding method in any other appropriate manner (e.g., by means of firmware).
[0126] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0127] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer program may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0128] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, device, or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices, or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer 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 of the foregoing.
[0129] To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).
[0130] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.
[0131] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.
[0132] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.
[0133] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. A video encoding method, characterized in that: include: Filtering at least one key frame from the original video sequence according to a current network condition of a current encoding cycle, payload data of a decoder decoding a video frame in the original video sequence, and image quality data of the video frame; Optimizing each key frame according to the current network condition to obtain an optimized frame corresponding to each key frame and an intermediate video sequence including each optimized frame; Filling the visual blanks in the intermediate video sequence to obtain a target video sequence; Encoding the target video sequence using the current encoding parameters of the current encoding cycle; The step of selecting at least one key frame from the original video sequence according to the current network conditions of the current encoding cycle, the load data of the decoder decoding the video frame in the original video sequence, and the image quality data of the video frame comprises: Determine a network score corresponding to a video frame in the original video sequence according to a current network condition in a current encoding cycle; wherein the current network condition includes a network delay and a packet loss rate; Determine, according to load data obtained by decoding a video frame in the original video sequence by a decoder, a device load score corresponding to the video frame; Determining, according to the image quality data of the video frame, an image quality restoration potential score corresponding to the video frame; wherein the image quality data includes content complexity and historical usage frequency; Filtering at least one key frame from the original video sequence according to the network score, the device load score, and the image quality restoration potential score corresponding to each video frame; The step of filling the visual blanks in the intermediate video sequence includes: For each visual blank in the intermediate video sequence, determining a blank position of the visual blank in the intermediate video sequence; According to the blank position, determining a first reference frame located before the blank position and a second reference frame located after the blank position; wherein the frame positions of the first reference frame and the second reference frame are both adjacent to the blank position; An intermediate frame is generated between the first reference frame and the second reference frame to fill the visual blank with the intermediate frame.
2. The method according to claim 1, characterized in that The determining, according to load data obtained by decoding a video frame in an original video sequence by a decoder, a device load score corresponding to the video frame comprises: For each video frame in the original video sequence, determining a decoder load capacity corresponding to the video frame according to a CPU usage rate and a memory occupancy rate when the decoder decodes the video frame; Based on the corresponding relationship between the device load capacity and the device load score, the device load score corresponding to the video frame is determined according to the decoder load capacity.
3. The method according to claim 1, characterized in that The step of selecting at least one key frame from the original video sequence according to the network score, the device load score, and the image quality restoration potential score corresponding to each video frame includes: For each video frame, a weighted sum of the network score, device load score, and image quality restoration potential score corresponding to the video frame is performed to obtain a comprehensive score corresponding to the video frame; At least one key frame is selected from the original video sequence according to a preset score threshold and a comprehensive score corresponding to each video frame.
4. The method according to claim 1, characterized in that: The step of encoding the target video sequence by using the current encoding parameters of the current encoding cycle includes: For each video frame in the target video sequence, determining a target coding layer corresponding to the video frame from at least two preset coding layers of the encoder; The video frame is encoded at the target coding layer using the current coding parameters of the current coding cycle.
5. The method according to claim 1, characterized in that The method further comprises: At least one feedback signal sent by the decoder is received, and the current encoding parameters are updated according to each feedback signal to obtain new encoding parameters, so as to encode the target video sequence using the new encoding parameters.
6. A video encoding device, characterized in that: include: A key frame screening module, configured to screen out at least one key frame from the original video sequence according to the current network conditions of the current encoding cycle, the load data of the decoder decoding the video frame in the original video sequence, and the image quality data of the video frame; An intermediate video sequence determination module, configured to optimize each key frame according to the current network condition to obtain an optimized frame corresponding to each key frame and an intermediate video sequence including each optimized frame; A target video sequence determination module, used for filling the visual blanks in the intermediate video sequence to obtain a target video sequence; A video encoding module, configured to encode the target video sequence using current encoding parameters of the current encoding cycle; Wherein, the key frame screening module includes: A network score determination unit, configured to determine a network score corresponding to a video frame in an original video sequence according to a current network condition in a current encoding cycle; wherein the current network condition includes a network delay and a packet loss rate; a device load score determination unit, configured to determine a device load score corresponding to a video frame according to load data obtained by decoding a video frame in the original video sequence by a decoder; A picture quality restoration potential score determination unit, configured to determine a picture quality restoration potential score corresponding to the video frame according to picture quality data of the video frame; wherein the picture quality data includes content complexity and historical usage frequency; A key frame screening unit, configured to screen out at least one key frame from the original video sequence according to a network score, a device load score, and a picture quality restoration potential score corresponding to each video frame; Wherein, the target video sequence determination module is specifically used for: For each visual blank in the intermediate video sequence, determining a blank position of the visual blank in the intermediate video sequence; According to the blank position, determining a first reference frame located before the blank position and a second reference frame located after the blank position; wherein the frame positions of the first reference frame and the second reference frame are both adjacent to the blank position; An intermediate frame is generated between the first reference frame and the second reference frame to fill the visual blank with the intermediate frame.
7. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can perform the video encoding method according to any one of claims 1 to 5.
8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the video encoding method according to any one of claims 1 to 5 when executed.
Citation Information
Patent Citations
Method and device for carrying out target segmentation on video by adopting semantic segmentation model
CN113570610A
Video transmission method and device, equipment and medium
CN117676239A
