Video stream coding configuration method, system and device and storage medium
By dynamically adjusting the encoding parameters according to the video source stream frame rate, the problem of excessive encoding delay in live video is solved, and the fluency experience of the audience is improved.
Patent Information
- Application Number
- CN202411705437.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-26
- Publication Date
- 2025-03-07
AI Technical Summary
In live video scenarios, when the frame rate of the coded source stream on the anchor side is low, using a fixed code table for encoding may increase the encoding delay, which in turn causes the problem of stuttering video playback on the audience side.
By determining the source stream frame rate of the video source stream, comparing and matching the set multiple frame rate interval ranges, each interval corresponds to different encoding parameter settings, including encoding delay parameters. The final encoding parameters are determined based on the interval range in which the source stream frame rate falls, and the encoder of the video source stream is configured based on these parameters.
By adaptively selecting encoding parameters, the encoding delay is reduced, the video playback is avoided, and the viewing fluency experience of the audience is improved.
Smart Images

Figure CN119583803A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of video coding technology, and in particular to a video stream coding configuration method, system, device and storage medium. Background Art
[0002] At present, in the video live broadcast scene, in order to be compatible with different audience devices, the host end encoding source stream will be encoded into multiple encoded video streams of different gears based on a fixed code table to meet the needs of different viewers. For different encoding gears, the relevant encoding parameters will decrease in sequence as the gear decreases.
[0003] However, since live encoding usually uses a fixed code table for encoding, when the frame rate of the encoding source stream on the host side is low, if higher encoding parameters are also used for encoding, the introduced encoding delay may increase, causing video playback stuttering on the audience side, which in turn affects the audience's viewing smoothness experience. Summary of the invention
[0004] The embodiments of the present application provide a video stream encoding configuration method, system, device and storage medium, which can adaptively select the video encoding gear to configure the encoding parameters according to the encoding source stream frame rate, and solve the technical problem of excessive encoding delay caused by the incompatibility between the encoding source stream frame rate and the encoding parameters.
[0005] In a first aspect, an embodiment of the present application provides a video stream encoding configuration method, including:
[0006] Determine a source stream frame rate of a video source stream, and set multiple frame rate intervals based on the source stream frame rate comparison, wherein the frame rate intervals correspond to different encoding parameter settings, and the frame rate values of each frame rate interval do not overlap, and the encoding parameters include encoding delay parameters;
[0007] Determine the corresponding encoding parameters as the final encoding parameters according to the frame rate interval range that the source stream frame rate falls into;
[0008] The encoding parameters of the encoder of the video source stream are configured based on the final encoding parameters, so as to encode the video source stream based on the final encoding parameters.
[0009] In a second aspect, an embodiment of the present application provides a video stream encoding configuration system, including:
[0010] A comparison module is configured to determine a source stream frame rate of a video source stream, and compare multiple frame rate intervals set based on the source stream frame rate, wherein the frame rate intervals correspond to different encoding parameter settings, and the frame rate values of the various frame rate intervals do not overlap, and the encoding parameters include encoding delay parameters;
[0011] A parameter determination module is configured to determine corresponding encoding parameters as final encoding parameters according to a frame rate interval range into which a source stream frame rate falls;
[0012] The configuration module is configured to configure the encoding parameters of the encoder of the video source stream based on the final encoding parameters, so as to encode the video source stream based on the final encoding parameters.
[0013] In a third aspect, an embodiment of the present application provides a video stream encoding configuration device, including:
[0014] memory and one or more processors;
[0015] The memory is configured to store one or more programs;
[0016] When the one or more programs are executed by the one or more processors, the one or more processors implement the video stream encoding configuration method as described in the first aspect.
[0017] In a fourth aspect, an embodiment of the present application provides a non-volatile computer-readable storage medium, which stores computer-executable instructions, and the computer-executable instructions are configured to execute the video stream encoding configuration method described in the first aspect when executed by a computer processor.
[0018] In a fifth aspect, an embodiment of the present application provides a computer program product, which includes instructions. When the instructions are executed on a computer or a processor, the computer or the processor executes the video stream encoding configuration method as described in the first aspect.
[0019] The embodiment of the present application determines the source stream frame rate of the video source stream, and compares multiple frame rate intervals set based on the source stream frame rate. The frame rate intervals correspond to different encoding parameter settings, and the frame rate values of each frame rate interval do not overlap. The encoding parameters include encoding delay parameters; the corresponding encoding parameters are determined as final encoding parameters according to the frame rate interval range that the source stream frame rate falls into; the encoding parameters of the encoder of the video source stream are configured based on the final encoding parameters, so as to encode the video source stream based on the final encoding parameters. The above-mentioned technical means are adopted to determine the corresponding encoding delay parameters through the video source stream frame rate, and the encoding parameters of the encoder of the video source stream based on the encoding delay parameters, so as to reduce the introduced encoding delay through the encoding delay parameters when encoding the video source stream, avoid the problem of video playback freeze, and thus improve the audience's viewing fluency experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] Figure 1 It is a flowchart of a video stream encoding configuration method provided by an embodiment of the present application;
[0021] Figure 2is a flowchart for updating the first target bit rate in an embodiment of the present application;
[0022] Figure 3 is a video source stream encoding flow chart in an embodiment of the present application;
[0023] Figure 4 It is a structural diagram of a video stream encoding configuration system provided by an embodiment of the present application;
[0024] Figure 5 It is a structural diagram of a video stream encoding configuration device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0025] In order to make the purpose, technical scheme and advantages of the present application clearer, the specific embodiments of the present application are further described in detail below in conjunction with the accompanying drawings. It is understood that the specific embodiments described herein are only used to explain the present application, rather than to limit the present application. It should also be noted that, for the convenience of description, only the part related to the present application but not all the contents are shown in the accompanying drawings. Before discussing the exemplary embodiments in more detail, it should be mentioned that some exemplary embodiments are described as processes or methods depicted as flow charts. Although the flow chart describes each operation (or step) as a sequential process, many of the operations therein can be implemented in parallel, concurrently or simultaneously. In addition, the order of each operation can be rearranged. The process can be terminated when its operation is completed, but it can also have additional steps not included in the accompanying drawings. The process can correspond to a method, a function, a procedure, a subroutine, a subprogram, etc.
[0026] A video stream encoding configuration method provided by the present application aims to determine the encoding delay parameters of the corresponding gear through the frame rate of the video source stream, and configure the encoding parameters of the encoder of the video source stream based on the encoding delay parameters, so as to reduce the encoding delay introduced by the encoding delay parameters when encoding the video source stream, and avoid the problem of video playback freeze.
[0027] In the live video scene, live video technology is mainly divided into audio and video acquisition, beauty, filter, special effect processing, encoding, packaging, streaming, encoding, distribution, decoding, rendering, playback and other links. First, the host device is tested for performance at the host end, and the appropriate acquisition resolution and acquisition frame rate are selected for video acquisition, and then encoding is performed according to the appropriate encoding resolution and bit rate. Live encoding is to encode the received host end encoding stream into videos of different resolutions in order to adapt to different network bandwidths, different terminal processing capabilities and different user needs. A bit rate ladder is set for different resolutions, and a suitable output bit rate is selected for each set of resolutions. The highest encoding file resolution is generally the same as the source stream resolution, the bit rate is the highest among all encoding streams, and the picture quality is also the best among all encoding streams. After receiving the distributed video stream, the audience end decodes, renders and plays the video stream.
[0028] During live video streaming, factors that affect the smoothness of the live streaming experience include latency, stuttering, and video playback rate. Latency is the time required for data to be sent from the information source to the destination. Applied to live streaming scenarios, it is the time it takes for video data to be sent from the anchor end to the audience end. The lower the latency, the better the user experience. Stuttering refers to the lag of frames during video playback. The main factor causing stuttering is network bandwidth. Network abnormalities or insufficient bandwidth can easily cause playback stuttering. The lower the stuttering rate, the better the audience experience. Video playback rate refers to the proportion of the number of times from the time the audience enters the live broadcast room to the time the first frame of the video is rendered that does not exceed 1s in the total number of playbacks. The higher the video playback rate, the better the audience experience.
[0029] Generally speaking, live broadcast delay mainly includes two aspects: transmission delay and encoding delay. Since live broadcast encoding will decode the video stream encoded by the host side, and re-encode it according to the encoding code table to generate multiple video streams, it will introduce additional encoding delay. And because the number of encoding delay frames introduced by live broadcast encoding is fixed, the lower the frame rate of the encoded stream on the host side, the longer the encoding delay, resulting in a significant increase in end-to-end delay at low frame rates, which in turn affects the audience's smooth experience. At the same time, since encoding usually uses a fixed code table for encoding, and the performance of the host's equipment varies greatly, there are host-side encoding streams with extremely low bit rates. At this time, the encoding stream bit rate will be higher than the source stream, which not only wastes transmission bandwidth, but also increases transmission time, affecting the audience's smooth experience.
[0030] Live encoding usually uses a fixed set of code tables for encoding. In order to be compatible with different viewer devices, multiple streams will be converted to meet the audience's requirements. The general transcoding gears include FHD, HD and SD. The resolution, bit rate and image quality of different transcoding gears decrease in turn. The resolution of FHD is generally consistent with the resolution of the encoding stream on the host side.
[0031] When there are B frames in the source stream encoded by the host, the decoding module will output the decoded frames in the order of playback after decoding, which will introduce additional decoding delay. When the encoding parameters of the encoding file use encoding parameters with higher compression rates, at the same bit rate, although the quality of the encoded stream can be improved, additional encoding delay frames will be introduced. The number of encoding delay frames is lookaheadDepth+bframes+2. Among them, lookaheadDepth is the number of frames queued by the pre-processing module, which is used to pre-encode the encoded frames and use the pre-encoding information to guide the formal encoding to improve the performance of the encoder. The longer the queue, the higher the encoder compression rate. bframes is the maximum number of consecutive frame types determined by the pre-processing module as B frames. The larger the value, the higher the encoder compression rate.
[0032] Because live encoding usually uses a fixed code table for encoding, when the frame rate of the source stream encoded on the host side is low, if encoding parameters with a higher compression rate are also used for encoding, the introduced encoding delay will increase, which is more likely to cause video playback stuttering problems on the audience side, affecting the audience's viewing experience.
[0033] Based on this, a video stream encoding configuration method is provided in an embodiment of the present application to solve the technical problem that the encoding source stream frame rate and the encoding parameters are not compatible, resulting in excessive encoding delay.
[0034] Example:
[0035] Figure 1 A flowchart of a video stream coding configuration method provided in an embodiment of the present application is given. The video stream coding configuration method provided in this embodiment can be executed by a video stream coding configuration device, which can be implemented by software and / or hardware. The video stream coding configuration device can be composed of two or more physical entities, or can be composed of one physical entity. Generally speaking, the video stream coding configuration device can be a processing device such as a video coding server and a video device.
[0036] The following description is made by taking the video stream coding configuration device as an example of the subject for executing the video stream coding configuration method. Figure 1 , the video stream encoding configuration method specifically includes:
[0037] S110, determining a source stream frame rate of a video source stream, and setting a plurality of frame rate intervals based on the source stream frame rate comparison, wherein the frame rate intervals correspond to different encoding parameter settings, and the frame rate values of the various frame rate intervals do not overlap, and the encoding parameters include encoding delay parameters.
[0038] When configuring the encoding parameters of the encoder, the application counts the frame rate of the video source stream at the host end, and then decides on appropriate encoding parameters based on the frame rate of the source stream at the host end, so as to reduce the encoding delay and the encoding stream bit rate, thereby reducing the live broadcast delay and improving the viewing fluency of the audience. The encoding parameters are adaptively determined based on the frame rate of the source stream at the host end. The lower the frame rate, the fewer the encoding delay frames, thereby reducing the encoding delay at low frame rates.
[0039] Among them, different frame rate intervals are divided according to the corresponding source stream frame rate, and encoding parameters corresponding to different frame rate intervals are designed. When configuring the encoding parameters, the source stream frame rate of the upstream video source stream on the host end is counted, and then the pre-configured frame rate interval range is compared based on the source stream frame rate, and the corresponding encoding parameters can be determined according to the frame rate interval range. Exemplarily, the source stream frame rate is divided into fps_high, fps_medium and fps_low according to different frame rate interval ranges. According to the actual division requirements, the frame rate ranges of different intervals are adaptively configured from high to low.
[0040] The source stream frame rate is calculated by counting the number of frames received by the encoding module within one minute. The update cycle is configured according to the actual encoding parameters, and the source stream frame rate can be adaptively determined based on the number of frames received by the encoding module in the past cycle. Based on the source stream frame rate, more reasonable encoding parameters can be determined.
[0041] The encoding parameters of the present application include encoding delay parameters, wherein the encoding delay parameters include the number of frames queued by the pre-processing module of the encoder and the maximum number of frames for which the pre-processing module decides that the continuous frame type is a B frame. The encoding delay parameter is used to adjust the encoding delay introduced by the source stream encoding. In the video source stream encoding process, the number of encoding delay frames is lookaheadDepth+bframes+2. Wherein lookaheadDepth is the number of frames queued by the pre-processing module, which is used to pre-encode the encoded frames, and use the pre-coding information to guide the formal encoding to improve the encoder performance. The longer the queue, the higher the encoder compression rate. bframes is the maximum number of consecutive frame types decided by the pre-processing module as B frames. The larger the value, the higher the encoder compression rate. The present application can adaptively adjust the encoding delay by setting the corresponding lookaheadDepth and bframes. According to different frame rate ranges, lookaheadDepth can be set to depth_high, depth_medium and depth_low gears, and bframes can be set to frames_high, frames_medium and frames_low gears.
[0042] Optionally, the encoding parameters of the present application also include encoding complexity associated parameters, which are used to adjust the encoding complexity of the video source stream. Different encoding complexity associated parameters are set for different frame rate ranges. It is understandable that since reducing 10k ahead Depth and bframes will reduce the encoder compression rate, resulting in a deterioration in the quality of the transcoded stream, it is necessary to introduce encoding complexity associated parameters while reducing 10k ahead Depth and bframes, so as to ensure that the quality of the transcoded stream is not reduced by adjusting the encoding complexity.
[0043] The encoding complexity-related parameters may include encoding gears and sub-pixel motion estimation parameters, and the encoding gears may also correspond to different frame rate intervals, such as preset_high, preset_medium, and preset_low. Different encoding gear configurations correspond to different encoder complexities.
[0044] In addition, the subpixel motion estimation parameter subme (subpixel motion estimation) is an important configurable parameter in the encoding field, especially in the x264 video encoder, which affects the computational complexity of the subpixel motion estimation process. The subpixel motion estimation parameter subme also corresponds to different frame rate range settings such as level_high, level_medium and level_low.
[0045] By adjusting the encoding gear, subme and other parameters, the encoding complexity can be adaptively adjusted to improve the encoder compression rate to ensure that the transcoded stream quality is not reduced. According to actual needs, the encoding complexity associated parameter type can be adaptively configured, and this application does not impose fixed restrictions on this.
[0046] Based on the above-mentioned pre-set multiple frame rate ranges and corresponding configured encoding parameters, by setting multiple frame rate ranges based on source stream frame rate comparison, the corresponding encoding parameters can be determined according to the frame rate range that the current source stream frame rate falls into, so as to update the encoder encoding parameters.
[0047] Optionally, the video stream encoding configuration method of the present application further includes:
[0048] Determine the source stream bit rate of the video source stream, update the first target bit rate of each transcoding gear based on the source stream bit rate and the set bit rate adjustment coefficient of each transcoding gear of the encoder and the initial first target bit rate, so as to encode the video source stream based on the updated first target bit rate.
[0049] It is understandable that, since the transmission bandwidth is limited, the higher the bit rate of the coded stream, the longer the transmission time, the longer the live broadcast delay, and the easier it is to cause the audience to play stuck. Therefore, the present application tracks the source stream bit rate in real time, and adaptively adjusts the target bit rate of each transcoding gear according to the statistical source stream bit rate to ensure that the target bit rate of the transcoding gear is lower than the source stream. The transcoding gear may include FHD, HD and SD, and the resolution and bit rate of different transcoding gear configurations are different, and the image quality decreases successively. Among them, the target bit rate of each transcoding gear is defined as the first target bit rate, and the first target bit rate of each transcoding gear is updated based on the source stream bit rate and the set bit rate adjustment coefficient of each transcoding gear and the initial first target bit rate. For example, the adjustment result is calculated based on the product of the set bit rate adjustment coefficient and the initial first target bit rate or using the set adjustment formula, and the minimum value is selected from the adjustment result and the source stream bit rate as the final updated target bit rate. The method of updating the first target bit rate of each transcoding gear based on the source stream bit rate, the set bit rate adjustment coefficient of each transcoding gear and the initial first target bit rate in this application can be adaptively set according to actual needs. It only needs to ensure that the target bit rate of the transcoding gear is lower than the source stream, and no fixed restriction is made here.
[0050] Specifically, refer to Figure 2 , based on the source stream bit rate, the set bit rate adjustment coefficient of each transcoding gear and the initial first target bit rate, updating the first target bit rate of each transcoding gear, including:
[0051] S1101, calculating a second target bit rate based on an initial first target bit rate of a transcoding gear and a set bit rate adjustment coefficient;
[0052] S1102: Determine the minimum value between the second target bit rate and the source stream bit rate, determine the maximum value between the minimum value and the set minimum bit rate, and update the first target bit rate of the transcoding gear based on the maximum value.
[0053] Assume that the preset target bitrate fhd_presetBitrate of FHD file is 1000kbps, the preset target bitrate hd_presetBitrate of HD file is 800kbps, and the preset target bitrate sd_presetBitrate of SD file is 500kbps, adjust the target bitrate of each transcoding gear according to the source stream bitrate srcBitrate.
[0054] In order to avoid the situation where the target bitrate of the encoded stream is too low and the image quality is too poor when the source stream bitrate of the anchor is extremely low, this application sets the minimum bitrate for each transcoding gear to prevent the target bitrate of the encoded stream from being too low. Taking the update of the FHD target bitrate fhd_presetBitrate as an example, the update formula is expressed as:
[0055] max(minBitrate1,min(srcBitrate*percentage,fhd_presetBitrate))
[0056] The bitrate adjustment coefficient percentage is set to be less than 1 to ensure that the target bitrate of the FHD file is less than the source stream bitrate and not higher than the preset target bitrate value, thereby reducing the bitrate of the FHD file. At the same time, by increasing the minimum bitrate of the FHD file minBitrate1 limit, it is avoided that when the source stream bitrate is extremely low, the quality of the encoded stream is too poor, affecting the audience experience.
[0057] The target bitrate adjustment range for HD and SD files is the same as that for FHD files. The target bitrate update formula for HD files is expressed as:
[0058]
[0059] The target bit rate update formula for SD files is expressed as:
[0060]
[0061] Among them, minBitrate2 and minBitrate3 are the minimum bit rates of HD and SD files respectively.
[0062] By adaptively adjusting the target bitrate of the encoding file according to the encoding stream bitrate of the anchor end, the bitrate of the transcoding file can be ensured to be lower than the source stream, saving bandwidth while reducing transmission time, so as to achieve the purpose of reducing live broadcast delay and improving the smoothness of the audience's viewing experience.
[0063] Optionally, updating the first target bit rate of the transcoding gear based on the maximum value includes:
[0064] When the number of frames from the last update of the first target bit rate reaches a set number and a designated frame of the video source stream is detected, the first target bit rate is updated based on the maximum value starting from the designated frame.
[0065] By setting the frame interval for adjusting the target bitrate of the transcoding gear, the target bitrate of the transcoding gear is adjusted at the first IDR frame encountered when the frame interval from the last adjustment is greater than 200 frames. This avoids frequent updates of the target bitrate, which may lead to inaccurate encoder bitrate control.
[0066] S120: Determine corresponding encoding parameters as final encoding parameters according to the frame rate interval range that the source stream frame rate falls into.
[0067] Further, based on the above source stream frame rate comparison frame rate interval range, when the source stream frame rate falls into the fps_high frame rate interval, the encoding parameters of the corresponding gear are determined, where lookaheadDepth is depth_high, bframes is frames_high, the encoding gear is preset_high, and subme is level_high;
[0068] Otherwise, when the source stream frame rate falls into the fps_medium frame rate range, lookaheadDepth is depth_medium, bframs is frames_medium, encoding gear is preset_medium, and subme is level_medium;
[0069] Otherwise, when the source stream frame rate falls into the fps_low frame rate interval, lookaheadDepth is depth_low, bframes is frames_low, encoding gear is preset_low, and subme is level_low.
[0070] Among them, fps_high>fps_medium>fps_low, depth_high>depth_medium>depth_low, frames_high>frames_medium>frames_low, level_low>level_medium>level_high, and the encoding complexity of the three encoding gears preset_high, preset_medium, and preset_low increases in sequence, so that the lower the encoding frame rate on the anchor end, the fewer the encoding delay frames, and the higher the encoding complexity. While reducing the encoding delay of the low frame rate anchor, it does not affect the image quality of the encoded stream.
[0071] By comparing the frame rate range that the source stream frame rate falls into, the encoding parameters of the corresponding gear can be determined, namely the encoding delay parameters (lookaheadDepth and bframes), the encoding gear and the sub-pixel motion estimation parameter subme, and the determined encoding parameters are defined as the final encoding parameters.
[0072] S130: configuring encoding parameters of an encoder of the video source stream based on the final encoding parameters, so as to encode the video source stream based on the final encoding parameters.
[0073] Further, referring to Figure 3, after obtaining the final encoding parameters according to the source stream frame rate decision, it is possible to determine whether to restart the encoder and update the encoding parameters of the encoding module by judging whether the final encoding parameters are consistent with the initial encoding parameters. The video source stream is encoded based on the updated encoding parameters, and the corresponding encoded video stream is then sent to the downstream viewer end.
[0074] Among them, when the source stream frame rate changes greatly, such as when a high frame rate switches to a low frame rate, you can set it to a low-delay encoding parameter and restart the encoder; when a low frame rate switches to a high frame rate, you can set it to a high-delay encoding parameter and restart the encoder. By modifying lookaheadDepth and bframes, the number of encoding delay frames can be reduced. The lower the frame rate, the smaller the lookaheadDepth and bframes, and the fewer the encoding delay frames, ensuring that the encoding delay of all anchors is within a certain range, thereby reducing playback jams on the audience side. At the same time, since reducing lookaheadDepth and bframes will reduce the compression rate of the encoder, resulting in poor quality of the encoded stream, while reducing lookaheadDepth and bframes, adjust the encoding parameters such as encoding gear and subme to increase the compression rate of the encoder, so as to ensure that the quality of the encoded stream is not reduced.
[0075] Optionally, configuring encoding parameters of an encoder of the video source stream based on the final encoding parameters includes:
[0076] When the final encoding parameters are inconsistent with the initial encoding parameters of the encoder of the video source stream, and the difference between the source stream frame rate and the historical source stream frame rate of the previous target period reaches a set threshold, the final encoding parameters are updated to the encoding parameters of the encoder of the video source stream.
[0077] This application modifies the encoding parameters in the comprehensive decision-making module. When restarting the encoder encoding, it is necessary to meet the final encoding parameters and the initial encoding parameters of the encoder of the video source stream are inconsistent, and the difference between the source stream frame rate and the source stream frame rate of the previous minute is greater than a certain threshold. Only when the above conditions are met, the update of the encoding parameters is triggered, otherwise the video source stream continues to be encoded with the initial encoding parameters of the encoder. In this way, the frequent restart of the encoder when the source stream frame rate jitters can be avoided, and the stability and reliability of video encoding can be improved.
[0078] In the above, by determining the source stream frame rate of the video source stream, a plurality of frame rate intervals are set based on the source stream frame rate comparison, the frame rate intervals correspond to different encoding parameter settings, and the frame rate values of each frame rate interval do not overlap, and the encoding parameters include encoding delay parameters; the corresponding encoding parameters are determined as the final encoding parameters according to the frame rate interval in which the source stream frame rate falls; the encoding parameters of the encoder of the video source stream are configured based on the final encoding parameters, so as to encode the video source stream based on the final encoding parameters. The above technical means are adopted to determine the corresponding encoding delay parameters through the video source stream frame rate, and the encoding parameters of the encoder of the video source stream based on the encoding delay parameters, so as to reduce the introduced encoding delay through the encoding delay parameters when encoding the video source stream, avoid the problem of video playback freeze, and thus improve the audience's viewing fluency experience.
[0079] Based on the above embodiments, Figure 4 A schematic diagram of the structure of a video stream encoding configuration system provided by this application. Figure 4 The video stream encoding configuration system provided in this embodiment specifically includes: a comparison module 21, a parameter determination module 22 and a configuration module 23.
[0080] Wherein, the comparison module 21 is configured to determine the source stream frame rate of the video source stream, and compare a plurality of frame rate intervals set based on the source stream frame rate, wherein the frame rate intervals correspond to different encoding parameter settings, and the encoding parameters include encoding delay parameters;
[0081] A parameter determination module 22 is configured to determine the corresponding encoding parameters as final encoding parameters according to the frame rate interval range that the source stream frame rate falls into;
[0082] The configuration module 23 is configured to configure the encoding parameters of the encoder of the video source stream based on the final encoding parameters, so as to encode the video source stream based on the final encoding parameters.
[0083] Specifically, it also includes:
[0084] Determine the source stream bit rate of the video source stream, update the first target bit rate of each transcoding gear based on the source stream bit rate and the set bit rate adjustment coefficient of each transcoding gear of the encoder and the initial first target bit rate, so as to encode the video source stream based on the updated first target bit rate.
[0085] Wherein, updating the first target bit rate of each transcoding gear position based on the source stream bit rate, the set bit rate adjustment coefficient of each transcoding gear position of the encoder, and the initial first target bit rate includes:
[0086] Calculating a second target bit rate based on the initial first target bit rate of the transcoding gear and a set bit rate adjustment coefficient;
[0087] The minimum value between the second target bit rate and the source stream bit rate is determined, the maximum value between the minimum value and the set minimum bit rate is determined, and the first target bit rate of the transcoding gear is updated based on the maximum value.
[0088] Updating the first target bit rate of the transcoding gear based on the maximum value includes:
[0089] When the number of frames from the last update of the first target bit rate reaches a set number and a designated frame of the video source stream is detected, the first target bit rate is updated based on the maximum value starting from the designated frame.
[0090] Specifically, the encoding parameters of the encoder of the video source stream are configured based on the final encoding parameters, including:
[0091] When the final encoding parameters are inconsistent with the initial encoding parameters of the encoder of the video source stream, and the difference between the source stream frame rate and the historical source stream frame rate of the previous target period reaches a set threshold, the final encoding parameters are updated to the encoding parameters of the encoder of the video source stream.
[0092] Specifically, the encoding delay parameters include the number of frames queued by the pre-processing module of the encoder and the maximum number of frames of the continuous frame type of B frame.
[0093] Specifically, the encoding parameters also include encoding complexity associated parameters, which are used to adjust the encoding complexity of the video source stream, and the encoding complexity associated parameters include encoding gears and sub-pixel motion estimation parameters.
[0094] In the above, by determining the source stream frame rate of the video source stream, a plurality of frame rate intervals are set based on the source stream frame rate comparison, the frame rate intervals correspond to different encoding parameter settings, and the frame rate values of each frame rate interval do not overlap, and the encoding parameters include encoding delay parameters; the corresponding encoding parameters are determined as the final encoding parameters according to the frame rate interval in which the source stream frame rate falls; the encoding parameters of the encoder of the video source stream are configured based on the final encoding parameters, so as to encode the video source stream based on the final encoding parameters. The above technical means are adopted to determine the corresponding encoding delay parameters through the video source stream frame rate, and the encoding parameters of the encoder of the video source stream based on the encoding delay parameters, so as to reduce the introduced encoding delay through the encoding delay parameters when encoding the video source stream, avoid the problem of video playback freeze, and thus improve the audience's viewing fluency experience.
[0095] The video stream encoding configuration system provided in the embodiment of the present application can be configured to execute the video stream encoding configuration method provided in the above embodiment, and has corresponding functions and beneficial effects.
[0096] Based on the above practical example, the embodiment of the present application also provides a video stream encoding configuration device, referring to Figure 5, the video stream coding configuration device includes: a processor 31, a memory 32, a communication module 33, an input device 34 and an output device 35. The memory, as a computer-readable storage medium, can be configured to store software programs, computer executable programs and modules, such as program instructions / modules corresponding to the video stream coding configuration method described in any embodiment of the present application (for example, a comparison module, a parameter determination module and a configuration module in a video stream coding configuration system). The communication module is configured to perform data transmission. The processor executes various functional applications and data processing of the device by running the software programs, instructions and modules stored in the memory, that is, implements the above-mentioned video stream coding configuration method. The input device can be configured to receive input digital or character information, and generate key signal input related to the user settings and function control of the device. The output device may include a display device such as a display screen. The video stream coding configuration device provided above can be configured to execute the video stream coding configuration method provided in the above-mentioned embodiment, and has corresponding functions and beneficial effects.
[0097] On the basis of the above embodiments, the embodiments of the present application further provide a non-volatile computer-readable storage medium, wherein the non-volatile computer-readable storage medium stores computer-executable instructions, wherein the computer-executable instructions are configured to execute a video stream encoding configuration method when executed by a computer processor, and the storage medium may be any of various types of memory devices or storage devices. Of course, the non-volatile computer-readable storage medium provided in the embodiments of the present application, whose computer-executable instructions are not limited to the video stream encoding configuration method described above, may also execute related operations in the video stream encoding configuration method provided in any embodiment of the present application.
[0098] On the basis of the above embodiments, the embodiments of the present application also provide a computer program product. The technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product. The computer program product is stored in a storage medium, and includes a number of instructions for enabling a computer device, a mobile terminal or a processor therein to execute all or part of the steps of the video stream encoding configuration method described in each embodiment of the present application.
Claims
1. A video stream encoding configuration method, characterized in that: include: Determine a source stream frame rate of a video source stream, compare and set a plurality of frame rate intervals based on the source stream frame rate, the frame rate intervals correspond to different encoding parameter settings, and the frame rate values of the respective frame rate intervals do not overlap, and the encoding parameters include encoding delay parameters; Determine the corresponding encoding parameters as final encoding parameters according to the frame rate interval range that the source stream frame rate falls into; The encoding parameters of the encoder of the video source stream are configured based on the final encoding parameters, so as to encode the video source stream based on the final encoding parameters.
2. The video stream encoding configuration method according to claim 1, characterized in that: Also includes: Determine a source stream bit rate of a video source stream, and update the first target bit rate of each transcoding gear based on the source stream bit rate and the set bit rate adjustment coefficient of each transcoding gear of the encoder and the initial first target bit rate, so as to encode the video source stream based on the updated first target bit rate.
3. The video stream encoding configuration method according to claim 2, characterized in that: The updating of the first target bit rate of each transcoding gear position based on the source stream bit rate, the set bit rate adjustment coefficient of each transcoding gear position of the encoder, and the initial first target bit rate includes: Calculating a second target bit rate based on the initial first target bit rate of the transcoding gear and a set bit rate adjustment coefficient; Determine a minimum value between the second target bit rate and the source stream bit rate, determine a maximum value between the minimum value and the set minimum bit rate, and update the first target bit rate of the transcoding gear based on the maximum value.
4. The video stream encoding configuration method according to claim 3, characterized in that: The updating of the first target bit rate of the transcoding gear based on the maximum value includes: When the number of frames from the last update of the first target bit rate reaches a set number and a designated frame of the video source stream is detected, the first target bit rate is updated based on the maximum value starting from the designated frame.
5. The video stream encoding configuration method according to any one of claims 1 to 4, characterized in that: The configuring the encoding parameters of the encoder of the video source stream based on the final encoding parameters includes: When the final encoding parameters are inconsistent with the initial encoding parameters of the encoder of the video source stream, and the difference between the source stream frame rate and the historical source stream frame rate of the previous target time period reaches a set threshold, the final encoding parameters are updated to the encoding parameters of the encoder of the video source stream.
6. The video stream encoding configuration method according to any one of claims 1 to 4, characterized in that: The encoding delay parameters include the number of frames queued by the pre-processing module of the encoder and the maximum number of frames of the continuous frame type of B frame.
7. The video stream encoding configuration method according to any one of claims 1 to 4, characterized in that: The encoding parameters also include encoding complexity associated parameters, and the encoding complexity associated parameters are used to adjust the encoding complexity of the video source stream.
8. The video stream encoding configuration method according to claim 7, characterized in that: The encoding complexity associated parameters include encoding gears and sub-pixel motion estimation parameters.
9. A video stream encoding configuration system, characterized in that: include: A comparison module is configured to determine a source stream frame rate of a video source stream, and compare a plurality of frame rate intervals set based on the source stream frame rate, wherein the frame rate intervals correspond to different encoding parameter settings, and the frame rate values of the respective frame rate intervals do not overlap, and the encoding parameters include encoding delay parameters; A parameter determination module, configured to determine a corresponding encoding parameter as a final encoding parameter according to the frame rate interval range into which the source stream frame rate falls; A configuration module is configured to configure encoding parameters of an encoder of the video source stream based on the final encoding parameters, so as to encode the video source stream based on the final encoding parameters.
10. A video stream encoding configuration device, characterized in that: include: memory and one or more processors; The memory is configured to store one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the video stream encoding configuration method as described in any one of claims 1-8.
11. A non-volatile computer-readable storage medium, characterized in that: The non-volatile computer-readable storage medium stores computer-executable instructions, and when the computer-executable instructions are executed by a computer processor, the computer-executable instructions are configured to execute the video stream encoding configuration method according to any one of claims 1 to 8.
12. A computer program product, characterized in that The computer program product includes instructions, and when the instructions are executed on a computer or a processor, the computer or the processor executes the video stream encoding configuration method according to any one of claims 1 to 8.