Media resource distribution and storage method and device, storage medium and electronic equipment
By determining the size of the media resources based on the playback end communication bandwidth and historical transmission speed, and distributing it to the edge server, the problem of poor distribution effects of media resources in existing technology has been solved, and a more stable network transmission and more stable network transmission and Higher distribution effect.
Patent Information
- Application Number
- CN202411537745.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-30
- Publication Date
- 2025-01-28
AI Technical Summary
In the prior art, the size of media resource shards is mostly preset or random shards, resulting in packet loss when the shard size is large, affecting the use effect.
Determine the target transmission speed of the initial media resources according to the communication bandwidth information of the playback end, and determine the target transmission cycle based on the historical transmission speed of historical media resources. The product transmission speed and the product transmission cycle are determined. Media resources are divided into multiple target media resources.
通过动态调整媒体资源的分片大小,确保媒体资源分发时的网络稳定,防止丢包,提高媒体资源的分发效果。
Smart Images

Figure CN119383416A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computers, and in particular to a method, device, storage medium and electronic device for distributing and storing media resources. Background Art
[0002] In the prior art, the size of media resource shards is mostly preset or random. For edge nodes with small bandwidth or high network fluctuation frequency, if the shard size is large, packet loss may easily occur, thus affecting the use effect.
[0003] Therefore, there is a technical problem in the related technology that the distribution effect of media resources is poor. Summary of the invention
[0004] The embodiments of the present application provide a method, device, storage medium and electronic device for distributing and storing media resources, so as to at least solve the technical problem of poor distribution effect of media resources existing in the related art.
[0005] According to one aspect of an embodiment of the present application, a method for distributing media resources is provided, including: determining a target transmission speed of an initial media resource to be distributed according to communication bandwidth information of a playback end; determining a target transmission period of the initial media resource according to the target transmission speed and a historical transmission speed of a historical media resource; determining a fragment size of a single media resource based on the target transmission speed and the target transmission period; dividing the initial media resource into multiple target media resources according to the fragment size, wherein the fragment size of each target media resource is the fragment size; establishing index information for the multiple target media resources, and distributing the index information and the multiple target media resources to an edge server, wherein the edge server is used to respond to a media resource acquisition request from the playback end.
[0006] According to another aspect of an embodiment of the present application, a media resource distribution device is provided, including: a first determination unit, used to determine a target transmission speed of an initial media resource to be distributed according to communication bandwidth information of a playback end; a second determination unit, used to determine a target transmission period of the initial media resource according to the target transmission speed and a historical transmission speed of a historical media resource; a third determination unit, used to determine a fragment size of a single media resource based on the target transmission speed and the target transmission period; a fragmentation unit, used to divide the initial media resource into multiple target media resources according to the fragment size, wherein the fragment size of each target media resource is the fragment size; a distribution unit, used to establish index information for multiple target media resources, and distribute the index information and the multiple target media resources to an edge server, wherein the edge server is used to respond to a media resource acquisition request from the playback end.
[0007] As an optional solution, a method for storing media resources is also provided, including: receiving multiple target media resources and multiple index information corresponding to the multiple target media resources; storing the multiple target media resources and multiple index information in a first cache area; determining popular target media resources that meet expected media resource conditions and popular index information corresponding to the popular target media resources from the multiple target media resources and multiple index information, wherein the expected media resource conditions are used to indicate that the frequency at which the target media resource is requested by a playback end within a preset time period is greater than a preset frequency threshold; after the preset time period, storing the popular target media resources and the popular index information in a second cache area, and deleting other target media resources and other index information except the popular target media resources and the popular index information from the multiple target media resources and the multiple index information from the first cache area.
[0008] As an optional solution, a storage device for media resources is also provided, including: a receiving unit, used to receive multiple target media resources and multiple index information corresponding to the multiple target media resources; a first storage unit, used to store the multiple target media resources and the multiple index information in a first cache area; a fourth determination unit, used to determine popular target media resources and popular index information corresponding to the popular target media resources that meet the expected media resource condition from the multiple target media resources and the multiple index information, wherein the expected media resource condition is used to indicate that the frequency at which the target media resource is requested by the playback end within a preset time period is greater than a preset frequency threshold; a second storage unit, used to store the popular target media resources and the popular index information in a second cache area after the preset time period, and to delete other target media resources and other index information except the popular target media resources and the popular index information from the first cache area.
[0009] According to another aspect of the embodiment of the present application, a computer program product is provided, the computer program product including a computer program / instruction, the computer instruction being stored in a computer-readable storage medium. A processor of a computer device reads the computer program / instruction from the computer-readable storage medium, and the processor executes the computer program / instruction, so that the computer device executes the above media resource distribution method or the above media resource storage method.
[0010] According to another aspect of an embodiment of the present application, there is also provided an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the above-mentioned media resource distribution method or the above-mentioned media resource storage method through the computer program.
[0011] In this embodiment, the target transmission speed of the initial media resource is determined according to the communication bandwidth information of the playback end, and then the target transmission period of the initial media resource is determined according to the target transmission speed of the initial media resource and the historical transmission speed of the historical media resource. In this way, the fragment size of a single media resource is determined based on the product of the target transmission speed and the target transmission period, and the initial media resource is divided based on the fragment size to obtain multiple target media resources, which are distributed to the edge server after the index information is established, thereby ensuring the network stability during the distribution of media resources and preventing the edge nodes with small bandwidth or high network fluctuation frequency from packet loss if the fragment size is large, thereby achieving the technical effect of improving the distribution effect of media resources and solving the technical problem of poor distribution effect of media resources in related technologies. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0013] Figure 1 is a schematic diagram of a process of an optional resource processing method according to an embodiment of the present application;
[0014] Figure 2 is a schematic diagram of a process of another optional resource processing method according to an embodiment of the present application;
[0015] Figure 3 is a schematic diagram of an optional resource processing method according to an embodiment of the present application;
[0016] Figure 4 is a schematic diagram of an optional resource processing method according to an embodiment of the present application;
[0017] Figure 5 is a schematic diagram of an optional resource processing method according to an embodiment of the present application;
[0018] Figure 6 is a schematic diagram of an optional resource processing device according to an embodiment of the present application;
[0019] Figure 7 is a schematic diagram of another optional resource processing device according to an embodiment of the present application;
[0020] Figure 8 A schematic structural diagram of an optional electronic device according to an embodiment of the present application.
[0021] Fig. 9 A schematic structural diagram of another optional electronic device according to an embodiment of the present application. DETAILED DESCRIPTION
[0022] In order to enable those skilled in the art to better understand the solution of the present application, 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 only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present application.
[0023] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0024] Optionally, as an optional implementation, as Figure 1 As shown, the method for distributing media resources includes the following specific steps:
[0025] S102, determining a target transmission speed of the initial media resource to be distributed according to the communication bandwidth information of the playback end;
[0026] S104, determining a target transmission period of the initial media resource according to the target transmission speed and the historical transmission speed of the historical media resource;
[0027] S106, determining a slice size of a single media resource based on a target transmission speed and a target transmission period;
[0028] S108, dividing the initial media resource into a plurality of target media resources according to the fragment size, wherein the fragment size of each target media resource is the fragment size;
[0029] S110, creating index information for multiple target media resources, and distributing the index information and the multiple target media resources to an edge server, wherein the edge server is used to respond to a media resource acquisition request from a playback terminal.
[0030] Optionally, in this embodiment, the method for distributing media resources can be applied to, but not limited to, a media file transmission scenario based on HLS (HTTP Live Streaming, HLS for short) fragmentation. In this scenario, the media file is divided into a series of small fragments (chunks), each of which usually lasts for a few seconds. These fragments can be dynamically loaded and played to adapt to different network conditions and devices.
[0031] It should be noted that in the related art, the size of media resource shards is mostly preset or random. For edge nodes with small bandwidth or high network fluctuation frequency, if the shard size is large, packet loss will easily occur, thereby affecting the use effect and resulting in poor distribution of media resources.
[0032] In response to the above problem, this embodiment determines the target transmission speed of the initial media resource based on the communication bandwidth information of the playback end, and then determines the target transmission period of the initial media resource based on the target transmission speed of the initial media resource and the historical transmission speed of the historical media resource. In this way, the fragment size of a single media resource is determined based on the product of the target transmission speed and the target transmission period, and the initial media resource is divided based on the fragment size to obtain multiple target media resources, which are distributed to the edge server after establishing index information, thereby ensuring network stability during media resource distribution and preventing edge nodes with small bandwidth or high network fluctuation frequency from packet loss if the fragment size is large, thereby achieving the technical effect of improving the distribution effect of media resources and solving the problem of poor distribution effect of the above-mentioned media resources.
[0033] Optionally, in this embodiment, the target transmission speed of the initial media resource to be distributed is determined based on the communication bandwidth information of the playback end, which may include but is not limited to determining the first playback end with the smallest communication bandwidth from all playback ends; and determining the target transmission speed based on the communication bandwidth of the first playback end.
[0034] Optionally, in this embodiment, the target transmission speed of the initial media resource to be distributed is determined based on the communication bandwidth information of the playback end, and it may also include but is not limited to determining a second playback end whose communication bandwidth meets the expected bandwidth condition from all playback ends; and determining the target transmission speed based on the average communication bandwidth of the second playback end.
[0035] It can be understood that the second playback end can be but is not limited to multiple playback ends that meet the expected bandwidth conditions, wherein the expected bandwidth conditions can be but are not limited to the communication bandwidth being greater than the first preset threshold, can also be but are not limited to the communication bandwidth being less than the second preset threshold, can also be but are not limited to being greater than the first preset threshold and less than the third preset threshold.
[0036] It should be noted that the transmission speed can be determined based on the communication bandwidth of the playback end, and can be calculated by, but not limited to, the following formula:
[0037] Transmission speed = communication bandwidth / 8
[0038] The unit of communication bandwidth is usually bits per second (bps), and the unit of transmission speed is usually bytes per second (Bps). Therefore, when calculating the transmission speed, the unit of communication bandwidth is converted to bytes per second. The specific conversion method is to divide the communication bandwidth by 8 to get the corresponding transmission speed.
[0039] Optionally, in this embodiment, the historical transmission speed of the historical media resource may be, but is not limited to, an average value of N transmission speeds corresponding to N previous media resource distributions occurring within a historical time period.
[0040] Optionally, in this embodiment, the target transmission period of the initial media resource is determined based on the target transmission speed and the historical transmission speed of the historical media resources, which may include, but is not limited to, determining the minimum time difference when the transmission speed is less than the target transmission speed for each media resource distribution process in the above-mentioned N media resource distributions in turn; and performing weighted summation of the minimum time differences for the N media resource distributions based on the weight coefficient and the minimum time difference corresponding to each media resource distribution process to obtain the target transmission period.
[0041] Optionally, in this embodiment, based on the weight coefficient and minimum time difference corresponding to each media resource distribution process, a weighted summation of the minimum time differences is performed on N media resource distributions to obtain a target transmission period, which may include but is not limited to: obtaining the i-th weight coefficient and the i-th minimum time difference corresponding to the i-th media resource distribution process, wherein the i-th weight coefficient is the accumulation of i+1 weight values, the m-th weight value among the i weight values is the m-1th power of a preset parameter, i is a positive integer less than or equal to N, and m is a natural number less than i; determining the product of the i-th weight coefficient and the i-th minimum time difference as the weighted product result corresponding to the i-th media resource distribution process; adding the weighted product results corresponding to each media resource distribution process in the N media resource distributions, and dividing by N to obtain the target transmission period.
[0042] Optionally, in this embodiment, determining the slice size of a single media resource based on the target transmission speed and the target transmission period may include, but is not limited to: determining the slice size of a single media resource based on the product of the target transmission speed and the target transmission period.
[0043] Optionally, in this embodiment, the fragment size of a single media resource is determined based on the product of the target transmission speed and the target transmission period, which may include but is not limited to: using 1 minus the value of the redundancy coefficient, multiplying it by the product of the target transmission speed and the target transmission period to obtain the fragment size of the single media resource.
[0044] It should be noted that the initial media resource is divided into a plurality of target media resources according to the fragment size, wherein the segment size of each target media resource is the fragment size.
[0045] Optionally, in this embodiment, index information is created for multiple target media resources, which may be, but is not limited to, used to instruct generation of m3u8 index files for the multiple target media resources.
[0046] It can be understood that the index information and multiple target media resources are distributed to the edge server, wherein the edge server is used to respond to the media resource acquisition request of the playback end.
[0047] Through the embodiments provided by the present application, the target transmission speed of the initial media resource is determined according to the communication bandwidth information of the playback end, and then the target transmission period of the initial media resource is determined according to the target transmission speed of the initial media resource and the historical transmission speed of the historical media resource. In this way, the fragment size of a single media resource is determined based on the product of the target transmission speed and the target transmission period, and the initial media resource is divided based on the fragment size to obtain multiple target media resources, which are distributed to the edge server after the index information is established, thereby ensuring the network stability during the distribution of media resources and preventing the edge nodes with small bandwidth or high network fluctuation frequency from packet loss if the fragment size is large, thereby improving the distribution effect of media resources.
[0048] As an optional solution, according to the target transmission speed and the historical transmission speed of the historical media resources, the target transmission period of the initial media resources is determined, including:
[0049] Obtain N transmission speeds corresponding to N media resource distributions occurring in a historical time period, and determine an average value of the N transmission speeds as a historical transmission speed, where N is a positive integer;
[0050] For each media resource distribution process in the N media resource distributions, determine the minimum time difference at which the transmission speed is less than the target transmission speed;
[0051] Based on the weight coefficient and the minimum time difference corresponding to each media resource distribution process, the minimum time difference of N media resource distributions is weightedly summed to obtain the target transmission period.
[0052] Optionally, in this embodiment, according to the transmission speed of the previous N media resource distribution processes, two transmission time nodes whose transmission speed is less than the target transmission speed are determined, and the time interval Δt between adjacent time nodes is calculated, and then the minimum value is taken to obtain Δt imin , represents the minimum time difference between two adjacent transmission speeds that are less than the target transmission speed in the current transmission speed.
[0053] Optionally, in this embodiment, according to The target transmission period t is calculated, where n is the number of media resource distributions that occurred in the historical time period, and k is the number of media resource distributions that occurred in the historical time period. i is the weight coefficient, which satisfies k i =a i-m +a i-m-1 +……+a i -1 , where a is a constant greater than 1, and m is a natural number less than i.
[0054] Through the embodiments provided by the present application, the fragment size is determined based on the target transmission speed and the target transmission period, thereby ensuring network stability during the transmission of media resources and preventing packet loss. The calculation of the target transmission period adopts the control method of the time node in combination with the weight, and the weight can be determined based on the fluctuation of the adjacent time, so that the result is more accurate.
[0055] As an optional solution, based on the weight coefficient and the minimum time difference corresponding to each media resource distribution process, the minimum time difference of N media resource distributions is weighted and summed to obtain the target transmission period, including:
[0056] Obtain the i-th weight coefficient and the i-th minimum time difference corresponding to the i-th media resource distribution process, wherein the i-th weight coefficient is the accumulation of i+1 weight values, the m-th weight value among the i+1 weight values is the m-1th power of a preset parameter, i is a positive integer less than or equal to N, and m is a natural number less than i;
[0057] Determine the product of the i-th weight coefficient and the i-th minimum time difference as the weighted product result corresponding to the i-th media resource distribution process;
[0058] The weighted product results corresponding to each media resource distribution process in the N media resource distributions are added together and divided by N to obtain the target transmission period.
[0059] Optionally, in this embodiment, the i-th weight coefficient corresponding to the i-th media resource distribution process is the accumulation of i+1 weight values, and the m-th weight value among the i weight values is the m-1th power of a preset parameter, where i is a positive integer less than or equal to N, and m is a natural number less than i.
[0060] Optionally, in this embodiment, the product of the i-th weight coefficient and the i-th minimum time difference is determined as the weighted product result corresponding to the i-th media resource distribution process; the weighted product results corresponding to each media resource distribution process in N media resource distributions are added and divided by N to obtain the target transmission period.
[0061] Through the embodiments provided in the present application, the target transmission period is calculated by using a time node control method in combination with weights, and the weights can be determined based on fluctuations in the adjacent time periods, thereby making the results more accurate.
[0062] As an optional solution, the target transmission speed of the initial media resource to be distributed is determined according to the communication bandwidth information of the playback end, including:
[0063] Determine a first playback terminal with the smallest communication bandwidth from all playback terminals;
[0064] Determine the target transmission speed according to the communication bandwidth of the first playback end; or,
[0065] Determine a second playback terminal whose communication bandwidth meets the expected bandwidth condition from all playback terminals;
[0066] The target transmission speed is determined according to the average communication bandwidth of the second playback end.
[0067] Optionally, in this embodiment, the second playback end may be, but is not limited to, multiple playback ends that meet the expected bandwidth condition, wherein the expected bandwidth condition may be, but is not limited to, the communication bandwidth being greater than a first preset threshold, may be, but is not limited to, the communication bandwidth being less than a second preset threshold, may be, but is not limited to, being greater than the first preset threshold and less than a third preset threshold.
[0068] It should be noted that the transmission speed can be determined based on the communication bandwidth of the playback end, and can be calculated by, but not limited to, the following formula:
[0069] Transmission speed = communication bandwidth / 8
[0070] The unit of communication bandwidth is usually bits per second (bps), and the unit of transmission speed is usually bytes per second (Bps). Therefore, when calculating the transmission speed, the unit of communication bandwidth is converted to bytes per second. The specific conversion method is to divide the communication bandwidth by 8 to get the corresponding transmission speed.
[0071] Optionally, as an optional implementation, as Figure 2 As shown, the method for storing media resources includes the following specific steps:
[0072] Receiving multiple target media resources and multiple index information corresponding to the multiple target media resources;
[0073] storing the plurality of target media resources and the plurality of index information in a first cache area;
[0074] Determine, from the plurality of target media resources and the plurality of index information, a popular target media resource that meets the expected media resource condition and popular index information corresponding to the popular target media resource, wherein the expected media resource condition is used to indicate that the frequency at which the target media resource is requested by the playback terminal within a preset time period is greater than a preset frequency threshold;
[0075] After a preset time period, the popular target media resources and popular index information are stored in the second cache area, and other target media resources and other index information except the popular target media resources and popular index information among the multiple target media resources and multiple index information are deleted from the first cache area.
[0076] Optionally, in this embodiment, the storage method of media resources can be applied to, but not limited to, a media file transmission scenario based on HLS (HTTP Live Streaming, HLS for short) fragmentation. In this scenario, the media file is divided into a series of small fragments (chunks), each of which usually lasts for a few seconds. These fragments can be dynamically loaded and played to adapt to different network conditions and devices.
[0077] Optionally, in this embodiment, multiple target media resources and multiple index information corresponding to the multiple target media resources can be, but are not limited to, obtained by dividing the initial media resources to be distributed by the central (control) server according to the fragment size of a single media resource, the fragment size of each target media resource is the above-mentioned fragment size, and each target media resource corresponds to one index information.
[0078] Optionally, in this embodiment, the central (control) server divides the initial media resources to be distributed according to the fragment size of a single media resource to obtain multiple target media resources and multiple index information, which can be achieved but is not limited to the above-mentioned media resource distribution method, which will not be repeated here.
[0079] Optionally, in this embodiment, the edge server may, but is not limited to, include a first cache area and a second cache area, wherein the first cache area is used for short-term caching (caching objects for at most a first time period), and the second cache area is used for long-term caching (caching objects for at most a second time period, the second time period being longer than the first time period).
[0080] Optionally, in this embodiment, the edge server initially caches the received multiple target media resources and multiple index information in a first cache area. Within a preset time period, if the frequency of being requested by the playback end is greater than a preset frequency threshold, the target media resource is determined to be a popular media resource, and the popular media resource and its corresponding popular index information are cached in a second cache area to reduce subsequent repeated requests and transmission delays.
[0081] Optionally, in this embodiment, other target media resources and other index information except popular target media resources and popular index information among the multiple target media resources and multiple index information are deleted from the first cache area to reduce storage pressure on the edge server.
[0082] The embodiment provided in the present application is improved, and target media resources whose frequency of being requested by the playback end is greater than a preset frequency threshold within a preset time period are cached in a second cache area for a long time, and other target media resources are deleted after the preset time period, which not only reduces subsequent repeated requests and transmission delays, but also reduces storage pressure.
[0083] As an optional solution, after playing the target media resource, the method further includes:
[0084] In response to a first media resource acquisition request requested by the first playback end, acquiring a first target media resource corresponding to the first index information from a cache area, wherein the first media resource acquisition request is used to request to acquire the first target media resource, and the cache area includes a first cache area and a second cache area;
[0085] If the first index information does not exist in the cache area, forward the first media resource acquisition request to other edge servers;
[0086] Obtain the first target media resource from other edge servers.
[0087] Optionally, in this embodiment, in response to the first media resource acquisition request requested by the first playback end, the first target media resource corresponding to the first index information is acquired from the cache area.
[0088] It should be noted that, when the first index information does not exist in the cache area, the first media resource acquisition request is forwarded to other edge servers, and the other edge servers respond to the request and acquire the first target media resource.
[0089] It is understandable that, for the playback end, after receiving the m3u8 index file, it first attempts to obtain media resources from the nearest edge server. If the edge server does not have the required media resources, or cannot respond in time due to network congestion and other reasons, the playback end will initiate a request to other edge servers (such as adjacent or nearest edge servers).
[0090] Through the embodiments provided by the present application, when the required media resources do not exist on the current edge server, the request is forwarded, thereby improving the efficiency and flexibility of the transmission of media resources.
[0091] As an optional solution, the above media resource distribution method is applied to a video transmission system based on HLS segmentation, such as Figure 3 As shown, the video transmission system includes a video source server 302, a central control server 304, an edge node 306, and a playback terminal 308. The video source server 302 is responsible for collecting and encoding the original video data and transmitting it to the central control server 304. The central control server 304 is responsible for the distribution of video streams, node management, data synchronization, and network status monitoring. The edge node 306, a node located at the edge of the network, has a large bandwidth and storage capacity, is responsible for caching and forwarding video data, and reduces the burden of the central control server. The playback terminal 308 is used to receive and play video data.
[0092] Optionally, in Figure 3 In the video transmission system shown, the central control server 304 adopts a data transmission mechanism based on the HLS protocol to divide the video stream into multiple TS file segments, and generates an m3u8 index file, which is distributed to the edge node 306. The playback end 308 downloads the file segments from the edge node 306 in sequence according to the m3u8 index file for playback.
[0093] Optionally, the video segmentation and indexing process performed by the central control server 304 is as follows: Figure 4 As shown, the specific steps include:
[0094] S402, after establishing the communication connection, obtaining the communication bandwidth of each playback end, and calculating the corresponding transmission speed V according to the communication bandwidth of each playback end;
[0095] S404, obtaining an adaptive stable transmission period t according to the previous transmission speed;
[0096] S406, setting a redundancy coefficient Δ, and then calculating the size of a single TS file segment according to the formula P=(1-Δ)Vt;
[0097] S408, dividing the file into a plurality of file segments of P size.
[0098] Optionally, in the above step S404, the process of determining the stable transmission period t includes the following specific steps: Figure 5 As shown, including:
[0099] S502, obtaining the transmission speeds of the previous n times by monitoring the previous transmission speeds;
[0100] S504: Determine two transmission time nodes whose transmission speed is less than V according to the transmission speeds of the previous n times, calculate the time interval Δt between adjacent time nodes, and then take the minimum value to obtain Δt imin , which represents the minimum time difference between two adjacent transmission speeds less than V in the previous i-th transmission speed;
[0101] S506, according to Calculate the adaptive stable transmission period t,k i is the weight coefficient, which satisfies k i =a i-m +a i-m-1 +……+a i-1 , where a is a constant greater than 1, and m is a natural number less than i.
[0102] Optionally, in Figure 3 In the video transmission system shown, for the player 308, after receiving the m3u8 index file, first try to obtain the TS file segment from the nearest edge node. If the edge node does not have the required TS file segment, or cannot respond in time due to network congestion and other reasons, the player will initiate a request to other players.
[0103] Optionally, the playback terminal 308 has a built-in verification unit. The working logic of the verification unit includes: according to the m3u8 index file, the index identifier of the multiple files connected is confirmed; the index identifier of the current playback segment is obtained, and the local cache is checked to see if there is an index identifier of the next playback segment; if not, the file segment with the corresponding index identifier is obtained from other edge nodes.
[0104] Through the embodiments provided by the present application, the shard size can be determined based on the node bandwidth and the frequency of past network fluctuations, thereby ensuring the stability of the network during transmission and preventing packet loss. In addition, the calculation of the fluctuation frequency adopts the control method of the time node in combination with the weight, and the weight can be determined based on the fluctuation of the adjacent time, so that the result is more accurate.
[0105] It is understandable that in the specific implementation of this application, related data such as user information is involved. When the above embodiments of this application are applied to specific products or technologies, user permission or consent is required, and the collection, use and processing of relevant data need to comply with relevant laws, regulations and standards of relevant countries and regions.
[0106] It should be noted that, for the aforementioned method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the described order of actions, because according to the present application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present application.
[0107] Optionally, as an optional implementation, as Figure 6 As shown, the media resource distribution device includes:
[0108] A first determining unit 602 is used to determine a target transmission speed of an initial media resource to be distributed according to the communication bandwidth information of the playback end;
[0109] A second determining unit 604 is used to determine a target transmission period of the initial media resource according to the target transmission speed and the historical transmission speed of the historical media resource;
[0110] A third determining unit 606, configured to determine a fragment size of a single media resource based on a product of a target transmission rate and a target transmission period;
[0111] A fragmentation unit 608, configured to divide the initial media resource into a plurality of target media resources according to the fragment size, wherein the segment size of each target media resource is the fragment size;
[0112] The distribution unit 610 is used to create index information for multiple target media resources, and distribute the index information and the multiple target media resources to an edge server, wherein the edge server is used to respond to a media resource acquisition request from a playback terminal.
[0113] As an optional solution, the second determining unit 604 includes:
[0114] A first acquisition module is used to acquire N transmission speeds corresponding to N media resource distributions occurring in a historical time period, and determine an average value of the N transmission speeds as a historical transmission speed, where N is a positive integer;
[0115] A first determination module is used to determine, in turn, for each media resource distribution process in the N media resource distributions, a minimum time difference at which the transmission speed is less than the target transmission speed;
[0116] The second determination module is used to perform weighted summation of the minimum time differences of N media resource distributions based on the weight coefficient and the minimum time difference corresponding to each media resource distribution process to obtain a target transmission period.
[0117] As an optional solution, the second determining module includes:
[0118] An acquisition submodule is used to obtain the i-th weight coefficient and the i-th minimum time difference corresponding to the i-th media resource distribution process, wherein the i-th weight coefficient is the accumulation of i+1 weight values, the m-th weight value among the i weight values is the m-1th power of a preset parameter, i is a positive integer less than or equal to N, and m is a natural number less than i;
[0119] A first determination submodule, used to determine the product of the i-th weight coefficient and the i-th minimum time difference as the weighted product result corresponding to the i-th media resource distribution process;
[0120] The second determination submodule is used to add the weighted product results corresponding to each media resource distribution process in the N media resource distributions, and divide the result by N to obtain a target transmission period.
[0121] As an optional solution, the first determining unit 602 includes:
[0122] A third determining module, used to determine a first playback terminal with the smallest communication bandwidth from all playback terminals;
[0123] A fourth determination module is used to determine a target transmission speed according to the communication bandwidth of the first playback end; or,
[0124] A fifth determination module, used to determine a second playback terminal whose communication bandwidth meets the expected bandwidth condition from all playback terminals;
[0125] The sixth determination module is used to determine the target transmission speed according to the average communication bandwidth of the second playback end.
[0126] Optionally, as an optional implementation, as Figure 7 As shown, the storage device of the media resource includes:
[0127] A receiving unit 702, configured to receive a plurality of target media resources and a plurality of index information corresponding to the plurality of target media resources;
[0128] A first storage unit 704, used to store multiple target media resources and multiple index information in a first cache area;
[0129] The fourth determining unit 706 is used to determine, from the multiple target media resources and the multiple index information, the popular target media resources that meet the expected media resource condition and the popular index information corresponding to the popular target media resources, wherein the expected media resource condition is used to indicate that the frequency of the target media resource being requested by the playback terminal within a preset time period is greater than a preset frequency threshold;
[0130] The second storage unit is used to store popular target media resources and popular index information in a second cache area after a preset time period, and delete other target media resources and other index information except the popular target media resources and popular index information from the first cache area among multiple target media resources and multiple index information.
[0131] As an optional solution, the device also includes:
[0132] A second acquisition module is used to acquire, after playing the target media resource, a first target media resource corresponding to the first index information from a cache area in response to a first media resource acquisition request requested by the first playback end, wherein the first media resource acquisition request is used to request to acquire the first target media resource, and the cache area includes a first cache area and a second cache area;
[0133] A forwarding module, configured to forward the first media resource acquisition request to other edge servers after playing the target media resource if the first index information does not exist in the cache area;
[0134] The third acquisition module is used to acquire the first target media resource from other edge servers after playing the target media resource.
[0135] According to one aspect of the embodiments of the present application, an electronic device for implementing the above-mentioned media resource distribution method is also provided, further as follows Figure 8 As shown, the electronic device includes a memory 802 and a processor 804. The memory 802 stores a computer program, and the processor 804 is configured to execute the steps in any of the above method embodiments through the computer program.
[0136] Optionally, in this embodiment, the electronic device may be located in at least one network device among a plurality of network devices of a computer network.
[0137] Optionally, in this embodiment, the processor may be configured to perform the following steps through a computer program:
[0138] S1, determining the target transmission speed of the initial media resource to be distributed according to the communication bandwidth information of the playback end;
[0139] S2, determining a target transmission period of the initial media resource according to the target transmission speed and the historical transmission speed of the historical media resource;
[0140] S3, determining the fragment size of a single media resource based on the product of the target transmission speed and the target transmission period;
[0141] S4, dividing the initial media resource into a plurality of target media resources according to the fragment size, wherein the fragment size of each target media resource is the fragment size;
[0142] S5, creating index information for the multiple target media resources, and distributing the index information and the multiple target media resources to an edge server, wherein the edge server is used to respond to the media resource acquisition request of the playback end.
[0143] Alternatively, a person skilled in the art may understand that: Figure 8 The structure shown is for illustration only. Figure 8 The structure of the electronic device is not limited. Figure 8 More or fewer components (such as network interfaces, etc.) as shown in, or with Figure 8 Different configurations are shown.
[0144] Among them, the memory 802 can be used to store software programs and modules, such as the program instructions / modules corresponding to the resource processing method and device in the embodiments of the present application. The processor 804 executes various functional applications and data processing by running the software programs and modules stored in the memory 802, that is, to realize the above-mentioned method of distributing media resources. The memory 802 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 802 may further include a memory remotely located relative to the processor 804, and these remote memories may be connected to the electronic device via a network. Examples of the above-mentioned networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof. Among them, the memory 802 can be specifically, but not limited to, used to store multiple target media resources, multiple index information, and other information. As an example, such as Figure 8 As shown, the memory 802 may include, but is not limited to, the first determination unit 602, the second determination unit 604, the third determination unit 606, the slicing unit 608, and the distribution unit 610 in the resource processing device. In addition, other module units in the resource processing device may also be included but are not limited to, which will not be repeated in this example.
[0145] Optionally, the transmission device 806 is used to receive or send data via a network. Specific examples of the network may include wired networks and wireless networks. In one example, the transmission device 806 includes a network adapter (Network Interface Controller, NIC), which can be connected to other network devices and routers via a network cable so as to communicate with the Internet or a local area network. In one example, the transmission device 806 is a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0146] In addition, the electronic device further includes: a display 808 for displaying information such as a plurality of target media resources and a plurality of index information; and a connection bus 810 for connecting various module components in the electronic device.
[0147] In other embodiments, the client or server may be a node in a distributed system, wherein the distributed system may be a blockchain system, and the blockchain system may be a distributed system formed by connecting the multiple nodes in the form of network communication. A peer-to-peer network may be formed between the nodes, and any form of computing device, such as a server, a client, or other electronic device, may become a node in the blockchain system by joining the peer-to-peer network.
[0148] According to one aspect of the embodiments of the present application, an electronic device for implementing the above-mentioned media resource distribution method is also provided, further as follows Fig. 9 As shown, the electronic device includes a memory 902 and a processor 904. The memory 902 stores a computer program, and the processor 904 is configured to execute the steps in any of the above method embodiments through the computer program.
[0149] Optionally, in this embodiment, the electronic device may be located in at least one network device among a plurality of network devices of a computer network.
[0150] Optionally, in this embodiment, the processor may be configured to perform the following steps through a computer program:
[0151] S1, receiving multiple target media resources and multiple index information corresponding to the multiple target media resources;
[0152] S2, storing the multiple target media resources and the multiple index information in a first cache area;
[0153] S3, determining popular target media resources and popular index information corresponding to the popular target media resources that meet the expected media resource condition from the multiple target media resources and the multiple index information, wherein the expected media resource condition is used to indicate that the frequency of the target media resource being requested by the playback terminal within a preset time period is greater than a preset frequency threshold;
[0154] After a preset time period, the popular target media resources and popular index information are stored in the second cache area, and other target media resources and other index information except the popular target media resources and popular index information among the multiple target media resources and multiple index information are deleted from the first cache area.
[0155] Alternatively, a person skilled in the art may understand that: Fig. 9 The structure shown is for illustration only. Fig. 9 The structure of the electronic device is not limited. Fig. 9 More or fewer components (such as network interfaces, etc.) as shown in, or with Fig. 9 Different configurations shown.
[0156] Among them, the memory 902 can be used to store software programs and modules, such as the program instructions / modules corresponding to the resource processing method and device in the embodiments of the present application. The processor 904 executes various functional applications and data processing by running the software programs and modules stored in the memory 902, that is, to implement the above-mentioned method of storing media resources. The memory 902 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 902 may further include a memory remotely located relative to the processor 904, and these remote memories may be connected to the electronic device via a network. Examples of the above-mentioned networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof. Among them, the memory 902 can be specifically, but not limited to, used to store multiple target media resources, multiple index information, and other information. As an example, such as Fig. 9 As shown, the memory 902 may include but is not limited to the receiving unit 702, the first storage unit 704, and the fourth determination unit 706 in the resource processing device. In addition, it may also include but is not limited to other module units in the resource processing device, which will not be repeated in this example.
[0157] Optionally, the transmission device 906 is used to receive or send data via a network. Specific examples of the above-mentioned network may include a wired network and a wireless network. In one example, the transmission device 906 includes a network adapter (Network Interface Controller, NIC), which can be connected to other network devices and routers via a network cable so as to communicate with the Internet or a local area network. In one example, the transmission device 906 is a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0158] In addition, the electronic device further includes: a display 906 for displaying information such as a plurality of target media resources and a plurality of index information; and a connection bus 910 for connecting various module components in the electronic device.
[0159] In other embodiments, the client or server may be a node in a distributed system, wherein the distributed system may be a blockchain system, and the blockchain system may be a distributed system formed by connecting the multiple nodes in the form of network communication. A peer-to-peer network may be formed between the nodes, and any form of computing device, such as a server, a client, or other electronic device, may become a node in the blockchain system by joining the peer-to-peer network.
[0160] According to one aspect of the present application, a computer program product is provided, the computer program product comprising a computer program / instruction, the computer program / instruction comprising a program code for executing the method shown in the flow chart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication part, and / or installed from a removable medium. When the computer program is executed by a central processing unit, various functions provided by the embodiments of the present application are executed.
[0161] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.
[0162] It should be noted that the computer system of the electronic device is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0163] The computer system includes a central processing unit (CPU), which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) or the program loaded from the storage part to the random access memory (RAM). In the random access memory, various programs and data required for system operation are also stored. The central processing unit, the read-only memory and the random access memory are connected to each other through a bus. The input / output interface (I / O interface) is also connected to the bus.
[0164] The following components are connected to the input / output interface: an input part including a keyboard, a mouse, etc.; an output part including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker; a storage part including a hard disk, etc.; and a communication part including a network interface card such as a local area network card, a modem, etc. The communication part performs communication processing via a network such as the Internet. A drive is also connected to the input / output interface as needed. Removable media, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., are installed on the drive as needed so that the computer program read therefrom is installed into the storage part as needed.
[0165] In particular, according to an embodiment of the present application, the process described in each method flow chart can be implemented as a computer software program. For example, an embodiment of the present application includes a computer program product, which includes a computer program carried on a computer readable medium, and the computer program contains a program code for executing the method shown in the flow chart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication part, and / or installed from a removable medium. When the computer program is executed by a central processing unit, various functions defined in the system of the present application are executed.
[0166] According to one aspect of the present application, a computer-readable storage medium is provided, and a processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the methods provided in the above-mentioned various optional implementations.
[0167] Optionally, in this embodiment, the computer-readable storage medium may be configured to store data for executing the media resource distribution method or the media resource storage method.
[0168] Optionally, in this embodiment, a person of ordinary skill in the art may understand that all or part of the steps in the various methods of the above embodiments may be completed by instructing hardware related to the electronic device through a program, and the program may be stored in a computer-readable storage medium, and the storage medium may include: a flash drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.
[0169] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.
[0170] If the integrated units in the above embodiments are implemented in the form of software functional units and sold or used as independent products, they can be stored in the above computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for enabling one or more computer devices (which can be personal computers, servers or network devices, etc.) to execute all or part of the steps of the methods of each embodiment of the present application.
[0171] In the above embodiments of the present application, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, please refer to the relevant description of other embodiments.
[0172] In the several embodiments provided in the present application, it should be understood that the recorded client can be implemented in other ways. Among them, the device embodiments described above are only schematic, for example, the division of units is only a logical function division, and there may be other division methods in actual implementation, for example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.
[0173] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0174] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0175] The above are only preferred implementations of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.
Claims
1. A method for distributing media resources, characterized in that: include: Determine the target transmission speed of the initial media resource to be distributed according to the communication bandwidth information of the playback end; Determining a target transmission period of the initial media resource according to the target transmission speed and a historical transmission speed of a historical media resource; Determining a slice size of a single media resource based on the target transmission speed and the target transmission period; According to the fragment size, the initial media resource is divided into a plurality of target media resources, wherein the segment size of each target media resource is the fragment size; Index information is created for the multiple target media resources, and the index information and the multiple target media resources are distributed to an edge server, wherein the edge server is used to respond to the media resource acquisition request of the playback end.
2. The method according to claim 1, characterized in that The step of determining the target transmission period of the initial media resource according to the target transmission speed and the historical transmission speed of the historical media resource includes: Obtaining N transmission speeds corresponding to N media resource distributions occurring in a historical time period, and determining an average value of the N transmission speeds as the historical transmission speed, where N is a positive integer; For each media resource distribution process in the N media resource distributions, determining a minimum time difference at which a transmission speed is less than a target transmission speed; Based on the weight coefficient corresponding to each media resource distribution process and the minimum time difference, a weighted sum of the minimum time differences is performed on the N media resource distributions to obtain the target transmission period.
3. The method according to claim 2, characterized in that The step of performing weighted summation of the minimum time difference for the N media resource distributions based on the weight coefficient corresponding to each media resource distribution process and the minimum time difference to obtain the target transmission period includes: Obtaining the i-th weight coefficient and the i-th minimum time difference corresponding to the i-th media resource distribution process, wherein the i-th weight coefficient is the accumulation of i+1 weight values, the m-th weight value among the i+1 weight values is the m-1th power of a preset parameter, i is a positive integer less than or equal to N, and m is a natural number less than i; Determine the product of the i-th weight coefficient and the i-th minimum time difference as the weighted product result corresponding to the i-th media resource distribution process; The target transmission period is obtained by adding up the weighted product results corresponding to each media resource distribution process in the N media resource distributions and dividing the result by N.
4. The method according to any one of claims 1 to 3, characterized in that: The step of determining the target transmission speed of the initial media resource to be distributed according to the communication bandwidth information of the playback end includes: Determine a first playback terminal with the smallest communication bandwidth from all playback terminals; Determine the target transmission speed according to the communication bandwidth of the first playback end; or determine a second playback end whose communication bandwidth meets the expected bandwidth condition from all the playback ends; The target transmission speed is determined according to the average communication bandwidth of the second playback end.
5. A method for storing media resources, characterized in that: include: Receive multiple target media resources and multiple index information corresponding to the multiple target media resources; storing the plurality of target media resources and the plurality of index information in a first cache area; Determine, from the multiple target media resources and the multiple index information, a popular target media resource that meets an expected media resource condition and popular index information corresponding to the popular target media resource, wherein the expected media resource condition is used to indicate that the frequency of the target media resource being requested by the playback terminal within a preset time period is greater than a preset frequency threshold; After the preset time period, the popular target media resource and the popular index information are stored in a second cache area, and other target media resources and other index information among the multiple target media resources and the multiple index information except the popular target media resource and the popular index information are deleted from the first cache area.
6. The method according to claim 5, characterized in that After playing the target media resource, the method further includes: In response to a first media resource acquisition request requested by the first playback end, acquiring a first target media resource corresponding to the first index information from a cache area, wherein the first media resource acquisition request is used to request to acquire the first target media resource, and the cache area includes the first cache area and the second cache area; If the first index information does not exist in the cache area, forwarding the first media resource acquisition request to another edge server; The first target media resource is obtained from the other edge server.
7. A resource processing device, characterized in that: include: A first determining unit, configured to determine a target transmission speed of an initial media resource to be distributed according to communication bandwidth information of a playback terminal; A second determining unit, configured to determine a target transmission period of the initial media resource according to the target transmission speed and the historical transmission speed of the historical media resource; A third determining unit, configured to determine a fragment size of a single media resource based on a target transmission speed and a target transmission period; A fragmentation unit, used to divide the initial media resource into a plurality of target media resources according to the fragment size, wherein the segment size of each target media resource is the fragment size; The distribution unit is used to create index information for multiple target media resources and distribute the index information and the multiple target media resources to the edge server, wherein the edge server is used to respond to the media resource acquisition request of the playback end.
8. A resource processing device, characterized in that: include: A receiving unit, configured to receive a plurality of target media resources and a plurality of index information corresponding to the plurality of target media resources; A first storage unit, used to store multiple target media resources and multiple index information in a first cache area; a fourth determination unit, configured to determine, from the plurality of target media resources and the plurality of index information, a popular target media resource that meets an expected media resource condition and popular index information corresponding to the popular target media resource, wherein the expected media resource condition is used to indicate that the frequency at which the target media resource is requested by the playback terminal within a preset time period is greater than a preset frequency threshold; The second storage unit is used to store popular target media resources and popular index information in a second cache area after a preset time period, and delete other target media resources and other index information except the popular target media resources and popular index information from the first cache area among multiple target media resources and multiple index information.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes a stored program, wherein the program executes the method described in any one of claims 1 to 4 or 5 to 6 when executed by an electronic device.
10. An electronic device comprising a memory and a processor, characterized in that: A computer program is stored in the memory, and the processor is configured to execute the method described in any one of claims 1 to 4 or 5 to 6 through the computer program.