File carousel streaming method, device and live streaming server
By parsing and pre-downloading the file carousel task on the live streaming server, and unifying the time base and timestamp, the problem of traditional live broadcast content being unable to play offline files and the file carousel system being stuck has been solved, achieving stability and stability. Smooth file carousel push streaming improves user experience.
Patent Information
- Application Number
- CN202210002241.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-01-04
- Publication Date
- 2024-09-20
- Estimated Expiration
- 2042-01-04
AI Technical Summary
Traditional live broadcast content is limited by the host's online time and cannot play offline file content. Moreover, the file carousel system is prone to problems such as playback lag, film change lag, and abnormal jumps in the network environment and when changing slices.
By parsing the received file carousel task on the live streaming push server, pre-downloading the carousel file, converting it into a media stream, unifying the time base and timestamp, caching and pushing the stream to the content distribution network, file carousel is realized Stream push.
It solves the problems of push jitter, playback lag, and film change lag, improves the stability and user experience of file carousel push, and provides a good viewing experience.
Smart Images

Figure CN114339267B
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of online live broadcast and audio and video processing, and more specifically, to a file carousel streaming method and device and a live streaming streaming server applied to a live broadcast platform. Background Art
[0002] With the continuous development of mobile Internet technology and network communication technology, online live broadcasting has been rapidly developed and applied in people's daily work and life. For example, users can watch the live broadcast content provided by various anchors on the live broadcast platform online through smart phones, computers, tablets and other devices, or users can also provide live broadcast content on the corresponding live broadcast platform anytime and anywhere through smart phones, computers, tablets and other devices for others to watch.
[0003] The current live broadcast platform has a large amount of real-time online live broadcast content, which has the advantages of real-time user interaction, mutual sharing of complaints, and bringing users closer together. However, traditional live broadcast content is limited by the online time of the anchor or operator, and cannot be broadcast at any time, and cannot play file content (such as offline audio content, offline video content, etc.).
[0004] The file carousel system based on the live broadcast system can combine the live broadcast system with offline file content, solving the problem that the live broadcast content is limited by the host's online time and the inability to play files, greatly enriching the content and form of the live broadcast. However, the inventors found that the traditional file carousel system is limited by the network environment and the influence of slice switching, which is prone to problems such as playback jamming, slice switching jamming, and abnormal episode skipping. Summary of the invention
[0005] Based on the above, in order to solve at least some of the above problems, in a first aspect, an embodiment of the present application provides a file carousel streaming method, the method comprising:
[0006] Parsing the received file carousel task to obtain task information of the file carousel task, wherein the task information includes a carousel file list, and the carousel file list includes a plurality of files to be pushed;
[0007] According to the carousel file list, the to-be-streamed files included in the carousel file list are sequentially downloaded from the content providing source according to a preset pre-download strategy to the local storage of the live streaming server;
[0008] The stream files to be pushed are sequentially obtained from the local storage, the obtained stream files to be pushed are converted into media streams, and the media streams are pushed to the content distribution network of the live broadcast platform for playback.
[0009] In a possible implementation manner of the first aspect, converting the acquired stream file to be pushed into a media stream, and pushing the media stream to a content distribution network of a live broadcast platform for playback, includes:
[0010] Convert the acquired streaming file to be pushed into a media package in a preset format;
[0011] Correcting the time base of the media packet uniformly and concatenating the timestamps of the media frames of the media packet;
[0012] Splicing the media packets corresponding to the to-be-pushed stream files after time base correction and timestamp splicing into the same media stream, and caching the media packets into a preset physical memory;
[0013] Each media frame in the cached media stream is sequentially pulled from the physical memory and sent to a corresponding carousel channel in the content distribution network for streaming and playing.
[0014] A possible implementation manner based on the first aspect is to sequentially download, according to the carousel file list and in accordance with a preset pre-download strategy, each to-be-streamed file included in the carousel file list from a content provider source to a local storage of the live streaming server, including:
[0015] On the premise that the first stream file to be pushed in the carousel file list is not downloaded, at least two stream files to be pushed including the first stream file to be pushed are pre-downloaded sequentially to the local storage;
[0016] When a media frame corresponding to any media package is pushed to the content distribution network of the live broadcast platform, determining the next to-be-pushed stream file that needs to be pre-downloaded;
[0017] The next stream file to be pushed is downloaded from the content providing source to the local storage.
[0018] According to a possible implementation manner of the first aspect, the method further includes:
[0019] Create a file streaming configuration table entry, wherein the file streaming configuration table entry includes a streaming progress flag bit of each file to be streamed, and in an initialization state, the streaming progress flag bits corresponding to the N files to be streamed, including the first file to be streamed, in the file streaming configuration table entry are set to the first progress flag, wherein N is greater than or equal to 2;
[0020] When any to-be-streamed file is downloaded to the local storage, the streaming progress mark position of the to-be-streamed file in the file streaming configuration table entry is set to the second progress mark;
[0021] When a media packet of any to-be-pushed stream file is pushed to the content distribution network of the live broadcast platform through the media stream, the streaming progress mark position of the to-be-pushed stream file is set to the third progress mark, and the streaming progress mark position of the next to-be-pushed stream file pre-downloaded last time is set to the first progress mark;
[0022] Correspondingly, when the media frame corresponding to any media package is pushed to the content distribution network of the live broadcast platform, determining the next to-be-pushed stream file that needs to be pre-downloaded includes:
[0023] The to-be-pushed stream file whose stream pushing progress flag bit in the file stream pushing configuration table item is a first progress flag is determined as the next to-be-pushed stream file that needs to be pre-downloaded.
[0024] According to a possible implementation manner of the first aspect, the method further includes:
[0025] At preset intervals, the to-be-streamed files whose streaming progress flag in the file streaming configuration table is the third progress flag are deleted from the local storage, and the streaming progress flag position corresponding to the deleted to-be-streamed files is set to the fourth progress flag.
[0026] In a possible implementation manner of the first aspect, the downloading, in accordance with the carousel file list and in accordance with a preset pre-download strategy, from a content provider in sequence each to-be-streamed file included in the carousel file list to a local storage of the live streaming server further includes:
[0027] When an exception occurs in downloading the to-be-pushed stream file from the content providing source, the to-be-pushed stream file is downloaded from a predetermined backup content providing source.
[0028] In a possible implementation manner of the first aspect, before downloading the to-be-streamed files included in the carousel file list from the content provider in sequence according to the preset pre-download strategy to the local storage of the live streaming server, the method further includes:
[0029] Determine whether the file carousel task is a file carousel task of a preset type. If it is a carousel task of a preset type, execute the step of sequentially downloading the files to be pushed included in the carousel file list from the content provider source according to the preset pre-download strategy according to the carousel file list to the local storage of the live streaming server;
[0030] If the file carousel task is not a file carousel task of a preset type, the method further includes:
[0031] Pulling each to-be-streamed file included in the carousel file list in sequence from the content provider corresponding to the to-be-streamed file;
[0032] The pulled stream file to be pushed is converted into a media stream, and the media stream is pushed to the content distribution network of the live broadcast platform for playback.
[0033] According to a possible implementation manner of the first aspect, the method further includes:
[0034] During the streaming of the media stream, it is detected whether there is any missing audio frame in the media stream. If there is any missing audio frame, a preset silent frame is used to supplement the missing audio frame.
[0035] In a second aspect, an embodiment of the present application further provides a file carousel streaming device, which is applied to a live streaming server, and the file carousel streaming device includes:
[0036] The task manager is used to parse the received file carousel task and obtain the task information of the file carousel task, wherein the task information includes a carousel file list, and the carousel file list includes a plurality of stream files to be pushed;
[0037] A stream puller, used to download the to-be-streamed files included in the carousel file list from a content provider in sequence according to the preset pre-download strategy according to the carousel file list to the local storage of the live streaming server;
[0038] The stream pusher is used to sequentially obtain the stream files to be pushed from the local storage, convert the obtained stream files to be pushed into media streams, and push the media streams to the content distribution network of the live broadcast platform for playback.
[0039] In a third aspect, an embodiment of the present application further provides a live streaming server, comprising a machine-readable storage medium and one or more processors, wherein the machine-readable storage medium stores machine-executable instructions, and when the machine-executable instructions are executed by the one or more processors, the above-mentioned method is implemented.
[0040] Based on the above content of the embodiments of the present application, compared with the prior art, the file carousel streaming method, device and live streaming server provided by the embodiments of the present application can solve the problems of streaming jitter and playback freeze that are prone to occur in traditional real-time file streaming by pre-downloading the files to be streamed and caching the streaming media packages. Furthermore, a solution for unified output streams of multiple files is implemented by using a unified time base and timestamp splicing, which solves the problems of playback freezes and audio and video asynchrony when switching between films. In this way, the stability of file carousel streaming is improved, so that the audience has a good and smooth viewing experience, thereby improving the user experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0042] Figure 1 It is a schematic diagram of a file carousel streaming system for implementing the file carousel streaming method provided in this embodiment.
[0043] Figure 2 It is a flowchart of the file carousel streaming method provided in an embodiment of the present application.
[0044] Figure 3 It is a schematic diagram of controlling the streaming process based on the streaming configuration table items provided in an embodiment of the present application.
[0045] Figure 4 yes Figure 2 Schematic diagram of the sub-step flow chart of step S300.
[0046] Figure 5 This is another flowchart of the file carousel streaming method provided in this embodiment.
[0047] Figure 6 It is a schematic diagram of a live streaming server for implementing the above-mentioned file carousel streaming method provided in an embodiment of the present application.
[0048] Figure 7 It is a schematic diagram of the functional modules of the file carousel streaming device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0049] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. The components of the embodiments of the present application described and shown in the drawings here can be arranged and designed in various different configurations.
[0050] Therefore, the following detailed description of the embodiments of the present application provided in the accompanying drawings is not intended to limit the scope of the present application for which protection is sought, but merely represents selected embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without creative work are within the scope of protection of the present application.
[0051] It should be noted that similar reference numerals and letters denote similar items in the following drawings, and therefore, once an item is defined in one drawing, further definition and explanation thereof is not required in subsequent drawings.
[0052] Before introducing the relevant technical solutions provided by the embodiments of the present application in detail, in order to more clearly understand the relevant technical solutions of the embodiments of the present application, the relevant technical terms involved in the embodiments of the present application are first explained.
[0053] First, before exemplarily introducing the relevant embodiments provided in the present application, the relevant terms involved in the present application are explained.
[0054] RTMP (Real Time Messaging Protocol) is a real-time messaging protocol developed for audio, video and data transmission. It is based on TCP and includes the RTMP basic protocol and multiple variants such as RTMPT / RTMPS / RTMPE. RTMP is a network protocol for real-time data communication. It is generally used for audio and video streaming media data communication between Flash, AIR and other platforms and streaming media and interactive servers that support the RTMP protocol.
[0055] Content Distribution Network (CDN), also known as content delivery network, is an intelligent virtual network built on the existing network. It relies on edge servers deployed in various places and uses the load balancing, content distribution, scheduling and other functional modules of the central platform to enable users to obtain the required content nearby, reduce network congestion, and improve user access response speed and hit rate.
[0056] Timestamp, the timestamp in this application refers to the timestamp of streaming media such as audio and video, which generally includes PTS (Presentation Time Stamp) and DTS (Decoding Time Stamp). DTS is used to indicate the time of decoding the corresponding media frame (such as audio and video frame), and PTS is used to indicate the time of displaying the corresponding media frame.
[0057] The time base can be understood as the time scale of the media stream. Taking the frame rate as an example, if the frame rate per second is 100, then the corresponding time base (time scale) is 1 / 100, which means that a media frame is displayed every 1 / 100 second.
[0058] Based on the technical problems mentioned in the above background technology, the existing online live broadcast platform can provide various types of live broadcast services for the majority of users, such as live broadcast services based on real-person on-site interaction, live broadcast services based on virtual digital images, online live broadcast based on online content (such as audio and video), etc., so that audience users can watch the corresponding live broadcast through the live broadcast client and conduct corresponding interactions, etc. Among them, online live broadcast based on online content, such as video live broadcast based on online audio and video and other media content, can provide online live broadcast services (such as online live broadcast for hot movies) to the majority of users at the same time through the live broadcast platform. Different users can interact by sending barrages, sending gifts to each other, etc. when watching the same video live broadcast content, for example, they can interact in real time, share complaints with each other, etc., thereby enhancing the fun of online live broadcast.
[0059] The existing online live broadcast solutions based on online content are typically implemented by streaming the files corresponding to the content to be broadcast to the content distribution network (CDN) of the live broadcast platform for playback, so that users who watch the live broadcast can directly access the content distribution network through the live broadcast client or the live broadcast webpage to watch the corresponding live broadcast content.
[0060] The inventor studied the implementation method of the above-mentioned file streaming and found that the existing file streaming scheme generally uses a streaming tool to stream multimedia programs one by one. Specifically, the file to be played is pulled, parsed, transpacked and streamed. After the playback is completed, the next file in the program list is obtained for playback. However, this streaming scheme does not handle exceptions. In the actual streaming process, many abnormal situations such as network abnormalities and file abnormalities are often encountered. For example, if there is a network fluctuation or file abnormality, it is easy to cause streaming jitter, playback jams, or even black screens and episode skips, which greatly affects the viewing experience, especially when playing movies or TV series, jams and episode skips occur, which is unacceptable to the audience. In addition, when the traditional file streaming scheme is played and the video is changed, the audio and video parameters such as the frame rate, resolution, and timestamp between the sources have changed, and it is often necessary to reset the streaming device for streaming, which will cause discontinuity in the playback process and jams in the video change.
[0061] In view of this, the embodiment of the present application innovatively proposes a file carousel streaming solution based on a live broadcast platform, which can solve the problems of streaming jitter, playback freeze, playback skipping, and starting playback from the beginning that are prone to occur in file streaming through file pre-downloading, playback cache, unified time base, splicing timestamps and other solutions, thereby improving the stability of carousel streaming and enhancing the user's viewing experience.
[0062] The specific implementation method of the embodiment of the present application will be exemplarily described below in conjunction with the accompanying drawings.
[0063] First, if Figure 1 As shown, it is a schematic diagram of the architecture of the file carousel streaming system based on the live broadcast platform provided by an embodiment of the present application. In this embodiment, the file carousel streaming system may include a live broadcast streaming server 100, a content source 200, a content distribution network (CDN) 300 and a user terminal 400. In this embodiment, the live broadcast streaming server 100 is connected in communication with the content source 200 to obtain content files (such as audio and video multimedia files) that need to be streamed through the live broadcast platform from the content source 200, and then the obtained content files are parsed, transpackaged, etc., and then streamed through the content distribution network 300, so that users who watch online live broadcasts can access the content distribution network 300 through the user terminal 400 to watch the corresponding online live content.
[0064] For example, as an example, the live streaming server 100 can be, but is not limited to, a computer device, a server, a cloud computing terminal, a server cluster, a data center, or other device with multimedia content processing capabilities.
[0065] The content source 200 may be a cloud service platform with a large amount of online live content (such as film and television content, movie content, short video, historical live video, game video, etc.) set up by a live platform that provides live broadcast services, or a content source download center provided by a third-party service agency (such as a movie website, game platform, short video platform, etc. that provides online audio and video content), which is not specifically limited in this embodiment. With respect to the implementation method of the third-party service agency, the live broadcast platform can provide users with online content live broadcast services by pulling the media content that needs to be broadcast live from the content source 200 after obtaining the authorization of the third-party service agency. The user terminal 400 can download and install the relevant applications or program components required for watching online live broadcasts through the live broadcast platform, such as application APP, Web page, live broadcast applet, live broadcast plug-in or component, etc., but not limited thereto, and can access the content distribution network 300 to watch the corresponding online live content after registering through these applications or program components. In this embodiment, the user terminal 400 may be, but not limited to, a smart phone, a personal digital assistant, a tablet computer, a personal computer, a laptop computer, a virtual reality terminal device, an augmented reality terminal device, etc.
[0066] Understandably, Figure 1 The file carousel streaming system shown is only an alternative example. In other possible embodiments, the file carousel streaming system may also include only Figure 1 Some of the components shown may also include other components.
[0067] The following is based on Figure 1 The file carousel streaming system shown in the figure is combined with Figure 2 The file carousel streaming method provided in the embodiment of the present application is described. Figure 2 As shown, Figure 2 is a flowchart of a file carousel streaming method provided in an embodiment of the present application. In this embodiment, the file carousel streaming method can be Figure 1 It should be understood that the order of some steps included in the file carousel streaming method provided in this embodiment can be interchanged according to actual needs during actual implementation, or some steps can be omitted or deleted, and this embodiment does not specifically limit this.
[0068] The following is a detailed description of each step of the file carousel streaming method of this embodiment by way of example. Figure 2 As shown, the method may include the relevant contents described in the following steps S100 to S300.
[0069] Step S100: parsing the received file carousel task to obtain task information of the file carousel task.
[0070] Among them, in this embodiment, when a file carousel task is received, a file carousel task instance can be first created, and the file carousel task can be parsed through the file carousel task instance to obtain the task information of the file carousel task. In this embodiment, the task information may include, but is not limited to, a carousel file list, a streaming address, a backup address domain name, a file index to be played currently, an offset time of the file to be played currently, etc. For example, the carousel file list may include a plurality of stream files to be pushed and a stream pull address of each stream file to be pushed that is required to be played by the carousel channel (e.g., a playback channel) for executing the current file carousel task. The stream pull address may refer to a URL address provided by the content provider 200 for downloading each stream file to be pushed, but is not limited thereto. The stream push address may refer to the address to be pushed after the stream file to be pushed is processed by parsing, transcoding and packaging, for example, it may be a channel address or channel address in the content distribution network 300 for playing the stream file to be pushed.
[0071] Step S200 , according to the carousel file list, the to-be-streamed files included in the carousel file list are sequentially downloaded from the content provider 200 to the local storage of the live streaming server 100 in accordance with a preset pre-download strategy.
[0072] Among them, in a possible implementation of the embodiment of the present application, the carousel file list may include more than two files to be pushed. The pre-download strategy may include the number of pre-downloaded files. For example, the number of pre-downloaded files may refer to the number of files downloaded in advance to the local storage waiting for streaming. Generally speaking, the speed of downloading files from the content provider source is much faster than the speed of file streaming. Therefore, the number of pre-downloaded files can be set to 1 or two, preferably to 1.
[0073] Furthermore, in this embodiment, when an exception occurs when downloading the stream file to be pushed from the content provider, the stream file to be pushed can be downloaded from a predetermined backup content provider. For example, the address of the backup content provider can be obtained through the backup address domain name in the aforementioned carousel information. For example, if the download is interrupted and the download cannot be completed after multiple attempts (such as 3 times), or the download is not completed within a set time (such as 30 seconds, 60 seconds, 90 seconds, etc.), the pre-set backup content provider can be tried to download the stream file to be pushed. The backup content provider can be, for example, another file download address or another cloud server, which is not limited in this embodiment.
[0074] Step S300, sequentially obtain the stream files to be pushed from the local storage, convert the obtained stream files to be pushed into media streams, and push the media streams to the content distribution network of the live broadcast platform for playback.
[0075] On the basis of the above content, for step S200, taking the number of pre-downloaded files set as 1 as an example, when the to-be-pushed stream files in the carousel file list are initially downloaded, that is, under the premise that the first to-be-pushed stream file in the carousel file list has not been downloaded, at least two to-be-pushed stream files including the first to-be-pushed stream file can be downloaded to the local storage in sequence for the first time. For example, during the first round of pre-download, the first to-be-pushed stream file and the second to-be-pushed stream file in the to-be-pushed stream file list can be downloaded to the local storage in sequence. After the first to-be-pushed stream file is downloaded, the first to-be-pushed stream file can be immediately pulled from the local storage for streaming. At the same time, the second to-be-pushed stream file is also synchronously downloaded to the local storage during the streaming process of the first to-be-pushed stream file. Since the file download speed is much greater than the streaming speed, before the first to-be-pushed stream file is pushed, the second to-be-pushed stream file has been pre-downloaded to the local storage in advance and is in a state of being pushed.
[0076] In addition, when the streaming of any stream file to be pushed is completed (such as when each media frame in the media package converted from the stream file to be pushed is streamed to the content distribution network of the live broadcast platform or is played out), the next stream file to be pushed that needs to be pre-downloaded can be determined, and the determined next stream file to be pushed can be downloaded from the content provider to the local storage.
[0077] For example, when the first stream file to be pushed is completed, the third stream file to be pushed can be determined as the next stream file to be pushed that needs to be pre-downloaded. When the second stream file to be pushed is completed, the fourth stream file to be pushed can be determined as the next stream file to be pushed that needs to be pre-downloaded, and so on, until all the stream files to be pushed are pre-downloaded. At the same time, when a stream file to be pushed is completed, the stream file to be pushed that has completed the push can be deleted from the local storage in time, and then the next stream file to be pushed can be downloaded to save local storage space and avoid the problem of pre-download exceptions caused by insufficient space. In this way, it is possible to achieve the push of a file, delete a file, and pre-download a file. While occupying as little local storage space as possible, the solution of pulling the stream directly from the content provider 200 can be avoided by local pre-download, which causes problems such as stuck streaming due to network jitter and other problems. In addition, compared with the traditional method of directly pulling files from the content source, the traditional method of pulling files needs to re-establish a new file download link (re-establish the link) when switching between different files, which will inevitably cause problems such as slow pulling or freezing due to the process of rebuilding the link. In this embodiment, by pre-downloading in advance, abnormalities such as freezing of the push stream caused by rebuilding the link can be avoided.
[0078] Furthermore, in this embodiment, in order to facilitate the management of processes such as pre-downloading, streaming, aging and deletion of files to be streamed, the embodiment of the present application innovatively introduces a file streaming configuration table item to assist in the management of the above processes, so that the processes of pre-downloading, streaming, and aging and deletion of files to be streamed can be carried out in an orderly manner and occupy as little local storage space of the live streaming server 100 as possible.
[0079] In detail, in this embodiment, a file streaming configuration table entry may be created. The file streaming configuration table entry may include streaming progress flags for each file to be streamed. In the initialization state, the streaming progress flags corresponding to the N files to be streamed (such as the first N files to be streamed) in the file streaming configuration table entry including the first file to be streamed are set to the first progress flag. N is greater than or equal to 2.
[0080] On this basis, when any stream file to be pushed is downloaded to the local storage, the live streaming server 100 can set the stream pushing progress mark position of the stream file to be pushed in the file streaming configuration table item to the second progress mark. At the same time, when the media package of any stream file to be pushed is pushed to the content distribution network of the live platform through the media stream, the live streaming server 100 can further set the stream pushing progress mark position of the stream file to be pushed to the third progress mark, and set the stream pushing progress mark position of the next stream file to be pushed of the previous pre-downloaded stream file to be pushed to the first progress mark.
[0081] Furthermore, in order to reduce the occupation of the local storage space of the live streaming server 100 by the pre-downloaded stream files to be pushed as much as possible, while not affecting the progress of live streaming. In this embodiment, the live streaming server 100 can delete the stream files to be pushed whose stream progress mark position in the file stream pushing configuration table is the third progress mark from the local storage at a preset time interval, and set the stream progress mark position corresponding to the deleted stream files to be pushed to the fourth progress mark.
[0082] As a better example, Figure 3 As shown, in this embodiment, taking a carousel streaming task including six files A, B, C, D, E, and F to be streamed as an example, the scheme for controlling and managing the streaming process through the file streaming configuration table item in the embodiment of the present application is exemplified.
[0083] First, at the first moment t1 (in the initialization state), the push stream progress flags corresponding to the first to-be-pushed stream file (A) and the second to-be-pushed stream file (B) in the file push stream configuration table entry are set to the first progress flag (e.g., 00), wherein the first progress flag indicates that the corresponding to-be-pushed stream file is currently in the pre-download state. At this time, based on the file push stream configuration table entry, the live streaming server 100 can perform a pre-download operation on the corresponding to-be-pushed stream file according to the first progress flag, for example, starting to perform a file pre-download operation on files A and B in sequence.
[0084] Secondly, at the second time t2 (for example, when file A is pre-downloaded), the push stream progress flag corresponding to file A is set to the second progress flag (e.g., 01), wherein the second progress flag indicates that the corresponding to-be-pushed stream file is currently in the to-be-pushed stream state. At this time, based on the file push stream configuration table entry, the live streaming server 100 can start the push stream operation for file A according to the second progress flag, and start the file pre-download operation for file B at the same time.
[0085] Then, at the third moment t3 (for example, when file A completes streaming and file B completes pre-download), the streaming progress flag corresponding to the third file to be streamed (C) in the file streaming configuration table entry is set to the first progress flag, and when file B is pre-downloaded, the streaming progress flag corresponding to file B is set to the second flag. At this time, based on the file streaming configuration table entry, the live streaming server 100 can start pre-downloading the file C according to the first progress flag, and at the same time, the streaming progress flag corresponding to file A is set to the third progress flag (such as 10), and the third progress flag indicates that the corresponding file to be streamed has completed streaming. At this time, based on the file streaming configuration table entry, the live streaming server 100 can start to perform the file pre-download operation on file C and start streaming file B. Further, in order to avoid occupying the local storage space of the live streaming server 100, the file A that has completed streaming can be aged and deleted from the local storage at this time. After the aging deletion is completed, the streaming progress flag corresponding to file A can be further set to the fourth progress flag.
[0086] Then, at the fourth moment t4 (for example, when file B completes streaming and file C completes pre-download at the same time), the streaming progress flag corresponding to the fourth file to be streamed (D) in the file streaming configuration table entry is set to the first progress flag, and when file C is pre-downloaded, the streaming progress flag corresponding to file C is set to the second progress flag. At this time, based on the file streaming configuration table entry, the live streaming server 100 can start pre-downloading the file D according to the first progress flag, and at the same time, change the streaming progress flag position corresponding to file B to the third progress flag. At this time, based on the file streaming configuration table entry, the live streaming server 100 can start pre-downloading the file D and start streaming the file C. Furthermore, the file B that has completed streaming can be aged and deleted from the local storage. After the aging and deletion is completed, the streaming progress flag position corresponding to file B can be further changed to the fourth progress flag.
[0087] In addition, at the fifth moment t5 (for example, when file C completes streaming and file D completes pre-download at the same time), the streaming progress flag corresponding to the fifth file to be streamed (E) in the file streaming configuration table entry is set to the first progress flag, and when file D is pre-downloaded, the streaming progress flag corresponding to file D is set to the second progress flag. At this time, based on the file streaming configuration table entry, the live streaming server 100 can start pre-downloading the file E according to the first progress flag, and at the same time, change the streaming progress flag position corresponding to file C to the third progress flag. At this time, based on the file streaming configuration table entry, the live streaming server 100 can start pre-downloading the file E and start streaming the file D. Furthermore, the file C that has completed streaming can be aged and deleted from the local storage. After the aging and deletion is completed, the streaming progress flag position corresponding to file C can be further changed to the fourth progress flag.
[0088] Finally, at the sixth moment t6 (for example, when file D completes streaming and file E completes pre-download at the same time), the streaming progress flag corresponding to the sixth file to be streamed (F) in the file streaming configuration table entry is set to the first progress flag, and when file E is pre-downloaded, the streaming progress flag corresponding to file E is set to the second progress flag. At this time, based on the file streaming configuration table entry, the live streaming server 100 can start pre-downloading operation on file F according to the first progress flag, and at the same time, change the streaming progress flag position corresponding to file D to the third progress flag. At this time, based on the file streaming configuration table entry, the live streaming server 100 can start to perform file pre-download operation on file F, and start streaming file E. Furthermore, the file D that has completed streaming can be aged and deleted from the local storage, and after the aging deletion is completed, the streaming progress flag position corresponding to file D can be further changed to the fourth progress flag.
[0089] After the above process, after the pre-download of file F and the push of file E are completed, file F can be pushed. At this point, the push task for the carousel of files A, B, C, D, E, and F is completed.
[0090] It should be noted that the above process is only an illustrative description of a possible file carousel streaming process. In actual application, the specific streaming process may be different from the above or may be replaced by an equivalent one. For example, the number of files pre-downloaded each time may be changed from 1 to 2, or the aging process of the files that have been pushed may be to delete the files to be pushed whose streaming progress flag in the file streaming configuration table item is set to the third progress flag from the local storage at preset intervals, and set the streaming progress flag corresponding to the deleted files to be pushed to the fourth progress flag.
[0091] Further, based on the above content, with respect to step S300, in a possible implementation of this embodiment, as Figure 4 As shown, the acquired stream file to be pushed can be converted into a media stream through the following sub-steps S301-S304, and the media stream is pushed to the content distribution network of the live broadcast platform for playback, which is exemplarily introduced as follows.
[0092] Sub-step S301, converting the acquired stream file to be pushed into a media package in a preset format.
[0093] For example, in a possible embodiment, the to-be-pushed stream file may be converted into a media package in RTMP format, and the converted media package may be called an RTMP package.
[0094] Sub-step S302, uniformly correcting the time bases of the media packets and concatenating the timestamps of the media packets.
[0095] In this embodiment, it is considered that different files (sources) to be pushed may have different parameters (such as audio and video parameters). When one file is pushed and switched to another file for streaming, due to the difference in parameters, such as frame rate, resolution, timestamp and other parameters have changed. In order to complete the carousel streaming of different files in the same media stream, the traditional streaming solution needs to adjust the streaming parameters of the live streaming server 100, such as resetting the streamer before streaming. This method is prone to cause discontinuity in the streaming playback process, abnormal situations such as freezing when changing films, etc. In particular, for the inconsistency of timestamp parameters, since the time bases and timestamps used by different files are different, if different sources are directly pushed into audio and video streams, the timestamp jump and timestamp rollback will cause freezing in the streaming.
[0096] Based on the above problems, in an embodiment of the present application, before each stream file to be pushed is pushed, the time bases of the media packets of different stream files to be pushed are uniformly corrected, and the timestamps of the media packets are spliced to ensure that the timestamps of the entire media stream (the timestamps of the audio and video streams) are monotonically increasing, thereby avoiding the problem of streaming jams caused by problems such as inconsistent time bases and timestamp rollbacks.
[0097] Among them, uniformly correcting the time base refers to unifying the time bases of the media packets of each stream file to be pushed into the same time base, for example, unified to 1 / 1000. Splicing the timestamps refers to adjusting the timestamps of the media packets of the current stream to be pushed according to the time offset of the previous file that has completed the push. For example, the time offset of the previous file that has completed the push is ts1, and the initial timestamp of each media frame in the media packet of the current stream to be pushed is ts2. Then splicing the timestamps of the media packets refers to adding the timestamp ts2 of the media frame in the media packet to the time offset ts1 of the previous file that has completed the push, so that after the media packets of the current stream to be pushed are spliced to the media stream, the timestamps of each media frame of the media stream are monotonically increasing, thereby avoiding the problem of streaming jams caused by inconsistent time bases and timestamp rollback. Among them, the time offset of the previous file that has completed the push corresponding to the first streaming media packet to be pushed can be a set default value, such as 0.
[0098] Sub-step S303, splicing the media packets corresponding to the to-be-pushed stream files after time base correction and timestamp splicing into the same media stream, and caching the media packets into a preset physical memory.
[0099] In this embodiment, splicing the media packets into the same media stream may refer to splicing each media frame (such as an audio or video frame) in the corresponding media packet into the media stream currently being streamed or the media stream to be streamed. For example, as an example, the media stream may be a media stream in RTMP format.
[0100] Sub-step S304: pulling each media frame in the cached media stream from the physical memory in sequence and sending it to the corresponding carousel channel in the content distribution network for streaming and playing.
[0101] In this embodiment, the physical memory may be a memory space pre-set in the live streaming server 100 for caching the media packets to be streamed.
[0102] In the embodiment of the present application, the file carousel streaming method implemented based on the above content can solve the problems of streaming jitter and playback jamming that are prone to occur in traditional real-time file streaming by pre-downloading and caching the streaming media package. Furthermore, the solution of unified output stream of multiple files is realized by using the unified same time base and timestamp splicing, which solves the problems of playback jamming and audio and video asynchrony when changing films. In this way, the stability of file carousel streaming is improved, so that the audience has a good and smooth viewing experience, thereby improving the user experience.
[0103] The above solution of this embodiment is applicable to the live streaming mode of "downloading and pushing" or "downloading and broadcasting", for example Figure 5As shown, in the embodiment of the present application, before the above step S100, it can be determined whether the file carousel task is a preset type of file carousel task based on step S10, and if it is a preset type of carousel task, then step S100 is entered. The preset type of file carousel task can be, for example, the above-mentioned "download and push" or "download and play" type of file carousel task.
[0104] If the file carousel task is not a preset type of file carousel task (for example, a real-time streaming pull and push file carousel task), then proceed to step S400, and sequentially pull each stream file to be pushed included in the carousel file list from the content provider corresponding to the stream file to be pushed. Then, based on step S500, the pulled stream file to be pushed is converted into a media stream, and the media stream is pushed to the content distribution network of the live broadcast platform for playback.
[0105] Among them, in step S500, when pulling the stream file to be pushed, the file address of the stream file to be pushed and the time offset of the current pull can be recorded in real time. When the process of pulling the stream file to be pushed has a stream pulling exception, the file is pulled from the time point when the current stream pulling fails, and the play is resumed as much as possible. If it still fails after multiple attempts to pull again, the backup stream pulling domain name of the file will be tried to pull, and the play is resumed as much as possible. If the stream pulling with the backup address still fails multiple times, the task instance is requested to obtain the next stream pulling file address to start the stream pulling, and the exception is reported. Based on this, the breakpoint resume solution can solve the abnormal problem of playing episodes and starting from the beginning.
[0106] In addition, in an embodiment of the present application, during the process of pushing the file, based on step S300 and step S500, during the process of pushing the media stream, the live streaming server 100 can further detect the media stream to detect whether there is a missing audio frame in the media stream, and when there is a missing audio frame, use a pre-set silent frame to complete the missing audio frame. For example, in one possible implementation, when it is detected that the audio frame is missing for a set time, such as 1s or 2s, the live streaming server 100 can complete the audio frame by pushing a silent frame to the media stream. Based on this method, the problem of streaming jamming caused by the lack of audio frames during the media stream pushing process can be avoided, and in order to ensure the synchronization of audio and video during the media stream pushing process, the audio frame is not received and the audio frame is not received.
[0107] See also Figure 6 As shown, Figure 61 is a schematic diagram of a live streaming server 100 for implementing the above-mentioned file carousel streaming method provided by an embodiment of the present application. In detail, the live streaming server 100 may include one or more processors 110, a machine-readable storage medium 120, and a file carousel streaming device 130. The processor 110 and the machine-readable storage medium 120 may be connected to each other via a system bus. The machine-readable storage medium 120 stores machine-executable instructions, and the processor 110 implements the above-described file carousel streaming method by reading and executing the machine-executable instructions in the machine-readable storage medium 120.
[0108] The machine-readable storage medium 120 may be, but is not limited to, a random access memory (RAM), a read only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable read-only memory (EEPROM), etc. The machine-readable storage medium 120 is used to store a program, and the processor 110 executes the program after receiving an execution instruction.
[0109] The processor 110 may be an integrated circuit chip with signal processing capability. The processor may be, but is not limited to, a general-purpose processor, including a central processing unit (CPU), a network processor (NP), a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA), etc.
[0110] Please refer to Figure 7 , is a functional module diagram of the file carousel streaming device 130. In this embodiment, the file carousel streaming device 130 may include one or more software function modules running on the live streaming server 100, and these software function modules may be stored in the machine-readable storage medium 120 in the form of computer programs, so that when these software function modules are called and executed by the processor 130, the file carousel streaming method described in the embodiment of the present application can be implemented.
[0111] In detail, the file carousel streaming device 130 may include a task manager 131 , a stream puller 132 , and a stream pusher 133 .
[0112] The task manager 131 is used to parse the received file carousel task and obtain task information of the file carousel task.
[0113] Among them, in this embodiment, when the task manager 131 receives the file carousel task, it can first create a corresponding file carousel task instance, and parse the file carousel task through the file carousel task instance to obtain the task information of the file carousel task. In this embodiment, the task information may include, but is not limited to, a carousel file list, a streaming address, a backup address domain name, a file index to be played currently, a file offset time to be played currently, a callback domain name, etc. For example, the carousel file list may include each stream file to be pushed and the stream pull address of each stream file to be pushed that is required to be played by the carousel channel (such as a playback channel) for executing the current file carousel task. The stream pull address may refer to the URL address provided by the content provider 200 for downloading each stream file to be pushed, but is not limited to this. The stream push address may refer to the address required to be pushed after the stream file to be pushed is processed by parsing, transcoding and packaging, for example, it may be a channel address or channel address in the content distribution network 300 for playing the stream file to be pushed.
[0114] Among them, the task manager 131 can be responsible for receiving and distributing tasks, managing task instances, machine load monitoring, etc. The created task instances can be responsible for task parsing, task starting, stopping, updating operations, task changing, playlist management, task abnormal main and backup stream switching, download file management and other functions.
[0115] In this embodiment, the task manager 131 is used to execute step S100 in the above method embodiment. For details of the task manager 131, reference may be made to the above description of the specific contents of step S100, which will not be repeated here.
[0116] The stream puller 132 is used to download the to-be-pushed stream files included in the carousel file list in sequence from the content provider corresponding to the to-be-pushed stream files according to the preset pre-download strategy according to the carousel file list to the local storage of the live streaming server 100 .
[0117] In this embodiment, the flow puller 132 is used to execute step S200 in the above method embodiment. For details about the flow puller 132, reference can be made to the above description of the specific contents of step S200, which will not be repeated here.
[0118] The stream pusher 133 is used to sequentially obtain the stream files to be pushed from the local storage, convert the obtained stream files to be pushed into media streams, and push the media streams to the content distribution network of the live broadcast platform for playback.
[0119] In a possible implementation of this embodiment, the streaming device 133 may further include a transpackaging module 1331 and a cache module 1332. The transpackaging module 1331 is used to convert the acquired files to be streamed into media packages in a preset format, uniformly correct the time bases of the media packages, and splice the timestamps of the media packages.
[0120] The cache module 1332 is used to splice the media packets corresponding to the files to be pushed into the same media stream after the time base correction and timestamp splicing are completed, and cache the media packets in a preset physical memory. In this way, the stream pusher 133 can subsequently pull the cached media frames in the media stream from the physical memory in sequence and send them to the corresponding carousel channel in the content distribution network for streaming playback.
[0121] In this embodiment, the flow promoter 133 is used to execute step S300 in the above method embodiment. For details of the flow promoter 133, reference can be made to the above description of the specific contents of step S300, which will not be repeated here.
[0122] In summary, the file carousel streaming method, device and live streaming server provided in the embodiments of the present application provide an innovative solution that can ensure the stability of live streaming and the smoothness of slicing on the live streaming platform. Specifically, the file carousel solution of the embodiments of the present application can solve the problems of streaming jitter and playback jamming that are prone to occur in traditional real-time file streaming by pre-downloading the files to be streamed and caching the streaming media packages. Furthermore, a solution for unified output streams of multiple files is implemented by using a unified time base and timestamp splicing, which solves the problems of playback jamming and audio and video asynchrony when switching between films. In this way, the stability of the file carousel streaming is improved, so that the audience has a good and smooth viewing experience, thereby improving the user experience.
[0123] In the embodiments provided in the present application, it should be understood that the disclosed devices and methods can also be implemented in other ways. The device embodiments described above are merely schematic. For example, the flowcharts and block diagrams in the accompanying drawings show the possible architecture, functions and operations of the devices, methods and computer program products according to the multiple embodiments of the present application. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of a code, and the module, a program segment or a part of a code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or the flowchart, and the combination of boxes in the block diagram and / or the flowchart can be implemented with a dedicated hardware-based system that performs a specified function or action, or can be implemented with a combination of dedicated hardware and computer instructions.
[0124] In addition, the functional modules in the various embodiments of the present application may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.
[0125] If the functions are implemented in the form of software function modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0126] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0127] The above are only various implementations of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. A file carousel streaming method, characterized in that: Applied to a live streaming server, the method includes: Parsing the received file carousel task to obtain task information of the file carousel task, wherein the task information includes a carousel file list, and the carousel file list includes a plurality of files to be pushed; According to the carousel file list, the to-be-streamed files included in the carousel file list are sequentially downloaded from the content providing source according to a preset pre-download strategy to the local storage of the live streaming server; Sequentially acquiring the stream files to be pushed from the local storage, converting the acquired stream files to be pushed into media streams, and pushing the media streams to the content distribution network of the live broadcast platform for playback; The step of downloading the to-be-streamed files included in the carousel file list from the content provider in sequence according to the preset pre-download strategy to the local storage of the live streaming server includes: On the premise that the first stream file to be pushed in the carousel file list is not downloaded, at least two stream files to be pushed including the first stream file to be pushed are pre-downloaded sequentially to the local storage; When a media frame corresponding to any media package is pushed to the content distribution network of the live broadcast platform, determining the next to-be-pushed stream file that needs to be pre-downloaded; The next stream file to be pushed is downloaded from the content providing source to the local storage.
2. The file carousel streaming method according to claim 1, characterized in that: The step of converting the acquired stream file to be pushed into a media stream, and pushing the media stream to a content distribution network of a live broadcast platform for playback, includes: Convert the acquired streaming file to be pushed into a media package in a preset format; Correcting the time base of the media packet uniformly and concatenating the timestamps of the media frames of the media packet; Splicing the media packets corresponding to the to-be-pushed stream files after time base correction and timestamp splicing into the same media stream, and caching the media packets into a preset physical memory; Each media frame in the cached media stream is sequentially pulled from the physical memory and sent to a corresponding carousel channel in the content distribution network for streaming and playing.
3. The file carousel streaming method according to claim 2, characterized in that: The method further comprises: Create a file streaming configuration table entry, wherein the file streaming configuration table entry includes a streaming progress flag bit of each file to be streamed, and in an initialization state, the streaming progress flag bits corresponding to the N files to be streamed, including the first file to be streamed, in the file streaming configuration table entry are set to the first progress flag, wherein N is greater than or equal to 2; When any to-be-streamed file is downloaded to the local storage, the streaming progress mark position of the to-be-streamed file in the file streaming configuration table entry is set to the second progress mark; When a media packet of any to-be-pushed stream file is pushed to the content distribution network of the live broadcast platform through the media stream, the streaming progress mark position of the to-be-pushed stream file is set to the third progress mark, and the streaming progress mark position of the next to-be-pushed stream file pre-downloaded last time is set to the first progress mark; Correspondingly, when the media frame corresponding to any media package is pushed to the content distribution network of the live broadcast platform, determining the next to-be-pushed stream file that needs to be pre-downloaded includes: The to-be-pushed stream file whose stream pushing progress flag bit in the file stream pushing configuration table item is a first progress flag is determined as the next to-be-pushed stream file that needs to be pre-downloaded.
4. The file carousel streaming method according to claim 3, characterized in that: The method further comprises: At preset intervals, the to-be-streamed files whose streaming progress flag in the file streaming configuration table is the third progress flag are deleted from the local storage, and the streaming progress flag position corresponding to the deleted to-be-streamed files is set to the fourth progress flag.
5. The file carousel streaming method according to claim 1, characterized in that: The method of sequentially downloading the to-be-streamed files included in the carousel file list from the content provider according to the preset pre-download strategy to the local storage of the live streaming server also includes: When an exception occurs in downloading the to-be-pushed stream file from the content providing source, the to-be-pushed stream file is downloaded from a predetermined backup content providing source.
6. The file carousel streaming method according to any one of claims 1 to 5, characterized in that: Before downloading the to-be-streamed files included in the carousel file list from the content provider in sequence according to the preset pre-download strategy to the local storage of the live streaming server, the method further includes: Determine whether the file carousel task is a file carousel task of a preset type. If it is a carousel task of a preset type, execute the step of sequentially downloading the files to be pushed included in the carousel file list from the content provider source according to the preset pre-download strategy according to the carousel file list to the local storage of the live streaming server; If the file carousel task is not a file carousel task of a preset type, the method further includes: Pulling each to-be-streamed file included in the carousel file list in sequence from the content provider corresponding to the to-be-streamed file; The pulled stream file to be pushed is converted into a media stream, and the media stream is pushed to the content distribution network of the live broadcast platform for playback.
7. The file carousel streaming method according to any one of claims 1 to 5, characterized in that: The method further comprises: During the streaming of the media stream, it is detected whether there is any missing audio frame in the media stream. If there is any missing audio frame, a preset silent frame is used to supplement the missing audio frame.
8. A file carousel streaming device, applied to a live streaming server, characterized in that: The file carousel streaming device comprises: The task manager is used to parse the received file carousel task and obtain the task information of the file carousel task, wherein the task information includes a carousel file list, and the carousel file list includes a plurality of stream files to be pushed; A stream puller, used to download the to-be-streamed files included in the carousel file list from a content provider in sequence according to the preset pre-download strategy according to the carousel file list to the local storage of the live streaming server; A stream pusher, used to sequentially obtain the stream files to be pushed from the local storage, convert the obtained stream files to be pushed into media streams, and push the media streams to the content distribution network of the live broadcast platform for playback; The flow puller is also used for: On the premise that the first stream file to be pushed in the carousel file list is not downloaded, at least two stream files to be pushed including the first stream file to be pushed are pre-downloaded sequentially to the local storage; When a media frame corresponding to any media package is pushed to the content distribution network of the live broadcast platform, determining the next to-be-pushed stream file that needs to be pre-downloaded; The next stream file to be pushed is downloaded from the content providing source to the local storage.
9. A live streaming server, characterized in that: The method comprises a machine-readable storage medium and one or more processors, wherein the machine-readable storage medium stores machine-executable instructions, and when the machine-executable instructions are executed by the one or more processors, the method according to any one of claims 1 to 7 is implemented.
