Live picture transcoding method, device and equipment and computer readable storage medium
By using personalized quantization parameters to encode different color coding planes for each frame of the image during live streaming, the problem of color loss after transcoding is solved, and the color quality of the image is improved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- BEIJING KINGSOFT CLOUD NETWORK TECH CO LTD
- Filing Date
- 2024-12-02
- Publication Date
- 2026-06-02
AI Technical Summary
In existing technologies, color quality degrades during transcoding of live streaming footage, resulting in significant color loss.
By receiving each frame of image data sent by the client, the quantization parameters of each frame are determined, and based on the color coding data and quantization parameters of each macroblock in each frame of image, different quantization parameters are used for encoding for different color coding planes.
It effectively avoids color loss in the image and improves the color quality of the image, especially the color quality of static images.
Smart Images

Figure CN122137965A_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of computer technology, and in particular to a method, apparatus, device and computer-readable storage medium for transcoding live broadcast images. Background Technology
[0002] With the development of computer network technology, live streaming is becoming increasingly popular among users. Live streaming is a multimedia format that utilizes communication networks and multimedia communication technologies to broadcast video footage live on online platforms.
[0003] In existing technologies, when a server transcodes a live stream, the color quality of the image degrades significantly after transcoding, resulting in severe color loss. Summary of the Invention
[0004] To solve the above-mentioned technical problems, or at least partially solve them, this disclosure provides a live broadcast transcoding method, apparatus, device, and computer-readable storage medium, which can improve the color quality of the image and avoid serious color loss.
[0005] In a first aspect, embodiments of this disclosure provide a method for transcoding live stream footage, the method comprising:
[0006] Receive each frame of image data sent by the client, wherein each frame of image data includes color-coded data for each macroblock in each frame of image;
[0007] Based on the image data of each frame, the quantization parameters of each frame are determined;
[0008] Based on the color coding data of each macroblock in each frame of the image and the quantization parameters of each frame, the quantization parameters corresponding to each color coding plane of each frame of the image are determined.
[0009] Each frame of the image is encoded based on the quantization parameters corresponding to each color coding plane.
[0010] Secondly, embodiments of this disclosure provide a live stream transcoding device, the device comprising:
[0011] The receiving module is used to receive each frame of image data sent by the client, wherein each frame of image data includes color-coded data of each macroblock in each frame of image;
[0012] The first determining module is used to determine the quantization parameters of each frame based on the image data of each frame;
[0013] The second determining module is used to determine the quantization parameters corresponding to each color coding plane of each frame image based on the color coding data of each macroblock in each frame image and the quantization parameters of each frame.
[0014] The encoding module is used to encode each frame of the image based on the quantization parameters corresponding to each color encoding plane of each frame.
[0015] Thirdly, embodiments of this disclosure provide an electronic device, including:
[0016] Memory;
[0017] Processor; and
[0018] Computer programs;
[0019] The computer program is stored in the memory and configured to be executed by the processor to implement the method as described in the first aspect.
[0020] Fourthly, embodiments of this disclosure provide a computer-readable storage medium having a computer program stored thereon, the computer program being executed by a processor to implement the method as described in the first aspect.
[0021] Fifthly, embodiments of this disclosure also provide a computer program product comprising a computer program or instructions that, when executed by a processor, implement the method described in the first aspect.
[0022] The live streaming transcoding method, apparatus, device, and computer-readable storage medium provided in this disclosure receive image data frame by frame sent by a client. Each frame includes color-coded data for each macroblock in the image frame. Based on this image data, quantization parameters for each frame are determined. Based on the color-coded data for each macroblock and the quantization parameters, quantization parameters corresponding to each color coding plane of the image frame are determined. Each image frame is then encoded based on these quantization parameters. Compared to existing technologies, this disclosure solves the problem of severe color loss during live streaming transcoding. By determining the quantization parameters for each color coding plane based on the color-coded data for each macroblock and the quantization parameters, and encoding each image based on these parameters, and by using different quantization parameters for different color coding planes, severe color loss can be avoided. Attached Figure Description
[0023] The accompanying drawings, which are incorporated in and form a part of this specification, illustrate embodiments consistent with this disclosure and, together with the description, serve to explain the principles of this disclosure.
[0024] To more clearly illustrate the technical solutions in the embodiments of this disclosure or the prior art, the accompanying drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, those skilled in the art can obtain other drawings based on these drawings without creative effort.
[0025] Figure 1 A flowchart of a live stream transcoding method provided in this embodiment of the disclosure;
[0026] Figure 2 This is a schematic diagram comparing YUV444 and YUV420 sampling provided in an embodiment of this disclosure;
[0027] Figure 3 A flowchart of a live stream transcoding method provided in another embodiment of this disclosure;
[0028] Figure 4 A flowchart of a live stream transcoding method provided in another embodiment of this disclosure;
[0029] Figure 5 This is a schematic diagram of the structure of the live broadcast transcoding device provided in the embodiments of this disclosure;
[0030] Figure 6 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this disclosure. Detailed Implementation
[0031] To better understand the above-mentioned objectives, features, and advantages of this disclosure, the solutions disclosed herein will be further described below. It should be noted that, unless otherwise specified, the embodiments and features described herein can be combined with each other.
[0032] Numerous specific details are set forth in the following description in order to provide a full understanding of this disclosure, but this disclosure may also be implemented in other ways different from those described herein; obviously, the embodiments in the specification are only some, and not all, of the embodiments of this disclosure.
[0033] With the development of computer network technology, live streaming is becoming increasingly popular among users. Live streaming is a multimedia format that utilizes communication networks and multimedia communication technologies to broadcast video footage live on online platforms.
[0034] In existing technologies, when a server transcodes a live stream, the color quality of the image degrades significantly after transcoding, resulting in severe color loss.
[0035] To address this issue, this disclosure provides a method for transcoding live stream footage, which will be described below with reference to specific embodiments.
[0036] Figure 1 This is a flowchart illustrating a live stream transcoding method provided in this embodiment. The method is executed by an electronic device. The electronic device can be a server, such as a single server or a server cluster. The server cluster can be a distributed cluster or a centralized cluster. This method can be applied to scenarios involving live stream transcoding, particularly those requiring significant color loss. It is understood that the live stream transcoding method provided in this embodiment can also be applied to other scenarios.
[0037] The following is about Figure 1 The following describes a live stream transcoding method. This method can be applied to the server side. Taking the server side as an example, the specific steps included in this method are as follows:
[0038] S101. Receive each frame of image data sent by the client, wherein each frame of image data includes color-coded data of each macroblock in each frame of image.
[0039] In this step, the client pushes a video stream to the server; in other words, the client pushes the live video content to the server. The live video content consists of each frame of image data, and the server receives each frame of image data sent by the client. Optionally, the color-coded data for each macroblock includes the luminance component, the first chroma component, and the second chroma component of each macroblock. For example... Figure 2 As shown, the color-coded data includes Y, U, and V, where Y represents the luminance component, U represents the first chrominance component, and V represents the second chrominance component. Figure 2 As shown, four sampling points (two in the first row and two in the second row) are taken as a macroblock. Each macroblock of a frame of YUV444 pixel contains four Y, four U, and four V; each macroblock of a frame of YUV420 pixel contains four Y, one U, and one V.
[0040] S102. Based on the image data of each frame, determine the quantization parameters of each frame.
[0041] In this step, after receiving each frame of image data sent by the client, the server can determine the quantizer parameter (QP) for each frame based on the image data.
[0042] S103. Based on the color coding data of each macroblock in each frame of the image and the quantization parameters of each frame, determine the quantization parameters corresponding to each color coding plane of each frame of the image.
[0043] In this step, the server determines the quantization parameters corresponding to each color coding plane of each frame image based on the color coding data of each macroblock in each frame image and the quantization parameters of each frame.
[0044] S104. Encode each frame of image based on the quantization parameters corresponding to each color coding plane of each frame of image.
[0045] In this step, the server encodes each image frame according to the quantization parameters corresponding to each color encoding plane. Specifically, each color encoding plane of each image frame is encoded separately according to the quantization parameters corresponding to each color encoding plane. For example, color encoding plane A of each image frame is encoded according to the quantization parameter 'a' corresponding to color encoding plane A, and color encoding plane B of each image frame is encoded according to the quantization parameter 'b' corresponding to color encoding plane B. Using different quantization parameters for different color encoding planes can avoid severe color loss in the image.
[0046] This embodiment of the disclosure receives image data frame by frame sent by a client. Each frame includes color-coded data of each macroblock in the image frame. Based on the image data frame, quantization parameters for each frame are determined. Based on the color-coded data of each macroblock in the image frame and the quantization parameters of each frame, quantization parameters corresponding to each color coding plane of the image frame are determined. Based on the quantization parameters corresponding to each color coding plane of the image frame, each frame is encoded. Compared with the prior art, this embodiment of the disclosure solves the problem of severe color loss during live broadcast transcoding in the prior art. Based on the color-coded data of each macroblock in the image frame and the quantization parameters of each frame, quantization parameters corresponding to each color coding plane of the image frame are determined. Based on the quantization parameters corresponding to each color coding plane of the image frame, each frame is encoded. Different quantization parameters are used for encoding different color coding planes, which can avoid severe color loss.
[0047] Figure 3 A flowchart of a live stream transcoding method provided in another embodiment of this disclosure is shown below. Figure 3 As shown, the method includes the following steps:
[0048] S201. Receive each frame of image data sent by the client, wherein each frame of image data includes color-coded data of each macroblock in each frame of image.
[0049] Specifically, the implementation process and principle of S201 and S101 are the same, and will not be repeated here.
[0050] The image data for each frame includes complexity information for each macroblock in each frame.
[0051] S202. Calculate the complexity information of each frame based on the complexity information of each macroblock in each frame of the image.
[0052] In this step, the server can calculate the complexity information of each frame based on the complexity information of each macroblock in each frame of the image. Specifically, the complexity information of each macroblock in each frame of the image can be accumulated to obtain the complexity information of each frame.
[0053] S203. Based on the complexity information of each frame and the preset quantization curve compression coefficient, calculate the quantization parameters of each frame.
[0054] In this step, the server can calculate the quantization parameters of each frame based on the complexity information of each frame and the preset quantization curve compression coefficient. For example, the quantization parameter QP = x for each frame can be calculated using the formula. 1-qcomp .
[0055] Where QP represents the quantization parameters for each frame, x represents the complexity information for each frame, and qcomp represents the preset quantization curve compression coefficient, which can be configured without specific limitations.
[0056] In some alternative embodiments, the server can determine the quantization step size of each frame by looking up a table based on the complexity information of each frame, obtain the correspondence between the quantization step size and the quantization parameters, and determine the quantization parameters of each frame corresponding to the quantization step size of each frame from the correspondence.
[0057] For example, the server stores a mapping table between complexity information and quantization step size (Qstep). The server can determine the quantization step size for each frame by looking up the table based on the complexity information of each frame. The server also stores a correspondence between quantization step size (Qstep) and quantization parameters (QP). By obtaining this correspondence, the server can further determine the quantization parameters for each frame corresponding to the quantization step size of each frame.
[0058] S204. Based on the color coding data of each macroblock in each frame of the image, obtain each color coding plane of each frame of the image, wherein each color coding plane includes a luminance plane, a first chromaticity plane and a second chromaticity plane.
[0059] In this step, the server obtains the color coding planes for each frame of the image based on the color coding data of each macroblock. These color coding planes include a luma plane, a first chroma plane, and a second chroma plane. Specifically, each frame of the image is divided into three color coding planes. The luma plane is obtained by reading the Y value from the color coding data of each macroblock in each frame; the first chroma plane is obtained by reading the U value from the color coding data of each macroblock in each frame; and the second chroma plane is obtained by reading the V value from the color coding data of each macroblock in each frame.
[0060] S205. Based on each color coding plane of each frame image and the quantization parameters of each frame, determine the quantization parameters corresponding to each color coding plane of each frame image.
[0061] In this step, the server determines the quantization parameters corresponding to each color encoding plane of each frame of the image based on each color encoding plane and the quantization parameters of each frame.
[0062] In some embodiments, S205 includes, but is not limited to, S2051 and S2052:
[0063] S2051. If the color coding plane is a luminance plane, then the quantization parameter of each frame is determined to be the quantization parameter corresponding to the luminance plane of each frame image.
[0064] In this embodiment, if the color encoding plane is a luminance plane, the server determines that the quantization parameter of each frame is the quantization parameter corresponding to the luminance plane of each frame image, that is, the quantization parameter of each frame is used as the quantization parameter corresponding to the luminance plane of each frame image.
[0065] S2052. If the color coding plane is a first chromaticity plane or a second chromaticity plane, then based on the preset formula and the quantization parameters of each frame, the quantization parameters corresponding to the first chromaticity plane or the second chromaticity plane are obtained.
[0066] In this embodiment, if the color encoding plane is a first chromaticity plane or a second chromaticity plane, the server obtains the quantization parameters corresponding to the first chromaticity plane or the second chromaticity plane based on a preset formula and the quantization parameters of each frame. Appropriately reducing the precision of static images without significant degradation allows for the allocation of bitrate resources to dynamic images and also improves the color quality relative to static images. In some embodiments, the preset formula is as follows:
[0067]
[0068] Where QP' represents the quantization parameter corresponding to the first or second chromaticity plane, QP represents the quantization parameter for each frame, qpdynamic represents the preset color shift threshold, and floor(QP) represents the color encoding optimization formula. The value range of QP is [0, 51], and qpdynamic refers to the critical point at which color shift occurs, which can be 8 or other values without specific limitations.
[0069] In some embodiments, the color coding optimization formula floor(QP) is as follows: a step-like QP is adopted, where QP is set to 0 when it belongs to [0, 1); 1 when it belongs to [1, 2); 2 when it belongs to [2, 3); and so on.
[0070] S206. Encode each frame of image based on the quantization parameters corresponding to each color coding plane of each frame of image.
[0071] Specifically, the implementation process and principle of S206 and S104 are the same, and will not be repeated here.
[0072] This embodiment of the disclosure receives image data frame by frame sent by a client. Each frame of image data includes color-coded data for each macroblock in each frame. Then, based on the complexity information of each macroblock in each frame, the complexity information of each frame is calculated. Based on the complexity information of each frame and a preset quantization curve compression coefficient, the quantization parameters of each frame are calculated. Further, based on the color-coded data of each macroblock in each frame, each color-coded plane of each frame is obtained. Each color-coded plane includes a luma plane, a first chroma plane, and a second chroma plane. Based on each color-coded plane of each frame and the quantization parameters of each frame, the quantization parameters corresponding to each color-coded plane of each frame are determined. Finally, each frame is encoded based on the quantization parameters corresponding to each color-coded plane of each frame. Compared to existing technologies, the embodiments disclosed in this disclosure solve the problem of severe color loss during live video transcoding. Based on the color coding planes of each frame and the quantization parameters of each frame, the quantization parameters corresponding to each color coding plane of each frame are determined. Each frame is then encoded based on these quantization parameters, using different quantization parameters for different color coding planes to avoid severe color loss. Appropriately reducing the precision of static images without significant degradation allows for the allocation of bitrate resources to dynamic images, thus improving the color quality compared to static images.
[0073] Figure 4 A flowchart of a live stream transcoding method provided in another embodiment of this disclosure is shown below. Figure 4 As shown, the method includes the following steps:
[0074] S301. Receive each frame of image data sent by the client, wherein each frame of image data includes color-coded data of each macroblock in each frame of image.
[0075] Specifically, the implementation process and principle of S301 and S101 are the same, and will not be repeated here.
[0076] S302. Based on the image data of each frame, determine the quantization parameters of each frame.
[0077] Specifically, the implementation process and principle of S302 and S102 are the same, and will not be repeated here.
[0078] S303. Based on the color coding data of each macroblock in each frame of the image, obtain each color coding plane of each frame of the image, wherein each color coding plane includes a luminance plane, a first chromaticity plane and a second chromaticity plane.
[0079] Specifically, the implementation process and principle of S303 and S204 are the same, and will not be repeated here.
[0080] S304. If the color coding plane is a luminance plane, then the quantization parameter of each frame is determined to be the quantization parameter corresponding to the luminance plane of each frame image.
[0081] In this embodiment, if the color encoding plane is a luminance plane, the server determines that the quantization parameter of each frame is the quantization parameter corresponding to the luminance plane of each frame image, that is, the quantization parameter of each frame is used as the quantization parameter corresponding to the luminance plane of each frame image.
[0082] S305. If the color encoding plane is a first chromaticity plane or a second chromaticity plane, then determine whether the quantization parameter of each frame is greater than or equal to a preset color offset threshold.
[0083] In this embodiment, if the color encoding plane is a first chromaticity plane or a second chromaticity plane, the server will determine whether the quantization parameter of each frame is greater than or equal to a preset color offset threshold.
[0084] S306. If the quantization parameter of each frame is less than the preset color offset threshold, then perform color encoding optimization on the first chromaticity plane or the second chromaticity plane to obtain the quantization parameter corresponding to the first chromaticity plane or the second chromaticity plane.
[0085] In this step, if the server determines that the quantization parameter of each frame is less than the preset color offset threshold, it means that the image has not experienced color shift. Then, color encoding optimization is performed on the first or second chromaticity plane to obtain the corresponding quantization parameters. Appropriately reducing the precision of static images without causing significant degradation allows for the allocation of bitrate resources to dynamic images, while also improving the color quality relative to static images.
[0086] Optionally, color coding optimization formulas can be used to optimize the color coding of the first or second chromaticity plane. Specifically, a step-wise QP is adopted: when QP belongs to [0, 1), all values are 0; when QP belongs to [1, 2), all values are 1; when QP belongs to [2, 3), all values are 2, and so on.
[0087] In some embodiments, S306 performs color encoding optimization on the first chromaticity plane or the second chromaticity plane to obtain quantization parameters corresponding to the first chromaticity plane or the second chromaticity plane, which may include, but is not limited to, S3061 and S3062:
[0088] S3061. Determine the quantization interval corresponding to the quantization parameters of each frame;
[0089] In this embodiment, the quantization parameters are pre-divided into multiple quantization intervals, such as [0, 1), [1, 2), [2, 3), etc. The server will determine the quantization interval corresponding to the quantization parameters of each frame.
[0090] S3062. The minimum value of the quantization interval is used as the quantization parameter corresponding to the first chromaticity plane or the second chromaticity plane.
[0091] Furthermore, the server will use the minimum value of the quantization interval, i.e. the left boundary value of the quantization interval, as the quantization parameter corresponding to the first chromaticity plane or the second chromaticity plane.
[0092] S307. If the quantization parameter of each frame is greater than or equal to the preset color offset threshold, then the quantization parameter of each frame is determined to be the quantization parameter corresponding to the brightness plane of each frame image.
[0093] In this step, if the server determines that the quantization parameter of each frame is greater than or equal to the preset color offset threshold, it indicates that the image has undergone color shift. In this case, the quantization parameter of each frame is used as the quantization parameter corresponding to the brightness plane of each frame image.
[0094] S308. Encode each frame of image based on the quantization parameters corresponding to each color coding plane of each frame of image.
[0095] Specifically, the implementation process and principle of S308 and S104 are the same, and will not be repeated here.
[0096] This embodiment of the disclosure receives image data frame by frame sent by a client. Each frame of image data includes color-coded data of each macroblock in each frame. Based on the image data frame, a quantization parameter for each frame is determined. Then, based on the color-coded data of each macroblock in each frame, each color-coded plane of each frame is obtained. Each color-coded plane includes a luma plane, a first chroma plane, and a second chroma plane. If the color-coded plane is a luma plane, the quantization parameter for each frame is determined to be the quantization parameter corresponding to the luma plane of each frame. Further, if the color-coded plane is the first chroma plane or the second chroma plane, it is determined whether the quantization parameter for each frame is greater than or equal to a preset color offset threshold. If the quantization parameter for each frame is less than the preset color offset threshold, color encoding optimization is performed on the first chroma plane or the second chroma plane to obtain the quantization parameter corresponding to the first chroma plane or the second chroma plane. If the quantization parameter for each frame is greater than or equal to the preset color offset threshold, the quantization parameter for each frame is determined to be the quantization parameter corresponding to the luma plane of each frame. Then, each frame of the image is encoded based on the quantization parameters corresponding to each color encoding plane. Compared with the prior art, the embodiments of this disclosure solve the problem of severe color loss during live broadcast transcoding in the prior art. By encoding each frame of the image based on the quantization parameters corresponding to each color encoding plane, and using different quantization parameters for different color encoding planes, severe color loss can be avoided. Appropriately reducing the precision of static images without causing significant damage allows bitrate resources to be allocated to dynamic images, thus improving the color quality of static images.
[0097] Figure 5 This is a schematic diagram of the structure of the live stream transcoding device provided in this embodiment. The live stream transcoding device can be a server as described in the above embodiment, or it can be a component or part of the server. The live stream transcoding device provided in this embodiment can execute the processing flow provided in the live stream transcoding method embodiment, such as... Figure 5 As shown, the live stream transcoding device 50 includes: a receiving module 51, a first determining module 52, a second determining module 53, and an encoding module 54; wherein, the receiving module 51 is used to receive image data of each frame sent by the client, the image data of each frame including color encoding data of each macroblock in each frame image; the first determining module 52 is used to determine the quantization parameters of each frame based on the image data of each frame; the second determining module 53 is used to determine the quantization parameters corresponding to each color encoding plane of each frame image based on the color encoding data of each macroblock in each frame image and the quantization parameters of each frame; the encoding module 54 is used to encode each frame image based on the quantization parameters corresponding to each color encoding plane of each frame image.
[0098] Optionally, the image data for each frame also includes complexity information of each macroblock in each frame; when the first determining module 52 determines the quantization parameters of each frame based on the image data for each frame, it is specifically used to: calculate the complexity information of each frame according to the complexity information of each macroblock in each frame; and calculate the quantization parameters of each frame based on the complexity information of each frame and the preset quantization curve compression coefficient.
[0099] Optionally, the color-coded data for each macroblock includes: the luminance component of each macroblock, the first chrominance component of each macroblock, and the second chrominance component of each macroblock.
[0100] Optionally, when the second determining module 53 determines the quantization parameters corresponding to each color coding plane of each frame image based on the color coding data of each macroblock in each frame image and the quantization parameters of each frame, it is specifically used to: obtain each color coding plane of each frame image based on the color coding data of each macroblock in each frame image, wherein each color coding plane includes a luminance plane, a first chrominance plane, and a second chrominance plane; and determine the quantization parameters corresponding to each color coding plane of each frame image based on each color coding plane of each frame image and the quantization parameters of each frame.
[0101] Optionally, when the second determining module 53 determines the quantization parameters corresponding to each color coding plane of each frame image based on each color coding plane of each frame image and the quantization parameters of each frame, it is specifically used to: if the color coding plane is a luminance plane, then determine the quantization parameters of each frame as the quantization parameters corresponding to the luminance plane of each frame image; if the color coding plane is a first chromaticity plane or a second chromaticity plane, then obtain the quantization parameters corresponding to the first chromaticity plane or the second chromaticity plane based on a preset formula and the quantization parameters of each frame.
[0102] Optionally, when the second determining module 53 obtains the quantization parameters corresponding to the first chromaticity plane or the second chromaticity plane based on the preset formula and the quantization parameters of each frame, it is specifically used to: determine whether the quantization parameters of each frame are greater than or equal to a preset color offset threshold; if the quantization parameters of each frame are less than the preset color offset threshold, then perform color encoding optimization on the first chromaticity plane or the second chromaticity plane to obtain the quantization parameters corresponding to the first chromaticity plane or the second chromaticity plane; if the quantization parameters of each frame are greater than or equal to the preset color offset threshold, then determine that the quantization parameters of each frame are the quantization parameters corresponding to the luminance plane of each frame image.
[0103] Optionally, when the second determining module 53 performs color encoding optimization on the first chromaticity plane or the second chromaticity plane to obtain the quantization parameters corresponding to the first chromaticity plane or the second chromaticity plane, it is specifically used to: determine the quantization interval corresponding to the quantization parameters of each frame; and take the minimum value of the quantization interval as the quantization parameter corresponding to the first chromaticity plane or the second chromaticity plane.
[0104] Figure 5 The live stream transcoding device shown in the embodiment can be used to execute the technical solution of the above method embodiment. Its implementation principle and technical effect are similar, and will not be described again here.
[0105] Figure 6 This is a schematic diagram of the structure of an electronic device according to an embodiment of this disclosure. See below for details. Figure 6 It shows a schematic diagram of a structure suitable for implementing the electronic device 600 in the embodiments of this disclosure. Figure 6 The electronic device shown is merely an example and should not be construed as limiting the functionality and scope of the embodiments disclosed herein.
[0106] like Figure 6 As shown, the electronic device 600 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 601, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 602 or a program loaded from a storage device 608 into a random access memory (RAM) 603 to implement the live video transcoding method as described in the embodiments of this disclosure. The RAM 603 also stores various programs and data required for the operation of the electronic device 600. The processing device 601, ROM 602, and RAM 603 are interconnected via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.
[0107] Typically, the following devices can be connected to I / O interface 605: input devices 606 including, for example, touchscreens, touchpads, keyboards, mice, cameras, microphones, accelerometers, gyroscopes, etc.; output devices 607 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; storage devices 608 including, for example, magnetic tapes, hard disks, etc.; and communication devices 609. Communication device 609 allows electronic device 600 to communicate wirelessly or wiredly with other devices to exchange data. Although Figure 6 An electronic device 600 with various devices is shown; however, it should be understood that it is not required to implement or possess all of the devices shown. More or fewer devices may be implemented or possessed alternatively.
[0108] In particular, according to embodiments of this disclosure, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of this disclosure include a computer program product comprising a computer program carried on a non-transitory computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts, thereby implementing the live video transcoding method as described above. In such embodiments, the computer program can be downloaded and installed from a network via a communication device 609, or installed from a storage device 608, or installed from a ROM 602. When the computer program is executed by the processing device 601, it performs the functions defined in the methods of embodiments of this disclosure.
[0109] It should be noted that the computer-readable medium described in this disclosure can be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this disclosure, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in connection with an instruction execution system, apparatus, or device. In this disclosure, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium can be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wires, optical fibers, RF (radio frequency), etc., or any suitable combination thereof.
[0110] In some implementations, clients and servers can communicate using any currently known or future-developed network protocol such as HTTP (Hypertext Transfer Protocol) and can interconnect with digital data communication (e.g., communication networks) of any form or medium. Examples of communication networks include local area networks (“LANs”), wide area networks (“WANs”), the Internet (e.g., the Internet of Things), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future-developed networks.
[0111] The aforementioned computer-readable medium may be included in the aforementioned electronic device; or it may exist independently and not assembled into the electronic device.
[0112] The aforementioned computer-readable medium carries one or more programs, which, when executed by the electronic device, cause the electronic device to:
[0113] Receive each frame of image data sent by the client, wherein each frame of image data includes color-coded data for each macroblock in each frame of image;
[0114] Based on the image data of each frame, the quantization parameters of each frame are determined;
[0115] Based on the color coding data of each macroblock in each frame of the image and the quantization parameters of each frame, the quantization parameters corresponding to each color coding plane of each frame of the image are determined.
[0116] Each frame of the image is encoded based on the quantization parameters corresponding to each color coding plane.
[0117] Optionally, when one or more of the above-described procedures are executed by the electronic device, the electronic device may also perform other steps described in the above embodiments.
[0118] Computer program code for performing the operations of this disclosure can be written in one or more programming languages or a combination thereof, including but not limited to object-oriented programming languages such as Java, Smalltalk, and C++, as well as conventional procedural programming languages such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0119] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0120] The units described in the embodiments of this disclosure can be implemented in software or hardware. The names of the units are not, in some cases, intended to limit the specific unit.
[0121] The functions described above in this document can be performed, at least in part, by one or more hardware logic components. For example, exemplary types of hardware logic components that can be used, without limitation, include: Field Programmable Gate Arrays (FPGAs), Application-Specific Integrated Circuits (ASICs), Application Standard Products (ASSPs), System-on-Chip (SoCs), Complex Programmable Logic Devices (CPLDs), and so on.
[0122] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0123] The above description is merely a preferred embodiment of this disclosure and an explanation of the technical principles employed. Those skilled in the art should understand that the scope of this disclosure is not limited to technical solutions formed by specific combinations of the above-described technical features, but should also cover other technical solutions formed by arbitrary combinations of the above-described technical features or their equivalents without departing from the above-described concept. For example, technical solutions formed by substituting the above features with (but not limited to) technical features disclosed in this disclosure that have similar functions.
[0124] Furthermore, while the operations are described in a specific order, this should not be construed as requiring these operations to be performed in the specific order shown or in a sequential order. In certain environments, multitasking and parallel processing may be advantageous. Similarly, while several specific implementation details are included in the above discussion, these should not be construed as limiting the scope of this disclosure. Certain features described in the context of individual embodiments may also be implemented in combination in a single embodiment. Conversely, various features described in the context of a single embodiment may also be implemented individually or in any suitable sub-combination in multiple embodiments.
[0125] Although the subject matter has been described using language specific to structural features and / or methodological logic, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. Rather, the specific features and actions described above are merely illustrative examples of implementing the claims.
Claims
1. A method for transcoding live stream footage, characterized in that, The method includes: Receive each frame of image data sent by the client, wherein each frame of image data includes color-coded data for each macroblock in each frame of image; Based on the image data of each frame, the quantization parameters of each frame are determined; Based on the color coding data of each macroblock in each frame of the image and the quantization parameters of each frame, the quantization parameters corresponding to each color coding plane of each frame of the image are determined. Each frame of the image is encoded based on the quantization parameters corresponding to each color coding plane.
2. The method according to claim 1, characterized in that, The image data for each frame also includes complexity information for each macroblock in each frame. The process of determining the quantization parameters for each frame based on the image data of each frame includes: The complexity information of each frame is calculated based on the complexity information of each macroblock in each frame of the image. Based on the complexity information of each frame and the preset quantization curve compression coefficient, the quantization parameters of each frame are calculated.
3. The method according to claim 1, characterized in that, The color-coded data for each macroblock includes: The luminance component of each macroblock, the first chrominance component of each macroblock, and the second chrominance component of each macroblock.
4. The method according to claim 3, characterized in that, The determination of quantization parameters corresponding to each color coding plane of each frame image based on the color coding data of each macroblock in each frame image and the quantization parameters of each frame includes: Based on the color coding data of each macroblock in each frame of the image, each color coding plane of each frame of the image is obtained, and each color coding plane includes a luminance plane, a first chrominance plane and a second chrominance plane; Based on each color coding plane of each frame of the image and the quantization parameters of each frame, the quantization parameters corresponding to each color coding plane of each frame of the image are determined.
5. The method according to claim 4, characterized in that, The step of determining the quantization parameters corresponding to each color coding plane of each frame of the image based on each color coding plane and the quantization parameters of each frame includes: If the color coding plane is a luminance plane, then the quantization parameter of each frame is determined to be the quantization parameter corresponding to the luminance plane of each frame image; If the color encoding plane is a first chromaticity plane or a second chromaticity plane, then based on the preset formula and the quantization parameters of each frame, the quantization parameters corresponding to the first chromaticity plane or the second chromaticity plane are obtained.
6. The method according to claim 5, characterized in that, The process of obtaining quantization parameters corresponding to the first chromaticity plane or the second chromaticity plane based on a preset formula and the quantization parameters of each frame includes: Determine whether the quantization parameter of each frame is greater than or equal to the preset color offset threshold; If the quantization parameter of each frame is less than the preset color offset threshold, then color encoding optimization is performed on the first chromaticity plane or the second chromaticity plane to obtain the quantization parameter corresponding to the first chromaticity plane or the second chromaticity plane. If the quantization parameter of each frame is greater than or equal to the preset color offset threshold, then the quantization parameter of each frame is determined to be the quantization parameter corresponding to the brightness plane of each frame image.
7. The method according to claim 6, characterized in that, The step of optimizing the color encoding of the first chromaticity plane or the second chromaticity plane to obtain the quantization parameters corresponding to the first chromaticity plane or the second chromaticity plane includes: Determine the quantization range corresponding to the quantization parameters of each frame; The minimum value of the quantization interval is used as the quantization parameter corresponding to the first chromaticity plane or the second chromaticity plane.
8. A live stream transcoding device, characterized in that, The device includes: The receiving module is used to receive each frame of image data sent by the client, wherein each frame of image data includes color-coded data of each macroblock in each frame of image; The first determining module is used to determine the quantization parameters of each frame based on the image data of each frame; The second determining module is used to determine the quantization parameters corresponding to each color coding plane of each frame image based on the color coding data of each macroblock in each frame image and the quantization parameters of each frame. The encoding module is used to encode each frame of the image based on the quantization parameters corresponding to each color encoding plane of each frame.
9. An electronic device, characterized in that, include: Memory; processor; as well as Computer programs; The computer program is stored in the memory and configured to be executed by the processor to implement the method as described in any one of claims 1-7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the method as described in any one of claims 1-7.