Video stream live broadcast method, streaming media server and readable storage medium
By determining the main code stream and backup code stream in the IPTV system and switching to the backup code stream when the main code stream is abnormal, the problem of live broadcast channels being unavailable due to network problems is solved, and the experience quality of live video streaming is improved.
Patent Information
- Application Number
- CN202311295358.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-10-07
- Publication Date
- 2025-04-15
AI Technical Summary
In the existing IPTV system, the live broadcast channel cannot receive video streams due to network problems, which makes the live broadcast channel unavailable, which reduces the experience quality of live video streaming.
By acquiring a plurality of incoming video streams of the live broadcast channel, the main code stream and at least one backup code stream are determined. If the main code stream is in an abnormal transmission state, the target code stream is determined from the backup code stream and the target code stream is output to the terminal device.
When the main code stream is abnormal, switch to the backup code stream to ensure the availability of live channel services, improve the quality of experience, and avoid the live channel being unavailable due to network problems.
Smart Images

Figure CN119835451A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of communication technology, and in particular to a video streaming live broadcast method, a streaming media server and a computer-readable storage medium. Background Art
[0002] In the existing IPTV (Internet Protocol Television, interactive network television) system, the live channel service generally adopts the streaming server (SS, Streaming Server) architecture. The input of the live channel is generally a video stream formatted by the encoder or an outgoing video stream of the live channel of the upper-level streaming server. The streaming server receives the video stream and outputs the video stream to the terminal device after a series of internal processing. The terminal device can receive the video stream for video playback. When the network from the encoder or the upper-level streaming server to the local streaming server is congested or unreachable, the live channel of the local streaming server will not receive the video stream due to network problems, causing the live channel to become unavailable, reducing the quality of experience (Quality of Experience, QoE) of the live video stream.
[0003] Therefore, how to improve the quality of experience of live video streaming has become an urgent problem to be solved. Summary of the invention
[0004] The main purpose of the embodiments of the present invention is to provide a video streaming live broadcast method, a streaming media server and a computer-readable storage medium, which solves the problem in the related art that the live broadcast channel becomes unavailable due to network problems and the video stream cannot be received, thereby reducing the experience quality of the video streaming live broadcast.
[0005] In a first aspect, an embodiment of the present invention provides a method for live broadcasting of a video stream, comprising:
[0006] Acquire multiple incoming video streams corresponding to the live channel, determine a main code stream and at least one backup code stream from the multiple incoming video streams; if the main code stream is in a normal transmission state, output the main code stream to the terminal device; if the main code stream is in an abnormal transmission state, determine a target code stream from the at least one backup code stream, and output the target code stream to the terminal device.
[0007] In one embodiment, determining a main stream and at least one backup stream from the multiple incoming video streams comprises:
[0008] Determine the priority corresponding to each of the incoming video streams; determine the incoming video stream with the highest priority and in a normal transmission state as the main code stream, and determine the remaining incoming video streams as the backup code streams, and the normal transmission state is a state in which no interruption occurs and the packet loss rate is less than a preset packet loss rate threshold.
[0009] In one embodiment, the video streaming live broadcast method further includes:
[0010] When it is detected that the incoming video stream is disconnected and / or the packet loss rate is greater than the packet loss rate threshold, it is confirmed that the incoming video stream is in an abnormal transmission state.
[0011] In one embodiment, the determining of the target bitstream from the at least one backup bitstream further includes:
[0012] At least one candidate code stream is determined from the at least one backup code stream, where the candidate code stream is a backup code stream in a normal transmission state; and the target code stream is determined according to the candidate code stream with the highest priority.
[0013] In one embodiment, before determining the main code stream and at least one backup code stream from the multiple incoming video streams, the method further includes:
[0014] The multiple incoming video streams are rate adapted based on the target bit rate corresponding to the live channel to obtain the multiple incoming video streams with the same bit rate as the target bit rate.
[0015] In one embodiment, before outputting the main stream to the terminal device, the method further includes:
[0016] The main code stream is format-converted based on a preset target video format to obtain a main code stream after format conversion.
[0017] In one embodiment, the outputting the main stream to the terminal device includes:
[0018] The main code stream after format conversion is output to the terminal device.
[0019] In one embodiment, outputting the format-converted main stream to the terminal device includes:
[0020] Obtain a target address and a target port corresponding to the terminal device; and output the main stream after format conversion to the terminal device based on the target address and the target port.
[0021] In one embodiment, after determining the target bitstream from at least one backup bitstream, the method further includes:
[0022] If it is detected that the main code stream is restored to a normal transmission state, a code stream switching operation is performed to output the main code stream to the terminal device.
[0023] In a second aspect, the present invention further provides a streaming media server, the streaming media server comprising a memory and a processor;
[0024] The memory is used to store computer programs;
[0025] The processor is used to execute the computer program and implement the above-mentioned video streaming live broadcast method when executing the computer program.
[0026] In a third aspect, the present invention further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the processor implements the video streaming live broadcast method as described above.
[0027] The present invention discloses a video stream live broadcast method, a streaming media server and a computer-readable storage medium. The test method comprises: obtaining multiple incoming video streams corresponding to a live broadcast channel, determining a main code stream and at least one backup code stream from the multiple incoming video streams; if the main code stream is in a normal transmission state, outputting the main code stream to a terminal device; if the main code stream is in an abnormal transmission state, determining a target code stream from at least one backup code stream, and outputting the target code stream to the terminal device. The above-mentioned video stream live broadcast method, by obtaining multiple video streams corresponding to a live broadcast channel and determining a main code stream and at least one backup code stream from multiple incoming video streams, can determine a target code stream from at least one backup code stream and output the target code stream to a terminal device when the main code stream is in an abnormal transmission state. It can realize active perception and switching of the incoming video stream when a certain encoder fails or a network problem occurs, thereby ensuring the availability of the live broadcast channel service and improving the quality of experience.
[0028] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0030] Figure 1 is a schematic diagram of the architecture of a network television system provided by an embodiment of the present invention;
[0031] Figure 2It is a software schematic diagram of a streaming media server provided by an embodiment of the present invention;
[0032] Figure 3 It is a hardware schematic diagram of a streaming media server provided by an embodiment of the present invention;
[0033] Figure 4 is a schematic flow chart of a video streaming live broadcast method provided by an embodiment of the present invention;
[0034] Figure 5 is a schematic flow chart of sub-steps of another method for live video streaming provided by an embodiment of the present invention;
[0035] Figure 6 is a schematic flow chart of sub-steps of another method for live video streaming provided by an embodiment of the present invention;
[0036] Figure 7 It is a schematic flowchart of the sub-steps of another method for live video streaming provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0037] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0038] The flowcharts shown in the accompanying drawings are only examples and do not necessarily include all the contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps may also be decomposed, combined or partially merged, so the actual execution order may change according to actual conditions.
[0039] It should be understood that the terms used in this specification of the present invention are only for the purpose of describing specific embodiments and are not intended to limit the present invention. As used in the specification of the present invention and the appended claims, unless the context clearly indicates otherwise, the singular forms "a", "an" and "the" are intended to include plural forms.
[0040] It should also be understood that the term "and / or" used in the present description and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.
[0041] It should be understood that the specific embodiments described herein are only used to explain the present invention, and are not used to limit the present invention.
[0042] In the subsequent description, the suffixes such as "module", "component" or "unit" used to represent elements are only used to facilitate the description of the present invention, and have no special meanings. Therefore, "module", "component" or "unit" can be used in a mixed manner.
[0043] The embodiment of the present invention provides a video streaming live broadcast method, a streaming media server, an Internet TV system and a computer-readable storage medium. The video streaming live broadcast method can be applied to a streaming media server in an Internet TV system, by obtaining multiple video streams corresponding to a live channel and determining a main code stream and at least one backup code stream from multiple incoming video streams, when the main code stream is in an abnormal transmission state, a target code stream can be determined from at least one backup code stream and output to a terminal device, and when a certain encoder fails or a network problem occurs, the incoming video stream can be actively sensed and switched, thereby ensuring the availability of the live channel service and improving the quality of experience.
[0044] Exemplarily, the terminal device may be a set top box (STB), or other electronic devices with a video playback function, such as smart phones, laptops, tablet computers, notebook computers, and desktop computers. In the embodiment of the present invention, the terminal device is a set top box as an example to illustrate how to perform video streaming live.
[0045] See also Figure 1 , Figure 1 FIG. 1 is a schematic diagram of the architecture of an Internet TV system 10 provided by an embodiment of the present invention. Figure 1 As shown, the network television system 10 may include a streaming media server 100 and a set top box (STB) 200. In the network television system 10, the streaming media server 100 may receive video streams from multiple encoders, determine the main code stream and the backup code stream according to the priority of each video stream, use the main code stream as the input source of the live channel, perform code stream conversion on the input main code stream, and then output it to the set top box 200.
[0046] It should be noted that, in the embodiment of the present invention, the backup code stream may also be referred to as a slave code stream.
[0047] In the embodiment of the present invention, when creating a live channel on the streaming media server 100, multiple incoming video streams with the same content and different transmission sources can be specified, and different priorities can be assigned to these incoming video streams. The streaming media server 100 can receive video stream data of the master stream and the slave stream at the same time, but only selects the master stream as the incoming video stream of the live channel.
[0048] Among them, the streaming media server 100 can use Simulcast technology to convert the bit rates of the main code stream and the slave code stream, and convert the bit rates of these incoming code streams to be consistent with the bit rates specified when creating the live channel. The streaming media server preferentially selects the main code stream as the incoming video stream of the live channel. When the main code stream is disconnected or the packet loss rate is greater than the preset packet loss rate threshold, the streaming media server 100 is triggered to select a high-priority backup code stream from multiple backup code streams as the main code stream, and the original main code stream is downgraded to a backup code stream. When it is detected that a backup code stream with a higher priority than the current main code stream is restored, the code stream switching is triggered, that is, the restored high-priority code stream becomes the main code stream, and the current main code stream is downgraded to a backup code stream.
[0049] In the embodiment of the present invention, the live broadcast of the video stream can be realized by the live broadcast service module in the streaming media server 100. The live broadcast service module will be described in detail below.
[0050] See also Figure 2 , Figure 2 FIG. 1 is a software schematic diagram of a streaming media server 100 provided in an embodiment of the present invention. Figure 2 As shown, the live broadcast service module in the streaming media server 100 adopts a pipes and filters architecture, and may include a bit rate adaptation module, a bit stream selection module, a bit stream conversion module, and a bit stream push module.
[0051] The bitrate adaptation module may be a Simulcast module. Since the bitrate of the video stream output by the multi-input encoder is inconsistent with the target bitrate specified for creating a live channel, the bitrate adaptation module is used to adapt the bitrate of the input video stream to the target bitrate specified by the live channel, and then serve as the input of the bitrate selection module.
[0052] Among them, the bitstream selection module receives multiple video streams processed by the bitrate adaptation module, analyzes the packet loss and interruption of the video streams, and determines the main bitstream and backup bitstream based on the priority of the video stream, and then uses the main bitstream as the input of the bitstream conversion module.
[0053] The code stream conversion module performs data conversion on the main code stream selected by the code stream selection module, converts the main code stream into an extended RTP (Real Time Protocol) format, and then uses the converted main code stream as the input of the code stream push module.
[0054] The code stream push module receives the main code stream converted by the code stream conversion module, and pushes the main code stream to the IP address and port specified by the set-top box.
[0055] See also Figure 3 , Figure 3FIG. 1 is a hardware schematic diagram of a streaming media server 100 provided in an embodiment of the present invention. Figure 3 As shown, the streaming media server 100 may include a processor 1001 and a memory 1002, wherein the processor 1001 and the memory 1002 may be connected via a bus, such as an Inter-integrated Circuit (I2C) bus or any other suitable bus.
[0056] The memory 1002 may include a storage medium and an internal memory. The storage medium may store an operating system and a computer program. The computer program includes program instructions, which, when executed, may enable the processor to execute the video streaming live broadcast method described in any embodiment.
[0057] The processor 1001 is used to provide computing and control capabilities to support the operation of the entire streaming media server 100 .
[0058] The processor 1001 may be a central processing unit (CPU), a general-purpose processor, a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA), or other types of processors such as programmable logic devices, discrete gate or transistor logic devices, and discrete hardware components. A general-purpose processor may be a microprocessor, or a general-purpose processor may be any conventional processor.
[0059] In one embodiment, the processor 1001 is used to run a computer program stored in the memory 1002 to implement the following steps:
[0060] Acquire multiple incoming video streams corresponding to the live channel, determine a main code stream and at least one backup code stream from the multiple incoming video streams; if the main code stream is in a normal transmission state, output the main code stream to the terminal device; if the main code stream is in an abnormal transmission state, determine a target code stream from at least one backup code stream, and output the target code stream to the terminal device.
[0061] In one embodiment, the processor 1001, when determining a main stream and at least one backup stream from a plurality of incoming video streams, is configured to implement:
[0062] Determine the priority of each incoming video stream;
[0063] The incoming video stream with the highest priority and in normal transmission state is determined as the main code stream, and the remaining incoming video streams are determined as backup code streams. The normal transmission state is a state where no interruption occurs and the packet loss rate is less than a preset packet loss rate threshold.
[0064] In one embodiment, the processor 1001 is further configured to implement:
[0065] When it is detected that an incoming video stream is disconnected and / or the packet loss rate is greater than a packet loss rate threshold, it is confirmed that the incoming video stream is in an abnormal transmission state.
[0066] In one embodiment, when implementing determining the target bitstream from at least one backup bitstream, the processor 1001 is further configured to implement:
[0067] At least one candidate code stream is determined from at least one backup code stream, where the candidate code stream is a backup code stream in a normal transmission state; and a target code stream is determined according to the candidate code stream with the highest priority.
[0068] In one embodiment, before determining the primary code stream and at least one backup code stream from multiple incoming video streams, the processor 1001 is further configured to implement:
[0069] The bit rates of the multiple incoming video streams are adapted based on the target bit rate corresponding to the live channel to obtain the multiple incoming video streams with the same bit rate as the target bit rate.
[0070] In one embodiment, before outputting the main stream to the terminal device, the processor 1001 is further configured to implement:
[0071] The main code stream is format-converted based on a preset target video format to obtain a main code stream after format conversion.
[0072] In one embodiment, when outputting the main stream to the terminal device, the processor 1001 is used to implement:
[0073] Output the main stream after format conversion to the terminal device.
[0074] In one embodiment, when outputting the format-converted main stream to the terminal device, the processor 1001 is used to implement:
[0075] Obtain the target address and target port corresponding to the terminal device; based on the target address and the target port, output the main stream after format conversion to the terminal device.
[0076] In one embodiment, after determining the target bitstream from at least one backup bitstream, the processor 1001 is further configured to implement:
[0077] If it is detected that the main code stream has returned to a normal transmission state, the code stream switching operation is performed to output the main code stream to the terminal device.
[0078] Some embodiments of the present invention are described in detail below in conjunction with the accompanying drawings. The following embodiments and features of the embodiments can be combined with each other without conflict. Figure 4 , Figure 4 FIG. 1 is a schematic flow chart of a method for live video streaming provided by an embodiment of the present invention. Figure 4 As shown, the video stream live broadcast method includes steps S101 to S103.
[0079] Step S101: Acquire multiple incoming video streams corresponding to a live channel, and determine a main stream and at least one backup stream from the multiple incoming video streams.
[0080] Exemplarily, video streams sent by multiple encoders may be received to obtain multiple incoming video streams. Then, a main code stream and at least one backup code stream are determined from the multiple incoming video streams.
[0081] The main code stream is used to transmit to the terminal device for playback, for example, the main code stream is transmitted to the set-top box for playback. The backup code stream is used to select one of the backup code streams with the highest or higher priority as the main code stream when the main code stream is unavailable.
[0082] In some embodiments, determining a main code stream and at least one backup code stream from a plurality of incoming video streams may include: determining a priority corresponding to each incoming video stream; determining an incoming video stream with the highest priority and in a normal transmission state as the main code stream, and determining the remaining incoming video streams as backup code streams, wherein the normal transmission state is a state in which no interruption occurs and a packet loss rate is less than a preset packet loss rate threshold.
[0083] Exemplarily, the priority corresponding to each incoming video stream can be determined according to the priority identifier carried by each incoming video stream. Then, the transmission status of each incoming video stream is confirmed, and the incoming video stream with the highest priority and in a normal transmission status is determined as the main code stream, and the remaining incoming video streams are determined as backup code streams.
[0084] It should be noted that, in the embodiment of the present invention, the priority of the incoming video stream may be determined according to the quality of the incoming video stream, wherein the higher the quality of the incoming video stream is, the higher the corresponding priority level is.
[0085] In the above embodiment, by determining the priority of each incoming video stream, it is possible to determine the incoming video stream with the highest priority and in a normal transmission state as the main stream, and determine the remaining incoming video streams as backup streams.
[0086] In some embodiments, confirming the transmission status of each incoming video stream may include: when detecting an incoming video stream with a disconnection and / or a packet loss rate greater than a packet loss rate threshold, confirming that the incoming video stream is in an abnormal transmission state. When detecting an incoming video stream with a disconnection and / or a packet loss rate greater than a packet loss rate threshold, confirming that the incoming video stream is in an abnormal transmission state.
[0087] Exemplarily, when a disconnection of the incoming video stream is detected, it is confirmed that the incoming video stream is in an abnormal transmission state.
[0088] Exemplarily, when an incoming video stream having a packet loss rate greater than a packet loss rate threshold is detected, it is confirmed that the incoming video stream is in an abnormal transmission state.
[0089] Exemplarily, when an incoming video stream with a disconnection and a packet loss rate greater than a packet loss rate threshold is detected, it is confirmed that the incoming video stream is in an abnormal transmission state. When an incoming video stream with a disconnection and a packet loss rate not greater than a packet loss rate threshold is not detected, it is confirmed that the incoming video stream is in a normal transmission state.
[0090] It should be noted that the interruption of the video stream refers to the interruption of the transmission of the video stream. The packet loss rate refers to the ratio of the video stream to lose data packets. The packet loss rate threshold can be set according to the actual situation, and the specific value is not limited here.
[0091] In the above embodiment, by detecting whether the incoming video stream is interrupted and whether the packet loss rate is greater than the packet loss rate threshold, it can be accurately determined whether the incoming video stream is in a normal transmission state.
[0092] Step S102: If the main code stream is in a normal transmission state, the main code stream is output to the terminal device.
[0093] Exemplarily, after determining a main stream and at least one backup stream from a plurality of incoming video streams, if the main stream is in a normal transmission state, the main stream is output to the terminal device.
[0094] It should be noted that, in the embodiment of the present invention, when the main stream is in a normal transmission state, that is, when the main stream is not interrupted and the packet loss rate is less than a preset packet loss rate threshold, the main stream is output to the terminal device.
[0095] Step S103: If the main code stream is in an abnormal transmission state, a target code stream is determined from at least one backup code stream, and the target code stream is output to the terminal device.
[0096] Exemplarily, after determining a main stream and at least one backup stream from multiple incoming video streams, if the main stream is in an abnormal transmission state, a target stream is determined from at least one backup stream and output to the terminal device.
[0097] It should be noted that by determining the target bitstream from at least one backup bitstream and outputting the target bitstream to the terminal device when the main bitstream is in an abnormal transmission state, it is possible to actively sense and switch the incoming video stream when a certain encoder fails or a network problem occurs, thereby ensuring the availability of the live channel service and improving the quality of experience.
[0098] In some embodiments, determining the target bitstream from at least one backup bitstream may include: determining at least one candidate bitstream from at least one backup bitstream, where the candidate bitstream is a backup bitstream in a normal transmission state; and determining the target bitstream according to the candidate bitstream with the highest priority.
[0099] Exemplarily, a backup code stream in a normal transmission state may be determined as a candidate code stream, wherein there is at least one candidate code stream, and then the candidate code stream with the highest priority may be determined as the target code stream.
[0100] In the above embodiment, by determining the backup bitstream in normal transmission state as the candidate bitstream and determining the candidate bitstream with the highest priority as the target bitstream, it can be ensured that the selected target bitstream has the best quality, thereby ensuring the availability of the live channel service and improving the quality of experience.
[0101] See also Figure 5 , Figure 5 FIG. 1 is a schematic flow chart of sub-steps of another method for live video streaming provided by an embodiment of the present invention. Figure 5 As shown, the following steps S201 to S204 may be included.
[0102] Step S201: bit rate adaptation is performed on multiple incoming video streams based on a target bit rate corresponding to a live broadcast channel to obtain multiple incoming video streams having a bit rate that is the same as the target bit rate.
[0103] In some embodiments, after obtaining multiple incoming video streams corresponding to the live channel, the multiple incoming video streams can be rate adapted based on the target bit rate corresponding to the live channel to obtain multiple incoming video streams with the same bit rate as the target bit rate.
[0104] For example, Figure 2 As shown, the bit rate adaptation module can determine whether the bit rates of multiple incoming video streams are consistent with the target bit rate corresponding to the live channel. If the bit rates of multiple incoming video streams are inconsistent with the target bit rate corresponding to the live channel, the bit rates of the multiple incoming video streams can be adapted according to the target bit rate to obtain multiple incoming video streams with the same bit rate as the target bit rate. Of course, for incoming video streams with the same bit rate as the target bit rate, the bit rate adaptation operation is not performed. Among them, the specific process of bit rate adaptation can be referred to the relevant technology and is not limited here.
[0105] In the above-mentioned embodiment, by adapting the bit rates of multiple incoming video streams based on the target bit rate corresponding to the live channel, multiple incoming video streams with the same bit rate as the target bit rate are obtained. This can ensure that the bit rate of each incoming video stream is the same as the target bit rate required by the live channel, thereby avoiding the problem of the terminal device being unable to play the video stream due to inconsistent bit rates in the future, and improving the quality of experience.
[0106] Step S202: Determine a main stream and at least one backup stream from a plurality of incoming video streams.
[0107] Step S203: If the main code stream is in a normal transmission state, output the main code stream to the terminal device.
[0108] Step S204: If the main code stream is in an abnormal transmission state, a target code stream is determined from at least one backup code stream, and the target code stream is output to the terminal device.
[0109] It can be understood that the above steps S202 to S204 are the same as the above steps S101 to S103, and are not described in detail here.
[0110] See also Figure 6 , Figure 6 FIG. 1 is a schematic flow chart of sub-steps of another method for live video streaming provided by an embodiment of the present invention. Figure 6 As shown, the following steps S301 to S303 may be included.
[0111] Step S301: Acquire multiple incoming video streams corresponding to a live channel, and determine a main stream and at least one backup stream from the multiple incoming video streams.
[0112] It can be understood that the above step S302 is the same as the above step S101 and will not be described in detail here.
[0113] Step S302: If the main stream is in a normal transmission state, the main stream is format-converted based on a preset target video format to obtain a main stream after format conversion.
[0114] Exemplarily, when the main stream is in a normal transmission state, the main stream may be format-converted based on the target video format to obtain a main stream after format conversion.
[0115] The target video format may be determined according to the video format required by the terminal device. The target video format may be an RTP format or a TS (Transport Stream) format. For example, when the target video format is an RTP format, the format of the main code stream may be converted to the RTP format to obtain the main code stream after the format conversion.
[0116] In the above embodiment, by converting the format of the main code stream based on a preset target video format to obtain the main code stream after format conversion, it can be ensured that the video format of the main code stream is the same as the target video format, thereby avoiding the problem that the terminal device cannot play the main code stream due to inconsistent video formats in the future, thereby improving the quality of experience.
[0117] Step S303: output the main stream after format conversion to the terminal device.
[0118] Exemplarily, after the format conversion is performed on the main stream based on the preset target video format to obtain the main stream after the format conversion, the main stream after the format conversion can be output to the terminal device.
[0119] In some embodiments, outputting the format-converted main stream to the terminal device may include: acquiring a target address and a target port corresponding to the terminal device; and outputting the format-converted main stream to the terminal device based on the target address and the target port.
[0120] Exemplarily, the media stream server may request the target address and target port corresponding to the terminal device, and based on the target address and target port, establish a communication link with the terminal device, and output the format-converted main code stream to the terminal device, so that the terminal device can receive the main code stream through the communication link and play the video.
[0121] In the above embodiment, by acquiring the target address and the target port corresponding to the terminal device, the main stream after format conversion can be output to the terminal device based on the target address and the target port.
[0122] See also Figure 7 , Figure 7 FIG. 1 is a schematic flow chart of sub-steps of another method for live video streaming provided by an embodiment of the present invention. Figure 7 As shown, the following steps S401 to S403 may be included.
[0123] Step S401: Acquire multiple incoming video streams corresponding to a live channel, and determine a main stream and at least one backup stream from the multiple incoming video streams.
[0124] Step S402: If the main code stream is in an abnormal transmission state, a target code stream is determined from at least one backup code stream, and the target code stream is output to the terminal device.
[0125] It can be understood that the above steps S401 and S402 are the same as the above steps S101 and S103, and are not described in detail here.
[0126] Step S403: If it is detected that the main code stream is restored to a normal transmission state, a code stream switching operation is performed to output the main code stream to the terminal device.
[0127] It should be noted that, in the embodiment of the present invention, when it is detected that a video stream with a higher priority than the current target stream is restored, a stream switching operation is triggered, that is, the restored high-priority stream becomes the main stream, and the current target stream is downgraded to a backup stream.
[0128] Exemplarily, after determining a target stream from at least one backup stream and outputting the target stream to the terminal device, if it is detected that the main stream is restored to a normal transmission state, a stream switching operation is performed to output the main stream to the terminal device.
[0129] The above embodiment, by performing a stream switching operation and outputting the main stream to the terminal device when detecting that the main stream has returned to a normal transmission state, can ensure that the highest priority video stream is output to the terminal device, thereby ensuring the availability of the live channel service and improving the quality of experience.
[0130] A computer-readable storage medium is also provided in an embodiment of the present invention. The computer-readable storage medium stores a computer program. The computer program includes program instructions. The processor executes the above program instructions to implement any one of the video streaming live broadcast methods provided in the embodiments of the present invention.
[0131] For example, the program is loaded by the processor and may execute the following steps:
[0132] Acquire multiple incoming video streams corresponding to the live channel, determine a main code stream and at least one backup code stream from the multiple incoming video streams; if the main code stream is in a normal transmission state, output the main code stream to the terminal device; if the main code stream is in an abnormal transmission state, determine a target code stream from at least one backup code stream, and output the target code stream to the terminal device.
[0133] Those skilled in the art will appreciate that all or some of the steps in the methods disclosed above, and the functional modules / units in the systems and devices may be implemented as software, firmware, hardware, or a suitable combination thereof.
[0134] In hardware implementation, the division between the functional modules / units mentioned in the above description does not necessarily correspond to the division of physical components; for example, a physical component may have multiple functions, or a function or step may be performed by several physical components in cooperation. Some physical components or all physical components may be implemented as software executed by a processor, such as a central processing unit, a digital signal processor or a microprocessor, or implemented as hardware, or implemented as an integrated circuit, such as an application-specific integrated circuit. Such software may be distributed on a storable medium, and the storage medium may include a computer storage medium (or a non-temporary medium) and a communication medium (or a temporary medium). As known to those of ordinary skill in the art, the term storage medium includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, program modules or other data). Computer storage media include, but are not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, digital versatile disk (DVD) or other optical disk storage, magnetic cassettes, magnetic tapes, disk storage or other magnetic storage devices, or any other medium that can be used to store desired information and can be accessed by a computer. Furthermore, it is well known to those skilled in the art that communication media typically embodies computer readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave or other transport mechanism, and may include any information delivery media.
[0135] The preferred embodiments of the present invention are described above with reference to the accompanying drawings, but the scope of the present invention is not limited thereby. Any modification, equivalent substitution and improvement made by those skilled in the art without departing from the scope and essence of the present invention shall be within the scope of the present invention.
Claims
1. A method for live video streaming, the method comprising: Acquire multiple incoming video streams corresponding to the live channel, and determine a main stream and at least one backup stream from the multiple incoming video streams; If the main code stream is in a normal transmission state, outputting the main code stream to the terminal device; If the main code stream is in an abnormal transmission state, a target code stream is determined from the at least one backup code stream, and the target code stream is output to the terminal device.
2. The video streaming live broadcast method according to claim 1, characterized in that: The step of determining a main code stream and at least one backup code stream from the multiple incoming video streams comprises: Determine the priority corresponding to each of the incoming video streams; The incoming video stream with the highest priority and in a normal transmission state is determined as the main code stream, and the remaining incoming video streams are determined as the backup code streams. The normal transmission state is a state in which no interruption occurs and the packet loss rate is less than a preset packet loss rate threshold.
3. The video streaming live broadcast method according to claim 2, characterized in that: The method further comprises: When it is detected that the incoming video stream is disconnected and / or the packet loss rate is greater than the packet loss rate threshold, it is confirmed that the incoming video stream is in an abnormal transmission state.
4. The video streaming live broadcast method according to claim 1, characterized in that: The determining the target bitstream from the at least one backup bitstream comprises: Determine at least one candidate codestream from the at least one backup codestream, wherein the candidate codestream is a backup codestream in a normal transmission state; The target code stream is determined according to the candidate code stream with the highest priority.
5. The video streaming live broadcast method according to claim 1, characterized in that: Before determining the main code stream and at least one backup code stream from the multiple incoming video streams, the method further includes: The multiple incoming video streams are rate adapted based on the target bit rate corresponding to the live channel to obtain the multiple incoming video streams with the same bit rate as the target bit rate.
6. The video streaming live broadcast method according to claim 1, characterized in that: Before outputting the main stream to the terminal device, the method further includes: Performing format conversion on the main stream based on a preset target video format to obtain a main stream after format conversion; The outputting the main stream to the terminal device comprises: The main code stream after format conversion is output to the terminal device.
7. The video streaming live broadcast method according to claim 6, characterized in that: Outputting the format-converted main stream to the terminal device includes: Obtaining the target address and target port corresponding to the terminal device; Based on the target address and the target port, the main stream after format conversion is output to the terminal device.
8. The video streaming live broadcast method according to any one of claims 1 to 7, characterized in that: After determining the target bitstream from the at least one backup bitstream, the method further includes: If it is detected that the main code stream is restored to a normal transmission state, a code stream switching operation is performed to output the main code stream to the terminal device.
9. A streaming media server, characterized in that: The streaming media server includes a processor, a memory, a computer program stored in the memory and executable by the processor, and a data bus for realizing connection and communication between the processor and the memory, wherein the computer program, when executed by the processor, realizes the video streaming live broadcast method as described in any one of claims 1 to 8.
10. A computer-readable storage medium for readable storage, characterized in that: The computer-readable storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement the video streaming live broadcast method as described in any one of claims 1 to 8.