Live broadcast method, system, device and storage medium based on media segment files
By judging the time difference of media shard files and adjusting the playback order and download strategy, the problem of high live broadcast delay is solved, and the effect of reducing the playback delay of live videos and improving the efficiency of starting playback is achieved.
Patent Information
- Application Number
- CN202410823647.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-24
- Publication Date
- 2025-04-29
- Estimated Expiration
- 2044-06-24
AI Technical Summary
In the shard streaming media live broadcast system, a large number of media shard files need to be downloaded in advance when the live video is started, resulting in high live broadcast delays. The existing technology has not yet proposed an effective solution.
By determining whether the time difference between the time that the generated media shard file can be obtained by the playback end and the current time is within the preset time range. If within the range, first play the preset number of media shard files, and then download the continuous media shard files with it after waiting for the preset time threshold to reduce the delay during live broadcast.
It reduces the delay in playing live videos, reduces the number of media shard files that the playback end needs to download when starting playback, and improves the efficiency of starting playback of live videos.
Smart Images

Figure CN118764657B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of streaming media, and in particular to a live broadcast method, system, device and storage medium based on media segment files. Background Art
[0002] In the related art, in the segmented streaming media live broadcast system, the server will divide the live stream into several media segment files of a certain length and continuous (for example, HLS (a streaming media transmission protocol)) protocol ts (transport stream) files, and continuously update the latest media segment files. In order to maintain stable playback, when the live video playback starts, the playback end needs to pre-download several media segments before starting to play. Therefore, the live broadcast method based on media segment files in the related art has a large delay.
[0003] To address the above-mentioned problems, no effective solution has been proposed yet. Summary of the invention
[0004] The embodiments of the present invention provide a live broadcast method, system, device and storage medium based on media segment files, so as to at least solve the technical problem in the related art that when starting to play the live video, a large number of media segment files need to be downloaded in advance before starting to play the live video, resulting in high live broadcast delay.
[0005] According to one aspect of an embodiment of the present invention, a live broadcast method based on media segment files is provided, comprising: responding to a playback request of a live video, obtaining the time difference between the time when the media segment file being generated can be obtained by the playback end and the current time, and judging whether the time difference is within a preset time range; when the time difference is within the preset time range, playing the videos in a preset number of media segment files in a specified order, wherein the preset number is less than a target number, and the target number includes: the number of media segment files recommended to be downloaded when the playback end starts playback; and after waiting for a preset time threshold, downloading media segment files that are continuous with the preset number of media segment files.
[0006] Further, when the time difference is within the preset time range, the videos in the preset number of media segment files are played in a specified order, including: when the time difference is within the preset time range, downloading the target number of media segment files, and based on the downloaded target number of media segment files, playing the videos in the preset number of media segment files; or, when the time difference is within the preset time range, downloading the preset number of media segment files, and playing the videos in the downloaded preset number of media segment files in a specified order.
[0007] Furthermore, after waiting for a preset time threshold, downloading media segment files that are continuous with the preset number of media segment files includes: when the number of downloaded media segment files is the target number, downloading media segment files that are continuous with the target number of media segment files; or, when the number of downloaded media segment files is the preset number, downloading media segment files that are continuous with the preset number of media segment files.
[0008] Furthermore, before downloading the media segment files that are continuous with the target number of media segment files, it also includes: judging whether the media segment files to be downloaded that are continuous with the target number of media segment files have been downloaded by the playback end, and in the case that the media segment files continuous with the target number of media segment files have been downloaded, prohibiting the step of downloading the media segment files continuous with the target number of media segment files; or, before downloading the media segment files continuous with the preset number of media segment files, it also includes: judging whether the media segment files to be downloaded that are continuous with the preset number of media segment files have been downloaded by the playback end, and in the case that the media segment files continuous with the preset number of media segment files have been downloaded, prohibiting the step of downloading the media segment files continuous with the preset number of media segment files.
[0009] Furthermore, when the time difference is not within the preset time range, the target number of media segment files are downloaded; and at the playback end, the videos in the target number of media segment files are played.
[0010] Furthermore, obtaining the time difference between the time when the media segment file being generated can be obtained by the playback end and the current time includes: using a content distribution network to determine the time when the media segment file being generated can be obtained by the playback end to obtain a target time point; and determining the time difference based on the target time point and the current time.
[0011] Furthermore, the preset time range is between 0 and the time required to generate one of the media segment files, and the preset time threshold is greater than or equal to the time difference.
[0012] According to another aspect of an embodiment of the present invention, a live broadcast system based on media segment files is also provided. The live broadcast system based on media segment files is used to execute any one of the live broadcast methods based on media segment files. The live broadcast system based on media segment files includes: a time judgment module, used to obtain the time difference between the time when the media segment file being generated can be obtained by the playback end and the current time, and judge whether the time difference is within a preset time range; the playback end is used to play the videos in a preset number of media segment files in a specified order when the time difference is within the preset time range, and after waiting for a preset time threshold, download the media segment files that are continuous with the preset number of media segment files, wherein the preset number is less than the target number, and the target number includes: the number of media segment files recommended to be downloaded when the playback end starts playback; a media segment file providing end, used to generate the media segment files.
[0013] According to another aspect of an embodiment of the present invention, a live broadcast device based on media segment files is also provided, including: a processing unit, used to respond to a playback request of a live video, obtain the time difference between the time when the media segment file being generated can be obtained by the playback end and the current time, and determine whether the time difference is within a preset time range; a first playback unit, used to play videos in a preset number of media segment files in a specified order when the time difference is within the preset time range, wherein the preset number is less than a target number, and the target number includes: the number of media segment files recommended to be downloaded when the playback end starts playback; a first downloading unit, used to download media segment files that are continuous with the preset number of media segment files after waiting for a preset time threshold.
[0014] Further, the first playback unit includes: a first processing subunit, used to download the target number of media segment files when the time difference is within the preset time range, and play the videos in the preset number of media segment files based on the downloaded target number of media segment files; or, a second processing subunit, used to download the preset number of media segment files when the time difference is within the preset time range, and play the videos in the downloaded preset number of media segment files in a specified order.
[0015] Furthermore, the first downloading unit also includes: a third processing sub-unit, used to download media segment files that are continuous with the target number of media segment files when the number of downloaded media segment files is the target number; or, a fourth processing sub-unit, used to download media segment files that are continuous with the preset number of media segment files when the number of downloaded media segment files is the preset number.
[0016] Furthermore, the first downloading unit also includes: a fifth processing subunit, which is used to determine whether the media segment files to be downloaded that are continuous with the target number of media segment files have been downloaded by the playback end before downloading the media segment files that are continuous with the target number of media segment files, and in the case that the media segment files continuous with the target number of media segment files have been downloaded, prohibiting the step of downloading the media segment files continuous with the target number of media segment files; or, a sixth processing subunit, which is used to determine whether the media segment files to be downloaded that are continuous with the preset number of media segment files have been downloaded by the playback end before downloading the media segment files that are continuous with the preset number of media segment files, and in the case that the media segment files continuous with the preset number of media segment files have been downloaded, prohibiting the step of downloading the media segment files continuous with the preset number of media segment files.
[0017] Furthermore, the live broadcast device based on media segment files also includes: a second downloading unit, used to download the target number of media segment files when the time difference is not within the preset time range; a second playback unit, used to play the videos in the target number of media segment files at the playback end.
[0018] Furthermore, the processing unit includes: a first determining subunit, used to use the content distribution network to determine the time when the media segment file being generated can be obtained by the playback end, and obtain a target time point; a second determining subunit, used to determine the time difference based on the target time point and the current time.
[0019] Furthermore, the preset time range is between 0 and the time required to generate one of the media segment files, and the preset time threshold is greater than or equal to the time difference.
[0020] According to another aspect of an embodiment of the present invention, an electronic device is also provided, including: a processor; and a memory for storing executable instructions of the processor; wherein the processor is configured to execute any one of the above-mentioned live broadcast methods based on media segment files by executing the executable instructions.
[0021] According to another aspect of an embodiment of the present invention, a computer-readable storage medium is provided, which stores a computer program, wherein when the computer program is running, the device where the computer-readable storage medium is located is controlled to execute any one of the above-mentioned live broadcast methods based on media segment files.
[0022] In the present invention, in response to a request to play a live video, the time difference between the time when the media segment file being generated can be obtained by the playback end and the current time is obtained, and it is determined whether the time difference is within a preset time range; when the time difference is within the preset time range, the videos in a preset number of media segment files are played in a specified order, wherein the preset number is less than the target number, and the target number includes the number of media segment files recommended to be downloaded when the playback end starts playing; after waiting for a preset time threshold, the media segment files that are continuous with the preset number of media segment files are downloaded for playback. This solves the technical problem in the related art that when starting to play a live video, a large number of media segment files need to be downloaded in advance before the live video starts playing, and the live broadcast delay is high. In the present invention, it is determined whether the time difference is within the preset time range to determine whether the conditions for reducing the live broadcast start-up segments are met when the playback end starts broadcasting, and when the time difference is within the preset time range, the preset number of media segment files are played first, thereby achieving the technical effect of reducing the live video playback delay. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of this application. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:
[0024] Figure 1 is a flowchart of an optional live broadcast method based on media segment files according to an embodiment of the present invention;
[0025] Figure 2 This is a flow chart of an optional T1 and the latest several media segment files of the current live broadcast according to an embodiment of the present invention;
[0026] Figure 3 is a flowchart of an optional live broadcast based on a media segment file according to an embodiment of the present invention;
[0027] Figure 4 is a schematic diagram of an optional live broadcast system based on media segment files according to an embodiment of the present invention;
[0028] Figure 5 is a schematic diagram of an optional live broadcast device based on media segment files according to an embodiment of the present invention;
[0029] Figure 6 is a schematic diagram of an electronic device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0030] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only 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 should fall within the scope of protection of the present invention.
[0031] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0032] Embodiment 1
[0033] According to an embodiment of the present invention, an optional method embodiment of a live broadcast method based on media segment files is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0034] Figure 1 is a flowchart of an optional live broadcast method based on media segment files according to an embodiment of the present invention. Figure 1 As shown, the method comprises the following steps:
[0035] Step S101, responding to a request for playing a live video, obtaining a time difference between a time when a media segment file being generated can be obtained by a player and a current time, and determining whether the time difference is within a preset time range.
[0036] The above-mentioned live video playback request may refer to a live broadcast start request initiated by the playback end, and the above-mentioned media segmentation file may refer to a media segmentation file obtained by segmenting the live stream of the live video, and the segmentation length of the live stream may be a preset length.
[0037] In order to reduce the live broadcast delay of the playback end used by some users, it can be determined whether the condition of reducing the number of media segment files required for starting the live broadcast is met, that is, whether the time difference is within a preset time range.
[0038] For example, after the playback end of a live video initiates a request to start playback (referred to as start broadcast), the time judgment module (set to M1) can be used to determine whether the difference between the time when the latest media segment file being generated is available to the playback end and the current time (set to T1) is within a preset time range (set to T2).
[0039] Step S102, when the time difference is within a preset time range, playing videos in a preset number of media segment files in a specified order, wherein the preset number is less than the target number, and the target number includes: the number of media segment files that the recommended playback terminal needs to download when starting playback.
[0040] The above-mentioned target number may refer to the number of media segment files that a conventional playback end needs to download when starting playback (i.e., the number of media segment files that a recommended playback end needs to download when starting playback). For example, in the HLS protocol, the recommended playback end downloads three small files (e.g., media segment files) before starting playback. At this time, the number of media segment files that a conventional playback end needs to download when starting playback is three; the number of media segment files that a conventional playback end needs to download when starting playback may also be specified based on a trade-off between business needs and playback quality, for example, may be specified as four.
[0041] In order to reduce the playback delay of live video, in this embodiment, a preset number (set as C2) of media segment files that is less than the number of media segment files that need to be downloaded for normal startup (set as C1) can be downloaded, and playback can be started from the oldest media segment file among the downloaded media segment files. Alternatively, when the playback end starts the broadcast, C1 number of media segment files can be downloaded, and then only the latest number of C2 media segment files are played in sequence. Since the playback end can download and play fewer media segment files than the normal number of media segment files when starting the broadcast, the playback delay can be reduced.
[0042] Step S103: after waiting for a preset time threshold, download media segment files that are consecutive to a preset number of media segment files for playback.
[0043] In order to ensure that the latest media segment files required by the client can be downloaded and to avoid adverse situations such as freezes in the live video, after waiting for a preset time threshold, the playback end can request to download the latest media segment files that are continuous with the downloaded media segment files, so that after the videos in a preset number of media segment files are played, the videos in media segment files that are continuous with a preset number of media segment files can be played continuously.
[0044] Through the above steps, in this embodiment, it is determined whether the time difference is within the preset time range to determine whether the condition of reducing the live broadcast start-up segments is met when the playback end starts broadcasting, and when the time difference is within the preset time range, a preset number of media segment files are played first, thereby achieving the technical effect of reducing the live video playback delay. This solves the technical problem in the related art that when starting to play a live video, a large number of media segment files need to be downloaded in advance before starting to play the live video, resulting in high live broadcast delay.
[0045] Optionally, when the time difference is within a preset time range, videos in a preset number of media segment files are played in a specified order, including: when the time difference is within the preset time range, downloading a target number of media segment files, and based on the downloaded target number of media segment files, playing the videos in a preset number of media segment files; or, when the time difference is within the preset time range, downloading a preset number of media segment files, and playing the videos in the downloaded preset number of media segment files in a specified order.
[0046] The above-mentioned preset number (C2) may be one time less than the number (C1) of media segment files that need to be downloaded for the conventional start-up (corresponding to the target number), that is, C1=C2+1.
[0047] For example, the playback end can download a preset number (set to C2) of media segment files that is less than the number of media segment files required to be downloaded for normal startup (set to C1) (corresponding to the target number), and start playing from the oldest media segment file among the downloaded media segment files, or, when the playback end starts, it downloads C1 number of media segment files, and then only plays the latest C2 number of media segment files in sequence.
[0048] If the method adopted is "the playback end downloads a preset number (set as C2) of media segment files that is less than the number of media segment files required for normal startup (set as C1), and starts playing from the oldest media segment file among the downloaded media segment files", then it is only necessary to download the media segment files to be played. Since only C2 number of media segment files are downloaded, the technical effect of improving the startup efficiency of the playback end and reducing the live video playback delay is achieved, and at the same time, the technical effect of reducing a certain amount of network bandwidth is achieved.
[0049] If the method of "downloading C1 number of media segment files when the playback end starts, and then playing only the latest C2 number of media segment files in sequence" is adopted, the playback end will download at least one more media segment file that will not be played. However, the work of the time judgment module M1 can be completed by the client, and there is no need to modify the media segment file provider at this time.
[0050] Optionally, after waiting for a preset time threshold, downloading media segment files that are continuous with a preset number of media segment files includes: when the number of downloaded media segment files is a target number, downloading media segment files that are continuous with the target number of media segment files; or, when the number of downloaded media segment files is a preset number, downloading media segment files that are continuous with a preset number of media segment files.
[0051] In order to restore the number of media segment files cached by the playback end to a normal level as soon as possible and stabilize the live video playback, in this embodiment, after waiting for a preset time (set to T3), the playback end can request to download the latest media segment file that is continuous with the downloaded media segment files. When the number of downloaded media segment files is the target number, the media segment files that are continuous with the target number of media segment files can be downloaded for playback. When the number of downloaded media segment files is the preset number, the media segment files that are continuous with the preset number of media segment files can be downloaded for playback, thereby achieving the purpose of ensuring stable playback of the live video by the playback end.
[0052] Optionally, before downloading media segment files that are continuous with a target number of media segment files, the step further includes: determining whether the media segment files to be downloaded that are continuous with the target number of media segment files have been downloaded by the playback end, and in the case where the media segment files continuous with the target number of media segment files have been downloaded, prohibiting the step of downloading the media segment files continuous with the target number of media segment files; or, before downloading media segment files continuous with a preset number of media segment files, the step further includes: determining whether the media segment files to be downloaded that are continuous with the preset number of media segment files have been downloaded by the playback end, and in the case where the media segment files continuous with the preset number of media segment files have been downloaded, prohibiting the step of downloading the media segment files continuous with the preset number of media segment files.
[0053] In this embodiment, before "requesting to download the latest media segment file that is continuous with the media segment files that have been downloaded", that is, judging whether the media segment files to be downloaded that are continuous with the preset number of media segment files have been downloaded by the playback end, it is also possible to judge whether the media segment files requested to be downloaded have been downloaded by the playback end. If they have been downloaded, no further download request is made. Otherwise, the download request can be made. In an optional example, the download record can be queried at the playback end to judge whether the media segment files requested to be downloaded have been downloaded by the playback end, thereby avoiding the situation where the media segment files are downloaded repeatedly.
[0054] Optionally, when the time difference is not within a preset time range, download a target number of media fragment files; at the playback end, play the videos in the target number of media fragment files.
[0055] When the difference between the time when the latest media fragment file being generated can be obtained by the playback end and the current time (set as T1, corresponding to the above time difference) is not within the preset time range (set as T2), a target number of media fragment files can be downloaded and the target number of media fragment files can be played, achieving the technical effect of ensuring the stability of live video playback.
[0056] Optionally, obtain the time difference between the time when the media fragment file being generated can be obtained by the playback end and the current time, including: using a content delivery network to determine the time when the media fragment file being generated can be obtained by the playback end to obtain a target time point; based on the target time point and the current time, determine the time difference.
[0057] In this embodiment, the "time when the latest media fragment file being generated can be obtained by the playback end" (corresponding to the above target time point) can be determined and provided by a CDN (content delivery network) associated with the current playback end.
[0058] Specifically, the CDN stores several media fragment files closest to the current live broadcast, and continuously updates and stores them to the latest media fragment files. Moreover, the time interval for each media fragment file of the live broadcast system to be updated to the CDN is generally fixed and thus easily predictable. The "time when the latest media fragment file being generated can be obtained by the playback end" can be obtained through the CDN to get the target time point, and then the time difference between the target time point and the current time can be calculated to obtain the above time difference, achieving the purpose of accurately calculating the time difference between the time when the media fragment file being generated can be obtained by the playback end and the current time.
[0059] Optionally, the preset time range is between 0 and the duration required to generate a media fragment file, and the preset time threshold is greater than or equal to the time difference.
[0060] The above preset time range (T2) can be from 0 to the total duration of generating a media fragment file. In an optional example, the preset time range (T2) can be from 0 to 1 / 2 of the duration of generating a media fragment file. The media fragment file can include the latest media fragment file being generated. At this time, if the time difference T1 is within the preset time range T2, then 0 < T1 < 1 / 2 of the duration of generating a media fragment file. Figure 2 It is a flowchart of an optional T1 and the latest several media fragment files of the current live broadcast according to an embodiment of the present invention, as Figure 2As shown, it includes: media segment file 1, media segment file 2, media segment file 3 and the segment being generated (ie, the media segment file being generated).
[0061] Since the duration of the live media segment files is usually not much different during one playback, the preset time range T2 can also be set to different ranges according to business needs, which is not limited here.
[0062] It should be noted that, in order to ensure that the latest media segment file requested can be downloaded, the value of the above-mentioned preset time threshold (set to T3) can be related to the time difference T1, and T3 can be set to a value greater than or equal to the time difference (T1). In order to avoid video freezes due to long waiting time, the above-mentioned preset time threshold T3 can be less than 1.5 to 2 times of T1.
[0063] In this embodiment, when the playback end starts broadcasting, it is determined whether the conditions for reducing the number of media segment files for starting live broadcasting are met, and based on the judgment result, the video involved in the media segment file is played, thereby achieving the technical effect of reducing the live broadcast delay of the playback end used by some users and retaining the stability of the playback on the playback end to a large extent.
[0064] Embodiment 2
[0065] Embodiment 2 of the present invention provides a live broadcast system based on media segment files. The live broadcast system based on media segment files can be used to execute the live broadcast method based on media segment files provided in Embodiment 1 of the present invention.
[0066] Figure 4 is a schematic diagram of an optional live broadcast system based on media segment files according to an embodiment of the present invention. Figure 4 As shown, the live broadcast system based on media segment files includes: a time judgment module, a playback end, and a media segment file providing end.
[0067] Among them, the time judgment module is used to obtain the time difference between the time when the media segment file being generated can be obtained by the playback end and the current time, and to determine whether the time difference is within a preset time range; the playback end is used to play the videos in a preset number of media segment files in a specified order when the time difference is within the preset time range, and after waiting for a preset time threshold, download the media segment files that are continuous with the preset number of media segment files for playback, wherein the preset number is less than the target number, and the target number includes: the number of media segment files that need to be downloaded when the recommended playback end starts playback; the media segment file providing end is used to generate media segment files.
[0068] The above-mentioned player can be used to play live video, request and download the media segment files required for video playback;
[0069] The time judgment module (set as M1) can be used to obtain the time when the latest media segment file being generated can be obtained by the playback end (corresponding to the target time point in the first embodiment) and the current time, calculate the difference T1 between the time when the latest media segment file being generated can be obtained by the playback end and the current time (corresponding to the above time difference), and determine whether T1 is within the preset time range T2;
[0070] The media segment file provider can be used to respond to the media segment file request initiated by the player and provide the download of the media segment file. The media segment file provider can be a CDN (Content Delivery Network) or another player that is in a P2P (Peer to Peer) relationship with the current player.
[0071] Figure 3 1 is a flowchart of an optional live broadcast based on a media segment file according to an embodiment of the present invention. The live broadcast system based on a media segment file provided in this embodiment can perform the following steps:
[0072] Step 1: The player starts playing;
[0073] Step 2: The time judgment module (set as M1) judges whether the difference between the time when the latest media segment file being generated can be obtained by the playback end and the current time (set as T1) is within a preset time range (set as T2). If so, go to step 3; otherwise, go to step 4.
[0074] Step 3: The playback end downloads a preset number (set as C2) of media segment files that is less than the number of media segment files that need to be downloaded for normal playback (set as C1), and starts playing from the oldest media segment file among the downloaded media segment files, and then goes to step 5; or the playback end downloads C1 number of media segment files when starting playback, and then only plays the latest C2 number of media segment files in sequence, and then goes to step 5;
[0075] Step 4: The player downloads and plays a regular number of media segment files;
[0076] Step 5: After the player waits for a preset time (set to T3), it requests to download the latest media segment file that is continuous with the media segment files that have been downloaded.
[0077] Preferably, "the time when the latest media segment file being generated can be obtained by the playback end" can be determined and provided by the CDN associated with the current playback end. The CDN can store several media segment files closest to the current live broadcast, and continuously update and store the latest media segment files. The time interval for each media segment file of the live broadcast system to be updated to the CDN is generally fixed and thus easy to predict. Therefore, the "time when the latest media segment file being generated can be obtained by the playback end" can be obtained through the CDN.
[0078] In an optional example, if the time judgment module M1 is located in the CDN, it is possible to directly judge whether T1 is within the preset time range T2 at the CDN end. This example can be applied to the scenario in step 3 where "the playback end downloads a preset number (set as C2) of media segment files that is less than the number of media segment files required for normal playback (set as C1), and starts playback from the oldest media segment file among the downloaded media segment files." In this scenario, the playback end can request C1 number of media segment files when starting playback, but the media segment file provider can only provide the latest C2 number of media segment files to the playback end and inform the playback end.
[0079] In another optional example, if the time judgment module M1 includes a playback end, the information or results related to determining whether T1 is within the preset time range T2 can be informed to the playback end. This example can be applied to the scenario in step three where "the playback end downloads C1 number of media segment files when starting broadcasting, and then only plays the latest C2 number of media segment files in sequence."
[0080] Preferably, the notification information (i.e., the information or result related to determining whether T1 is within the preset time range T2) can be included in the relevant information of the media segment file provided by the media segment file provider to the playback end. For example, in the header returned to the playback end. This method is simple and fast. When the playback end downloads the media segment file, it also obtains the notification information.
[0081] It should be noted that the start of broadcasting on the playback end may include the first live broadcast upon entering the live broadcast page, continued live broadcast after a pause that meets certain conditions, and a retry of live broadcasting after a playback failure.
[0082] In this embodiment, by judging whether the conditions for reducing the live broadcast start-up fragments are met when the playback end starts broadcasting, the live broadcast delay of some users can be reduced, while the playback stability of the playback end used by these users is retained to a large extent.
[0083] Embodiment 3
[0084] Embodiment 3 of the present invention provides an optional live broadcast device based on media segment files, and each implementation unit in the live broadcast device corresponds to each implementation step in Embodiment 1.
[0085] Figure 5 is a schematic diagram of an optional live broadcast device based on media segment files according to an embodiment of the present invention. Figure 5 As shown, the indicator device includes: a processing unit 51, a first playing unit 52 and a first downloading unit 53.
[0086] The processing unit 51 is used to respond to the playback request of the live video, obtain the time difference between the time when the media segment file being generated can be obtained by the playback end and the current time, and determine whether the time difference is within a preset time range;
[0087] The first playback unit 52 is configured to play the videos in a preset number of media segment files in a specified order when the time difference is within a preset time range, wherein the preset number is less than a target number, and the target number includes: the number of media segment files that the recommended playback terminal needs to download when starting playback;
[0088] The first downloading unit 53 is configured to download media segment files that are continuous with a preset number of media segment files after waiting for a preset time threshold, for playback.
[0089] In the live broadcast device based on media segment files provided in the third embodiment of the present invention, the processing unit 51 can respond to the playback request of the live video, obtain the time difference between the time when the media segment file being generated can be obtained by the playback end and the current time, and judge whether the time difference is within the preset time range, and then the first playback unit 52 plays the videos in the preset number of media segment files in the specified order when the time difference is within the preset time range, wherein the preset number is less than the target number, and the target number includes: the number of media segment files required to be downloaded when the recommended playback end starts playing, and then the first downloading unit 53 downloads the media segment files that are continuous with the preset number of media segment files after waiting for the preset time threshold. Thus, the technical problem that a large number of media segment files need to be downloaded in advance before starting to play the live video in the related art is solved, and the live broadcast delay is high. In this embodiment, it is judged whether the time difference is within the preset time range to determine whether the conditions for reducing the live broadcast start-up segments are met when the playback end starts, and when the time difference is within the preset time range, the preset number of media segment files are played first, thereby achieving the technical effect of reducing the live video playback delay.
[0090] Optionally, in the live broadcast device based on media segment files provided in Example 3 of the present invention, the first playback unit includes: a first processing subunit, used to download a target number of media segment files when the time difference is within a preset time range, and play videos in a preset number of media segment files based on the downloaded target number of media segment files; or, a second processing subunit, used to download a preset number of media segment files when the time difference is within a preset time range, and play videos in the downloaded preset number of media segment files in a specified order.
[0091] Optionally, in the live broadcast device based on media segment files provided in Example 3 of the present invention, the first downloading unit includes: a third processing sub-unit, used to download media segment files that are continuous with the target number of media segment files for playback when the number of downloaded media segment files is the target number; or, a fourth processing sub-unit, used to download media segment files that are continuous with a preset number of media segment files for playback when the number of downloaded media segment files is the preset number.
[0092] Optionally, in the live broadcast device based on media segment files provided in Example 3 of the present invention, the first downloading unit also includes: a fifth processing subunit, which is used to determine whether the media segment files to be downloaded that are continuous with the target number of media segment files have been downloaded by the playback end before downloading the media segment files that are continuous with the target number of media segment files, and in the case that the media segment files continuous with the target number of media segment files have been downloaded, prohibiting the step of downloading the media segment files continuous with the target number of media segment files; or, a sixth processing subunit, which is used to determine whether the media segment files to be downloaded that are continuous with the preset number of media segment files have been downloaded by the playback end before downloading the media segment files that are continuous with the preset number of media segment files, and in the case that the media segment files continuous with the preset number of media segment files have been downloaded, prohibiting the step of downloading the media segment files continuous with the preset number of media segment files.
[0093] Optionally, in the live broadcast device based on media segment files provided in Example 3 of the present invention, the live broadcast device based on media segment files also includes: a second downloading unit, used to download a target number of media segment files when the time difference is not within a preset time range; a second playback unit, used to play the videos in the target number of media segment files at the playback end.
[0094] Optionally, in the live broadcast device based on media segment files provided in Example 3 of the present invention, the processing unit includes: a first determination subunit, used to use the content distribution network to determine the time when the media segment file being generated can be obtained by the playback end, and obtain the target time point; a second determination subunit, used to determine the time difference based on the target time point and the current time.
[0095] Optionally, in the live broadcast device based on media segment files provided in the third embodiment of the present invention, the preset time range is between 0 and the duration required to generate a media segment file, and the preset time threshold is greater than or equal to the time difference.
[0096] The above-mentioned live broadcast device based on media segment files may also include a processor and a memory. The above-mentioned processing unit 51, the first playback unit 52 and the first downloading unit 53 are all stored in the memory as program units, and the processor executes the above-mentioned program units stored in the memory to realize corresponding functions.
[0097] The processor includes a kernel, which retrieves the corresponding program unit from the memory. One or more kernels can be set, and the kernel parameters are adjusted to determine whether the time difference is within a preset time range to determine whether the conditions for reducing the live broadcast start-up segments are met when the playback end starts broadcasting, and when the time difference is within the preset time range, a preset number of media segment files are played first, thereby achieving the technical effect of reducing the live video playback delay.
[0098] The above-mentioned memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM, and the memory includes at least one storage chip.
[0099] According to another aspect of an embodiment of the present invention, an electronic device is also provided, including: a processor; and a memory for storing executable instructions of the processor; wherein the processor is configured to execute any one of the above-mentioned live broadcast methods based on media segment files by executing the executable instructions.
[0100] According to another aspect of an embodiment of the present invention, a computer-readable storage medium is provided, which stores a computer program, wherein when the computer program is running, the device where the computer-readable storage medium is located is controlled to execute any one of the above-mentioned live broadcast methods based on media segment files.
[0101] Figure 6 is a schematic diagram of an electronic device according to an embodiment of the present invention, such as Figure 6As shown, an embodiment of the present invention provides an electronic device 60, which includes a processor, a memory, and a program stored in the memory and executable on the processor. When the processor executes the program, any one of the above-mentioned live broadcast methods based on media segment files is implemented.
[0102] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.
[0103] In the above embodiments of the present invention, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0104] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the units can be a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.
[0105] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0106] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0107] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, server or network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, disk or optical disk, etc. Various media that can store program codes.
[0108] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principle of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.
Claims
1. A live broadcast method based on media segment files, characterized in that: include: In response to a request to play a live video, obtain the time difference between the time when the media segment file being generated can be obtained by the player and the current time, and determine whether the time difference is within a preset time range; When the time difference is within the preset time range, playing the videos in a preset number of media segment files in a specified order, wherein the preset number is less than a target number, and the target number includes: the number of media segment files that the playback end is recommended to download when starting playback; After waiting for a preset time threshold, downloading the media segment files that are continuous with the preset number of media segment files; Wherein, when the time difference is within the preset time range, playing the videos in the preset number of media segment files in a specified order includes: downloading the preset number of media segment files, and playing the videos in the downloaded preset number of media segment files in a specified order; If the time difference is not within the preset time range, downloading the target number of media segment files; and at the playback end, playing the videos in the target number of media segment files; Obtaining the time difference between the time when the media segment file being generated can be obtained by the playback end and the current time, including: using a content distribution network to determine the time when the media segment file being generated can be obtained by the playback end to obtain a target time point; and determining the time difference based on the target time point and the current time.
2. The live broadcast method according to claim 1, characterized in that: After waiting for a preset time threshold, downloading the media segment files that are continuous with the preset number of media segment files includes: When the number of downloaded media segment files is the preset number, media segment files that are continuous with the preset number of media segment files are downloaded.
3. The live broadcast method according to claim 2, characterized in that: Before downloading the media segment files that are continuous with the preset number of media segment files, it also includes: judging whether the media segment files to be downloaded that are continuous with the preset number of media segment files have been downloaded by the playback end, and in the case that the media segment files that are continuous with the preset number of media segment files have been downloaded, prohibiting the step of downloading the media segment files that are continuous with the preset number of media segment files.
4. The live broadcast method according to claim 1, characterized in that: The preset time range is between 0 and the time required to generate one of the media segment files, and the preset time threshold is greater than or equal to the time difference.
5. A live broadcast system based on media segment files, characterized in that: The live broadcast system based on media segment files is used to execute the live broadcast method based on media segment files according to any one of claims 1 to 4, and the live broadcast system based on media segment files includes: A time judgment module is used to obtain the time difference between the time when the media segment file being generated can be obtained by the playback end and the current time, and to determine whether the time difference is within a preset time range; The playback end is used to play the videos in a preset number of media segment files in a specified order when the time difference is within the preset time range, and download the media segment files that are continuous with the preset number of media segment files after waiting for a preset time threshold, wherein the preset number is less than a target number, and the target number includes: the number of media segment files that are recommended to be downloaded when the playback end starts playing; A media segment file providing terminal, used for generating the media segment file; Wherein, when the time difference is within the preset time range, playing the videos in the preset number of media segment files in a specified order includes: downloading the preset number of media segment files, and playing the videos in the downloaded preset number of media segment files in a specified order; If the time difference is not within the preset time range, downloading the target number of media segment files; and at the playback end, playing the videos in the target number of media segment files; Obtaining the time difference between the time when the media segment file being generated can be obtained by the playback end and the current time, including: using a content distribution network to determine the time when the media segment file being generated can be obtained by the playback end to obtain a target time point; and determining the time difference based on the target time point and the current time.
6. A live broadcast device based on media segment files, characterized in that: include: A processing unit, configured to respond to a request for playing a live video, obtain a time difference between a time when the media segment file being generated can be obtained by the player and a current time, and determine whether the time difference is within a preset time range; A first playback unit, configured to play videos in a preset number of media segment files in a specified order when the time difference is within the preset time range, wherein the preset number is less than a target number, and the target number includes: a number of media segment files recommended to be downloaded when the playback end starts playback; A first downloading unit, configured to download media segment files that are continuous with the preset number of media segment files after waiting for a preset time threshold; Wherein, when the time difference is within the preset time range, playing the videos in the preset number of media segment files in a specified order includes: downloading the preset number of media segment files, and playing the videos in the downloaded preset number of media segment files in a specified order; If the time difference is not within the preset time range, downloading the target number of media segment files; and at the playback end, playing the videos in the target number of media segment files; Obtaining the time difference between the time when the media segment file being generated can be obtained by the playback end and the current time, including: using a content distribution network to determine the time when the media segment file being generated can be obtained by the playback end to obtain a target time point; and determining the time difference based on the target time point and the current time.
7. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein when the computer program is executed, the device where the computer-readable storage medium is located is controlled to execute the live broadcast method based on media segment files as described in any one of claims 1 to 4.
Citation Information
Patent Citations
Play-start delay optimizing method and device of player
CN106604079A