Video Bitstream Processing Method, Apparatus, Device, and Computer-Readable Storage Medium
By performing video encoding processing based on code rate control on the video code stream, video code streams that are adapted to different code rates are generated based on the code rate proportion of the time domain layer, the problem of high transcoding cost of video code streams and mismatch of code rates is solved, and efficient video code stream matching and compression is achieved.
Patent Information
- Application Number
- CN202011285567.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-11-17
- Publication Date
- 2025-05-27
- Estimated Expiration
- 2040-11-17
AI Technical Summary
The existing video code stream transcoding cost is high, and the code rate at the broadcast stream does not match the code rate at the push stream, resulting in problems such as stuttering playback.
By obtaining an image group that conforms to the preset encoding structure, query the bit rate proportion of each time domain layer, and perform video encoding processing based on the bit rate control of the image data of each time domain layer based on these ratios, and generate a video code stream that is suitable for different bit rates.
There is no need to transcode video encoding, which avoids the time, interaction and economic costs caused by transcoding video code streams, and realizes efficient matching and compression of video code streams.
Smart Images

Figure CN114513667B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of video processing, and particularly relates to a method, apparatus, device, and computer-readable storage medium for processing a video bitstream. Background Art
[0002] A video bitstream is the data traffic corresponding to a video file, and the bitrate of the video bitstream determines the quality of the video picture. The larger the bitrate of the video bitstream, the smaller the compression ratio of the video bitstream, and the higher the quality of the video picture. The smaller the bitrate of the video bitstream, the larger the compression ratio of the video bitstream, and the lower the quality of the video picture. When playing a video file, the client can smoothly play the video file only when the bandwidth of the client matches the bitrate of the video bitstream.
[0003] For example: Video live broadcast includes a video pushing process and a video pulling process. The video pushing process refers to the process in which a pushing end generates a video bitstream and pushes the video bitstream to a video source station server. The video pulling process refers to the process in which a playing end pulls the video bitstream from the video source station server through a Content Delivery Network (CDN) network.
[0004] During the video live broadcast process, for different network environments, video bitstreams with different bitrates need to be provided to meet the needs of users in different network environments. However, generally, the bitrate of the playing end is determined by the bitrate of the pushing end, that is, the bitrate of the playing end is the same as the bitrate of the pushing end. If the bitrate of the pushing end is high and the bandwidth resources of the playing end are limited, problems such as stuttering during playback will occur at the playing end. To solve the problem of mismatch between the bitrate of the pushing end and the bandwidth of the playing end, currently, the video source station server can transcode the video bitstream through the transcoding cluster of the server of the transcoding provider, and then a video bitstream with a bitrate matching the bandwidth of the playing end can be obtained. However, the transcoding service provided by the transcoding provider increases the time cost and economic cost of transcoding, and when the playing end needs to adjust the bitrate, the edge nodes in the CDN network need to pull the video bitstream with the required bitrate from the video source station server again, increasing the interaction cost between the video source station server and the CDN network. Summary of the Invention
[0005] The main purpose of the embodiments of the present invention is to provide a method, apparatus, device, and computer-readable storage medium for processing a video bitstream to solve the problem of high transcoding cost of existing video bitstreams.
[0006] For the above technical problems, the embodiments of the present invention are solved by the following technical solutions:
[0007] An embodiment of the present invention provides a video bitstream processing method, including: obtaining a group of pictures to be encoded; wherein, the group of pictures conforms to a preset encoding structure; the encoding structure includes at least two temporal layers, and each of the temporal layers includes at least one frame of picture data in the group of pictures; querying the bitrate occupancy ratio preset for each of the temporal layers in the encoding structure; and respectively performing video encoding processing based on bitrate control on the picture data of each temporal layer according to the bitrate occupancy ratio corresponding to each temporal layer, generating an encoded slice corresponding to the picture data of each temporal layer, and forming a video bitstream corresponding to the group of pictures.
[0008] Wherein, respectively performing video encoding processing based on bitrate control on the picture data of each temporal layer according to the bitrate occupancy ratio corresponding to each temporal layer includes: performing the following operations for each temporal layer: performing video encoding on the picture data of the temporal layer, and during the process of performing video encoding on the picture data of the temporal layer, adjusting the encoding parameters of all or part of the picture data in the temporal layer, so that after video encoding, the ratio of the bitrate of the encoded slice of the temporal layer to the bitrate of the video bitstream is the bitrate occupancy ratio corresponding to the temporal layer.
[0009] Wherein, respectively performing video encoding processing based on bitrate control on the picture data of each temporal layer according to the bitrate occupancy ratio corresponding to each temporal layer includes: performing the following operations for each temporal layer: performing video encoding on the picture data of the temporal layer, and during the process of performing video encoding on the picture data of the temporal layer, determining the picture data that is not referenced in the picture data of the temporal layer; wherein, the picture data that is not referenced is used to generate an encoded slice of an unreferenced type; adjusting the encoding parameters of the picture data that is not referenced, so that after video encoding, the ratio of the bitrate of the encoded slice of the unreferenced type in the temporal layer to the bitrate of the video bitstream is the bitrate occupancy ratio corresponding to the temporal layer.
[0010] An embodiment of the present invention further provides a video bitstream processing method, including: obtaining a target compression ratio corresponding to a receiving device; determining an encoding structure corresponding to a video bitstream to be sent to the receiving device, where the video bitstream is obtained after a video encoding device performs video encoding processing based on bitstream control on a group of pictures conforming to the encoding structure; determining a to-be-processed temporal layer in the video bitstream according to a bitrate occupancy ratio preset for each temporal layer in the encoding structure, where the bitrate occupancy ratio corresponding to a temporal layer other than the to-be-processed temporal layer in the video bitstream is equal to the target compression ratio; identifying a to-be-processed coded slice in the to-be-processed temporal layer in the video bitstream, and performing image compression processing on the to-be-processed coded slice to obtain a video bitstream corresponding to the target compression ratio and sending the video bitstream corresponding to the target compression ratio to the receiving device.
[0011] Among them, determining the to-be-processed temporal layer in the video bitstream according to the bitrate occupancy ratio preset for each temporal layer in the encoding structure includes: sequentially obtaining the bitrate occupancy ratio corresponding to each temporal layer in descending order of the temporal layer; determining the bitrate occupancy ratio corresponding to all unobtained temporal layers according to the obtained bitrate occupancy ratio corresponding to each temporal layer until the bitrate occupancy ratio corresponding to all unobtained temporal layers is equal to the target compression ratio, then stopping obtaining the bitrate occupancy ratio corresponding to the next temporal layer, and determining each obtained temporal layer as the to-be-processed temporal layer in the video bitstream.
[0012] Among them, identifying the to-be-processed coded slice in the to-be-processed temporal layer in the video bitstream includes: obtaining the data header of each coded slice in the video bitstream; determining the temporal layer corresponding to each coded slice according to the temporal identifier in the data header of each coded slice; identifying the coded slice whose temporal layer is the to-be-processed temporal layer as the to-be-processed code.
[0013] Among them, identifying the to-be-processed coded slice in the to-be-processed temporal layer in the video bitstream includes: obtaining the data header of each coded slice in the video bitstream; for each coded slice, determining the coded slice type corresponding to the coded slice and the temporal layer corresponding to the coded slice according to the coded slice type identifier and the temporal layer identifier in the data header of the coded slice, where the coded slice type includes: not referenced and referenced; identifying the coded slice whose coded slice type is not referenced and whose temporal layer is the to-be-processed temporal layer as the to-be-processed coded slice.
[0014] Among them, performing image compression processing on the to-be-processed coded slice includes: discarding the to-be-processed coded slice; or filling the payload part of the to-be-processed coded slice with a preset value, where the bitrate of the to-be-processed coded slice whose payload part is filled with the preset value is less than the original bitrate of the to-be-processed coded slice.
[0015] After identifying the to-be-processed coded slice in the to-be-processed temporal layer in the video bitstream, the method further includes: obtaining a target audio bitstream corresponding to the video bitstream; wherein, the target audio bitstream includes a plurality of audio data frames; in the plurality of audio data frames, querying for the audio data frame corresponding to the to-be-processed coded slice in the video bitstream, and discarding the queried audio data frame.
[0016] Wherein, the types of the receiving devices include: video source station servers and video playback devices; the types of the video processing devices include: zero transcoding servers and edge content distribution network CDN nodes.
[0017] An embodiment of the present invention further provides a video bitstream processing apparatus, which is disposed on the side of a video encoding device and includes: a first obtaining module, configured to obtain a group of pictures to be encoded; wherein, the group of pictures conforms to a preset encoding structure; the encoding structure includes at least two temporal layers, and each temporal layer includes at least one frame of picture data in the group of pictures; a ratio query module, configured to query a bitrate occupancy ratio corresponding to each temporal layer in the encoding structure in advance; a bitstream generation module, configured to perform video encoding processing based on bitrate control on the picture data of each temporal layer respectively according to the bitrate occupancy ratio corresponding to each temporal layer, generate a coded slice corresponding to the picture data of each temporal layer, and form a video bitstream corresponding to the group of pictures.
[0018] An embodiment of the present invention further provides a video bitstream processing apparatus, which is disposed on the side of a video processing device and includes: a second obtaining module, configured to obtain a target compression ratio corresponding to a receiving device; a first determining module, configured to determine an encoding structure corresponding to a video bitstream to be sent to the receiving device; the video bitstream is obtained after a video encoding device performs video encoding processing based on bitstream control on a group of pictures conforming to the encoding structure; a second determining module, configured to determine a to-be-processed temporal layer in the video bitstream according to the bitrate occupancy ratio corresponding to each temporal layer in the encoding structure in advance; wherein, the bitrate occupancy ratio corresponding to the temporal layer other than the to-be-processed temporal layer in the video bitstream is equal to the target compression ratio; a compression processing module, configured to identify a to-be-processed coded slice in the to-be-processed temporal layer in the video bitstream, and perform image compression processing on the to-be-processed coded slice to obtain a video bitstream corresponding to the target compression ratio and send the video bitstream corresponding to the target compression ratio to the receiving device.
[0019] An embodiment of the present invention further provides a video bitstream processing device, which includes: a memory, a processor, and a video bitstream processing program stored on the memory and executable on the processor. When the computer program is executed by the processor, it implements the steps of any one of the above-mentioned video bitstream processing methods executed on the video encoding device side, or implements the steps of any one of the above-mentioned video bitstream processing methods executed on the video processing device side.
[0020] An embodiment of the present invention provides a computer-readable storage medium, on which a video bitstream processing program is stored. When the video bitstream processing program is executed by a processor, it implements the steps of any one of the above-mentioned video bitstream processing methods executed on the video encoding device side, or implements the steps of any one of the above-mentioned video bitstream processing methods executed on the video processing device side.
[0021] The beneficial effects of the embodiments of the present invention are as follows:
[0022] In the embodiments of the present invention, according to the code rate occupancy ratio set for each time domain layer in the coding structure, video coding processing based on code rate control is performed on the image data of each time domain layer in the group of pictures, so that the code rate occupancy ratio of the compressible part of each time domain layer in the video bitstream obtained by video coding becomes known, making it possible for the video processing device to compress the video bitstream into a video bitstream with other code rates without transcoding the video coding, and avoiding the time cost, interaction cost, and economic cost caused by transcoding the video bitstream. Description of the Drawings
[0023] The drawings described herein are used to provide a further understanding of the present invention, and constitute a part of this application. The schematic embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation to the present invention. In the drawings:
[0024] Figure 1 is a flowchart of a video bitstream processing method executed on the encoding device side according to an embodiment of the present invention;
[0025] Figure 2 is a schematic diagram of a coding structure according to an embodiment of the present invention;
[0026] Figure 3 is a structural diagram of the data header of a coded slice according to an embodiment of the present invention;
[0027] Figure 4 is a flowchart of a video bitstream processing method executed on the video processing device side according to an embodiment of the present invention;
[0028] Figure 5It is a structural diagram of a video bitstream processing system according to an embodiment of the present invention;
[0029] Figure 6 It is a structural diagram of a video bitstream processing device provided on the video encoding device side according to an embodiment of the present invention;
[0030] Figure 7 It is a structural diagram of a video bitstream processing device provided on the video processing device side according to an embodiment of the present invention;
[0031] Figure 8 It is a structural diagram of a video bitstream processing device according to an embodiment of the present invention. Detailed implementation manners
[0032] To make the objectives, technical solutions, and advantages of the present invention clearer, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0033] According to an embodiment of the present invention, a video bitstream processing method executed on the encoding device side is provided. The encoding device is the device where the video encoder is located. The device where the video encoder is located is, for example, the streaming end. As Figure 1 shown, it is a flowchart of a video bitstream processing method executed on the encoding device side according to an embodiment of the present invention.
[0034] Step S110, obtain a group of pictures to be encoded; wherein, the group of pictures conforms to a preset encoding structure; the encoding structure includes at least two temporal layers, and each temporal layer includes at least one frame of image data in the group of pictures.
[0035] A group of pictures (GOP) includes multiple frames of image data. The multiple frames of image data conform to a preset encoding structure. Image data refers to all or part of the data of a video image.
[0036] The encoding structure is used to specify the number of image data in the group of pictures, the frame type of the image data at each position, the image data referred to by the image data at each position in the group of pictures, and the temporal order of the image data at each position during encoding. Referring to other image data is to obtain a complete frame of video image. The frame types of image data include I-frame, B-frame, and P-frame. An I-frame is an intra-coded frame, a B-frame represents a bi-predictive coded interpolation frame, and a P-frame represents a forward-predictive coded frame. Among them, the image data of B-frames and P-frames need to refer to other image data. The multiple frames of image data are divided into multiple temporal layers, and the image data with a lower temporal level is first video-encoded according to the corresponding frame type, and the image data with a higher temporal level is then video-encoded according to the corresponding frame type.
[0037] For example: As Figure 2As shown, it is a schematic diagram of an encoding structure according to an embodiment of the present invention. In Figure 3 It is the encoding structure corresponding to the random access encoding mode. In this encoding structure, it includes five temporal layers and 17 frames of image data. The levels of the temporal layers from high to low are temporal layer 4, temporal layer 3, temporal layer 2, temporal layer 1, and temporal layer 0. Image data 0 is an I-frame, image data 16 is a P-frame, and image data 1 to image data 15 are B-frames. The image data pointed by the arrow is the referenced image data.
[0038] Furthermore, the encoding structure that the picture group conforms to is determined by the encoding mode adopted by the video encoding device, and the encoding structures corresponding to different encoding modes are different. Furthermore, the types of encoding modes include but are not limited to: intra-frame encoding, low-latency encoding, and random access encoding.
[0039] Step S120, query the bitrate occupancy ratio set in advance for each of the temporal layers in the encoding structure.
[0040] The bitrate occupancy ratio refers to the ratio of the bitrate of all or part of the encoded slices of a temporal layer to the bitrate of the video bitstream after video encoding. An encoded slice is also called a Network Abstract Layer Unit (NALU for short). An encoded slice is generated corresponding to the image data after encoding the image data. The encoded slice is used to carry the encoded result data of the image data.
[0041] Specifically, a bitrate occupancy ratio look-up table can be set in advance, and the bitrate occupancy ratios set in advance for each temporal layer in each encoding structure are recorded in the bitrate occupancy ratio look-up table; by querying the bitrate occupancy ratio look-up table, determine the bitrate occupancy ratio corresponding to each temporal layer in the encoding structure that the picture group conforms to.
[0042] Step S130, respectively perform video encoding processing based on bitrate control on the image data of each temporal layer according to the bitrate occupancy ratio corresponding to each temporal layer, generate the encoded slices corresponding to the image data of each temporal layer, and form the video bitstream corresponding to the picture group.
[0043] The video bitstream is a sequence of encoded slices. Each encoded slice in the sequence carries the encoded result data of one frame of image data. The data header of the encoded slice is used to record the information of the image data. The payload part of the encoded slice is used to carry the encoded result data of the image data. The temporal layer where the encoded slice is located is the same as the temporal layer where the image data corresponding to the encoded slice is located.
[0044] Video coding processing based on bitrate control means that during the execution of video coding processing, by adjusting the coding parameters of all or part of the image data in the current temporal layer, after the coding of all the image data in the temporal layer is completed, the percentage of the bitrate of the coded slices that can be compressed in the temporal layer in the bitrate of the video bitstream is equal to the bitrate occupancy ratio corresponding to the temporal layer. Among them, the coded slices that can be compressed are all or part of the coded slices in the temporal layer.
[0045] Furthermore, the types of coding parameters include but are not limited to: quantization parameter (Quantization Parameter, abbreviated as QP). When adjusting the coding parameters of image data, the quantization parameter of the image data can be increased or decreased. Increasing the quantization parameter of the image data can improve the compression ratio of the image data and reduce the bitrate of the image data. Decreasing the quantization parameter of the image data can reduce the compression ratio of the image data and increase the bitrate of the image data.
[0046] To make the video coding processing method based on bitrate control in this embodiment clearer, the following two video coding processing methods based on bitrate control are provided. Of course, those skilled in the art should know that the following two methods are only used to illustrate the embodiments of the present invention and are not used to limit the embodiments of the present invention.
[0047] Method 1: Adjust the coding parameters of all or part of the image data in each temporal layer. The following operations are performed for each temporal layer: perform video coding on the image data of the temporal layer, and during the process of performing video coding on the image data of the temporal layer, adjust the coding parameters of all or part of the image data in the temporal layer so that after video coding, the ratio of the bitrate of the coded slices in the temporal layer to the bitrate of the video bitstream is the bitrate occupancy ratio corresponding to the temporal layer.
[0048] Method 2: Adjust the coding parameters of the non-referenced image data in each temporal layer. The following operations are performed for each temporal layer: perform video coding on the image data of the temporal layer, and during the process of performing video coding on the image data of the temporal layer, determine the non-referenced image data in the image data of the temporal layer; adjust the coding parameters of the non-referenced image data so that after video coding, the ratio of the bitrate of the coded slices of the non-referenced type in the temporal layer to the bitrate of the video bitstream is the bitrate occupancy ratio corresponding to the temporal layer.
[0049] Non-referenced image data means not being referenced by other image data in the same temporal layer. The temporal layer may also include referenced image data. Referenced image data means being referenced by other image data in the same temporal layer. The type of non-referenced image data can be a B-frame or a P-frame. The type of referenced image data can be an I-frame.
[0050] The non-referenced picture data is used to generate a coded slice of the non-referenced type. The referenced picture data is used to generate a coded slice of the referenced type.
[0051] In Method 1, regardless of whether the picture data is referenced by other picture data, the encoding parameters of each picture data in the temporal layer are adjusted sequentially until the ratio of the bitrate of the temporal layer after video encoding to the bitrate of the video bitstream reaches the bitrate occupancy ratio corresponding to the temporal layer. In Method 2, it is concerned whether the picture data is referenced by other picture data, and the encoding parameters of each non-referenced picture data in the temporal layer are adjusted sequentially until the ratio of the bitrate occupancy ratio of the temporal layer after video encoding to the bitrate of the video bitstream reaches the bitrate occupancy ratio corresponding to the temporal layer.
[0052] In Method 1, the coded slices that can be compressed are all the coded slices in the temporal layer. In Method 2, the coded slices that can be compressed are the non-referenced coded slices.
[0053] Regarding the temporal layer where the picture data is located and whether the picture data is non-referenced picture data, it can be recorded in the data header of the coded slice corresponding to the picture data.
[0054] Furthermore, as Figure 3 shown, it is the structure diagram of the data header of the coded slice. The data header of the coded slice includes: Forbidden_zero_bit (abbreviated as F), NAL_unit_type (abbreviated as Type), NAL_reserved_zero_6bits (abbreviated as LayerID), and NAL_temporal_id_plus1 (abbreviated as TID). The data header occupies two bytes. The Forbidden_zero_bit occupies bit 0 of the first byte. The NAL_unit_type occupies bits 1 to 6 of the first byte. The NAL_reserved_zero_6bits occupies bit 7 of the first byte and bits 0 to 4 of the second byte. The NAL_temporal_id_plus1 occupies bits 5 to 7 of the second byte.
[0055] The Forbidden_zero_bit is used to indicate whether there is an error in the coded slice. The default value of the Forbidden_zero_bit is 0. If during network transmission, one of the network nodes identifies an error in the coded slice, the value of the Forbidden_zero_bit is set to 1.
[0056] The NAL_unit_type is used to represent the type of the coded slice.
[0057] The NAL_reserved_zero_6bits are reserved bit positions.
[0058] The time domain identifier is used to indicate the time domain layer where the coded slice is located. Subtracting 1 from the value of the time domain identifier gives the label of the time domain layer to which the coded slice belongs.
[0059] In this embodiment, according to the code rate occupancy ratio set corresponding to each of the time domain layers in the coding structure, video coding processing based on code rate control is performed on the image data of each time domain layer in the group of pictures, so that the code rate occupancy ratio of the compressible part of each time domain layer in the video bitstream obtained by video coding becomes known, making it possible for the video processing device to compress the video bitstream into a video bitstream with other code rates without transcoding the video coding, thus avoiding the time cost, interaction cost, and economic cost caused by transcoding the video bitstream.
[0060] For the video bitstream processing method executed on the video coding device side as described above, an embodiment of the present invention further provides a video bitstream processing method executed on the video processing device side. The types of video processing devices include but are not limited to: zero-transcoding servers and edge CDN nodes.
[0061] As Figure 4 shown, it is a flowchart of the video bitstream processing method executed on the video processing device side according to an embodiment of the present invention.
[0062] Step S410, obtain the target compression ratio corresponding to the receiving device.
[0063] The target compression ratio refers to the ratio of the code rate supported by the receiving device to the original code rate of the video bitstream. The original code rate of the video bitstream is the code rate of the video bitstream output by the video coding device.
[0064] The types of receiving devices include but are not limited to: video source station servers and video playback devices. Further, the video playback device can be a client. This client is, for example, a pull stream end.
[0065] When the type of the receiving device is a video source station server, a compression ratio record table can be set in advance, and the target compression ratio supported by the video source station server is recorded in the compression ratio record table. Further, the code rate supported by the video source station server can be obtained, and based on the original code rate of the video bitstream and the code rate supported by the video source station server, the target compression ratio supported by the video source station server is determined.
[0066] When the type of the receiving device is a video playback device, the target compression ratio or bitrate sent by the video playback device can be received before or after receiving a request for obtaining a video bitstream sent by the video playback device. If the video playback device sends a bitrate, the target compression ratio supported by the video playback device can be determined based on the original bitrate of the video bitstream requested by the video playback device and the bitrate sent by the video playback device, and then the target compression ratio corresponding to the video playback device can be obtained.
[0067] Step S420, determine the encoding structure corresponding to the video bitstream to be sent to the receiving device.
[0068] The video bitstream can be a video bitstream requested or subscribed by the receiving device.
[0069] The video bitstream is obtained after the video encoding device performs video encoding processing based on bitstream control on a group of pictures conforming to the encoding structure.
[0070] Pre-set the encoding structure corresponding to the video bitstream in the video processing device according to the encoding structure adopted by the video encoding device and store it in a preset location; after obtaining the target compression ratio corresponding to the receiving device, read and determine the encoding structure corresponding to the video bitstream from this preset location. Of course, the encoding structure corresponding to the video bitstream can also be obtained and determined by communicating with the video encoding device.
[0071] Step S430, determine the time domain layer to be processed in the video bitstream according to the pre-set bitrate occupancy ratio corresponding to each time domain layer in the encoding structure; wherein, the bitrate occupancy ratio corresponding to the time domain layers other than the time domain layer to be processed in the video bitstream is equal to the target compression ratio.
[0072] The time domain layer to be processed refers to the time domain layer in the video bitstream that can be compressed and processed.
[0073] The encoding structure conforming to the group of pictures is the same as the encoding result corresponding to the video bitstream. The encoding structure includes at least two time domain layers. If the encoding structure has only one time domain layer, among the multiple frame image data in the group of pictures, except for the first frame of image data, each remaining frame of image data has to refer to the previous frame of image data for video encoding. If the video bitstream of this encoding structure is compressed, only the coded slice corresponding to the last frame of image data can be discarded, but this cannot achieve the compression effect. Since the image data of the low time domain layer does not refer to the image data of the high time domain layer, the encoding structure of this embodiment includes at least two time domain layers. First, compress the coded slices corresponding to the image data of the high time domain layer, and then compress the coded slices corresponding to the image data of the low time domain layer, reducing the possibility of video bitstream decoding failure.
[0074] In this embodiment, in order to achieve the goal of performing image compression processing layer by layer from a high temporal layer to a low temporal layer, when determining the to-be-processed temporal layer in the video bitstream, the bitrate occupancy ratio corresponding to each temporal layer is sequentially obtained in the order from high to low temporal layers; according to the obtained bitrate occupancy ratio corresponding to each temporal layer, the bitrate occupancy ratios corresponding to all unobtained temporal layers are determined until the bitrate occupancy ratios corresponding to all unobtained temporal layers are equal to the target compression ratio, then stop obtaining the bitrate occupancy ratio corresponding to the next temporal layer, and determine each obtained temporal layer as the to-be-processed temporal layer in the video bitstream. Among them, the bitrate occupancy ratios corresponding to each obtained temporal layer are accumulated, and 1 is subtracted from the accumulated value to obtain the bitrate occupancy ratios corresponding to all unobtained temporal layers.
[0075] Step S440, identify the to-be-processed coded slice in the to-be-processed temporal layer in the video bitstream, perform image compression processing on the to-be-processed coded slice, obtain the video bitstream corresponding to the target compression ratio, and send the video bitstream corresponding to the target compression ratio to the receiving device.
[0076] The to-be-processed coded slice refers to the coded slice in the to-be-processed coding layer that can be compressed.
[0077] Two methods for identifying the to-be-processed coded slice are provided below. However, those skilled in the art should know that the following two are only used to illustrate this embodiment and are not used to limit the embodiments of the present invention.
[0078] In the case of performing video coding processing based on bitrate control using the above method 1, all coded slices in the to-be-processed temporal layer are identified as to-be-processed coded slices. Specifically, obtain the data header of each coded slice in the video bitstream; according to the temporal identifier in the data header of each coded slice, determine the temporal layer corresponding to each coded slice; identify the coded slice whose temporal layer is the to-be-processed temporal layer as the to-be-processed coding.
[0079] In the case of performing video coding processing based on bitrate control using the above method 2, the coded slices in the to-be-processed temporal layer whose coded slice type is not referenced are identified as to-be-processed coded slices. Specifically, obtain the data header of each coded slice in the video bitstream; for each coded slice, according to the coded slice type identifier and temporal layer identifier in the data header of the coded slice, determine the coded slice type corresponding to the coded slice and the temporal layer corresponding to the coded slice; among them, the coded slice types include: not referenced and referenced; identify the coded slice whose coded slice type is not referenced and whose temporal layer is the to-be-processed temporal layer as the to-be-processed coded slice.
[0080] In this embodiment, performing image compression processing on the to-be-processed coded slice includes: discarding the to-be-processed coded slice; or, filling the payload part of the to-be-processed coded slice with a preset value; wherein, the code rate of the to-be-processed coded slice with the payload part filled with the preset value is less than the original code rate of the to-be-processed coded slice. Wherein, in the order from high to low of the temporal layer, image compression processing is sequentially performed on the to-be-processed coded slices in each to-be-processed temporal layer. Further, only after all the coded slices in the higher-level to-be-processed temporal layer are discarded, image compression processing is performed on the to-be-processed coded slices in the next to-be-processed temporal layer of the higher-level to-be-processed temporal layer.
[0081] In this embodiment, after identifying the to-be-processed coded slice in the to-be-processed temporal layer in the video bitstream, the method further includes: obtaining the target audio bitstream corresponding to the video bitstream; wherein, the target audio bitstream includes a plurality of audio data frames; among the plurality of audio data frames, querying for the audio data frame corresponding to the to-be-processed coded slice in the video bitstream, and discarding the queried audio data frame.
[0082] Further, the audio data frame is used to carry audio data. The coded slice stores the playback time of the corresponding image data in the video sequence. The audio data frame stores the playback time of the audio data in the audio stream. Query for the audio data frame with the same playback time stored in the to-be-processed coded slice and discard it. By discarding the audio data frame, the problem of audio-video out-of-sync on the video playback device side can be effectively prevented.
[0083] In this embodiment, since the ratio of the code rate of the compressible part of each temporal layer is known, the video bitstream with the original code rate is compressed according to the target compression ratio corresponding to the receiving device to obtain the video bitstream corresponding to the target compression ratio. The compression method is convenient and fast, without transcoding the video bitstream with the original code rate, avoiding the problem of high cost caused by transcoding.
[0084] Further, in a group of pictures, the image data of the lower temporal layer does not refer to the image data of the higher temporal layer, while the image data of the higher temporal layer needs to refer to the image data of the lower temporal layer. The image data of the lowest temporal layer is the reference basis for the image data of the higher temporal layer. Therefore, in order to enable the coded result data of the image data carried in the coded slice to be correctly decoded, in this embodiment, no compression processing is performed on the coded slice corresponding to the image data of the lowest temporal layer. Instead, starting from the highest temporal layer, layer by layer downward, the ratio of the code rate corresponding to each temporal layer is obtained until the ratio of the code rate corresponding to all the unobtained temporal layers is equal to the target compression ratio.
[0085] Further, if the embodiment of the present invention is executed on the zero transcoding server connected to the video source station server, the video source station server does not need to rent the transcoding service provided by the transcoding provider, reducing the time cost and economic cost of transcoding. If it is executed on the edge CDN node, the edge CDN node can directly compress the video stream with the original bit rate without repeatedly requesting video streams with different compression ratios from the video source station server, reducing the number of interactions between the edge CDN node and the video source station server.
[0086] Further, the embodiment of the present invention can parse the data header of the coded slice of each temporal layer, and implement compression with different compression ratios according to the temporal layer where the coded slice is located and the type of the coded slice. The compression process is simple and easy to operate.
[0087] A more specific example is given below to further describe the video stream processing method of the present invention. As Figure 5 shown, it is a structural diagram of a video stream processing system according to an embodiment of the present invention.
[0088] The video stream processing system includes: a video encoding device 510, a zero transcoding server 520, a first video source station server 530, a second video source station server 540, a first edge CDN node 550, a second edge CDN node 560, and a video playback device 570.
[0089] Among them, the video encoding device 510 is connected to the zero transcoding server 520, the zero transcoding server 520 is respectively connected to the first video source station server 530 and the second video source station server 540, both ends of the first edge CDN node 550 are respectively connected to the first video source station server 530 and the video playback device 570, and both ends of the second edge CDN node 560 are respectively connected to the second video source station server 540 and the video playback device 570.
[0090] A video encoding device 510 is used to perform video encoding processing based on bitrate control on a group of pictures, obtain a video bitstream with a first bitrate, and send the video bitstream with the first bitrate to a zero transcoding server 520. The first bitrate is the original bitrate of the video bitstream. Specifically, a video acquisition device (not shown in the figure) acquires a video sequence, and the video sequence includes multiple consecutive video images. The video acquisition device transmits the video sequence to the video encoding device; the video encoding device sequentially divides the video sequence into multiple groups of pictures according to the acquisition time sequence of the video images and the adopted encoding method. Each group of pictures includes multiple frame image data, and the multiple frame image data in each group of pictures conform to the encoding structure corresponding to the encoding method; according to the division sequence, each group of pictures is sequentially obtained, and the video bitrate processing method of the embodiment of the present invention is executed on each group of pictures. Further, the video acquisition device and the video encoding device can be integrated into one device, or can be separately arranged in different devices. The video acquisition device can be a camera or a video camera. The video encoding device can be a video encoder. The acquisition and encoding of the video sequence can be performed in real time, or can be encoded centrally after the acquisition is completed.
[0091] The zero transcoding server 520, as a video processing device, is used to receive the video bitstream with the first bitrate sent by the video encoding server; obtain at least one first target compression ratio corresponding to the first video source station server 530, and obtain at least one second target compression ratio corresponding to the second video source server; for each target compression ratio (at least one first target compression ratio and at least one second target compression ratio), according to the bitrate occupancy ratio corresponding to each temporal layer in the encoding structure corresponding to the video bitstream, determine the temporal layer to be processed in the video bitstream, identify the encoded slice to be processed in the temporal layer to be processed in the video bitstream, and perform image compression processing on the encoded slice to be processed to obtain the video bitstream corresponding to the target compression ratio and send the video bitstream corresponding to the target compression ratio. The zero transcoding server 520 sends the video bitstreams corresponding to at least one first target compression ratio to the first video source station server 530, and sends the video bitstreams corresponding to at least one second target compression ratio to the second video source station server 540.
[0092] For example, the first target compression ratios corresponding to the first video source server 530 are 75% and 50% respectively; the coding structure adopted by the picture group includes three temporal layers, namely Layer0, Layer1, and Layer2 from low to high. The bitrate occupancy ratio corresponding to Layer0 is 50%, the bitrate occupancy ratio corresponding to Layer1 is 25%, and the bitrate occupancy ratio corresponding to Layer2 is 25%. The zero transcoding server 520 discards all coded slices of the Layer2 temporal layer to obtain a video bitstream with a compression ratio of 75%, and discards all coded slices of the Layer2 and Layer1 temporal layers to obtain a video bitstream with a compression ratio of 50%.
[0093] The first edge CDN node 550 and the second edge CDN node 560 can also be used as video processing devices to compress the video bitstream with the original bitrate into a video bitstream with other bitrates. Here, only the second edge CDN node 560 is taken as the video processing device.
[0094] The video playback device 570 is used to detect the network status and playback status before or during the playback of the video bitstream, determine the target bitrate required currently according to the network status and playback status, and send the target bitrate to the first edge CDN node 550 or the second edge CDN node 560, so as to receive the video bitstream with the target bitrate sent by the first edge CDN node 550 or the second edge CDN node 560.
[0095] If the first edge CDN node 550 that receives the target bitrate is not the above-mentioned video processing device, it stops sending the video bitstream with the current bitrate to the video playback device 570, and requests the video bitstream with the target bitrate from the first video source server 530. The first video source server 530 sends the video bitstream with the target bitrate to the first edge CDN node 550, and the first edge CDN node 550 then sends the video bitstream with the target bitrate to the video playback device 570.
[0096] If the second edge CDN node 560 that receives the target bitrate is the above-mentioned video processing device, the second edge CDN node 560 directly compresses the video bitstream with the current bitrate sent to the video playback device 570 into the target bitrate and sends it to the video playback device 570. Among them, the ratio of the target bitrate to the first bitrate of the video bitstream is the target compression ratio corresponding to the video playback device 570.
[0097] The video encoding device in this embodiment performs video encoding processing on a group of pictures based on bitrate control to obtain a video bitstream with a first bitrate. The video processing device (zero transcoding server, edge CDN node) obtains multiple video bitstreams with different bitrates (compression ratios) by dropping packets or filling preset values in the video bitstream with the first bitrate, so as to adapt to different network environments and save transcoding costs.
[0098] Embodiments of the present invention can provide multiple video bitstreams with different bitrates (compression ratios) for the video source station server, so that the video source station server can provide video bitstreams with different bitrates to the edge CDN nodes connected thereto, without the need for the video source station server to rent transcoding services.
[0099] Embodiments of the present invention can provide a video bitstream with a first bitrate to the video source station server. During the process of the video source station server sending the video bitstream to the video playback device through the edge CDN node, the edge CDN node can compress the video bitstream with the first bitrate into a video bitstream with other bitrates to meet the network environment requirements of the video playback device, so that the edge CDN node does not need to repeatedly request video bitstreams with different bitrates from the video source station server, reducing the number of times the edge CDN node returns to the source.
[0100] Embodiments of the present invention also provide a video bitstream processing device provided on the video encoding device side. As Figure 6 shown, it is a structural diagram of a video bitstream processing device provided on the video encoding device side according to an embodiment of the present invention.
[0101] The video bitstream processing device provided on the video encoding device side includes: a first acquisition module 610, a ratio query module 620, and a bitstream generation module 630.
[0102] The first acquisition module 610 is configured to acquire a group of pictures to be encoded; wherein, the group of pictures conforms to a preset encoding structure; the encoding structure includes at least two temporal layers, and each temporal layer includes at least one frame of picture data in the group of pictures.
[0103] The ratio query module 620 is configured to query the bitrate ratio values respectively set in advance for each of the temporal layers in the encoding structure.
[0104] The bitstream generation module 630 is configured to perform video encoding processing based on bitrate control on the picture data of each temporal layer respectively according to the bitrate ratio value corresponding to each temporal layer, generate encoded slices corresponding to the picture data of each temporal layer, and form a video bitstream corresponding to the group of pictures.
[0105] The functions of the device described in the embodiments of the present invention have been described in the above method embodiments. Therefore, for the details not elaborated in this embodiment, reference can be made to the relevant descriptions in the foregoing embodiments and will not be repeated here.
[0106] An embodiment of the present invention further provides a video bitstream processing device disposed on the video processing device side. As Figure 7 shown, it is a structural diagram of a video bitstream processing device disposed on the video processing device side according to an embodiment of the present invention.
[0107] The video bitstream processing device disposed on the video processing device side includes: a second acquisition module 710, a first determination module 720, a second determination module 730, and a compression processing module 740.
[0108] The second acquisition module 710 is configured to acquire a target compression ratio corresponding to a receiving device.
[0109] The first determination module 720 is configured to determine an encoding structure corresponding to a video bitstream to be sent to the receiving device; the video bitstream is obtained after a video encoding device performs video encoding processing based on bitstream control on a group of pictures conforming to the encoding structure.
[0110] The second determination module 730 is configured to determine a to-be-processed temporal layer in the video bitstream according to a pre-set bitrate occupancy ratio corresponding to each temporal layer in the encoding structure; wherein, the bitrate occupancy ratios corresponding to the temporal layers other than the to-be-processed temporal layer in the video bitstream are equal to the target compression ratio.
[0111] The compression processing module 740 is configured to identify a to-be-processed coded slice in the to-be-processed temporal layer in the video bitstream, perform image compression processing on the to-be-processed coded slice, obtain a video bitstream corresponding to the target compression ratio, and send the video bitstream corresponding to the target compression ratio to the receiving device.
[0112] The functions of the device described in the embodiments of the present invention have been described in the above method embodiments. Therefore, for the details not elaborated in this embodiment, reference can be made to the relevant descriptions in the foregoing embodiments and will not be repeated here.
[0113] This embodiment provides a video bitstream processing device. As Figure 8 shown, it is a structural diagram of a video bitstream processing device according to an embodiment of the present invention.
[0114] In this embodiment, the shown video bitstream processing device includes, but is not limited to: a processor 810 and a memory 820.
[0115] The processor 810 is configured to execute a video bitstream processing program stored in the memory 820 to implement the above video bitstream processing method executed on the video encoding device side or the above video bitstream processing method executed on the video processing device side.
[0116] Specifically, the processor 810 is configured to execute a video bitstream processing program stored in the memory 820 and executed on the video encoding device side to implement the following steps:
[0117] Obtain a group of images to be encoded; wherein, the group of images conforms to a preset encoding structure; the encoding structure includes at least two temporal layers, and each temporal layer includes at least one frame of image data in the group of images; query the bitrate occupancy ratios respectively set in advance for each of the temporal layers in the encoding structure; according to the bitrate occupancy ratios corresponding to each temporal layer, perform video encoding processing based on bitrate control on the image data of each temporal layer respectively to generate encoded slices corresponding to the image data of each temporal layer, and form a video bitstream corresponding to the group of images.
[0118] Among them, performing video encoding processing based on bitrate control on the image data of each temporal layer according to the bitrate occupancy ratio corresponding to each temporal layer includes: performing the following operations for each temporal layer: performing video encoding on the image data of the temporal layer, and during the process of performing video encoding on the image data of the temporal layer, adjusting the encoding parameters of all or part of the image data in the temporal layer so that after video encoding, the ratio of the bitrate of the encoded slice of the temporal layer to the bitrate of the video bitstream is the bitrate occupancy ratio corresponding to the temporal layer.
[0119] Among them, performing video encoding processing based on bitrate control on the image data of each temporal layer according to the bitrate occupancy ratio corresponding to each temporal layer includes: performing the following operations for each temporal layer: performing video encoding on the image data of the temporal layer, and during the process of performing video encoding on the image data of the temporal layer, determining the image data that is not referenced in the image data of the temporal layer; wherein, the image data that is not referenced is used to generate an encoded slice of a type that is not referenced; adjusting the encoding parameters of the image data that is not referenced so that after video encoding, the ratio of the bitrate of the encoded slice of the type that is not referenced in the temporal layer to the bitrate of the video bitstream is the bitrate occupancy ratio corresponding to the temporal layer.
[0120] The processor 810 is configured to execute a video bitstream processing program stored in the memory 820 and executed on the video processing device side to implement the following steps: obtaining a target compression ratio corresponding to the receiving device; determining an encoding structure corresponding to the video bitstream to be sent to the receiving device, where the video bitstream is obtained after a video encoding device performs video encoding processing based on bitstream control on a group of pictures conforming to the encoding structure; determining a to-be-processed temporal layer in the video bitstream according to a pre-set bitrate occupancy ratio corresponding to each temporal layer in the encoding structure, where the bitrate occupancy ratio corresponding to a temporal layer other than the to-be-processed temporal layer in the video bitstream is equal to the target compression ratio; identifying a to-be-processed coded slice in the to-be-processed temporal layer in the video bitstream, and performing image compression processing on the to-be-processed coded slice to obtain a video bitstream corresponding to the target compression ratio and sending the video bitstream corresponding to the target compression ratio to the receiving device.
[0121] Among them, determining the to-be-processed temporal layer in the video bitstream according to the pre-set bitrate occupancy ratio corresponding to each temporal layer in the encoding structure includes: sequentially obtaining the bitrate occupancy ratio corresponding to each temporal layer in the order from high to low in terms of the temporal layer; determining the bitrate occupancy ratios corresponding to all unobtained temporal layers according to the obtained bitrate occupancy ratio corresponding to each temporal layer, until the bitrate occupancy ratios corresponding to all unobtained temporal layers are equal to the target compression ratio, then stopping obtaining the bitrate occupancy ratio corresponding to the next temporal layer, and determining each obtained temporal layer as the to-be-processed temporal layer in the video bitstream.
[0122] Among them, identifying the to-be-processed coded slice in the to-be-processed temporal layer in the video bitstream includes: obtaining the data header of each coded slice in the video bitstream; determining the temporal layer corresponding to each coded slice according to the temporal identifier in the data header of each coded slice; and identifying the coded slice whose temporal layer is the to-be-processed temporal layer as the to-be-processed coding.
[0123] Among them, identifying the to-be-processed coded slice in the to-be-processed temporal layer in the video bitstream includes: obtaining the data header of each coded slice in the video bitstream; for each coded slice, determining the coded slice type corresponding to the coded slice and the temporal layer corresponding to the coded slice according to the coded slice type identifier and the temporal layer identifier in the data header of the coded slice, where the coded slice type includes: not referenced and referenced; and identifying the coded slice whose coded slice type is not referenced and whose temporal layer is the to-be-processed temporal layer as the to-be-processed coded slice.
[0124] Among them, performing image compression processing on the to-be-processed coded slice includes: discarding the to-be-processed coded slice; or, filling the payload part of the to-be-processed coded slice with a preset value; wherein, the code rate of the to-be-processed coded slice with the payload part filled with the preset value is less than the original code rate of the to-be-processed coded slice.
[0125] Among them, after identifying the to-be-processed coded slice in the to-be-processed time domain layer in the video bitstream, the method further includes: obtaining the target audio bitstream corresponding to the video bitstream; wherein, the target audio bitstream includes a plurality of audio data frames; among the plurality of audio data frames, querying for the audio data frame corresponding to the to-be-processed coded slice in the video bitstream, and discarding the queried audio data frame.
[0126] Among them, the types of the receiving device include: video source station server and video playback device; the types of the video processing device include: zero transcoding server and edge content distribution network CDN node.
[0127] An embodiment of the present invention further provides a computer-readable storage medium. The computer-readable storage medium stores one or more programs. Among them, the computer-readable storage medium may include volatile memory, such as random access memory; the memory may also include non-volatile memory, such as read-only memory, flash memory, hard disk or solid-state drive; the memory may also include a combination of the above types of memory.
[0128] When one or more programs in the computer-readable storage medium can be executed by one or more processors to implement the above terminal wake-up method.
[0129] Specifically, the processor is used to execute the terminal wake-up program stored in the memory to implement the video bitstream processing method executed on the video encoding device side, or to implement the video bitstream processing method executed on the video processing device side as described above. Since the video bitstream processing method executed on the video encoding device side and the video bitstream processing method executed on the video processing device side have been described in detail above, they will not be elaborated here.
[0130] The above are only embodiments of the present invention and are not used to limit the present invention. For those skilled in the art, the present invention can have various changes and modifications. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included within the scope of the claims of the present invention.
Claims
1. A video bitstream processing method, characterized in that, it is applied to a video bitstream processing system, the system includes: a video encoding device and a video processing device, and the method includes: the video encoding device obtains a group of images to be encoded; wherein, the group of images conforms to a preset encoding structure; the encoding structure includes at least two temporal layers, and each temporal layer includes at least one frame of image data in the group of images; query the bitrate occupancy ratios respectively set in advance for each of the temporal layers in the encoding structure; according to the bitrate occupancy ratio corresponding to each temporal layer, respectively perform video encoding processing based on bitrate control on the image data of each temporal layer, generate encoded slices corresponding to the image data of each temporal layer, form a video bitstream corresponding to the group of images; and send the video bitstream to the video processing device; the video processing device obtains the target compression ratio corresponding to the receiving device; determines the encoding structure corresponding to the video bitstream to be sent to the receiving device; according to the bitrate occupancy ratios respectively set in advance for each of the temporal layers in the encoding structure, determines the temporal layer to be processed in the received video bitstream, identifies the encoded slices to be processed in the temporal layer to be processed in the video bitstream, and performs image compression processing on the encoded slices to be processed, obtains the video bitstream corresponding to the target compression ratio and sends the video bitstream corresponding to the target compression ratio to the receiving device; wherein, the bitrate occupancy ratios corresponding to the temporal layers other than the temporal layer to be processed in the received video bitstream are equal to the target compression ratio; the determining the temporal layer to be processed in the video bitstream according to the bitrate occupancy ratios respectively set in advance for each of the temporal layers in the encoding structure includes: sequentially obtaining the bitrate occupancy ratios corresponding to each temporal layer in the order from high to low of the temporal layers; according to the bitrate occupancy ratios corresponding to each obtained temporal layer, determining the bitrate occupancy ratios corresponding to all unobtained temporal layers until the bitrate occupancy ratios corresponding to all unobtained temporal layers are equal to the target compression ratio, then stopping obtaining the bitrate occupancy ratio corresponding to the next temporal layer, and determining each obtained temporal layer as the temporal layer to be processed in the video bitstream.
2. The method according to claim 1, characterized in that, performing video encoding processing based on bitrate control on the image data of each temporal layer according to the bitrate occupancy ratio corresponding to each temporal layer includes: performing the following operations for each temporal layer: performing video encoding on the image data of the temporal layer, and during the process of performing video encoding on the image data of the temporal layer, adjusting the encoding parameters of all or part of the image data in the temporal layer, so that after video encoding, the ratio of the bitrate of the encoded slice of the temporal layer to the bitrate of the video bitstream is the bitrate occupancy ratio corresponding to the temporal layer.
3. The method according to claim 1, characterized in that, performing video encoding processing based on bitrate control on the image data of each temporal layer according to the bitrate occupancy ratio corresponding to each temporal layer includes: Perform the following operations for each of the time domain layers: Perform video encoding on the image data of the time domain layer, and during the process of performing video encoding on the image data of the time domain layer, determine the un-referenced image data in the image data of the time domain layer; wherein, the un-referenced image data is used to generate an encoded slice with an encoded slice type of un-referenced; Adjust the encoding parameters of the un-referenced image data so that after video encoding, the ratio of the bitrate of the encoded slices with the encoded slice type of un-referenced in the time domain layer to the bitrate of the video bitstream is the bitrate occupancy ratio corresponding to the time domain layer.
4. A video bitstream processing method, characterized in that, applied to the video processing device side, includes: Obtain the target compression ratio corresponding to the receiving device; Determine the encoding structure corresponding to the video bitstream to be sent to the receiving device; the video bitstream is obtained after a video encoding device performs video encoding processing based on bitstream control on a group of pictures conforming to the encoding structure; Determine the time domain layer to be processed in the video bitstream according to the bitrate occupancy ratio preset for each time domain layer in the encoding structure; wherein, the bitrate occupancy ratio corresponding to the time domain layers other than the time domain layer to be processed in the video bitstream is equal to the target compression ratio; Identify the encoded slices to be processed in the time domain layer to be processed in the video bitstream, and perform image compression processing on the encoded slices to be processed to obtain the video bitstream corresponding to the target compression ratio and send the video bitstream corresponding to the target compression ratio to the receiving device; The determining the time domain layer to be processed in the video bitstream according to the bitrate occupancy ratio preset for each time domain layer in the encoding structure includes: Sequentially obtain the bitrate occupancy ratio corresponding to each time domain layer in the order from the highest time domain layer to the lowest time domain layer; According to the obtained bitrate occupancy ratio corresponding to each time domain layer, determine the bitrate occupancy ratio corresponding to all the unobtained time domain layers until the bitrate occupancy ratio corresponding to all the unobtained time domain layers is equal to the target compression ratio, then stop obtaining the bitrate occupancy ratio corresponding to the next time domain layer, and determine each of the obtained time domain layers as the time domain layer to be processed in the video bitstream.
5. The method according to claim 4, characterized in that, Identifying the encoded slices to be processed in the time domain layer to be processed in the video bitstream includes: Obtain the data header of each encoded slice in the video bitstream; Determine the time domain layer corresponding to each encoded slice according to the time domain identifier in the data header of each encoded slice; Identify the encoded slices with the time domain layer being the time domain layer to be processed as the encoded slices to be processed.
6. The method according to claim 4, characterized in that, Identifying the encoded slices to be processed in the time domain layer to be processed in the video bitstream includes: Obtain the data header of each encoded slice in the video bitstream; For each of the encoded slices, determine the encoded slice type corresponding to the encoded slice and the time domain layer corresponding to the encoded slice according to the encoded slice type identifier and the time domain layer identifier in the data header of the encoded slice; wherein, the encoded slice type includes: un-referenced and referenced; Identify coded slices whose coded slice type is not referenced and whose temporal layer is the to-be-processed temporal layer as the to-be-processed coded slices.
7. The method according to claim 4, wherein, performing image compression processing on the to-be-processed coded slices, including: discarding the to-be-processed coded slices; or, filling the payload part of the to-be-processed coded slices with a preset value; wherein, the code rate of the to-be-processed coded slices with the payload part filled with the preset value is less than the original code rate of the to-be-processed coded slices.
8. The method according to claim 4, wherein, after identifying the to-be-processed coded slices in the to-be-processed temporal layer in the video bitstream, the method further includes: obtaining a target audio bitstream corresponding to the video bitstream; wherein, the target audio bitstream includes a plurality of audio data frames; querying, among the plurality of audio data frames, an audio data frame corresponding to the to-be-processed coded slice in the video bitstream, and discarding the queried audio data frame.
9. The method according to any one of claims 4 to 8, wherein, the types of the receiving devices include: video source station servers and video playback devices; the types of the video processing devices include: zero transcoding servers and edge content delivery network CDN nodes.
10. A video bitstream processing system, including a video encoding device and a video processing device, wherein: the video encoding device includes: a first obtaining module, configured to obtain a group of images to be encoded; wherein, the group of images conforms to a preset encoding structure; the encoding structure includes at least two temporal layers, and each temporal layer includes at least one frame of image data in the group of images; a ratio querying module, configured to query a code rate ratio value corresponding to each of the temporal layers in the encoding structure in advance; a bitstream generating module, configured to perform video encoding processing based on code rate control on the image data of each temporal layer respectively according to the code rate ratio value corresponding to each temporal layer, generate coded slices corresponding to the image data of each temporal layer, form a video bitstream corresponding to the group of images; and send the video bitstream to the video processing device; the video processing device includes: a second obtaining module, configured to obtain a target compression ratio corresponding to a receiving device; a first determining module, configured to determine an encoding structure corresponding to the video bitstream to be sent to the receiving device; a second determining module, configured to determine a to-be-processed temporal layer in the received video bitstream according to the code rate ratio value corresponding to each temporal layer in the encoding structure in advance; a compression processing module, configured to identify to-be-processed coded slices in the to-be-processed temporal layer in the video bitstream, and perform image compression processing on the to-be-processed coded slices, obtain a video bitstream corresponding to the target compression ratio and send the video bitstream corresponding to the target compression ratio to the receiving device; wherein, the code rate ratio values corresponding to the temporal layers other than the to-be-processed temporal layer in the received video bitstream are equal to the target compression ratio; Determining the to-be-processed time domain layer in the video bitstream according to the bitrate occupancy ratio set in advance for each time domain layer in the encoding structure includes: Sequentially obtaining the bitrate occupancy ratio corresponding to each time domain layer in the order from the highest time domain layer to the lowest time domain layer; Determining the bitrate occupancy ratios corresponding to all unobtained time domain layers according to the bitrate occupancy ratios corresponding to each obtained time domain layer, and stopping obtaining the bitrate occupancy ratio corresponding to the next time domain layer until the bitrate occupancy ratios corresponding to all unobtained time domain layers are equal to the target compression ratio, and determining each obtained time domain layer as the to-be-processed time domain layer in the video bitstream.
11. A video bitstream processing device Characterized in that It is arranged on the video processing device side and includes: A second obtaining module, configured to obtain the target compression ratio corresponding to the receiving device; A first determining module, configured to determine the encoding structure corresponding to the video bitstream to be sent to the receiving device; the video bitstream is obtained after a video encoding device performs video encoding processing based on bitstream control on a group of pictures conforming to the encoding structure; A second determining module, configured to determine the to-be-processed time domain layer in the video bitstream according to the bitrate occupancy ratio set in advance for each time domain layer in the encoding structure; wherein, the bitrate occupancy ratios corresponding to the time domain layers other than the to-be-processed time domain layer in the video bitstream are equal to the target compression ratio; A compression processing module, configured to identify the to-be-processed coded slice in the to-be-processed time domain layer in the video bitstream, perform image compression processing on the to-be-processed coded slice, obtain the video bitstream corresponding to the target compression ratio, and send the video bitstream corresponding to the target compression ratio to the receiving device; Determining the to-be-processed time domain layer in the video bitstream according to the bitrate occupancy ratio set in advance for each time domain layer in the encoding structure includes: Sequentially obtaining the bitrate occupancy ratio corresponding to each time domain layer in the order from the highest time domain layer to the lowest time domain layer; Determining the bitrate occupancy ratios corresponding to all unobtained time domain layers according to the bitrate occupancy ratios corresponding to each obtained time domain layer, and stopping obtaining the bitrate occupancy ratio corresponding to the next time domain layer until the bitrate occupancy ratios corresponding to all unobtained time domain layers are equal to the target compression ratio, and determining each obtained time domain layer as the to-be-processed time domain layer in the video bitstream.
12. A video bitstream processing device Characterized in that The video bitstream processing device includes: a memory, a processor, and a video bitstream processing program stored on the memory and executable on the processor. When the video bitstream processing program is executed by the processor, it implements the steps of the video bitstream processing method according to any one of claims 1 to 3, or implements the steps of the video bitstream processing method according to any one of claims 4 to 9.
13. A computer-readable storage medium Characterized in that A video stream processing program is stored on the computer-readable storage medium. When the video stream processing program is executed by a processor, it implements the steps of the video stream processing method described in any one of claims 1 to 3, or implements the steps of the video stream processing method described in any one of claims 4 to 9.