CN115914187A - Video transcoding method and device - Google Patents

Video transcoding method and device Download PDF

Info

Publication number
CN115914187A
CN115914187A CN202211422160.6A CN202211422160A CN115914187A CN 115914187 A CN115914187 A CN 115914187A CN 202211422160 A CN202211422160 A CN 202211422160A CN 115914187 A CN115914187 A CN 115914187A
Authority
CN
China
Prior art keywords
coding
video
path
subsequence
current path
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202211422160.6A
Other languages
Chinese (zh)
Inventor
王剑光
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Jingdong Technology Information Technology Co Ltd
Original Assignee
Jingdong Technology Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Jingdong Technology Information Technology Co Ltd filed Critical Jingdong Technology Information Technology Co Ltd
Priority to CN202211422160.6A priority Critical patent/CN115914187A/en
Publication of CN115914187A publication Critical patent/CN115914187A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Compression Or Coding Systems Of Tv Signals (AREA)

Abstract

The invention discloses a method and a device for transcoding a video, and relates to the technical field of computers. One embodiment of the method comprises: the video data is segmented to obtain at least one ordered video subsequence; separately multiplex encoding each video sub-sequence, the multiplex encoding comprising: for each path of coding, coding the video subsequence according to the target code rate of the current path of coding and the coding information of the previous path of coding of the current path of coding to obtain the coding information and the coding code stream of the current path of coding, and calculating the actual code rate of the current path of coding, wherein the target code rate of the current path of coding is calculated based on the actual code rate of the previous path of coding; for each video subsequence, taking the last path of coded code stream as the video code stream of the video subsequence; and combining the video code streams of the video subsequences to obtain the transcoded video. The embodiment optimizes the target code rate of the coding, thereby optimizing the quality of the transcoded video and reducing the resource consumption.

Description

Video transcoding method and device
Technical Field
The invention relates to the technical field of computers, in particular to a method and a device for transcoding video.
Background
Video Transcoding (Video Transcoding) refers to converting Video data that has been compression-encoded into Video data in another format to adapt to different network bandwidths, different terminal processing capabilities and different user requirements. In order to improve the efficiency of video transcoding, a distributed mode can be adopted to transcode the video. The existing implementation method for performing distributed transcoding on video is as follows: the method comprises the steps of fragmenting a source video file, transcoding each fragment in a distributed mode, and merging to obtain a transcoded video file.
However, the video transcoding method does not consider the problem of video quality loss caused by distributed transcoding, and the transcoded video has low quality and poor transcoding effect.
Disclosure of Invention
In view of this, embodiments of the present invention provide a method and an apparatus for video transcoding, which are capable of optimizing a target code rate of encoding based on an information transfer multiplexing manner of a multi-path encoding manner, so as to optimize quality of transcoded video and reduce resource consumption.
To achieve the above object, according to an aspect of an embodiment of the present invention, there is provided a method of video transcoding, including:
the video data is sliced to obtain at least one ordered video subsequence;
separately multiplex encoding each of the video subsequences, the multiplex encoding comprising: for each path of coding, coding the video subsequence according to a target code rate of a current path of coding and coding information of a previous path of coding of the current path of coding to obtain coding information and a coding code stream of the current path of coding, and calculating an actual code rate of the current path of coding, wherein the target code rate of the current path of coding is calculated based on the actual code rate of the previous path of coding;
for each video subsequence, taking the last path of coded code stream as the video code stream of the video subsequence;
and combining the video code streams of the video subsequences to obtain the transcoded video.
Optionally, the slicing the video data to obtain at least one ordered video subsequence includes: and according to real-time refreshing video frames included in the video data, segmenting the video data to obtain at least one ordered video subsequence.
Optionally, before encoding the video subsequence according to the target code rate of the current-path encoding and the encoding information of the previous-path encoding of the current-path encoding, the method further includes: confirming that the current path code is not the first path code; and coding the video subsequence directly according to the target code rate of the current path coding under the condition that the current path coding is the first path coding.
Optionally, the target code rate of the current path coding is calculated based on the actual code rate of the previous path coding, and includes: for each video subsequence, calculating a target code rate of the current path coding of the video subsequence based on an actual code rate of the previous path coding of a video subsequence preceding the video subsequence.
Optionally, each of said video sub-sequences comprises no less than one sequential video frame; for each path of coding, coding the video subsequence according to the target code rate of the current path of coding and the coding information of the previous path of coding of the current path of coding to obtain the coding information and the coding code stream of the current path of coding, including: according to the image gradient of the video frame, carrying out quantization parameter adjustment on each video frame of the video subsequence; and for each path of coding, coding each video frame of the video subsequence according to the target code rate of the current path of coding, the coding information of the previous path of coding of the current path of coding and the adjusted quantization parameter of the video frame, so as to obtain the coding information and the coding code stream of the current path of coding.
Optionally, the performing quantization parameter adjustment on each video frame of the video sub-sequence according to the image gradient of the video frame includes: and for each video frame of the video subsequence, performing quantization parameter adjustment on the current video frame according to the ratio of the image gradient of the current video frame to the image gradient of the previous video frame of the current video frame, so as to perform quantization parameter adjustment on each video frame of the video subsequence.
Optionally, for each path of coding, coding the video subsequence according to the target code rate of the current path of coding and the coding information of the previous path of coding of the current path of coding, including: and for each path of coding, carrying out video enhancement on each video frame of the video subsequence, and then coding the video subsequence according to the target code rate of the current path of coding and the coding information of the previous path of coding of the current path of coding.
Optionally, before separately performing multi-pass encoding on each of the video sub-sequences, the method further includes: and performing video enhancement on each video subsequence respectively.
Optionally, the encoding mode of the first path encoding in the multi-path encoding is different from the encoding modes of other paths of encoding except for the first path encoding.
According to another aspect of the embodiments of the present invention, there is provided an apparatus for transcoding video, including:
the video sequence segmentation module is used for segmenting the video data to obtain at least one ordered video subsequence;
a sequence multi-path coding module, configured to perform multi-path coding on each of the video subsequences, where the multi-path coding includes: for each path of coding, coding the video subsequence according to a target code rate of a current path of coding and coding information of a previous path of coding of the current path of coding to obtain coding information and a coding code stream of the current path of coding, and calculating an actual code rate of the current path of coding, wherein the target code rate of the current path of coding is calculated based on the actual code rate of the previous path of coding;
a sequence code stream determining module, configured to use, for each video subsequence, the last encoded code stream as a video code stream of the video subsequence;
and the sequence code stream combination module is used for combining the video code streams of the video subsequences to obtain the transcoded video.
According to another aspect of the embodiments of the present invention, there is provided an electronic device for video transcoding, including: one or more processors; the storage device is used for storing one or more programs, and when the one or more programs are executed by the one or more processors, the one or more processors are enabled to realize the video transcoding method provided by the embodiment of the invention.
According to a further aspect of the embodiments of the present invention, there is provided a computer readable medium, on which a computer program is stored, which when executed by a processor, implements the method of video transcoding provided by the embodiments of the present invention.
One embodiment of the above invention has the following advantages or benefits: the method comprises the steps that video data are segmented to obtain at least one ordered video subsequence; separately multiplex encoding each video sub-sequence, the multiplex encoding comprising: for each path of coding, coding the video subsequence according to the target code rate of the current path of coding and the coding information of the previous path of coding of the current path of coding to obtain the coding information and the coding code stream of the current path of coding, and calculating the actual code rate of the current path of coding, wherein the target code rate of the current path of coding is calculated based on the actual code rate of the previous path of coding; for each video subsequence, taking the last path of coded code stream as the video code stream of the video subsequence; the technical scheme of combining the video code streams of the video subsequences to obtain the transcoded video can optimize the target code rate of coding based on the information transfer multiplexing mode of the multi-path coding mode, so that the quality of the transcoded video is optimized and the resource consumption is reduced.
Further effects of the above-mentioned non-conventional alternatives will be described below in connection with the embodiments.
Drawings
The drawings are included to provide a better understanding of the invention and are not to be construed as unduly limiting the invention. Wherein:
fig. 1 is a schematic diagram of main steps of a method of video transcoding according to an embodiment of the present invention;
FIG. 2 is a schematic diagram of a video forwarding implementation according to an embodiment of the present invention;
fig. 3 is a schematic diagram of main modules of an apparatus for video transcoding according to an embodiment of the present invention;
FIG. 4 is an exemplary system architecture diagram in which embodiments of the present invention may be applied;
fig. 5 is a schematic block diagram of a computer system suitable for use in implementing a terminal device or server according to an embodiment of the present invention.
Detailed Description
Exemplary embodiments of the present invention are described below with reference to the accompanying drawings, in which various details of embodiments of the invention are included to assist understanding, and which are to be considered as merely exemplary. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the invention. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
Fig. 1 is a schematic diagram of main steps of a video transcoding method according to an embodiment of the present invention. As shown in fig. 1, the method for transcoding a video according to the embodiment of the present invention mainly includes the following steps S101 to S104.
Step S101: and slicing the video data to obtain at least one ordered video subsequence. In the embodiment of the invention, in order to improve the transcoding efficiency, the video data can be transcoded after being segmented. Specifically, the video frame can be refreshed in real time according to the video data, and the video data is segmented to obtain at least one ordered video subsequence. When the frame type of the video frame is a real-time refreshing video frame, the real-time refreshing video frame is used as a division point, a plurality of video frames in front of the real-time refreshing video frame are used as a video subsequence, and a video frame between the real-time refreshing video frame and a next real-time refreshing video frame behind the real-time refreshing video frame is used as a video subsequence. The video frame (IDR frame) is refreshed in real time, instant Decoding Refresh is performed, the IDR frame has the function of refreshing immediately so that errors cannot be propagated, and a new sequence is recalculated from the IDR frame to start encoding.
Step S102: separately multi-coding each video sub-sequence, the multi-coding comprising: and for each path of coding, coding the video subsequence according to the target code rate of the current path of coding and the coding information of the previous path of coding of the current path of coding to obtain the coding information and the coding code stream of the current path of coding, and calculating the actual code rate of the current path of coding, wherein the target code rate of the current path of coding is calculated and obtained on the basis of the actual code rate of the previous path of coding. For each path of coding, the actual code rate can be counted in real time after the coding is carried out. And the coding information of each way of coding can be recorded and stored in the form of log.
According to an embodiment of the present invention, before encoding the video subsequence according to the target code rate of the current-path encoding and the encoding information of the previous-path encoding of the current-path encoding, the method further includes: confirming that the current path code is not the first path code; and directly coding the video subsequence according to the target code rate of the current path coding under the condition that the current path coding is the first path coding. The multi-path coding at least comprises two paths of coding, for the first path of coding, the target code rate can select a preset default value, and at the moment, when each video subsequence is coded, because the coding information of the previous path of coding does not exist, the video subsequence can be directly coded according to the target code rate of the first path of coding. For the second path of coding and the other subsequent paths of coding, the target code rate of each path of coding can be calculated based on the actual code rate of the previous path.
According to the embodiment of the present invention, the target code rate of the current path coding is calculated based on the actual code rate of the previous path coding, and includes: for each video subsequence, calculating a target code rate of the current path coding of the video subsequence based on an actual code rate of the previous path coding of a video subsequence preceding the video subsequence. Specifically, suppose that an IDR frame is adopted as an cut-in point to perform slicing operation on video data, and different video subsequences generated are recorded as subsequences (i), i belongs to [0, N ], N is a positive integer, and i is the number of the video subsequences; and (3) after the first path of coding is carried out on each video subsequence, the actual code rate of the first path of coding of each video subsequence is obtained and is ActureBit (i). Before the second-pass encoding is performed, the Target code rate Target (i) of the second-pass encoding is calculated according to the following formula:
Figure BDA0003942274530000061
when i =0, the target code rate set at the corresponding resolution frame rate in the actual use process is directly adopted.
According to the embodiment of the invention, the target code rate of the current path code is calculated and updated in real time based on the actual code rate of the previous path code, the target code rate of each path code can be more accurately determined, and the target code rate of the code is optimized based on the information transmission multiplexing mode of the multi-path coding mode, so that the quality of the transcoded video is optimized and the resource consumption is reduced.
In the embodiment of the present invention, the encoding mode of the first path encoding in the multi-path encoding is different from the encoding modes of the other path encoding except the first path encoding. In an embodiment, the first path of codes may be coded in a CRF (Constant Rate Factor), the second path of codes and the following other paths of codes may be coded in an ABR (Average Bit Rate), and the ABR and the CRF are also a Rate control method. By selecting different coding modes, the code rate of the second path and other subsequent paths can be more stable and closer to the actual state, and the picture state is more stable, so that the coding effect is improved.
According to one embodiment of the invention, each of the video sub-sequences comprises no less than one ordered video frame; for each path of coding, coding the video subsequence according to the target code rate of the current path of coding and the coding information of the previous path of coding of the current path of coding, including: and for each path of coding, carrying out video enhancement on each video frame of the video subsequence, and then coding the video subsequence according to the target code rate of the current path of coding and the coding information of the previous path of coding of the current path of coding. In an embodiment of the present invention, the video data includes a plurality of video frames, and the video frames are ordered, after the video data is divided into the video sub-sequences, each video sub-sequence is also ordered, and the video frames included in each video sub-sequence are also ordered. When each video sub-sequence is encoded, each video frame is encoded according to the sequence of the video frames in the video sub-sequence. When each video frame is encoded, video enhancement can be performed on the video frame, and then the enhanced video frame is encoded, so as to optimize the quality of the transcoded video. When video enhancement is performed on a video frame, the conventional video denoising, sharpening, beautifying and other technologies can be adopted, and the specific implementation manner of the invention is not limited in particular.
According to an embodiment of the present invention, before separately multiplexing each of the video subsequences, the method further comprises: and performing video enhancement on each video subsequence respectively. By video enhancement of the video sub-sequence before multi-pass encoding, the transcoded video quality can be optimized.
According to one embodiment of the invention, each of the video sub-sequences comprises no less than one ordered video frame; for each path of coding, coding the video subsequence according to the target code rate of the current path of coding and the coding information of the previous path of coding of the current path of coding to obtain the coding information and the coding code stream of the current path of coding, including: according to the image gradient of the video frame, carrying out quantization parameter adjustment on each video frame of the video subsequence; and for each path of coding, coding each video frame of the video subsequence according to the target code rate of the current path of coding, the coding information of the previous path of coding of the current path of coding and the adjusted quantization parameter of the video frame, so as to obtain the coding information and the coding code stream of the current path of coding. The image gradient refers to the change rate of a certain pixel of an image in the X and Y directions (compared with adjacent pixels), is a two-dimensional vector and consists of 2 components, and the change of the X axis and the change of the Y axis. In embodiments of the present invention, the solution for the image gradient may be calculated using conventional computational means. The invention is not limited in this regard. According to the technical scheme of the invention, before the video frames of each video subsequence are coded, the quantization parameters of the video frames can be adjusted so as to optimize the video transcoding quality. The quantization parameter is a parameter reflecting the details of image compression, and is mainly related to the image video quality and compression rate, and the range is [0,51]. The quantization parameter represents the finest quantization when the minimum value is 0, and the coarsest quantization when the maximum value is 51.
According to one embodiment of the present invention, the adjusting of the quantization parameter for each video frame of the video sub-sequence according to the image gradient of the video frame comprises: and for each video frame of the video subsequence, performing quantization parameter adjustment on the current video frame according to the ratio of the image gradient of the current video frame to the image gradient of the video frame before the current video frame, so as to perform quantization parameter adjustment on each video frame of the video subsequence. Specifically, in an embodiment of the present invention, it is assumed that no operation is performed on the quantization parameter of the current video frame when the ratio of the image gradient of the current video frame to the image gradient of the previous video frame of the current video frame is between [0.8,1.2 ]; suppose that when the ratio is between [0,0.5], an operation of increasing the quantization parameter of the current video frame by 0.3 is performed; suppose that when the ratio is between [1.5,2], the quantization parameter of the current video frame is decreased by 0.5; otherwise, no adjustment is made to the quantization parameter of the current video frame, and so on. In the specific implementation process, different proportion intervals can be set according to requirements for different adjustment. According to the technical scheme of the invention, the quantization parameter of the current video frame is adjusted according to the ratio of the image gradient of the current video frame to the image gradient of the previous video frame of the current video frame, so that the quantization parameter of each video frame of the video subsequence is adjusted, and the quantization parameter of the video frame can be adjusted based on the difference between the adjacent video frames, thereby optimizing the quality of the transcoded video.
Step S103: and for each video subsequence, taking the last path of coded code stream as the video code stream of the video subsequence. In the embodiment of the invention, when multiple paths of codes exist, the last path of coded code stream can be used as the video code stream of the video subsequence, and the coded code streams of other paths of codes do not need to be stored, so that the storage space can be saved. For different application scenes, the coding code streams of other paths of codes can be stored as coding results of different coding resolutions according to requirements.
Step S104: and combining the video code streams of the video subsequences to obtain the transcoded video. Specifically, the video subsequences obtained by slicing have corresponding precedence order, and the video code streams of the video subsequences can be combined according to the order of the video subsequences to obtain the transcoded video.
Fig. 2 is a schematic diagram of an implementation process of video forwarding according to an embodiment of the present invention. As in fig. 2, the notations in the figure have the following meanings:
(1) P1, P2 and Pn represent the 1 st, 2 nd and n th path codes;
(2) subsequence (i) denotes the ith video subsequence;
(3) A to F indicate the video sub-sequence from the coding information of the first path coding P1 to the second path coding P2 is referred to;
(4) Frame (i) represents the ith video Frame;
(5) FrameEnhance: and (5) enhancing the video.
In the embodiment shown in fig. 2, the video data is sliced into a plurality of ordered video sub-sequences, each video sub-sequence comprising a plurality of ordered video frames. Before each video sub-sequence is coded, video enhancement is firstly carried out to improve the quality of the transcoded video. And then, carrying out multi-path coding on each video subsequence, and starting from the second path of coding, when carrying out each path of coding, coding each video subsequence according to the coding information of the previous path. And before each path of coding, the target code rate of the path of coding is calculated according to the actual code rate of the previous path of coding. When each of the second and later encoding is performed, video enhancement can be started simultaneously, and each frame is encoded after video enhancement.
Fig. 3 is a schematic diagram of main modules of an apparatus for video transcoding according to an embodiment of the present invention. As shown in fig. 3, a video transcoding apparatus 300 according to an embodiment of the present invention mainly includes a video sequence segmentation module 301, a sequence multiplexing coding module 302, a sequence code stream determination module 303, and a sequence code stream combination module 304.
The video sequence segmentation module 301 is configured to segment video data to obtain at least one ordered video subsequence;
a sequence multi-path coding module 302, configured to perform multi-path coding on each of the video sub-sequences, respectively, where the multi-path coding includes: for each path of coding, coding the video subsequence according to a target code rate of a current path of coding and coding information of a previous path of coding of the current path of coding to obtain coding information and a coding code stream of the current path of coding, and calculating an actual code rate of the current path of coding, wherein the target code rate of the current path of coding is calculated based on the actual code rate of the previous path of coding;
a sequence code stream determining module 303, configured to use, for each video subsequence, the last encoded code stream as a video code stream of the video subsequence;
and the sequence code stream combination module 304 is configured to combine the video code streams of the video subsequences to obtain a transcoded video.
According to an embodiment of the present invention, the video sequence slicing module 301 may be further configured to: and according to real-time refreshing video frames included in the video data, segmenting the video data to obtain at least one ordered video subsequence.
According to another embodiment of the present invention, the sequence multiplexing coding module 302 may be further configured to: before coding the video subsequence according to the target code rate of the current path code and the coding information of the previous path code of the current path code, confirming that the current path code is not the first path code; and coding the video subsequence directly according to the target code rate of the current path coding under the condition that the current path coding is the first path coding.
According to another embodiment of the present invention, the target code rate of the current path coding is calculated based on the actual code rate of the previous path coding, and the target code rate of the current path coding includes: for each video subsequence, calculating a target code rate of the current path coding of the video subsequence based on an actual code rate of the previous path coding of a video subsequence preceding the video subsequence.
According to yet another embodiment of the present invention, each of the video sub-sequences includes no less than one sequential video frame; the sequence multiplexing coding module 302 may also be configured to: according to the image gradient of the video frame, carrying out quantization parameter adjustment on each video frame of the video subsequence; and for each path of coding, coding each video frame of the video subsequence according to the target code rate of the current path of coding, the coding information of the previous path of coding of the current path of coding and the adjusted quantization parameter of the video frame, so as to obtain the coding information and the coding code stream of the current path of coding.
According to yet another embodiment of the present invention, the sequence multiplexing coding module 302 may be further configured to: and for each video frame of the video subsequence, performing quantization parameter adjustment on the current video frame according to the ratio of the image gradient of the current video frame to the image gradient of the video frame before the current video frame, so as to perform quantization parameter adjustment on each video frame of the video subsequence.
According to yet another embodiment of the present invention, the sequence multiplexing coding module 302 may be further configured to: and for each path of coding, carrying out video enhancement on each video frame of the video subsequence, and then coding the video subsequence according to the target code rate of the current path of coding and the coding information of the previous path of coding of the current path of coding.
According to another embodiment of the present invention, the apparatus 300 for transcoding video may further include a video enhancement module (not shown in the figure) for: performing video enhancement on each of the video sub-sequences before performing multi-path coding on each of the video sub-sequences, respectively.
According to another embodiment of the present invention, the encoding mode of the first way encoding in the multi-way encoding is different from the encoding modes of the other ways encoding except the first way encoding.
According to the technical scheme of the embodiment of the invention, at least one ordered video subsequence is obtained by slicing the video data; separately multiplex encoding each video sub-sequence, the multiplex encoding comprising: for each path of coding, coding the video subsequence according to the target code rate of the current path of coding and the coding information of the previous path of coding of the current path of coding to obtain the coding information and the coding code stream of the current path of coding, and calculating the actual code rate of the current path of coding, wherein the target code rate of the current path of coding is calculated based on the actual code rate of the previous path of coding; for each video subsequence, taking the last path of coded code stream as the video code stream of the video subsequence; the technical scheme of combining the video code streams of the video subsequences to obtain the transcoded video can optimize the target code rate of coding based on the information transfer multiplexing mode of the multi-path coding mode, so that the quality of the transcoded video is optimized and the resource consumption is reduced.
Fig. 4 shows an exemplary system architecture 400 of a method of video transcoding or an apparatus of video transcoding to which an embodiment of the present invention may be applied.
As shown in fig. 4, the system architecture 400 may include terminal devices 401, 402, 403, a network 404, and a server 405. The network 404 serves as a medium for providing communication links between the terminal devices 401, 402, 403 and the server 405. Network 404 may include various types of connections, such as wire, wireless communication links, or fiber optic cables, to name a few.
A user may use terminal devices 401, 402, 403 to interact with a server 405 via a network 404 to receive or send messages or the like. Various communication client applications, such as a video-type application, a video browser application, a television-type video application, etc. (just examples) may be installed on the terminal devices 401, 402, 403.
The terminal devices 401, 402, 403 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop portable computers, desktop computers, and the like.
The server 405 may be a server providing various services, such as a background management server (for example only) providing support for video-like websites browsed by users using the terminal devices 401, 402, 403. The background management server can fragment the video data to obtain at least one ordered video subsequence for the received data such as the video transcoding request; separately multiplex encoding each of the video subsequences, the multiplex encoding comprising: for each path of coding, coding the video subsequence according to a target code rate of a current path of coding and coding information of a previous path of coding of the current path of coding to obtain coding information and a coding code stream of the current path of coding, and calculating an actual code rate of the current path of coding, wherein the target code rate of the current path of coding is calculated based on the actual code rate of the previous path of coding; for each video subsequence, taking the last path of coded code stream as the video code stream of the video subsequence; and combining the video code streams of the video subsequences to obtain a transcoded video and the like, and feeding back a processing result (such as the transcoded video-only an example) to the terminal equipment.
It should be noted that the method for transcoding video provided by the embodiment of the present invention is generally performed by the server 405, and accordingly, the apparatus for transcoding video is generally disposed in the server 405.
It should be understood that the number of terminal devices, networks, and servers in fig. 4 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
Referring now to FIG. 5, a block diagram of a computer system 500 suitable for use with a terminal device or server implementing an embodiment of the invention is shown. The terminal device or the server shown in fig. 5 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present invention.
As shown in fig. 5, the computer system 500 includes a Central Processing Unit (CPU) 501 that can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM) 502 or a program loaded from a storage section 508 into a Random Access Memory (RAM) 503. In the RAM 503, various programs and data necessary for the operation of the system 500 are also stored. The CPU 501, ROM 502, and RAM 503 are connected to each other via a bus 504. An input/output (I/O) interface 505 is also connected to bus 504.
The following components are connected to the I/O interface 505: an input portion 506 including a keyboard, a mouse, and the like; an output portion 507 including a display such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; a storage portion 508 including a hard disk and the like; and a communication section 509 including a network interface card such as a LAN card, a modem, or the like. The communication section 509 performs communication processing via a network such as the internet. The driver 510 is also connected to the I/O interface 505 as necessary. A removable medium 511 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 510 as necessary, so that a computer program read out therefrom is mounted into the storage section 508 as necessary.
In particular, according to embodiments of the present disclosure, the processes described above with reference to the flow diagrams may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method illustrated in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network through the communication section 509, and/or installed from the removable medium 511. The computer program performs the above-described functions defined in the system of the present invention when executed by the Central Processing Unit (CPU) 501.
It should be noted that the computer readable medium shown in the present invention can be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present invention, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In contrast, in the present invention, a computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units or modules described in the embodiments of the present invention may be implemented by software or hardware. The described units or modules may also be provided in a processor, and may be described as: a processor comprises a video sequence segmentation module, a sequence multi-path coding module, a sequence code stream determination module and a sequence code stream combination module. The names of these units or modules do not in some cases form a limitation to the units or modules themselves, for example, the sequence code stream combination module may also be described as a "module for combining the video code streams of the respective video sub-sequences to obtain the transcoded video".
As another aspect, the present invention also provides a computer-readable medium, which may be contained in the apparatus described in the above embodiments; or may be separate and not incorporated into the device. The computer readable medium carries one or more programs which, when executed by a device, cause the device to comprise: the video data is segmented to obtain at least one ordered video subsequence; separately multiplex encoding each of the video subsequences, the multiplex encoding comprising: for each path of coding, coding the video subsequence according to a target code rate of a current path of coding and coding information of a previous path of coding of the current path of coding to obtain coding information and a coding code stream of the current path of coding, and calculating an actual code rate of the current path of coding, wherein the target code rate of the current path of coding is calculated based on the actual code rate of the previous path of coding; for each video subsequence, taking the last encoded code stream as the video code stream of the video subsequence; and combining the video code streams of the video subsequences to obtain the transcoded video.
According to the technical scheme of the embodiment of the invention, at least one ordered video subsequence is obtained by segmenting the video data; separately multi-coding each video sub-sequence, the multi-coding comprising: for each path of coding, coding the video subsequence according to the target code rate of the current path of coding and the coding information of the previous path of coding of the current path of coding to obtain the coding information and the coding code stream of the current path of coding, and calculating the actual code rate of the current path of coding, wherein the target code rate of the current path of coding is calculated based on the actual code rate of the previous path of coding; for each video subsequence, taking the last path of coded code stream as a video code stream of the video subsequence; the technical scheme of combining the video code streams of the video subsequences to obtain the transcoded video can optimize the target code rate of coding based on the information transfer multiplexing mode of the multi-path coding mode, so that the quality of the transcoded video is optimized and the resource consumption is reduced.
The above-described embodiments should not be construed as limiting the scope of the invention. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions can occur, depending on design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (12)

1. A method of video transcoding, comprising:
the video data is sliced to obtain at least one ordered video subsequence;
separately multiplex encoding each of the video subsequences, the multiplex encoding comprising: for each path of coding, coding the video subsequence according to a target code rate of a current path of coding and coding information of a previous path of coding of the current path of coding to obtain coding information and a coding code stream of the current path of coding, and calculating an actual code rate of the current path of coding, wherein the target code rate of the current path of coding is calculated based on the actual code rate of the previous path of coding;
for each video subsequence, taking the last path of coded code stream as the video code stream of the video subsequence;
and combining the video code streams of the video subsequences to obtain the transcoded video.
2. The method of claim 1, wherein slicing video data into no less than one ordered video sub-sequence comprises:
and according to real-time refreshing video frames included in the video data, segmenting the video data to obtain at least one ordered video subsequence.
3. The method of claim 1, further comprising, before encoding the video sub-sequence according to a target code rate of a current-pass encoding and encoding information of a previous-pass encoding of the current-pass encoding:
confirming that the current path code is not the first path code;
and directly coding the video subsequence according to the target code rate of the current path coding under the condition that the current path coding is the first path coding.
4. The method of claim 1, wherein the target code rate of the current path coding is calculated based on the actual code rate of the previous path coding, and comprises:
for each video subsequence, calculating a target code rate of the current path coding of the video subsequence based on an actual code rate of the previous path coding of a video subsequence preceding the video subsequence.
5. The method of claim 1, wherein each of said video sub-sequences comprises no less than one ordered video frame; for each path of coding, coding the video subsequence according to the target code rate of the current path of coding and the coding information of the previous path of coding of the current path of coding to obtain the coding information and the coding code stream of the current path of coding, including:
according to the image gradient of the video frame, carrying out quantization parameter adjustment on each video frame of the video subsequence;
and for each path of coding, coding each video frame of the video subsequence according to the target code rate of the current path of coding, the coding information of the previous path of coding of the current path of coding and the adjusted quantization parameter of the video frame, so as to obtain the coding information and the coding code stream of the current path of coding.
6. The method of claim 5, wherein performing quantization parameter adjustment on each video frame of the video sub-sequence according to an image gradient of the video frame comprises:
and for each video frame of the video subsequence, performing quantization parameter adjustment on the current video frame according to the ratio of the image gradient of the current video frame to the image gradient of the previous video frame of the current video frame, so as to perform quantization parameter adjustment on each video frame of the video subsequence.
7. The method of claim 5, wherein for each encoding, encoding the video sub-sequence according to the target code rate of the current encoding and the encoding information of the previous encoding of the current encoding comprises:
and for each path of coding, carrying out video enhancement on each video frame of the video subsequence, and then coding the video subsequence according to the target code rate of the current path of coding and the coding information of the previous path of coding of the current path of coding.
8. The method of claim 1, further comprising, prior to separately multiplexing each of the video subsequences:
and performing video enhancement on each video subsequence respectively.
9. The method according to claim 1, wherein the first way of encoding is encoded in a different way than other ways of encoding except the first way of encoding.
10. An apparatus for video transcoding, comprising:
the video sequence segmentation module is used for segmenting the video data to obtain at least one ordered video subsequence;
a sequence multi-path coding module, configured to perform multi-path coding on each of the video subsequences, where the multi-path coding includes: for each path of coding, coding the video subsequence according to a target code rate of a current path of coding and coding information of a previous path of coding of the current path of coding to obtain coding information and a coding code stream of the current path of coding, and calculating an actual code rate of the current path of coding, wherein the target code rate of the current path of coding is calculated based on the actual code rate of the previous path of coding;
a sequence code stream determining module, configured to use, for each video subsequence, the last encoded code stream as a video code stream of the video subsequence;
and the sequence code stream combination module is used for combining the video code streams of the video subsequences to obtain the transcoded video.
11. An electronic device for video transcoding, comprising:
one or more processors;
a storage device for storing one or more programs,
when executed by the one or more processors, cause the one or more processors to implement the method of any one of claims 1-9.
12. A computer-readable medium, on which a computer program is stored, which, when being executed by a processor, carries out the method according to any one of claims 1-9.
CN202211422160.6A 2022-11-14 2022-11-14 Video transcoding method and device Pending CN115914187A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211422160.6A CN115914187A (en) 2022-11-14 2022-11-14 Video transcoding method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211422160.6A CN115914187A (en) 2022-11-14 2022-11-14 Video transcoding method and device

Publications (1)

Publication Number Publication Date
CN115914187A true CN115914187A (en) 2023-04-04

Family

ID=86491767

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211422160.6A Pending CN115914187A (en) 2022-11-14 2022-11-14 Video transcoding method and device

Country Status (1)

Country Link
CN (1) CN115914187A (en)

Similar Documents

Publication Publication Date Title
US20100226441A1 (en) Frame Capture, Encoding, and Transmission Management
US11277619B2 (en) Rate control for video splicing applications
CN113115067A (en) Live broadcast system, video processing method and related device
CN111836076B (en) Video resolution switching method and device and electronic equipment
US11356739B2 (en) Video playback method, terminal apparatus, and storage medium
US8620096B2 (en) Virtualization server for presentation virtualization and image data encoding method
CN114845106A (en) Video coding method, video coding device, storage medium and electronic equipment
CN111263243A (en) Video coding method and device, computer readable medium and electronic equipment
AU2020456664A1 (en) Reinforcement learning based rate control
CN115767149A (en) Video data transmission method and device
US10448009B1 (en) Determining sample adaptive offset filter parameters
CN115914187A (en) Video transcoding method and device
US20230027981A1 (en) Method, electronic device, and computer program product for video processing
CN111405293B (en) Video transmission method and device
CN115022725A (en) Video playing method and device
WO2022093535A1 (en) Lightweight transcoding at edge nodes
CN115706810A (en) Video frame adjusting method and device, electronic equipment and storage medium
CN113766255A (en) Video stream merging method and device, electronic equipment and computer medium
CN108769737B (en) Code rate adjusting method, server and computer readable medium
CN113038277B (en) Video processing method and device
US11025969B1 (en) Video packaging system using source encoding
Kobayashi et al. A Low-Latency 4K HEVC Multi-Channel Encoding System with Content-Aware Bitrate Control for Live Streaming
CN117793362A (en) Stream transcoding method and device
CN116527936A (en) Coding method and device suitable for space image
US20200213641A1 (en) Method and system for distributing an audiovisual content

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination