CN111447447B - Live broadcast encoding method and device and electronic equipment - Google Patents

Live broadcast encoding method and device and electronic equipment Download PDF

Info

Publication number
CN111447447B
CN111447447B CN202010262519.2A CN202010262519A CN111447447B CN 111447447 B CN111447447 B CN 111447447B CN 202010262519 A CN202010262519 A CN 202010262519A CN 111447447 B CN111447447 B CN 111447447B
Authority
CN
China
Prior art keywords
video
coding
coded
gpu
live broadcast
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.)
Active
Application number
CN202010262519.2A
Other languages
Chinese (zh)
Other versions
CN111447447A (en
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.)
Beijing Century TAL Education Technology Co Ltd
Original Assignee
Beijing Century TAL Education 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 Beijing Century TAL Education Technology Co Ltd filed Critical Beijing Century TAL Education Technology Co Ltd
Priority to CN202010262519.2A priority Critical patent/CN111447447B/en
Publication of CN111447447A publication Critical patent/CN111447447A/en
Application granted granted Critical
Publication of CN111447447B publication Critical patent/CN111447447B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/134Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or criterion affecting or controlling the adaptive coding
    • H04N19/156Availability of hardware or computational resources, e.g. encoding based on power-saving criteria
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/102Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or selection affected or controlled by the adaptive coding
    • H04N19/103Selection of coding mode or of prediction mode
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/20Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
    • H04N21/21Server components or server architectures
    • H04N21/218Source of audio or video content, e.g. local disk arrays
    • H04N21/2187Live feed
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/20Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
    • H04N21/23Processing of content or additional data; Elementary server operations; Server middleware
    • H04N21/234Processing of video elementary streams, e.g. splicing of video streams, manipulating MPEG-4 scene graphs
    • H04N21/2343Processing of video elementary streams, e.g. splicing of video streams, manipulating MPEG-4 scene graphs involving reformatting operations of video signals for distribution or compliance with end-user requests or end-user device requirements
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/20Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
    • H04N21/23Processing of content or additional data; Elementary server operations; Server middleware
    • H04N21/24Monitoring of processes or resources, e.g. monitoring of server load, available bandwidth, upstream requests
    • H04N21/2405Monitoring of the internal components or processes of the server, e.g. server load

Abstract

The application provides a live broadcast encoding method and device and electronic equipment, relates to the technical field of live broadcast, and solves the technical problem that live broadcast delay is caused by low efficiency of encoding videos for live broadcast. The method comprises the following steps: receiving a data stream of a video to be coded, which is recorded and transmitted by a main broadcasting terminal; dynamically adjusting a first target coding mode of the data stream of the video to be coded according to the utilization rates of a CPU and a GPU in a first direct-broadcasting server; the first target coding mode is hard coding or soft coding; and coding the data stream of the video to be coded based on the first target coding mode, and sending the coded video to a viewer client.

Description

Live broadcast encoding method and device and electronic equipment
Technical Field
The present application relates to the field of live broadcast technologies, and in particular, to a live broadcast encoding method and apparatus, and an electronic device.
Background
With the development of mobile internet, live broadcast software is more popular, and more anchor broadcasters play various contents to audiences by using a live broadcast platform. In mobile live broadcasting, a anchor client of an anchor can live broadcast to viewers through live broadcast software.
Currently, a live broadcast server needs to encode a video for live broadcast first, and the encoded video can be live broadcast to audiences. However, the encoding efficiency of the video encoding process is low at present, which causes live broadcast delay and easily reduces the customer experience in the live broadcast process.
Disclosure of Invention
The invention aims to provide a live broadcast encoding method, a live broadcast encoding device and electronic equipment, and aims to solve the technical problem that live broadcast delay is caused by low efficiency of encoding a video for live broadcast.
In a first aspect, an embodiment of the present application provides a live broadcast encoding method, which is applied to a first live broadcast server, and the method includes:
receiving a data stream of a video to be coded, which is recorded and transmitted by a main broadcasting terminal;
dynamically adjusting a first target encoding mode of a data stream of the video to be encoded according to utilization rates of a Central Processing Unit (CPU) and a Graphics Processing Unit (GPU) in the first direct-broadcasting server; the first target coding mode is hard coding or soft coding;
and coding the data stream of the video to be coded based on the first target coding mode, and sending the coded video to a viewer client.
In one possible implementation, before the step of dynamically adjusting the first target encoding mode of the data stream of the video to be encoded according to the utilization rates of the CPU and the GPU in the first live server, the method includes:
coding the data stream of the video to be coded in a hard coding mode;
and monitoring the utilization rate of the GPU and the CPU in real time.
In one possible implementation, the step of dynamically adjusting the first target encoding mode of the data stream of the video to be encoded according to the utilization rates of the CPU and the GPU in the first live server includes:
when the utilization rate of the GPU exceeds a first threshold value, determining to encode partial data streams of the video to be encoded in a soft encoding mode;
and when the utilization rate of the GPU is reduced to be lower than the first threshold value, determining to encode partial data streams of the video to be encoded in a hard coding mode.
In one possible implementation, the method further includes:
predicting the utilization rate of the GPU based on the task amount to be processed of the video to be coded;
when the utilization rate does not exceed a first threshold value, determining to encode the video to be encoded in a hard coding mode;
when the utilization rate exceeds the first threshold value, determining a second target coding mode based on the service attribute of the video to be coded; if the resolution or code rate corresponding to the service attribute reaches a preset value, determining that the second target coding mode is hard coding; and if the resolution or code rate corresponding to the service attribute does not reach the preset value, determining that the second target coding mode is soft coding.
In one possible implementation, the service attribute includes a service type, and the service type includes at least one of a variety class, a game class, a sport class, and a video class.
In one possible implementation, the method includes:
and when the coding task amount processed by the first live broadcast server is larger than a third threshold value, performing load balance switching with a second live broadcast server except the first live broadcast server so as to process the newly-added coding task amount through the second live broadcast server.
In a second aspect, a live broadcast encoding apparatus is provided, which is applied to a first live broadcast server, and includes:
the receiving module is used for receiving a data stream of a video to be coded, which is recorded and sent by the anchor terminal;
the adjusting module is used for dynamically adjusting a first target encoding mode of the data stream of the video to be encoded according to the utilization rates of a CPU (Central processing Unit) and a GPU (graphics processing Unit) in the first direct-broadcasting server; the first target coding mode is hard coding or soft coding;
and the coding module is used for coding the data stream of the video to be coded based on the first target coding mode and sending the coded video to the audience client.
In one possible implementation, the apparatus further comprises:
the determining and judging module is used for determining a second target coding mode based on the service attribute of the video to be coded;
the resolution or code rate of the video corresponding to different service attributes is different; if the resolution or code rate corresponding to the service attribute of the video to be coded reaches a threshold value, determining that the second target coding mode is hard coding; and if the resolution or code rate corresponding to the service attribute of the video to be coded does not reach a threshold value, determining that the second target coding mode is soft coding.
In a third aspect, an embodiment of the present application further provides an electronic device, which includes a memory and a processor, where the memory stores a computer program that is executable on the processor, and the processor implements the method of the first aspect when executing the computer program.
In a fourth aspect, embodiments of the present application further provide a computer-readable storage medium storing machine-executable instructions that, when invoked and executed by a processor, cause the processor to perform the method of the first aspect.
The embodiment of the application brings the following beneficial effects:
the live broadcast encoding method, the live broadcast encoding device and the electronic equipment provided by the embodiment of the application can receive the data stream of the video to be encoded, which is recorded and sent by the anchor terminal, and dynamically adjust the first target encoding mode of the data stream of the video to be encoded according to the utilization rates of a CPU (Central processing Unit) and a GPU (graphics processing Unit) in a server, wherein the first target encoding mode is hard encoding or soft encoding, and then, based on the first target encoding mode, the data stream of the video to be encoded is encoded and the encoded video is sent to the viewer client, in this scheme, the first target coding mode is dynamically adjusted to be hard coding or soft coding based on the utilization rate of the GPU and the CPU, the coding efficiency is prevented from being influenced by the utilization rate of the GPU or the CPU, the optimization of the coding process in video live broadcasting is realized, the efficiency of the coding process is improved, live broadcasting delay is reduced, and the customer experience of a client is improved.
In order to make the aforementioned objects, features and advantages of the present application more comprehensible, preferred embodiments accompanied with figures are described in detail below.
Drawings
In order to more clearly illustrate the detailed description of the present application or the technical solutions in the prior art, the drawings used in the detailed description or the prior art description will be briefly described below, and it is obvious that the drawings in the following description are some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative efforts.
Fig. 1 is a schematic view of an application scenario provided in an embodiment of the present application;
fig. 2 is a schematic flowchart of a live broadcast encoding method according to an embodiment of the present application;
fig. 3 is a schematic structural diagram of a live broadcast encoding apparatus according to an embodiment of the present application;
fig. 4 is a schematic structural diagram illustrating an electronic device according to an embodiment of the present application.
Detailed Description
To make the objects, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions of the present application will be clearly and completely described below with reference to the accompanying drawings, and it is obvious that the described embodiments are some, but not all embodiments of the present application. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
The terms "comprising" and "having," and any variations thereof, as referred to in the embodiments of the present application, are intended to cover non-exclusive inclusions. For example, a process, method, system, article, or apparatus that comprises a list of steps or elements is not limited to only those steps or elements but may alternatively include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
Currently, in the process of working of a live application program, a live server usually encodes video data in a soft coding or hard coding mode and then sends the encoded video data. Soft coding, which is coding using a Central Processing Unit (CPU), has a simple implementation, convenient parameter adjustment, and easy upgrade, but the CPU is loaded and has lower performance than hard coding; hard coding uses a Graphics Processing Unit (GPU) for coding, and has higher performance than soft coding.
Therefore, the live broadcast server generally uses a soft coding or hard coding mode to perform coding live broadcast in the whole live broadcast process. In the application of the live broadcast server, the CPU and the GPU are shared resources. If an application only supporting soft coding occupies CPU resources when executing, live video is blocked and the playing effect is poor due to the fact that other applications occupy CPU resources; for the application only using hard coding, if the GPU is running over load due to a large amount of processing tasks, the task processing efficiency is affected, and the full utilization of resources cannot be realized.
Moreover, the coding efficiency of the video used for live broadcasting in the coding process is low at present, so that live broadcasting delay is caused, and the customer experience in the live broadcasting process is easily reduced.
Based on this, the embodiment of the application provides a live broadcast encoding method and device and electronic equipment. The method can solve the technical problem of live broadcast delay caused by low efficiency of encoding the video for live broadcast.
The recording process of the video to be coded in the embodiment of the application can be completed by the terminal. The terminal comprises an image collector (such as a camera) and a processor, and the image collecting device is used for collecting real-time dynamic image data of a user.
In some embodiments, after the live video is recorded by the terminal, the recorded live video may be sent to a live server through wired or wireless communication, and the live server encodes the live video.
For example, as shown in fig. 1, fig. 1 is a schematic view of an application scenario provided in the embodiment of the present application. The application scenario may include a first direct broadcast server 101 and a terminal (e.g., a cell phone 102) that may communicate with the first direct broadcast server 101 through a wired network or a wireless network.
Certainly, there may be multiple terminals in the live scene provided in the embodiment of the present application, for example, a terminal of the anchor client and terminals of several viewer clients may all communicate with the first live server 101 in fig. 1 through a network. The first direct broadcast server 101 may be a Content Delivery Network (CDN) server.
Embodiments of the present invention are further described below with reference to the accompanying drawings.
Fig. 2 is a schematic flowchart of a live broadcast encoding method according to an embodiment of the present application. Wherein the method is applied to the first direct broadcasting server. As shown in fig. 2, the method includes:
step S210, receiving a data stream of a video to be encoded recorded and transmitted by the anchor terminal.
The video to be coded can be a live video recorded by the anchor client and used for live broadcasting, and can also be a live video recorded by other terminals and used for live broadcasting.
In practical applications, the first direct broadcast server may be in wired communication with the anchor client, and may also be in wireless communication.
Step S220, dynamically adjusting a first target coding mode of the data stream of the video to be coded according to the utilization rates of the CPU and the GPU in the first direct-broadcasting server.
Step S230, based on the first target encoding mode, encoding a data stream of the video to be encoded, and sending the encoded video to the viewer client.
The first target coding mode is dynamically adjusted to be hard coding or soft coding based on the utilization rate of the GPU and the CPU, the coding efficiency is prevented from being influenced due to the utilization rate of the GPU or the CPU, the optimization of the coding process in video live broadcast is realized, the efficiency of the coding process is improved, live broadcast delay is reduced, and the customer experience of a client is improved.
The above steps are described in detail below.
In some embodiments, before step S220, the method may further include the steps of:
step a), coding a data stream of a video to be coded in a hard coding mode;
and b), monitoring the utilization rates of the GPU and the CPU in real time.
In practical application, a hard coding mode of the GPU may be preferentially adopted, specifically, whether GPU hardware is locally inserted may be determined first, and if the GPU hardware is inserted, the hard coding mode is preferentially adopted, so as to realize the preferential and effective use of the GPU.
Based on the above steps a) and b), the above step S220 may include the following steps:
step c), when the utilization rate of the GPU exceeds a first threshold value, determining to encode partial data streams of the video to be encoded in a soft encoding mode;
and d), when the utilization rate of the GPU is reduced to be lower than the first threshold value, determining to code a part of data stream of the video to be coded in a hard coding mode.
And when the task amount distributed by the GPU reaches a first threshold value corresponding to the GPU, distributing the subsequent tasks to the CPU corresponding to the first live-action server. When the task amount allocated to the subsequent CPU reaches the second threshold corresponding to the CPU and the task amount allocated to the GPU is reduced to a certain degree, the subsequent new task can be allocated to the GPU to realize load balancing.
For example, when hard coding is used for the live video, if it is detected that the GPU utilization of the current first live server exceeds a first threshold, such as 65% of the GPU load, the subsequent coding task is allocated to the CPU corresponding to the first live server, so as to prevent the GPU from running under an overload condition so as not to affect the coding quality.
For another example, when soft coding is used for live video, if it is detected that the CPU utilization of the current first live server exceeds a second threshold, such as 60% of the CPU load, and the GPU utilization falls below the first threshold, a subsequent new task may be allocated to the GPU again, so as to prevent the CPU from running under an overload so as not to affect the coding quality.
In practical applications, hard coding may be preferred. Specifically, if the GPU is determined to be in the usable state, hard coding is preferentially adopted, that is, the GPU is used for hard coding. In the using process of the GPU, it may be determined whether the actual load condition of the GPU hardware reaches a first threshold preset in advance, and if the actual load condition of the GPU hardware reaches the first threshold, the coding mode is sequentially changed from hard coding to soft coding, that is, the CPU is used to perform soft coding. Next, for the task to be processed, when the CPU is to be used to perform soft coding task processing, whether the utilization rate of the GPU processing task drops below the first threshold may be determined by monitoring, and if the utilization rate drops below the first threshold, the task to be processed and the next task are successively allocated to hard coding for task processing, thereby enabling load balancing.
In some embodiments, the method may further comprise the steps of:
and e), predicting the utilization rate of the GPU based on the task amount to be processed of the video to be coded.
Step f), when the utilization rate exceeds a first threshold value, determining a second target coding mode based on the service attribute of the video to be coded; if the resolution or code rate corresponding to the service attribute reaches a preset value, determining that the second target coding mode is hard coding; and if the resolution or code rate corresponding to the service attribute does not reach a preset value, determining that the second target coding mode is soft coding.
And g), when the utilization rate does not exceed the first threshold value, determining to encode the video to be encoded in a hard coding mode.
The resolution or code rate of the video corresponding to different service attributes is different; under the condition that the utilization rate of the GPU exceeds a first threshold value, if the resolution or code rate corresponding to the service attribute of the video to be coded is higher, determining that a second target coding mode is hard coding; and if the resolution or code rate corresponding to the service attribute of the video to be coded is lower, determining that the second target coding mode is soft coding.
Of course, when the utilization rate of the GPU does not exceed the first threshold, the GPU is preferentially utilized to encode the video to be encoded in a hard coding manner.
The second target coding mode is determined according to the service attribute of the video to be coded, namely hard coding or soft coding is determined according to the resolution or code rate condition corresponding to the service attribute of the video to be coded, so that the determined and used coding mode is more suitable for the service attribute of the video to be coded, the optimization of the coding process in video live broadcast is realized, the efficiency of the coding process is improved, the live broadcast delay is reduced, and the customer experience of a client is improved.
In practical application, it may be determined that the second target encoding mode is hard encoding the video with higher resolution corresponding to the service attribute of the video or higher code rate; the smaller the resolution corresponding to the service attribute of the video is, or the smaller the code rate is, the more likely it is to determine that the second target encoding mode is soft encoding.
The second target coding mode is determined to be hard coding or soft coding according to the resolution, code rate and the like corresponding to the service attribute of the video to be coded, so that the coding process is more suitable for the service condition of the video to be coded, the pertinence is achieved, and the coding efficiency is improved.
Based on the step e) and the step f), the service attribute comprises a service type, and the service type comprises at least one of an art, a game, a sport and a video.
The service attribute of the video to be encoded may include various types, and may not be limited to a variety of categories, a game category, a sports category, and a video category. With the increasing of services, environments, scenes and the like, the service attributes of the video can be continuously updated to meet more requirements of the anchor client and the audience client.
In some embodiments, the method may further comprise the steps of:
and g), when the coding task amount processed by the first live broadcast server is larger than a third threshold value, carrying out load balance switching with a second live broadcast server except the first live broadcast server so as to process the newly added coding task amount through the second live broadcast server.
For example, when the utilization rates of the GPU and the CPU of the first server both exceed respective thresholds, the GPU of the second server may perform encoding processing, and when the utilization rate of the GPU of the second server exceeds its own threshold, the CPU of the second server may perform encoding processing again, so as to achieve load balancing among the plurality of servers.
Fig. 3 provides a schematic structural diagram of a live broadcast encoding device. The apparatus may be applied to a third live server. As shown in fig. 3, the live encoding apparatus 300 includes:
a receiving module 301, configured to receive a data stream of a video to be encoded, which is recorded and sent by a main broadcasting terminal;
an adjusting module 302, configured to dynamically adjust a first target encoding mode of a data stream of a video to be encoded according to utilization rates of a CPU and a GPU in a third live server; the first target coding mode is hard coding or soft coding;
the encoding module 303 is configured to encode a data stream of a video to be encoded based on the first target encoding manner, and send the encoded video to a viewer client.
In some embodiments, the apparatus further comprises:
the GPU module is used for coding the data stream of the video to be coded in a hard coding mode;
and the monitoring module is used for monitoring the utilization rates of the GPU and the CPU in real time.
In some embodiments, the apparatus further comprises:
the CPU module is used for determining that a part of data stream of a video to be coded is coded in a soft coding mode when the utilization rate of the GPU exceeds a first threshold value;
and when the utilization rate of the CPU exceeds a second threshold value, the GPU module determines to encode part of data stream of the video to be encoded in a hard coding mode.
In some embodiments, the apparatus further comprises:
the determining and judging module is used for determining a second target coding mode based on the service attribute of the video to be coded;
the resolution or code rate of the video corresponding to different service attributes is different; if the resolution or code rate corresponding to the service attribute of the video to be coded reaches a threshold value, determining that the second target coding mode is hard coding; and if the resolution or code rate corresponding to the service attribute of the video to be coded does not reach the threshold value, determining that the second target coding mode is soft coding.
In some embodiments, the service attributes include a service type, the service type including at least one of a variety class, a game class, a sports class, and a video class.
In some embodiments, the apparatus further comprises:
and the switching module is used for carrying out load balance switching with a fourth live broadcast server except the third live broadcast server when the coding task amount processed by the third live broadcast server is greater than a third threshold value so as to carry out processing of newly-added coding task amount through the fourth live broadcast server.
The live broadcast encoding device provided by the embodiment of the application has the same technical characteristics as the live broadcast encoding method provided by the embodiment of the application, so that the same technical problems can be solved, and the same technical effects are achieved.
As shown in fig. 4, an electronic device 400 provided in an embodiment of the present application includes a memory 401, a processor 402, and an image collector 405. The image collector 405 may obtain a video to be encoded by collecting an image, the memory 401 stores a computer program that can be run on the processor 402, and the processor 402 implements the steps of the method provided in the above embodiment when executing the computer program.
Referring to fig. 4, the electronic device further includes: a bus 403 and a communication interface 404, the processor 402, the communication interface 404 and the memory 401 being connected by the bus 403; the processor 402 is used to execute executable modules, such as computer programs, stored in the memory 401.
The Memory 401 may include a high-speed Random Access Memory (RAM), and may also include a non-volatile Memory (non-volatile Memory), such as at least one disk Memory. The communication connection between the network element of the system and at least one other network element is implemented through at least one communication interface 404 (which may be wired or wireless), and the internet, a wide area network, a local network, a metropolitan area network, and the like may be used.
Bus 403 may be an ISA bus, PCI bus, EISA bus, or the like. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one double-headed arrow is shown in FIG. 4, but this does not indicate only one bus or one type of bus.
The memory 401 is configured to store a program, and the processor 402 executes the program after receiving an execution instruction, where the method performed by the apparatus defined by the process disclosed in any of the embodiments of the present application may be applied to the processor 402, or implemented by the processor 402.
The processor 402 may be an integrated circuit chip having signal processing capabilities. In implementation, the steps of the above method may be performed by integrated logic circuits of hardware or instructions in the form of software in the processor 402. The Processor 402 may be a general-purpose Processor, and includes a Central Processing Unit (CPU), a Network Processor (NP), and the like; the device can also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field-Programmable Gate Array (FPGA), or other Programmable logic devices, discrete Gate or transistor logic devices, discrete hardware components. The various methods, steps, and logic blocks disclosed in the embodiments of the present application may be implemented or performed. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The steps of the method disclosed in connection with the embodiments of the present application may be directly implemented by a hardware decoding processor, or implemented by a combination of hardware and software modules in the decoding processor. The software module may be located in ram, flash memory, rom, prom, or eprom, registers, etc. storage media as is well known in the art. The storage medium is located in the memory 401, and the processor 402 reads the information in the memory 401 and completes the steps of the method in combination with the hardware.
Corresponding to the live broadcast encoding method, the embodiment of the application also provides a computer readable storage medium, and the computer readable storage medium stores machine executable instructions, and when the computer executable instructions are called and executed by a processor, the computer executable instructions cause the processor to execute the steps of the live broadcast encoding method.
The live broadcast encoding device provided by the embodiment of the application can be specific hardware on the device, or software or firmware installed on the device, and the like. The device provided by the embodiment of the present application has the same implementation principle and technical effect as the foregoing method embodiments, and for the sake of brief description, reference may be made to the corresponding contents in the foregoing method embodiments where no part of the device embodiments is mentioned. It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the foregoing systems, apparatuses and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other ways. The above-described apparatus embodiments are merely illustrative, and for example, the division of the units into only one type of logical function may be implemented in other ways, and for example, multiple units or components may be combined or integrated into another system, or some features may be omitted, or not implemented. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection of devices or units through some communication interfaces, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus and method can be implemented in other ways. The apparatus embodiments described above are merely illustrative and, for example, the flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods and computer program products according to various embodiments of the present application. 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 and/or flowchart illustration, and combinations of blocks in the block diagrams and/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.
In addition, functional units in the embodiments provided in the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit.
The functions, if implemented in the form of software functional units and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present application or portions thereof that substantially contribute to the prior art may be embodied in the form of a software product stored in a storage medium and including instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the live encoding method according to the embodiments of the present application. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
It should be noted that: like reference numbers and letters refer to like items in the following figures, and thus, once an item is defined in one figure, it need not be further defined or explained in subsequent figures, and moreover, the terms "first," "second," "third," etc. are used merely to distinguish one description from another, and are not to be construed as indicating or implying relative importance.
Finally, it should be noted that: the above-mentioned embodiments are only specific embodiments of the present application, and are used for illustrating the technical solutions of the present application, but not limiting the same, and the scope of the present application is not limited thereto, and although the present application is described in detail with reference to the foregoing embodiments, those skilled in the art should understand that: those skilled in the art can still make modifications or changes to the embodiments described in the foregoing embodiments, or make equivalent substitutions for some features, within the technical scope of the present disclosure; such modifications, changes or substitutions do not depart from the scope of the embodiments of the present application. Are intended to be covered by the scope of this application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims (8)

1. A live broadcast encoding method is applied to a first live broadcast server, and comprises the following steps:
receiving a data stream of a video to be coded, which is recorded and sent by an anchor terminal;
dynamically adjusting a first target coding mode of the data stream of the video to be coded according to the utilization rates of a CPU and a GPU in the first direct broadcasting server; the first target coding mode is hard coding or soft coding;
based on the first target coding mode, coding the data stream of the video to be coded, and sending the coded video to a viewer client;
predicting the utilization rate of the GPU based on the task amount to be processed of the video to be coded;
when the utilization rate of the GPU does not exceed a first threshold value, determining to encode the video to be encoded in a hard coding mode;
and when the utilization rate of the GPU exceeds the first threshold value, determining a second target coding mode based on the service attribute of the video to be coded, wherein the second target coding mode is determined to be hard coding under the condition that the resolution ratio or the code rate corresponding to the service attribute reaches a preset value, and the second target coding mode is determined to be soft coding under the condition that the resolution ratio or the code rate corresponding to the service attribute does not reach the preset value.
2. The method according to claim 1, wherein the step of dynamically adjusting the first target encoding mode of the data stream of the video to be encoded according to the utilization rates of the CPU and the GPU in the first live server is preceded by:
coding the data stream of the video to be coded in a hard coding mode;
and monitoring the utilization rates of the GPU and the CPU in real time.
3. The method according to claim 2, wherein the step of dynamically adjusting the first target encoding mode of the data stream of the video to be encoded according to the utilization rates of the CPU and the GPU in the first live server comprises:
when the utilization rate of the GPU exceeds a first threshold value, determining to encode partial data streams of the video to be encoded in a soft encoding mode;
and when the utilization rate of the GPU is reduced to be lower than the first threshold value, determining to encode partial data streams of the video to be encoded in a hard coding mode.
4. The method of claim 2, wherein the service attributes comprise a service type, and wherein the service type comprises at least one of a variety class, a game class, a sports class, and a video class.
5. The method according to any one of claims 1 to 4, characterized in that it comprises:
and when the coding task amount processed by the first live broadcast server is larger than a third threshold value, performing load balance switching with a second live broadcast server except the first live broadcast server so as to perform processing of newly-added coding task amount through the second live broadcast server.
6. A live encoding apparatus, applied to a first live server, the apparatus comprising:
the receiving module is used for receiving a data stream of a video to be coded, which is recorded and sent by the anchor terminal;
the adjusting module is used for dynamically adjusting a first target coding mode of the data stream of the video to be coded according to the utilization rates of a CPU and a GPU in the first direct broadcasting server; the first target coding mode is hard coding or soft coding;
the encoding module is used for encoding the data stream of the video to be encoded based on the first target encoding mode and sending the encoded video to a viewer client;
and the determining and judging module is used for determining a second target coding mode based on the service attribute of the video to be coded, wherein the resolution or the code rate of the video corresponding to different service attributes is different, the second target coding mode is determined to be hard coding under the condition that the resolution or the code rate corresponding to the service attribute of the video to be coded reaches a threshold value, and the second target coding mode is determined to be soft coding under the condition that the resolution or the code rate corresponding to the service attribute of the video to be coded does not reach the threshold value.
7. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the method according to any one of claims 1 to 5 when executing the computer program.
8. A computer readable storage medium having stored thereon machine executable instructions which, when invoked and executed by a processor, cause the processor to perform the method of any of claims 1 to 5.
CN202010262519.2A 2020-04-03 2020-04-03 Live broadcast encoding method and device and electronic equipment Active CN111447447B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010262519.2A CN111447447B (en) 2020-04-03 2020-04-03 Live broadcast encoding method and device and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010262519.2A CN111447447B (en) 2020-04-03 2020-04-03 Live broadcast encoding method and device and electronic equipment

Publications (2)

Publication Number Publication Date
CN111447447A CN111447447A (en) 2020-07-24
CN111447447B true CN111447447B (en) 2022-07-15

Family

ID=71655729

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010262519.2A Active CN111447447B (en) 2020-04-03 2020-04-03 Live broadcast encoding method and device and electronic equipment

Country Status (1)

Country Link
CN (1) CN111447447B (en)

Families Citing this family (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112354177A (en) * 2020-09-30 2021-02-12 江苏视博云信息技术有限公司 Webrtc-based cloud game instant starting method, device and system
CN112165623A (en) * 2020-09-30 2021-01-01 广州光锥元信息科技有限公司 Soft and hard combined audio and video coding and decoding device
CN112422963A (en) * 2020-11-17 2021-02-26 杭州雾联科技有限公司 Cloud computer system, encoding method, device, equipment and storage medium
CN114640862A (en) * 2020-12-16 2022-06-17 西安诺瓦星云科技股份有限公司 Video processing method, device, computer readable storage medium and processor
US20220269528A1 (en) * 2021-02-24 2022-08-25 Huawei Technologies Co., Ltd. System, method and apparatus for intelligent heterogeneous computation
CN115412731A (en) * 2021-05-11 2022-11-29 北京字跳网络技术有限公司 Video processing method, device, equipment and storage medium
CN114157850A (en) * 2021-11-26 2022-03-08 珠海视熙科技有限公司 Data transmission method and device and computer readable storage medium

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106454413A (en) * 2016-09-20 2017-02-22 北京小米移动软件有限公司 Live broadcast coding switching method and device, and live broadcast terminal equipment
CN109640116A (en) * 2018-12-24 2019-04-16 广州微算互联信息技术有限公司 The coding method of cloud mobile phone network video and server

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103839594A (en) * 2012-11-27 2014-06-04 建兴电子科技股份有限公司 Solid-state storage device and combining encoding and decoding method thereof

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106454413A (en) * 2016-09-20 2017-02-22 北京小米移动软件有限公司 Live broadcast coding switching method and device, and live broadcast terminal equipment
CN109640116A (en) * 2018-12-24 2019-04-16 广州微算互联信息技术有限公司 The coding method of cloud mobile phone network video and server

Also Published As

Publication number Publication date
CN111447447A (en) 2020-07-24

Similar Documents

Publication Publication Date Title
CN111447447B (en) Live broadcast encoding method and device and electronic equipment
US10848433B2 (en) Method for distributing available bandwidth of a network amongst ongoing traffic sessions run by devices of the network, corresponding device
CN106791956B (en) Network live broadcast card pause processing method and device
CN108810657B (en) Method and system for setting video cover
CN111314741B (en) Video super-resolution processing method and device, electronic equipment and storage medium
US9521178B1 (en) Dynamic bandwidth thresholds
CN113453085B (en) Method and device for judging playing card pause and electronic terminal
US11863841B2 (en) Video playing control method and system
CN108881931B (en) Data buffering method and network equipment
CN111510734B (en) CDN scheduling method, device, storage medium and equipment
CN111083536B (en) Method and device for adjusting video code rate
CN105556922A (en) Dash representations adaptations in network
CN106105145B (en) Method for operating a buffer arranged along a transmission path between a client terminal and at least one server, and corresponding buffer
CN112312162B (en) Video server for transmitting video stream
CN112019873A (en) Video code rate adjusting method and device and electronic equipment
CN111193936B (en) Video streaming transmission method and device, electronic equipment and computer readable storage medium
CN111970565A (en) Video data processing method and device, electronic equipment and storage medium
CN113286146B (en) Media data processing method, device, equipment and storage medium
CN110784731B (en) Data stream transcoding method, device, equipment and medium
CN111491207A (en) Video data processing method and device in live broadcast and electronic equipment
CN111586434B (en) Load balancing method based on edge device and distributed mixed screen server
CN114244843A (en) Streaming media downloading method, electronic equipment and storage medium
CN114945097A (en) Video stream processing method and device
US11290513B1 (en) Distributed adaptive bitrate (ABR) asset delivery
CN116233489A (en) Live broadcast processing method and device, electronic equipment and computer storage medium

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
TA01 Transfer of patent application right
TA01 Transfer of patent application right

Effective date of registration: 20210302

Address after: Room 1702-03, Lantian Hesheng building, 32 Zhongguancun Street, Haidian District, Beijing 100082

Applicant after: BEIJING CENTURY TAL EDUCATION TECHNOLOGY Co.,Ltd.

Address before: 102200 a1-05-001 maker Plaza, 338 Huilongguan East Street, Changping District, Beijing

Applicant before: BEIJING SANTICLOUD TECHNOLOGY Co.,Ltd.

GR01 Patent grant
GR01 Patent grant