Streaming media resource processing method and device, electronic equipment and storage medium

By employing a phased download and parallel playback writing method, the problem of efficiently saving streaming media files while ensuring smooth playback is solved, achieving low-latency instant playback and secure preservation of complete files.

CN121924282APending Publication Date: 2026-04-24BEIJING BAIDU NETCOM SCI & TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
BEIJING BAIDU NETCOM SCI & TECH CO LTD
Filing Date
2026-01-30
Publication Date
2026-04-24

AI Technical Summary

Technical Problem

Existing technologies struggle to efficiently and securely save streaming media files locally while ensuring smooth playback, especially in scenarios involving large files where there are engineering challenges such as memory spikes, breakpoint resume, and layered storage.

Method used

The system employs a phased approach to download streaming media resources, including initial segments, header segments controlled by the playback target and real-time bandwidth, and remaining media segments. Downloaded segments are stored in a preset buffer. Simultaneously, playback and writing operations are performed in parallel during the download process. The browser's MediaSource Extensions are used to achieve simultaneous downloading, playback, and storage.

Benefits of technology

It achieves a low-latency, instant playback experience and efficient, secure storage of complete media, reduces local first-frame latency and optimizes memory peaks, and supports breakpoint resume and tiered storage.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121924282A_ABST
    Figure CN121924282A_ABST
Patent Text Reader

Abstract

The invention provides a streaming media resource processing method and device, electronic equipment and a storage medium, and relates to the technical field of computers, in particular to the technical field of multimedia stream processing and browser end file management. According to the specific implementation scheme, the method comprises the following steps: analyzing a list file of streaming media resources to obtain fragment information of the streaming media resources; according to the fragment information, downloading an initialized fragment of the streaming media resource, a head fragment controlled by a playing target and a real-time bandwidth and a residual media fragment in stages, and storing the downloaded fragments to a preset buffer area; and in the downloading process, playing the downloaded fragments in the buffer area, and writing the downloaded fragments in the buffer area into a local disk.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of computer technology, and more particularly to the field of multimedia stream processing and browser-side file management technology. More specifically, this disclosure provides a streaming media resource processing method, apparatus, electronic device, storage medium, and computer program product. Background Technology

[0002] With the rapid development of online multimedia services and online video applications, users have high demands for both "instant playback" and "saveable content after viewing." On the one hand, users expect the shortest possible startup time and a smooth playback experience; on the other hand, users also hope to be able to save media files completely to their local devices for offline use or later management while playing. Summary of the Invention

[0003] This disclosure provides a streaming media resource processing method, apparatus, electronic device, storage medium, and computer program product.

[0004] According to the first aspect, a streaming media resource processing method is provided, the method comprising: parsing a manifest file of a streaming media resource to obtain segment information of the streaming media resource; downloading the initial segment, the header segment controlled by the playback target and real-time bandwidth, and the remaining media segments of the streaming media resource in stages according to the segment information, and storing the downloaded segments in a preset buffer; during the download process, playing the downloaded segments in the buffer, and writing the downloaded segments in the buffer to a local disk.

[0005] According to a second aspect, a streaming media resource processing apparatus is provided, comprising: a parsing module for parsing a manifest file of streaming media resources to obtain segment information of the streaming media resources; a downloading module for downloading, in stages, the initial segment, the header segment controlled by the playback target and real-time bandwidth, and the remaining media segments of the streaming media resources according to the segment information, and storing the downloaded segments in a preset buffer; and a playback and writing module for playing the downloaded segments in the buffer during the download process and writing the downloaded segments in the buffer to a local disk.

[0006] According to a third aspect, an electronic device is provided, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to perform a method provided according to the present disclosure.

[0007] According to a fourth aspect, a non-transitory computer-readable storage medium is provided that stores computer instructions for causing a computer to perform the methods provided in this disclosure.

[0008] According to a fifth aspect, a computer program product is provided, comprising a computer program stored on at least one of a readable storage medium and an electronic device, wherein the computer program, when executed by a processor, implements the method provided in this disclosure.

[0009] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of this disclosure, nor is it intended to limit the scope of this disclosure. Other features of this disclosure will become readily apparent from the following description. Attached Figure Description

[0010] The accompanying drawings are provided to better understand this solution and do not constitute a limitation of this disclosure. Wherein:

[0011] Figure 1 This is an exemplary system architecture diagram of a streaming media resource processing method and apparatus applicable according to an embodiment of the present disclosure;

[0012] Figure 2 This is a flowchart of a streaming media resource processing method according to an embodiment of the present disclosure;

[0013] Figure 3 This is a flowchart illustrating the phased downloading of media segments according to an embodiment of the present disclosure;

[0014] Figure 4 This is a flowchart of a streaming media resource processing method according to another embodiment of the present disclosure;

[0015] Figure 5 This is a block diagram of a streaming media resource processing apparatus according to an embodiment of the present disclosure;

[0016] Figure 6 This is a block diagram of an electronic device for a streaming media resource processing method according to an embodiment of the present disclosure. Detailed Implementation

[0017] The exemplary embodiments of this disclosure are described below with reference to the accompanying drawings, including various details of the embodiments to aid understanding, and should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of this disclosure. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description.

[0018] The collection, storage, use, processing, transmission, provision, and disclosure of any type of information, such as user personal information, in this technical solution comply with relevant laws and regulations and do not violate public order and good morals.

[0019] In the technical solution disclosed herein, the user's authorization or consent is obtained before acquiring or collecting the user's personal information.

[0020] Existing technologies address users' needs for "instant playback" and "saveable content after viewing" primarily employ two types of solutions: one is the traditional progressive download or full file download, suitable for direct saving but often requiring waiting for the download to complete before a good playback experience is achieved. The other is a streaming-based solution, capable of appending segments and playing them instantly, but typically focuses on playback and lacks support for reliable saving of complete files and low-memory writes. Furthermore, simply appending segments to the player buffer does not solve engineering problems such as memory spikes, resuming interrupted downloads, and layered storage in large file scenarios.

[0021] Therefore, there are overlapping but not entirely identical technical requirements between visual downloading (emphasizing segment management, breakpoint resumption, and final disk writing) and download-while-playing (emphasizing low-latency segment appending and playback): the former focuses on the controllability and file integrity of the download, while the latter focuses on the real-time performance of playback and buffer control. This application aims to organically combine the two, through a systematic download strategy, buffer-aware progress-driven approach, and layered streaming writing scheme, to both satisfy the user's immediate playback experience and ensure the efficient and secure preservation of complete media.

[0022] Figure 1 This is a schematic diagram of an exemplary system architecture for applying streaming media resource processing methods and apparatus according to an embodiment of this disclosure. It should be noted that... Figure 1 The examples shown are merely examples of system architectures that can be applied to the embodiments of this disclosure, in order to help those skilled in the art understand the technical content of this disclosure, but do not mean that the embodiments of this disclosure cannot be used in other devices, systems, environments or scenarios.

[0023] like Figure 1 As shown, the system architecture 100 according to this embodiment may include terminal devices 101, 102, and 103, a network 104, and a server 105. The network 104 serves as a medium for providing a communication link between the terminal devices 101, 102, and 103 and the server 105. The network 104 may include various connection types, such as wired and / or wireless communication links, etc.

[0024] Users can use browsers on terminal devices 101, 102, and 103 to interact with server 105 via network 104 to receive or send messages, etc. Terminal devices 101, 102, and 103 can be various electronic devices, including but not limited to smartphones, tablets, laptops, etc.

[0025] Server 105 can be a server that provides various services, such as a backend management server that supports websites browsed by users using terminal devices 101, 102, and 103 (for example only). The backend management server can analyze and process data such as received user requests (e.g., requests to download media segments) and feed back the processing results (e.g., media segments) to the terminal devices.

[0026] The streaming media resource processing method provided in this disclosure can be executed by a browser on terminal devices 101, 102, and 103. Correspondingly, the streaming media resource processing device provided in this disclosure can generally be installed in the browser on terminal devices 101, 102, and 103.

[0027] Figure 2 This is a flowchart of a streaming media resource processing method according to an embodiment of the present disclosure.

[0028] like Figure 2 As shown, the streaming media resource processing method 200 includes operations S210 to S230.

[0029] In operation S210, the manifest file of the streaming media resources is parsed to obtain the segmentation information of the streaming media resources.

[0030] Streaming media resources can be streamed video or audio resources. Streaming can refer to dividing the entire media content into multiple segments, including initial segments and full media segments. A manifest file describes the order, address, encoding format, resolution, bitrate, etc., of these segments.

[0031] For example, in response to a user's play request click on a browser page, a manifest file of the streaming media resource to be played can be obtained. Parsing this manifest file reveals segment information such as encoding format, resolution, bitrate, and segment URLs (Uniform Resource Locators). Segment URLs can include initial segment URLs and full media segment URLs.

[0032] In operation S220, based on the segmentation information, the initial segment of the streaming media resource, the header segment controlled by the playback target and real-time bandwidth, and the remaining media segments are downloaded in stages, and the downloaded segments are stored in a preset buffer.

[0033] The embodiments of this disclosure can utilize the browser's MediaSource Extensions (MSE) to enable simultaneous video download and playback. MSE is an API (Application Programming Interface) built into the browser, which can be used to control the download and playback of streaming media content.

[0034] Media sources and buffers can be created using MSE to perform download tasks. Embodiments of this disclosure can download media segments in stages based on the parsed initial segment URL and full media segment URL. For example, the initial segment contains decoding information; in stage one, the initial segment is downloaded and written to the buffer to establish a decoding context, ensuring that subsequent segments can be decoded correctly. In stage two, several header segments are downloaded and written to the buffer to quickly form a playable buffer window, achieving instant playback. In stage three, the remaining segments continue to be downloaded, with each downloaded segment appended to the buffer.

[0035] The number of segments in the first part of Phase Two can be dynamically calculated based on real-time bandwidth and playback target. For example, based on the current network bandwidth and the preset maximum startup latency, it can be calculated how many segments to download in advance to form a playable buffer.

[0036] Phase three of the download can efficiently and controllably download all remaining media segments while ensuring smooth playback. For example, it can use sequential downloading or controlled concurrent downloading to download the remaining segments, and can dynamically adjust the number of concurrent downloads and the download request pace based on the playback status to achieve efficient and controllable downloading.

[0037] During the operation of S230, the downloaded segments in the buffer are played and written to the local disk.

[0038] During the download process, playback tasks can be executed in parallel. The URL generated by the media source is bound to the player, and the player can play the downloaded content in the buffer, realizing downloading while playing.

[0039] During the download process, local write tasks can also be executed in parallel. For example, if streaming write is supported, downloaded segments in the buffer can be directly written to the corresponding file. If streaming write is not supported, the segments can be written to temporary storage first, and after the download is complete, the downloaded segments can be merged using an incremental merging method to obtain a merged file. This triggers the saving of the merged file to the user's device, achieving simultaneous playback and data retention.

[0040] According to embodiments of this disclosure, by downloading the initial segments, header segments controlled by the playback target and real-time bandwidth, and remaining media segments of the streaming media resources in stages, and storing the downloaded segments in a preset buffer, the local first-frame latency can be reduced. Furthermore, playback tasks are executed in parallel during the media segment download process, playing the downloaded segment content, achieving simultaneous download and playback. During the media segment download process, local write tasks are executed in parallel, writing the downloaded segments to the local disk, achieving simultaneous playback and retention, satisfying the user's immediate playback experience while ensuring efficient and secure preservation of the complete media.

[0041] Figure 3 This is a flowchart of a phased download of media segments according to an embodiment of the present disclosure.

[0042] like Figure 3 As shown, this embodiment includes operations S310 to S390. Operation S320 is the first stage of downloading, operations S330 to S360 are the second stage of downloading, and operations S370 to S390 are the third stage of downloading.

[0043] The S310 is used to parse the manifest file of the streaming media resources and obtain the segmentation information of the streaming media resources.

[0044] A stream parser can be used to parse the manifest file (MPD, Media Presentation Description) to extract information such as the total media duration, segment list, duration of each segment, and timescale. The timescale is a time unit conversion factor in streaming media formats, used to convert the scale on the media timeline into actual seconds.

[0045] During operation, the S320 downloads and initializes the fragments, writing them to the buffer.

[0046] Downloading the initialization segment establishes a decoding context, ensuring that subsequent segments can be decoded correctly.

[0047] In operation S330, the first quantity is determined based on the target buffer duration and the media fragment duration.

[0048] When operating S340, determine the second quantity based on real-time bandwidth and target startup maximum latency.

[0049] When operating S350, the target quantity is determined based on the first quantity, the second quantity, and the maximum head quantity.

[0050] When operating the S360, the target number of media segments are downloaded in segment order as header segments and written to the buffer.

[0051] According to embodiments of this disclosure, based on real-time bandwidth and playback target, a target number of header segments for forming a playable buffer is determined, and the target number of media segments are downloaded as header segments in segment order and written into the buffer.

[0052] In Phase Two, the target number of header fragments used to form a playable buffer is calculated. This can be done by obtaining or measuring the following parameters: target maximum startup latency Tmax (seconds, e.g., 1.5–2s), target buffer duration Tbuf (seconds, e.g., 6–12s), fragment duration sd (seconds / fragment, from manifest parsing), initial fragment size Si (bytes), and estimated average fragment size Ss (bytes). The estimated average fragment size Ss can be estimated by multiplying the fragment duration by the target bitrate, or by averaging the sizes of the first N fragments.

[0053] The real-time bandwidth can be calculated first. For example, for the i-th download segment, record the actual download time ti (seconds) and size bi (bytes); estimate the real-time bandwidth Bi = bi / ti; use a weighted or simple moving average of length N (e.g., N=5) to obtain the real-time bandwidth B = mean(Bi); for stability, extreme values ​​can be truncated.

[0054] The number of heads based on playback awareness is then calculated, known as the first number, which represents the minimum number of heads based on the target buffer duration. The first number H_time = ceil (Tbuf / sd), where ceil represents rounding up.

[0055] Then, the number of headers based on the downloadable time constraint, i.e., the second quantity, is calculated. The estimated time required to download the initial fragment + H fragments is approximately (Si + H * Ss) / B; to ensure the first frame is ready within Tmax, (Si + H * Ss) / B <= Tmax; therefore, the second quantity H_delay = floor ((B * Tmax - Si) / Ss). Here, floor represents rounding down.

[0056] Next, the overall header count is calculated and limited. This is done based on the first header count (H_time), the second header count (H_delay), and the preset maximum header count (H_max). The target header count is calculated as: `headerCount = max(1, min(H_time, H_delay, H_max))`, where `H_max` is the system upper limit (e.g., 10) to avoid over-prefetching. If `H_delay < 1`, the process degrades to downloading at least one fragment and quickly filling in the gaps in the background.

[0057] It should be noted that the above calculation method is only an example. In actual implementation, Ss and Si can be estimated more accurately by combining the fragment size information or bitrate information provided by the server. Furthermore, the target number headerCount obtained by the above calculation method can be a preliminary target number. If backtracking / stuttering occurs during playback, headerCount can be increased to quickly replenish buffering; if the network is good and the buffer is sufficient, the target number can be reduced to save bandwidth.

[0058] According to embodiments of this disclosure, operations S370 to S390 represent different controllable download strategies in phase three; that is, the download in phase three includes at least one of operations S370 to S390. In phase three, any one strategy can be selected for controllable downloading, or a combination of several strategies can be used for downloading.

[0059] When operating the S370, the remaining media segments within the time window of the current playback position are downloaded using a concurrent download method, and the number of concurrent downloads is adjusted according to the real-time bandwidth.

[0060] When operating the S380, the remaining media segments within the time window of the current playback position are downloaded sequentially based on the time distance from the current playback position.

[0061] In operation S390, a minimum request interval is set for the remaining media segments within the time window of the current playback position where the time distance is greater than the distance threshold.

[0062] Users can drag the progress bar, and the current playback position can be the position specified by the user's drag. While ensuring playability, the background can download segments within the time window of the current playback position sequentially or in a controlled concurrent manner. To balance bandwidth usage and playback smoothness, the following specific strategies can be adopted in the implementation.

[0063] 1) Concurrency control: Dynamically adjust the number of concurrent downloads based on the current buffered duration and the duration threshold.

[0064] According to embodiments of this disclosure, the dynamic adjustment of the concurrency count includes: determining a preset minimum concurrency count in response to a playable duration being less than a first duration threshold; determining a preset normal concurrency count in response to a playable duration being greater than or equal to the first duration threshold and less than a second duration threshold; and adjusting the normal concurrency count based on real-time bandwidth and a preset maximum concurrency count in response to a playable duration being greater than or equal to the second duration threshold to obtain a target concurrency count.

[0065] For example, the preset minimum concurrency C_min = 1, normal concurrency C_normal = 3, and maximum concurrency C_max = 6; if the playable duration PlayableSeconds is less than the first duration threshold MinPlayableThreshold (e.g., 2s), then the target concurrency C = C_min; if the playable duration PlayableSeconds is greater than or equal to the second duration threshold TargetPlayable (e.g., 6s) and the estimated real-time bandwidth B is greater than the bandwidth threshold, then the target concurrency C = min(C_max, C_normal + floor((B - BW_ref ) / BW_step )). Here, BW_ref is the baseline bandwidth, and BW_step is the bandwidth step size.

[0066] The above concurrency levels are adjusted based on the playable duration and real-time bandwidth. The playable duration is explained below. Downloading segments prioritizes segments near the user-specified playback position. Since the user can freely drag the progress bar, the buffer can include multiple buffered time periods. A buffered time period containing the current playback position's time point `currentTime` can be selected, and its end `end` is taken as `bufferedEnd`. The playable duration `PlayableSeconds = max(0, bufferedEnd - currentTime)`. If the playable duration `PlayableSeconds` is less than the warning threshold `EmergencyThreshold` (e.g., 1 second), low-priority downloads can be immediately paused, and concurrency increased to quickly make up the difference.

[0067] If playback is interrupted or stuttered, you can increase the number of header segments or temporarily increase the concurrency to quickly replenish buffering. If the network is good and the buffer is sufficient, you can reduce the concurrency and the number of header segments to save bandwidth.

[0068] 2) Requesting beat and delay: For segments whose time distance from the current playback position is greater than the distance threshold, a minimum request interval can be introduced during background download to avoid bandwidth jitter caused by short-term burst concurrency.

[0069] 3) Priority scheduling: Prioritize downloading segments within the time window closest to the current playback position, and set segments far from the current playback position as low priority to download when bandwidth is idle.

[0070] Strategy 1) above can be combined with strategy 2), for example, by using concurrent downloading for segments within the time window closest to the current playback position. Strategy 2) above can also be combined with strategy 3), for example, by establishing a priority queue where media segments are sorted according to their time distance from the current playback position. Based on the priority queue, media segments with a priority higher than a threshold are downloaded first, and a minimum request interval (e.g., 100–300ms) is set for media segments with a priority lower than the threshold.

[0071] In addition, the download strategy in Phase 3 may also include: 4) Bandwidth awareness: measuring the download rate of the most recent segments, estimating the available bandwidth, and adjusting the concurrency accordingly; 5) performing a limited number of retries on failed segments, with exponential backoff at retry intervals and logging failures for strategy adjustments.

[0072] The three-stage download strategy provided in the embodiments of this disclosure can enable media resources to open instantly and play continuously, thereby improving the user's playback experience.

[0073] According to embodiments of this disclosure, the download progress is determined based on the size of the segments already written to the local disk and the size of the streaming media resources; the playable progress is determined based on the continuous playable duration connected to the current playback position in the buffer and the total duration of the streaming media resources; and the download progress and playable progress are displayed in a visual interface.

[0074] The embodiments of this disclosure employ two complementary types of progress metrics to support playback decisions and save strategies. These two types of progress metrics can be used in this disclosure to optimize download scheduling and interface prompts.

[0075] One metric is the network download progress (Download%): measured in bytes, it represents the percentage of resources that have been retrieved from the network and written to local storage, which helps to determine the completeness of the save and estimate the remaining download time.

[0076] Another progress metric is Playable%: measured by time, it represents the proportion of the total time that the player can play continuously from the current playback position. This metric is obtained by reading the continuous time range of the player's buffer connected to the playhead and is used to determine playback readiness and continuity.

[0077] In the embodiments of this disclosure, the two types of metrics serve different functions: playability progress serves as the primary criterion for playback triggering and buffering assurance, determining whether immediate playback is allowed or whether segments closer to the playback start should be prioritized; network download progress serves as the criterion for complete file saving and background download completion, determining when to start or complete merging and export operations. This separation of metrics clearly distinguishes between the different semantics of "data has arrived locally" and "the player can consume it immediately," thereby supporting targeted strategies (e.g., prioritizing smooth playback with playability metrics and ensuring the final file is stored on disk with download metrics), truly reflecting the user's perception of playability.

[0078] According to embodiments of this disclosure, errors such as download requests, playback errors, and write errors can be captured. Retrying, switching storage strategies, or reverting to normal downloading can be performed according to preset strategies, and clear prompts and suggested actions can be displayed to the user (e.g., "Format incompatible, try downloading directly"). Metrics can also be recorded, including: first frame time (ms), average download speed (KB / s), peak memory usage (MB), merging time (s), download success rate, and number of retries. Error messages and statistical logs can be used for subsequent analysis and strategy optimization.

[0079] Figure 4 This is a flowchart of a streaming media resource processing method according to another embodiment of the present disclosure.

[0080] like Figure 4 As shown, this embodiment includes operations S410 to S480 and operations S481 to S483.

[0081] When operating the S410, in response to a user's download or playback request, browser capability detection and initialization are performed.

[0082] Before starting the download, browser capabilities are tested, such as support for OPFS (Origin Private FileSystem), FSA (File System Access API), IndexedDB, Streams API, and Web Worker. The device's memory and available disk space are also checked.

[0083] When operating the S420, select the corresponding tiered storage strategy based on the detection results.

[0084] Based on the test results, select the storage strategy according to priority. For example, if OPFS is supported, prioritize OPFS streaming writes; otherwise, if the File System Access API is supported, request the user to select a directory and create a write stream; otherwise, downgrade to IndexedDB and enable Workers for background merging.

[0085] When operating the S430, parse the streaming media manifest file.

[0086] Operating the S440, download and initialize fragments.

[0087] When operating the S450, download the header fragment.

[0088] Using S460, download the remaining fragments.

[0089] When operating the S470, the downloaded segments are appended to the player.

[0090] When operating the S480, the downloaded segments are written to the local disk.

[0091] According to embodiments of this disclosure, when streaming write mode is supported, each downloaded segment in the buffer is written sequentially to the local disk using streaming write mode; when streaming write mode is not supported, each downloaded segment in the buffer is stored in temporary storage space, and after the segments of the streaming media resource are downloaded, the segments stored in the temporary storage space are merged, and the merged file is stored in the local disk.

[0092] When the browser supports OPFS or FSA, in order to support streaming write mode, operations S460 to S480 are processed in parallel.

[0093] If the browser supports OPFS, operation S480 specifically executes operation S481, which writes the downloaded fragments to the local disk in a streaming manner. If the browser supports FSA, operation S480 specifically executes operation S482, which requests the user to select a directory and creates a write stream, writing the downloaded fragments to the local disk in a streaming manner.

[0094] If the browser does not support OPFS and FSA, but supports IndexedDB, Streams API, and Web Worker, operation S480 will specifically execute operation S483, storing the downloaded fragments in temporary storage space. After downloading, incremental merging will be performed, and the merged file will be stored on the local disk. The temporary storage space can be, for example, the indexed database (DB) space.

[0095] According to embodiments of this disclosure, by employing a three-stage download strategy and appending downloaded segments to the player and writing downloaded segments to the local disk during the download process, data in the buffer can be released as quickly as possible. This reduces peak client memory usage while ensuring "instant" video playback and continuous playback, and securely saves the complete media to the user's device after downloading.

[0096] According to embodiments of this disclosure, this disclosure also provides a streaming media resource processing apparatus.

[0097] Figure 5 This is a block diagram of a streaming media resource processing apparatus according to an embodiment of the present disclosure.

[0098] like Figure 5 As shown, the streaming media resource processing device 500 includes a parsing module 510, a download module 520, and a playback and writing module 530.

[0099] The parsing module 510 is used to parse the manifest file of the streaming media resources to obtain the segmentation information of the streaming media resources.

[0100] The download module 520 is used to download the initial segment of the streaming media resource, the header segment controlled by the playback target and real-time bandwidth, and the remaining media segments in stages according to the segment information, and store the downloaded segments to a preset buffer.

[0101] The playback and writing module 530 is used to play the downloaded segments in the buffer and write the downloaded segments in the buffer to the local disk during the download process.

[0102] The download module 520 includes a first download submodule, a second download submodule, and a third download submodule.

[0103] The first download submodule is used to download the initial fragments and write them to the buffer.

[0104] The second download submodule is used to determine the target number of header segments to form a playable buffer based on the real-time bandwidth and playback target, and download the target number of media segments as header segments in the segment order and write them into the buffer.

[0105] The third download submodule is used to download the remaining media segments and write them to the buffer. The remaining media segments are the media segments other than the initialization segments and the header segments.

[0106] According to embodiments of this disclosure, the playback target includes a target buffer duration and a target maximum startup latency. The second download submodule includes a first quantity determination unit, a second quantity determination unit, and a target quantity determination unit.

[0107] The first quantity determination unit is used to determine the first quantity based on the target buffer duration and the duration of each media segment parsed from the manifest file.

[0108] The second quantity determination unit is used to determine the second quantity based on the real-time bandwidth, the target maximum startup latency, the initial fragment size, and the average fragment size. The real-time bandwidth is determined based on the fragment size and download time of the real-time download.

[0109] The target quantity determination unit is used to determine the target number of header segments used to form a playable buffer based on the first quantity, the second quantity, and the preset maximum header quantity.

[0110] The third download submodule includes at least one of a concurrent download unit, a sequential download unit, and a settings unit.

[0111] The concurrent download unit is used to download the remaining media segments within the time window of the current playback position in a concurrent download manner, and adjusts the number of concurrent downloads according to the real-time bandwidth.

[0112] The sequential download unit is used to download the remaining media segments within the time window of the current playback position in sequence according to the time distance from the current playback position.

[0113] The setting unit is used to set the minimum request interval for the remaining media segments within the time window of the current playback position where the time distance is greater than the distance threshold.

[0114] According to embodiments of this disclosure, the concurrent download unit includes a playable duration determination subunit, a concurrency number determination subunit, and a concurrent download subunit.

[0115] The playable duration determination subunit is used to determine the playable duration based on the buffered time period including the current playback position.

[0116] The concurrency determination subunit is used to determine the concurrency based on the playable duration and real-time bandwidth.

[0117] The concurrent download subunit is used to download the remaining media segments within the time window of the current playback position concurrently according to the number of concurrent users.

[0118] According to embodiments of this disclosure, the concurrency determination subunit is configured to determine a preset minimum concurrency in response to a playable duration being less than a first duration threshold; determine a preset normal concurrency in response to a playable duration being greater than or equal to the first duration threshold and less than a second duration threshold; and adjust the normal concurrency based on real-time bandwidth and a preset maximum concurrency in response to a playable duration being greater than or equal to the second duration threshold to obtain a target concurrency.

[0119] According to embodiments of this disclosure, the streaming media resource processing apparatus 500 further includes a download progress determination module, a playable progress determination module, and a display module.

[0120] The download progress determination module is used to determine the download progress based on the size of the segments already written to the local disk and the size of the streaming media resources.

[0121] The playable progress determination module is used to determine the playable progress based on the continuous playable duration connected to the current playback position in the buffer and the total duration of the streaming media resources.

[0122] The display module is used to show the download progress and playable progress in the visual interface.

[0123] According to embodiments of this disclosure, the streaming media resource processing apparatus 500 further includes a first writing module and a second writing module.

[0124] The first write module is used to sequentially write each downloaded fragment in the buffer to the local disk using a streaming write method when streaming write mode is supported.

[0125] The second write module is used to store each downloaded segment in the buffer into temporary storage space when streaming write mode is not supported. After the segments of the streaming media resource are downloaded, the segments stored in the temporary storage space are merged and the merged file is stored into the local disk.

[0126] According to embodiments of this disclosure, this disclosure also provides an electronic device, a readable storage medium, and a computer program product.

[0127] Figure 6 A schematic block diagram of an example electronic device 600 that can be used to implement embodiments of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the present disclosure described and / or claimed herein.

[0128] like Figure 6As shown, device 600 includes a computing unit 601, which can perform various appropriate actions and processes based on a computer program stored in read-only memory (ROM) 602 or a computer program loaded into random access memory (RAM) 603 from storage unit 608. RAM 603 may also store various programs and data required for the operation of device 600. The computing unit 601, ROM 602, and RAM 603 are interconnected via bus 604. Input / output (I / O) interface 605 is also connected to bus 604.

[0129] Multiple components in device 600 are connected to I / O interface 605, including: input unit 606, such as keyboard, mouse, etc.; output unit 607, such as various types of monitors, speakers, etc.; storage unit 608, such as disk, optical disk, etc.; and communication unit 609, such as network card, modem, wireless transceiver, etc. Communication unit 609 allows device 600 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.

[0130] The computing unit 601 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 601 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 601 performs the various methods and processes described above, such as streaming media resource processing methods. For example, in some embodiments, the streaming media resource processing method may be implemented as a computer software program tangibly contained in a machine-readable medium, such as storage unit 608. In some embodiments, part or all of the computer program may be loaded and / or installed on device 600 via ROM 602 and / or communication unit 609. When the computer program is loaded into RAM 603 and executed by the computing unit 601, one or more steps of the streaming media resource processing method described above may be performed. Alternatively, in other embodiments, the computing unit 601 may be configured to perform streaming media resource processing methods by any other suitable means (e.g., by means of firmware).

[0131] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.

[0132] The program code used to implement the methods of this disclosure may be written in any combination of one or more programming languages. This program code may be provided to a processor or controller of a general-purpose computer, special-purpose computer, or other programmable data processing apparatus, such that when executed by the processor or controller, the program code causes the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The program code may be executed entirely on a machine, partially on a machine, as a standalone software package partially on a machine and partially on a remote machine, or entirely on a remote machine or server.

[0133] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.

[0134] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device for displaying information to the user (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor); and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the computer. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).

[0135] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as a data server), or computing systems that include middleware components (e.g., an application server), or computing systems that include frontend components (e.g., a user computer with a graphical user interface or web browser through which a user can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., a communication network). Examples of communication networks include local area networks (LANs), wide area networks (WANs), and the Internet.

[0136] Computer systems can include clients and servers. Clients and servers are generally located far apart and typically interact through communication networks. Client-server relationships are created by computer programs running on the respective computers and having a client-server relationship with each other.

[0137] It should be understood that the various forms of processes shown above can be used to rearrange, add, or delete steps. For example, the steps described in this disclosure can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution disclosed in this disclosure can be achieved, and this is not limited herein.

[0138] The specific embodiments described above do not constitute a limitation on the scope of protection of this disclosure. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this disclosure should be included within the scope of protection of this disclosure.

Claims

1. A method for processing streaming media resources, comprising: Parse the manifest file of the streaming media resources to obtain the segmentation information of the streaming media resources; Based on the segmentation information, the initial segment of the streaming media resource, the header segment controlled by the playback target and real-time bandwidth, and the remaining media segments are downloaded in stages, and the downloaded segments are stored in a preset buffer. During the download process, the downloaded segments in the buffer are played, and the downloaded segments in the buffer are written to the local disk.

2. The method according to claim 1, wherein, The phased downloading of the initial segments, the header segments controlled by the playback target and real-time bandwidth, and the remaining media segments of the streaming media resource, and the storage of the downloaded segments in a preset buffer, includes: Download the initial fragment and write it to the buffer; Based on the real-time bandwidth and playback target, determine the target number of header segments to form a playable buffer, and download the target number of media segments as the header segments in segment order, and write them into the buffer. Download the remaining media segments and write them to the buffer, wherein the remaining media segments are media segments other than the initialization segment and the header segment.

3. The method according to claim 2, wherein, The playback target includes the target buffer duration and the target maximum startup latency; The determination of the target number of header segments used to form a playable buffer includes: The first quantity is determined based on the target buffer duration and the duration of each media segment parsed from the manifest file; The second quantity is determined based on the real-time bandwidth, the target maximum startup latency, the initial fragment size, and the average fragment size, wherein the real-time bandwidth is determined based on the fragment size and download time of the real-time download. The target number of head segments used to form a playable buffer is determined based on the first number, the second number, and the preset maximum number of heads.

4. The method according to claim 2, wherein, Downloading the remaining media segments and writing them to the buffer includes at least one of the following operations: The remaining media segments within the current playback position's time window are downloaded using a concurrent download method, and the number of concurrent downloads is adjusted according to real-time bandwidth. Based on the time distance from the current playback position, download the remaining media segments within the time window of the current playback position in sequence; Set a minimum request interval for the remaining media segments within the time window of the current playback position where the time distance is greater than a distance threshold.

5. The method according to claim 4, wherein, The method of downloading the remaining media segments within the current playback position's time window using concurrent downloading, and adjusting the concurrency based on real-time bandwidth, includes: The playable duration is determined based on the buffered time period that includes the current playback position; The number of concurrent users is determined based on the playable duration and the real-time bandwidth. Based on the stated concurrency level, the remaining media segments within the time window of the current playback position are downloaded concurrently.

6. The method according to claim 5, wherein, The step of determining the number of concurrent users based on the playable duration and the real-time bandwidth includes: In response to the playable duration being less than a first duration threshold, the number of concurrent connections is determined to be a preset minimum number of concurrent connections; In response to the playable duration being greater than or equal to a first duration threshold and less than a second duration threshold, the number of concurrent connections is determined to be a preset normal number of concurrent connections; In response to the playable duration being greater than or equal to the second duration threshold, the normal concurrency is adjusted according to the real-time bandwidth and the preset maximum concurrency to obtain the target concurrency.

7. The method according to claim 1, further comprising: The download progress is determined based on the size of the segments already written to the local disk and the size of the streaming media resources; The playable progress is determined based on the continuous playable duration connected to the current playback position in the buffer and the total duration of the streaming media resource; The download progress and the playable progress are displayed in a visual interface.

8. The method according to claim 1, wherein, The step of writing the downloaded fragments in the buffer to the local disk includes: When streaming write mode is supported, each downloaded fragment in the buffer is written to the local disk in sequence using the streaming write method. If the streaming write mode is not supported, each downloaded segment in the buffer is stored in a temporary storage space. After the streaming media resource segments are downloaded, the segments stored in the temporary storage space are merged, and the merged file is stored in the local disk.

9. A streaming media resource processing device, comprising: The parsing module is used to parse the manifest file of the streaming media resources to obtain the segmentation information of the streaming media resources; The download module is used to download the initial segment, the header segment controlled by the playback target and real-time bandwidth, and the remaining media segments of the streaming media resource in stages according to the segment information, and store the downloaded segments in a preset buffer. The playback and writing module is used to play the downloaded segments in the buffer and write the downloaded segments in the buffer to the local disk during the download process.

10. An electronic device, comprising: At least one processor; as well as A memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the method of any one of claims 1 to 8.

11. A non-transitory computer-readable storage medium storing computer instructions, wherein, The computer instructions are used to cause the computer to perform the method according to any one of claims 1 to 8.

12. A computer program product comprising a computer program stored on at least one of a readable storage medium and an electronic device, the computer program implementing the method according to any one of claims 1 to 8 when executed by a processor.