Video transcoding method, device and computer-readable storage medium

By extracting the target image from the video image and adjusting the code rate based on the gradient, the problems of waste of code rate and high resource costs caused by fixed code rate are solved, and adaptive adjustment of code rate and resource saving are achieved.

CN115361562BActive Publication Date: 2025-08-19JD DIGITS HAIYI INFORMATION TECHNOLOGY CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202210977434.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-08-15
Publication Date
2025-08-19
Estimated Expiration
2042-08-15

AI Technical Summary

Technical Problem

In the prior art, there are problems of waste of code rates and high resource costs due to fixed code rates.

Method used

The target image is extracted from the multi-frame image of the video to be processed, the bit rate adjustment type is determined based on the gradient of the target image, and the initial bit rate is adjusted by the bit rate threshold corresponding to the bit rate adjustment type to obtain the target bit rate.

Benefits of technology

Reduces waste of code rate, saves resource costs, and ensures the clarity of the transcoding video image.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115361562B_ABST
    Figure CN115361562B_ABST
Patent Text Reader

Abstract

The present invention discloses a video transcoding method, comprising: extracting a target image from multiple frames of a video to be processed; determining a rate adjustment type corresponding to the video to be processed based on a gradient of the target image; wherein the rate adjustment type represents a method for adjusting the rate of the video to be processed; adjusting an initial rate of the video to be processed to obtain a target rate based on a rate threshold corresponding to the rate adjustment type; and transcoding the video to be processed based on the target rate. The present invention also discloses a video transcoding device and a computer-readable storage medium.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of video processing technology, and in particular to a video transcoding method, device, and computer-readable storage medium. Background Art

[0002] Video transcoding converts a compressed video stream into another video stream to accommodate varying network bandwidths and terminals with varying processing capabilities. Typically, each resolution uses a corresponding fixed bitrate for transcoding. However, during implementation, the inventors discovered that the existing technology suffers from at least the following issues: the fixed bitrate leads to wasteful bitrates and high resource costs. Summary of the Invention

[0003] To solve the above technical problems, the embodiments of the present application hope to provide a video transcoding method, device and computer-readable storage medium, which solve the problems of bit rate waste and high resource cost caused by fixed bit rate in the prior art.

[0004] The technical solution of this application is achieved as follows:

[0005] A video transcoding method, comprising:

[0006] Extracting a target image from multiple frames of the video to be processed;

[0007] Determining a bit rate adjustment type corresponding to the video to be processed based on the gradient of the target image; wherein the bit rate adjustment type represents a method of adjusting the bit rate corresponding to the video to be processed;

[0008] Based on the bit rate threshold corresponding to the bit rate adjustment type, adjusting the initial bit rate corresponding to the to-be-processed video to obtain a target bit rate;

[0009] Based on the target bit rate, the video to be processed is transcoded.

[0010] In the above solution, extracting the target image from multiple frames of the video to be processed includes:

[0011] Every target number of frames, one frame of image is extracted from the multiple frames of image of the video to be processed to obtain N frames of target image.

[0012] In the above solution, determining the bit rate adjustment type corresponding to the to-be-processed video based on the gradient of the target image includes:

[0013] Determining a target value based on a gradient of each target image in the N frames of target images;

[0014] From the target values, determining a target number whose values are within a target value range;

[0015] The rate adjustment type is determined based on the target quantity.

[0016] In the above solution, determining the target value based on the gradient of each target image in the N frames of target images includes:

[0017] Determine a gradient difference between the target image of the i+1th frame and the target image of the ith frame based on the gradient of the target image of the i-th frame and the gradient of the target image of the i+1th frame; wherein i is an odd number;

[0018] The gradient difference and the gradient of the i-th frame target image are calculated to obtain the target value.

[0019] In the above solution, determining the target number whose values are within the target value range from the target values includes:

[0020] determining, from the target values, a first number of target values whose values are within a first value range;

[0021] determining, from the target values, a second number of target values whose values are within a second value range;

[0022] From the target values, a third number of target values whose values lie within a third value range is determined.

[0023] In the above solution, determining the rate adjustment type based on the target number includes:

[0024] determining a first threshold based on N and the first value;

[0025] determining a second threshold based on the N and the second value;

[0026] determining a third threshold based on N and a third value;

[0027] The rate adjustment type is determined based on the first number, the second number, the third number, the first threshold, the second threshold, and the third threshold.

[0028] In the above solution, determining the rate adjustment type based on the first number, the second number, the third number, the first threshold, the second threshold, and the third threshold includes:

[0029] When the first number meets the first threshold, determining the rate adjustment type as a first adjustment type;

[0030] When the sum of the first number and the second number meets the first threshold, and the second number meets the second threshold, determining that the rate adjustment type is the second adjustment type;

[0031] When the third number satisfies the first threshold and the sum of the first number and the second number satisfies the third threshold, determining that the rate adjustment type is a third adjustment type;

[0032] When the first quantity does not meet the first threshold, and the second quantity does not meet the second threshold, and the sum of the first quantity and the second quantity does not meet the first threshold, and the sum of the first quantity and the second quantity does not meet the third threshold, and the third quantity does not meet the first threshold, the rate adjustment type is determined to be the fourth adjustment type.

[0033] In the above solution, adjusting the initial bit rate corresponding to the to-be-processed video to obtain the target bit rate based on the bit rate threshold corresponding to the bit rate adjustment type includes:

[0034] When the bit rate adjustment type is the first adjustment type, performing calculation processing on the initial bit rate based on a first bit rate threshold to obtain the target bit rate;

[0035] When the bit rate adjustment type is the second adjustment type, performing calculation processing on the initial bit rate based on a second bit rate threshold to obtain the target bit rate;

[0036] When the bit rate adjustment type is the third adjustment type, performing calculation processing on the initial bit rate based on a third bit rate threshold to obtain the target bit rate;

[0037] When the bit rate adjustment type is the fourth adjustment type, the initial bit rate is determined to be the target bit rate.

[0038] A video transcoding device, comprising: a processor, a memory, and a communication bus;

[0039] The communication bus is used to realize the communication connection between the processor and the memory;

[0040] The processor is used to execute the video transcoding program in the memory to implement the steps of the above-mentioned video transcoding method.

[0041] A computer-readable storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement the steps of the above-mentioned video transcoding method.

[0042] Because the target image is extracted from multiple frames of the video to be processed, the bit rate adjustment type corresponding to the video to be processed is determined based on the gradient of the target image, and then the initial bit rate corresponding to the video to be processed is adjusted based on the bit rate threshold corresponding to the bit rate adjustment type to obtain the target bit rate, and then the video to be processed is transcoded based on the target bit rate; in this way, the bit rate can be adjusted based on the gradient of the target image extracted from the multiple frames of the video to be processed, that is, the bit rate is adaptively adjusted based on the image of the video to be processed. The adjusted bit rate can reduce bit rate waste while ensuring the image clarity in the transcoded video to be processed, so the problems of bit rate waste and high resource cost caused by fixed bit rate in the prior art are overcome, thereby achieving the technical effect of reducing bit rate waste and saving resource cost. BRIEF DESCRIPTION OF THE DRAWINGS

[0043] Figure 1 A schematic diagram of a video transcoding method according to an embodiment of the present invention;

[0044] Figure 2 A schematic diagram of another video transcoding method provided in an embodiment of the present application;

[0045] Figure 3 A schematic diagram of a flow chart of another video transcoding method provided in an embodiment of the present application;

[0046] Figure 4 A schematic flow chart of a video transcoding method provided in another embodiment of the present application;

[0047] Figure 5 A schematic diagram of the structure of a video transcoding device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0048] The technical solutions in the embodiments of the present application will be described clearly and completely below in conjunction with the drawings in the embodiments of the present application.

[0049] It should be understood that the “embodiments of the present application” or “the aforementioned embodiments” mentioned throughout the specification mean that the specific features, structures or characteristics related to the embodiments are included in at least one embodiment of the present application. Therefore, “in the embodiments of the present application” or “in the aforementioned embodiments” appearing throughout the specification do not necessarily refer to the same embodiment. In addition, these specific features, structures or characteristics can be combined in one or more embodiments in any suitable manner. In the various embodiments of the present application, the size of the serial numbers of the above-mentioned processes does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application. The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages and disadvantages of the embodiments.

[0050] Unless otherwise specified, when an electronic device performs any step in the embodiments of the present application, the processor of the electronic device may perform the step. It is also worth noting that the embodiments of the present application do not limit the order in which the electronic device performs the following steps. In addition, the methods used to process data in different embodiments may be the same method or different methods. It should also be noted that any step in the embodiments of the present application can be independently executed by the electronic device, that is, when the electronic device performs any step in the following embodiments, it can be independent of the execution of other steps.

[0051] It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0052] The embodiment of the present application provides a video transcoding method, which can be applied to a video transcoding device. Figure 1 As shown, the method includes the following steps:

[0053] Step 101: Extract a target image from multiple frames of a video to be processed.

[0054] In the embodiments of the present application, the video to be processed is the video that needs to be transcoded. The video to be processed can be a single video or multiple videos. The embodiments of the present application do not limit the number of videos to be processed. A video is composed of multiple frames of images. Therefore, the multiple frames of the video to be processed are the images required to constitute the video to be processed. The target image is an image extracted from the multiple frames. Extracting the target image from the multiple frames is to analyze the video to be processed from an image perspective, facilitating subsequent adjustment of the bit rate corresponding to the video to be processed.

[0055] Step 102: Determine the bit rate adjustment type corresponding to the video to be processed based on the gradient of the target image.

[0056] The bitrate adjustment type represents a method for adjusting the bitrate of the video to be processed.

[0057] In an embodiment of the present application, the bit rate adjustment type may include multiple adjustment types, that is, multiple ways of adjusting the bit rate; determining the bit rate adjustment type also determines the bit rate adjustment method; the gradient of the target image can characterize the changes in pixels in the target image, so the bit rate adjustment type corresponding to the video to be processed can be determined based on the gradient of the target image, so that the bit rate of the video to be processed can be adjusted subsequently.

[0058] Step 103: Based on the bit rate threshold corresponding to the bit rate adjustment type, the initial bit rate corresponding to the video to be processed is adjusted to obtain a target bit rate.

[0059] In the embodiment of the present application, the initial bit rate is the bit rate of the video to be processed before transcoding. It can be set by the user or by a default value, and this embodiment of the present application does not limit this. Each bit rate adjustment type corresponds to a different bit rate threshold; the target bit rate is the bit rate after adjusting the initial bit rate of the video to be processed. In one feasible approach, the bit rate threshold corresponding to each bit rate adjustment type can be pre-set. In this way, after determining the bit rate adjustment type, the initial bit rate of the video to be processed can be adjusted based on the bit rate threshold corresponding to the bit rate adjustment type to obtain the target bit rate.

[0060] Step 104: Transcode the video to be processed based on the target bit rate.

[0061] In an embodiment of the present application, the bit rate adjustment type is determined based on the gradient of the target image extracted from the video to be processed, and the initial bit rate of the video to be processed is adjusted based on the bit rate threshold corresponding to the bit rate adjustment type. In this way, the video to be processed is analyzed from the perspective of the image, and the bit rate is adjusted based on the gradient of the image, thereby reducing bit rate waste and saving costs.

[0062] The video transcoding method provided in the embodiment of the present application extracts a target image from multiple frames of a video to be processed, determines a bit rate adjustment type corresponding to the video to be processed based on the gradient of the target image, then adjusts the initial bit rate corresponding to the video to be processed based on a bit rate threshold corresponding to the bit rate adjustment type to obtain a target bit rate, and then transcodes the video to be processed based on the target bit rate; in this way, the bit rate can be adjusted based on the gradient of the target image extracted from the multiple frames of the video to be processed, that is, the bit rate is adaptively adjusted based on the image of the video to be processed. The adjusted bit rate can reduce bit rate waste while ensuring image clarity in the transcoded video to be processed, thereby overcoming the problems of bit rate waste and high resource cost caused by fixed bit rate in the prior art, thereby achieving the technical effect of reducing bit rate waste and saving resource cost.

[0063] Based on the above embodiments, the present application provides a video transcoding method, referring to Figure 2 As shown, the method includes the following steps:

[0064] Step 201: The video transcoding device extracts one frame of image from multiple frames of the video to be processed every target number of frames to obtain N frames of target image.

[0065] In an embodiment of the present application, the target number of frames can be set in advance, and the target number of frames can be set according to actual business needs and business experience; the number of frames N of the target image can be set in advance, or the number of frames of the target image can be determined based on the target number of frames and the number of frames of images included in the video to be processed; in a feasible manner, the target number of frames can be set to 5, and the number of extracted image frames can be 30. In this case, every 5 frames, one frame is extracted from the multiple frames of the video to be processed, that is, the first frame image is extracted from the multiple frames to obtain the first frame target image, and the image 5 frames after the first frame image (that is, the sixth frame image) is extracted from the multiple frames to obtain the second frame target image, until 30 frames of target images are obtained; the 30 frames of target images can be expressed as {s1, s2,…, s30}.

[0066] Step 202: The video transcoding device determines a target value based on the gradient of each target image in the N frames of target images.

[0067] The target value can represent the gradient change of the target image in adjacent frames.

[0068] In the embodiment of the present application, the gradient change (ie, target value) between adjacent frames of images may be determined based on the gradient of each frame of the target image in N frames of the target image.

[0069] Step 202 can be implemented by the following steps:

[0070] Step 202a: The video transcoding device determines a gradient difference between the target image of the i+1th frame and the target image of the ith frame based on the gradient of the target image of the i-th frame and the gradient of the target image of the i+1th frame.

[0071] Wherein, i is an odd number.

[0072] In an embodiment of the present application, the gradient difference between the target image of the i+1th frame and the target image of the i-th frame is determined based on the gradient of the target image of the i-th frame and the gradient of the target image of the i+1th frame, that is, the gradient difference between adjacent frames is determined based on the gradients of the target images of adjacent frames; wherein, i is an odd number, indicating that the frame number of one target image in two adjacent frames is an odd number and the frame number of one target image is an even number, and each frame target image is used only once and will not be reused.

[0073] The calculation formula of the gradient of the target image can be (taking the gradient of the target image of the i-th frame as an example): Where WxH is the video resolution. If the video resolution is 1280*720, then W is 1280 and H is 720. P(s,k) is the pixel value of pixel point (s,k), where s and k are the two coordinate values of the pixel. P(s,k-1) is the pixel value of pixel point (s,k-1), and P(s-1,k) is the pixel value of pixel point (s-1,k).

[0074] In a feasible manner, after obtaining the gradient of the i-th frame target image and the gradient of the i+1-th frame target image based on the gradient calculation formula, the two gradient values can be subtracted to obtain the gradient difference between the two frames of target image.

[0075] Step 202b: The video transcoding device calculates the gradient difference and the gradient of the target image of the i-th frame to obtain a target value.

[0076] In the embodiment of the present application, the target value can be obtained by dividing the gradient difference by the gradient of the target image of the i-th frame. In other words, the target value can be the percentage of the emergent gradient of the adjacent frames (DeltaGray(i)), which can be expressed as: Among them, Gray(i+1) is the gradient of the target image of the i+1th frame, and Gray(i) is the gradient of the target image of the i-th frame.

[0077] In the embodiment of the present application, a target value can be obtained based on the gradient of a pair of adjacent frames. If the number of frames of the target image is 30, the number of target values obtained is 15.

[0078] In other embodiments of the present application, when i is an even number, the gradient difference between the i-th frame target image and the i-1-th frame target image can be determined based on the gradient of the i-th frame target image and the gradient of the i-1-th frame target image, and the gradient difference between the i-th frame target image and the i-1-th frame target image and the gradient of the i-1-th frame target image are calculated to obtain the target value; in this case, the method of calculating the gradient of the i-th frame target image is similar to the method of calculating the gradient of the i-1-th frame target image, and the gradient of each frame target image can be obtained based on the gradient calculation formula; after obtaining the gradient difference between the i-th frame target image and the i-1-th frame target image, the gradient difference between the i-th frame target image and the i-1-th frame target image can be divided by the gradient of the i-1-th frame target image to obtain the target value.

[0079] Step 203: The video transcoding device determines a target number of target values whose values are within a target value range from the target values.

[0080] In an embodiment of the present application, the target number is the number of target values whose values are within each target value range; the value range may include a first value range, a second value range, and a third value range; in a feasible manner, the first value range may be (0, 0.75), the second value range may be [0.75, 1), and the third value range may be [1, 1.5); the first value range, the second value range, and the third value range may all be set according to business needs and business experience, and the embodiment of the present application does not limit this. Determining the target number of target values whose values are within each value range from the target values is to facilitate the subsequent determination of the bit rate adjustment type corresponding to the video to be processed.

[0081] Step 203 can be implemented by the following steps:

[0082] Step 203a: The video transcoding device determines a first number of target values within a first value range from the target values.

[0083] In the embodiment of the present application, if the first numerical range is (0, 0.75), then the number of target values ​​located at (0, 0.75) is determined, that is, the first number.

[0084] Step 203b: The video transcoding device determines a second number of target values whose values are within a second value range from the target values.

[0085] In the embodiment of the present application, if the second numerical range is [0.75, 1), then the number of target values ​​in [0.75, 1) is determined, that is, the second number.

[0086] Step 203c: The video transcoding device determines a third number of target values within a third value range from the target values.

[0087] In the embodiment of the present application, if the third numerical range is [1, 1.5), then the number of target values ​​in [1, 1.5) is determined, that is, the third number.

[0088] Step 204: The video transcoding device determines a bit rate adjustment type based on the target number.

[0089] The bitrate adjustment type represents a method for adjusting the bitrate of the video to be processed.

[0090] Step 204 can be implemented by the following steps:

[0091] Step 204a: The video transcoding device determines a first threshold based on N and the first value.

[0092] In an embodiment of the present application, N is the number of frames of the target image, and the first value can be pre-set. The first value can be set to 3. In this case, the first threshold is N3.

[0093] Step 204b: The video transcoding device determines a second threshold based on N and the second value.

[0094] In an embodiment of the present application, the second value can be pre-set, and the second value can be set to 4. In this case, the second threshold is N4.

[0095] Step 204c: The video transcoding device determines a third threshold based on N and the third value.

[0096] In an embodiment of the present application, the third value can be pre-set, and the third value can be set to 6. In this case, the third threshold is N6.

[0097] It should be noted that the first value, the second value and the third value can all be set according to actual business needs and business experience, and the embodiments of the present application do not limit this.

[0098] Step 204d: The video transcoding device determines a rate adjustment type based on the first number, the second number, the third number, the first threshold, the second threshold, and the third threshold.

[0099] In the embodiment of the present application, the rate adjustment type may be determined based on the number of emergent gradient percentages of multiple pairs of adjacent frames that are within each value range, a first threshold, a second threshold, and a third threshold.

[0100] Step 205: The video transcoding device adjusts the initial bit rate corresponding to the video to be processed to obtain a target bit rate based on the bit rate threshold corresponding to the bit rate adjustment type.

[0101] Step 206: The video transcoding device transcodes the video to be processed based on the target bit rate.

[0102] In an embodiment of the present application, the rate adjustment type is determined based on the gradient of each frame of the target image and a first threshold, a second threshold, and a third threshold determined based on the number of frames of the target image. The determined rate adjustment type can more comprehensively reflect the differences between different images in the video to be processed, and then the target rate is adaptively adjusted based on the rate adjustment type, which can reduce rate waste while ensuring the image clarity in the video to be processed after transcoding.

[0103] It should be noted that, for the description of the same steps and contents in this embodiment as those in other embodiments, reference can be made to the description in other embodiments and will not be repeated here.

[0104] The video transcoding method provided in the embodiment of the present application adjusts the bit rate based on the gradient of the target image extracted from multiple frames of the video to be processed, that is, the bit rate is adaptively adjusted based on the image of the video to be processed. The adjusted bit rate can reduce bit rate waste while ensuring the image clarity in the transcoded video to be processed, thereby overcoming the problems of bit rate waste and high resource cost caused by fixed bit rate in the prior art, thereby achieving the technical effect of reducing bit rate waste and saving resource cost.

[0105] Based on the above embodiments, the present application provides a video transcoding method, referring to Figure 3 As shown, the method includes the following steps:

[0106] Step 301: The video transcoding device extracts one frame of image from multiple frames of the video to be processed every target number of frames to obtain N frames of target image.

[0107] Step 302: The video transcoding device determines a gradient difference between the target image of the i+1th frame and the target image of the ith frame based on the gradient of the target image of the i-th frame and the gradient of the target image of the i+1th frame.

[0108] Wherein, i is an odd number.

[0109] Step 303: The video transcoding device calculates the gradient difference and the gradient of the target image of the i-th frame to obtain a target value.

[0110] Step 304: The video transcoding device determines a first number of target values within a first value range from the target values.

[0111] Step 305: The video transcoding device determines a second number of target values whose values are within a second value range from the target values.

[0112] Step 306: The video transcoding device determines a third number of target values within a third value range from the target values.

[0113] The target quantity includes a first quantity, a second quantity and a third quantity.

[0114] Step 307: The video transcoding device determines a first threshold based on N and the first value.

[0115] Step 308: The video transcoding device determines a second threshold based on N and the second value.

[0116] Step 309: The video transcoding device determines a third threshold based on N and the third value.

[0117] It should be noted that after step 309 , steps 310 to 311 , or steps 312 to 313 , or steps 314 to 315 , or steps 316 to 317 may be executed.

[0118] Step 310: When the first number meets a first threshold, the video transcoding device determines that the bit rate adjustment type is a first adjustment type.

[0119] In the embodiment of the present application, if the first threshold is N3 and the first number is C1, then when C1>N3, the bit rate adjustment type is determined to be the first adjustment type.

[0120] Step 311: When the bit rate adjustment type is the first adjustment type, the video transcoding device performs calculation processing on the initial bit rate based on the first bit rate threshold to obtain a target bit rate.

[0121] In an embodiment of the present application, a first bit rate threshold may be pre-set, and the first bit rate threshold may be set to 200 kbps (kilobits per second). It should be noted that the first bit rate threshold may be set based on actual business needs and business experience, and the embodiment of the present application does not limit the specific value of the first bit rate threshold. In a feasible manner, the target bit rate may be obtained by subtracting the first bit rate threshold from the initial bit rate. That is, if the first bit rate threshold is a and the initial bit rate is TargetBit, then the target bit rate is TargetBit-a.

[0122] It should be noted that after step 311 , step 318 may be executed.

[0123] Step 312: When the sum of the first number and the second number meets the first threshold, and the second number meets the second threshold, the video transcoding device determines that the bitrate adjustment type is the second adjustment type.

[0124] In the embodiment of the present application, if the second threshold is N4 and the second number is C2, then when C2>N4 and C1+C2>N3, the rate adjustment type is determined to be the second adjustment type.

[0125] Step 313: When the bit rate adjustment type is the second adjustment type, the video transcoding device performs calculation processing on the initial bit rate based on the second bit rate threshold to obtain a target bit rate.

[0126] In an embodiment of the present application, the second bit rate threshold can be pre-set, and the second bit rate threshold can be set to 100kbps (kilobits per second). It should be noted that the second bit rate threshold can be set according to actual business needs and business experience. The embodiment of the present application does not limit the specific value of the second bit rate threshold. Generally, the second bit rate threshold will be set smaller than the first bit rate threshold; in a feasible manner, the initial bit rate can be subtracted from the second bit rate threshold to obtain the target bit rate; that is, if the second bit rate threshold is b and the initial bit rate is TargetBit, then the target bit rate is TargetBit-b.

[0127] It should be noted that after step 313 , step 318 may be executed.

[0128] Step 314: When the third number meets the first threshold and the sum of the first number and the second number meets the third threshold, the video transcoding device determines that the bitrate adjustment type is the third adjustment type.

[0129] In this embodiment of the present application, if the third threshold is N6 and the third number is C3, then when C3>N3 and C1+C2>N6, the rate adjustment type is determined to be the third adjustment type.

[0130] Step 315: When the bit rate adjustment type is the third adjustment type, the video transcoding device performs calculation processing on the initial bit rate based on the third bit rate threshold to obtain a target bit rate.

[0131] In an embodiment of the present application, the third bit rate threshold can be pre-set, and the third bit rate threshold can be set to 100kbps (kilobits per second). It should be noted that the second bit rate threshold can be set according to actual business needs and business experience. The embodiment of the present application does not limit the specific value of the third bit rate threshold; in a feasible manner, the initial bit rate can be added to the third bit rate threshold to obtain the target bit rate; that is, if the third bit rate threshold is c and the initial bit rate is TargetBit, then the target bit rate is TargetBit+c.

[0132] It should be noted that after step 315 , step 318 may be executed.

[0133] Step 316: When the first quantity does not meet the first threshold, the second quantity does not meet the second threshold, the sum of the first quantity and the second quantity does not meet the first threshold, the sum of the first quantity and the second quantity does not meet the third threshold, and the third quantity does not meet the first threshold, the video transcoding device determines that the bit rate adjustment type is the fourth adjustment type.

[0134] In an embodiment of the present application, the first quantity does not meet the first threshold, and the second quantity does not meet the second threshold, and the sum of the first quantity and the second quantity does not meet the first threshold, and the sum of the first quantity and the second quantity does not meet the third threshold, and the third quantity does not meet the first threshold, that is, the target quantity does not meet the conditions corresponding to the first adjustment type, does not meet the conditions corresponding to the second adjustment type, and does not meet the conditions corresponding to the third adjustment type, the bit rate adjustment type is determined to be the fourth adjustment type.

[0135] Step 317: When the bit rate adjustment type is the fourth adjustment type, the video transcoding device determines the initial bit rate as the target bit rate.

[0136] In an embodiment of the present application, if the target number does not meet the conditions corresponding to the first adjustment type, does not meet the conditions corresponding to the second adjustment type, and does not meet the conditions corresponding to the third adjustment type, then there is no need to adjust the initial bit rate at this time, and the initial bit rate is directly determined as the target bit rate.

[0137] It should be noted that after step 317 , step 318 is executed.

[0138] Step 318: The video transcoding device transcodes the video to be processed based on the target bit rate.

[0139] like Figure 4 As shown, when encoding a video, a target image can be extracted from multiple frames of the video, and the video is analyzed from the perspective of the image, that is, the rate adjustment type is determined based on the gradient of the target image, and the initial rate corresponding to the video is adjusted based on the rate adjustment type to obtain the target rate, the video is encoded based on the target rate, and the encoded video is decoded and then output.

[0140] It should be noted that, for the description of the same steps and contents in this embodiment as those in other embodiments, reference can be made to the description in other embodiments and will not be repeated here.

[0141] The video transcoding method provided in the embodiment of the present application adjusts the bit rate based on the gradient of the target image extracted from multiple frames of the video to be processed, that is, the bit rate is adaptively adjusted based on the image of the video to be processed. The adjusted bit rate can reduce bit rate waste while ensuring the image clarity in the transcoded video to be processed, thereby overcoming the problems of bit rate waste and high resource cost caused by fixed bit rate in the prior art, thereby achieving the technical effect of reducing bit rate waste and saving resource cost.

[0142] Based on the above embodiments, the embodiments of the present application provide a video transcoding device, which can be applied to Figures 1 to 3 In the video transcoding method provided in the corresponding embodiment, refer to Figure 5As shown, the video transcoding device 4 may include: a processor 41, a memory 42 and a communication bus 43, wherein:

[0143] The communication bus 43 is used to realize the communication connection between the processor 41 and the memory 42;

[0144] The processor 41 is configured to execute the video transcoding program in the memory 42 to implement the following steps:

[0145] Extracting a target image from multiple frames of the video to be processed;

[0146] Determine a bitrate adjustment type corresponding to the video to be processed based on the gradient of the target image; wherein the bitrate adjustment type represents a method for adjusting the bitrate corresponding to the video to be processed;

[0147] Based on the bitrate threshold corresponding to the bitrate adjustment type, the initial bitrate of the video to be processed is adjusted to obtain the target bitrate;

[0148] Transcode the video to be processed based on the target bit rate.

[0149] In other embodiments of the present application, the processor 41 is configured to execute the video transcoding program in the memory 42 to extract a target image from multiple frames of the video to be processed, so as to implement the following steps:

[0150] Every target number of frames, one frame of image is extracted from multiple frames of the video to be processed to obtain N frames of target image.

[0151] In other embodiments of the present application, the processor 41 is configured to execute the video transcoding program in the memory 42 based on the gradient of the target image, and determine the bit rate adjustment type corresponding to the video to be processed, so as to implement the following steps:

[0152] Determine a target value based on the gradient of each target image in N frames of target images;

[0153] From the target values, determining a target number of target values whose values are within the target value range;

[0154] Based on the target number, determine the rate adjustment type.

[0155] In other embodiments of the present application, the processor 41 is configured to execute the video transcoding program in the memory 42 to determine the target value based on the gradient of each target image in the N frames of target images, so as to implement the following steps:

[0156] Determine the gradient difference between the target image of the i+1th frame and the target image of the ith frame based on the gradient of the target image of the ith frame and the gradient of the target image of the i+1th frame; wherein i is an odd number;

[0157] The gradient difference and the gradient of the target image of the i-th frame are calculated to obtain the target value.

[0158] In other embodiments of the present application, the processor 41 is configured to execute the video transcoding program in the memory 42 to determine a target number of values within a target value range from the target value, so as to implement the following steps:

[0159] determining, from the target values, a first number of target values whose values are within a first value range;

[0160] determining, from the target values, a second number of target values whose values are within a second value range;

[0161] From the target values, a third number of target values whose values lie within a third range of values is determined.

[0162] In other embodiments of the present application, the processor 41 is configured to execute the target quantity-based determination of the bit rate adjustment type of the video transcoding program in the memory 42 to implement the following steps:

[0163] determining a first threshold based on N and the first value;

[0164] determining a second threshold based on N and the second value;

[0165] determining a third threshold based on N and a third value;

[0166] A rate adjustment type is determined based on the first number, the second number, the third number, the first threshold, the second threshold, and the third threshold.

[0167] In other embodiments of the present application, the processor 41 is configured to execute the video transcoding program in the memory 42 to determine the rate adjustment type based on the first number, the second number, the third number, the first threshold, the second threshold, and the third threshold, so as to implement the following steps:

[0168] When the first number meets a first threshold, determining the bit rate adjustment type as a first adjustment type;

[0169] When the sum of the first number and the second number meets the first threshold, and the second number meets the second threshold, determining the rate adjustment type to be the second adjustment type;

[0170] When the third number meets the first threshold and the sum of the first number and the second number meets the third threshold, determining the rate adjustment type to be the third adjustment type;

[0171] When the first quantity does not meet the first threshold, the second quantity does not meet the second threshold, the sum of the first quantity and the second quantity does not meet the first threshold, the sum of the first quantity and the second quantity does not meet the third threshold, and the third quantity does not meet the first threshold, the rate adjustment type is determined to be the fourth adjustment type.

[0172] In other embodiments of the present application, the processor 41 is configured to execute the video transcoding program in the memory 42 based on the bit rate threshold corresponding to the bit rate adjustment type, and adjust the initial bit rate corresponding to the video to be processed to obtain the target bit rate, so as to implement the following steps:

[0173] When the bit rate adjustment type is the first adjustment type, performing calculation processing on the initial bit rate based on the first bit rate threshold to obtain a target bit rate;

[0174] When the bit rate adjustment type is the second adjustment type, the initial bit rate is calculated based on the second bit rate threshold to obtain the target bit rate;

[0175] When the bit rate adjustment type is the third adjustment type, performing calculation processing on the initial bit rate based on the third bit rate threshold to obtain a target bit rate;

[0176] When the bit rate adjustment type is the fourth adjustment type, the initial bit rate is determined to be the target bit rate.

[0177] It should be noted that the specific description of the steps performed by the processor can be referred to Figures 1 to 3 The video transcoding method provided in the corresponding embodiment will not be described again here.

[0178] The video transcoding device provided in the embodiment of the present application adjusts the bit rate based on the gradient of the target image extracted from multiple frames of the video to be processed, that is, the bit rate is adaptively adjusted based on the image of the video to be processed. The adjusted bit rate can reduce bit rate waste while ensuring the image clarity in the transcoded video to be processed, thereby overcoming the problems of bit rate waste and high resource cost caused by fixed bit rate in the prior art, thereby achieving the technical effect of reducing bit rate waste and saving resource cost.

[0179] Based on the above embodiments, the embodiments of the present application provide a computer-readable storage medium, which stores one or more programs, and the one or more programs can be executed by one or more processors to implement Figures 1 to 3 The corresponding embodiment provides steps of the video transcoding method.

[0180] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of hardware embodiments, software embodiments, or embodiments combining software and hardware. Furthermore, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage and optical storage, etc.) containing computer-usable program code.

[0181] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the steps in the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0182] These computer program instructions may also be stored in a computer readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 a process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes.

[0183] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing the instructions executed on the computer or other programmable device for implementing the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.

[0184] The above description is merely a preferred embodiment of the present application and is not intended to limit the scope of protection of the present application.

Claims

1. A video transcoding method, characterized in that: The method comprises: Extracting a target image from multiple frames of the video to be processed to obtain N frames of target images; Determining a target value based on the gradient of each target image in the N frames of target images; wherein the target value represents a gradient change of the target images of adjacent frames; determining, from the target values, a target number of target values whose values are within a target value range; Determining the bit rate adjustment type based on the target number; wherein the bit rate adjustment type represents a method of adjusting the bit rate corresponding to the video to be processed; Based on the bit rate threshold corresponding to the bit rate adjustment type, adjusting the initial bit rate corresponding to the to-be-processed video to obtain a target bit rate; Based on the target bit rate, the video to be processed is transcoded.

2. The method according to claim 1, characterized in that The step of extracting a target image from multiple frames of a video to be processed to obtain N frames of target images includes: Every target number of frames, one frame of image is extracted from the multiple frames of image of the video to be processed to obtain N frames of target image.

3. The method according to claim 1, characterized in that The determining of the target value based on the gradient of each target image in the N frames of target images includes: Determine a gradient difference between the target image of the i+1th frame and the target image of the ith frame based on the gradient of the target image of the i-th frame and the gradient of the target image of the i+1th frame; wherein i is an odd number; The gradient difference and the gradient of the i-th frame target image are calculated to obtain the target value.

4. The method according to claim 1, wherein Determining, from the target values, a target number whose values are within a target value range includes: determining, from the target values, a first number of target values whose values are within a first value range; determining, from the target values, a second number of target values whose values are within a second value range; From the target values, a third number of target values whose values lie within a third value range is determined.

5. The method according to claim 4, characterized in that The determining the rate adjustment type based on the target quantity includes: determining a first threshold based on N and the first value; determining a second threshold based on the N and the second value; determining a third threshold based on N and a third value; The rate adjustment type is determined based on the first number, the second number, the third number, the first threshold, the second threshold, and the third threshold.

6. The method according to claim 5, characterized in that The determining the rate adjustment type based on the first number, the second number, the third number, the first threshold, the second threshold, and the third threshold includes: When the first number meets the first threshold, determining the rate adjustment type as a first adjustment type; When the sum of the first number and the second number meets the first threshold, and the second number meets the second threshold, determining that the rate adjustment type is the second adjustment type; When the third number satisfies the first threshold and the sum of the first number and the second number satisfies the third threshold, determining that the rate adjustment type is a third adjustment type; When the first quantity does not meet the first threshold, and the second quantity does not meet the second threshold, and the sum of the first quantity and the second quantity does not meet the first threshold, and the sum of the first quantity and the second quantity does not meet the third threshold, and the third quantity does not meet the first threshold, the rate adjustment type is determined to be the fourth adjustment type.

7. The method according to claim 1, characterized in that The adjusting the initial bit rate corresponding to the to-be-processed video to obtain a target bit rate based on the bit rate threshold corresponding to the bit rate adjustment type includes: When the bit rate adjustment type is the first adjustment type, performing calculation processing on the initial bit rate based on a first bit rate threshold to obtain the target bit rate; When the bit rate adjustment type is the second adjustment type, performing calculation processing on the initial bit rate based on a second bit rate threshold to obtain the target bit rate; When the bit rate adjustment type is the third adjustment type, performing calculation processing on the initial bit rate based on a third bit rate threshold to obtain the target bit rate; When the bit rate adjustment type is the fourth adjustment type, the initial bit rate is determined to be the target bit rate.

8. A video transcoding device, characterized in that: The device includes: a processor, a memory and a communication bus; The communication bus is used to realize the communication connection between the processor and the memory; The processor is configured to execute the video transcoding program in the memory to implement the steps of the video transcoding method according to any one of claims 1 to 7.

9. A computer-readable storage medium, characterized in that The computer-readable storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement the steps of the video transcoding method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Gradient-based adaptive high-performance video coding rate control method

    CN105392001A