CN114125493B - Distributed storage method, device and equipment for streaming media - Google Patents

Distributed storage method, device and equipment for streaming media Download PDF

Info

Publication number
CN114125493B
CN114125493B CN202111387482.7A CN202111387482A CN114125493B CN 114125493 B CN114125493 B CN 114125493B CN 202111387482 A CN202111387482 A CN 202111387482A CN 114125493 B CN114125493 B CN 114125493B
Authority
CN
China
Prior art keywords
data
streaming media
code stream
media data
frame
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202111387482.7A
Other languages
Chinese (zh)
Other versions
CN114125493A (en
Inventor
陆家龙
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Vtron Group Co Ltd
Original Assignee
Vtron Group Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Vtron Group Co Ltd filed Critical Vtron Group Co Ltd
Priority to CN202111387482.7A priority Critical patent/CN114125493B/en
Publication of CN114125493A publication Critical patent/CN114125493A/en
Application granted granted Critical
Publication of CN114125493B publication Critical patent/CN114125493B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/20Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
    • H04N21/23Processing of content or additional data; Elementary server operations; Server middleware
    • H04N21/231Content storage operation, e.g. caching movies for short term storage, replicating data over plural servers, prioritizing data for deletion
    • H04N21/23103Content storage operation, e.g. caching movies for short term storage, replicating data over plural servers, prioritizing data for deletion using load balancing strategies, e.g. by placing or distributing content on different disks, different memories or different servers
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/20Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
    • H04N21/23Processing of content or additional data; Elementary server operations; Server middleware
    • H04N21/234Processing of video elementary streams, e.g. splicing of video streams or manipulating encoded video stream scene graphs
    • H04N21/23418Processing of video elementary streams, e.g. splicing of video streams or manipulating encoded video stream scene graphs involving operations for analysing video streams, e.g. detecting features or characteristics
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/60Network structure or processes for video distribution between server and client or between remote clients; Control signalling between clients, server and network components; Transmission of management data between server and client, e.g. sending from server to client commands for recording incoming content stream; Communication details between server and client 
    • H04N21/63Control signaling related to video distribution between client, server and network components; Network processes for video distribution between server and clients or between remote clients, e.g. transmitting basic layer and enhancement layers over different transmission paths, setting up a peer-to-peer communication via Internet between remote STB's; Communication protocols; Addressing
    • H04N21/643Communication protocols

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Information Transfer Between Computers (AREA)
  • Two-Way Televisions, Distribution Of Moving Picture Or The Like (AREA)

Abstract

The invention discloses a distributed storage method, a device and equipment of streaming media, which are applied to a master control manager, wherein the master control manager is in communication connection with a storage server, the storage server comprises a plurality of distributed storage nodes, and the method comprises the following steps: acquiring initial streaming media data frame by frame; adding a corresponding time stamp for the initial streaming media data according to a transmission protocol corresponding to the initial streaming media data to obtain intermediate streaming media data; performing code stream encapsulation and splicing on the intermediate stream media data frame by frame to obtain spliced code stream data; and determining and storing the target storage node position of the spliced code stream data according to the residual storage space value and the load path number corresponding to each distributed storage node, thereby reducing the storage time while ensuring the low transmission cost of the stream media data.

Description

Distributed storage method, device and equipment for streaming media
Technical Field
The present invention relates to the field of streaming media storage technologies, and in particular, to a method, an apparatus, and a device for distributed storage of streaming media.
Background
With the continuous development of storage technology, distributed storage has become a more common storage mode. There are still few distributed storage approaches for streaming media in terms of storing objects.
In a traditional distributed storage mode, the target is usually of a known data size, the data is split, and the split data is stored to different storage nodes through a storage algorithm; when the data is read, the data stored in different storage nodes are respectively extracted and then spliced, and the spliced data are transmitted to a user side.
However, for the streaming media type data storage, such as live broadcast, security protection, etc., only the intercepting part is needed to be checked during reading, but the above traditional distributed storage mode needs to intercept the data again after the data is completely spliced, which takes too much time and further increases the transmission cost.
Disclosure of Invention
The invention provides a distributed storage method, a device and equipment for streaming media, which solve the technical problem that the transmission cost is increased due to excessive time consumption caused by the fact that the stored data are intercepted again after being spliced in the prior art.
The distributed storage method of the streaming media provided in the first aspect of the present invention is applied to a master control manager, where the master control manager is in communication connection with a storage server, and the storage server includes a plurality of distributed storage nodes, and the method includes:
acquiring initial streaming media data frame by frame;
adding a corresponding time stamp to the initial streaming media data according to a transmission protocol corresponding to the initial streaming media data to obtain intermediate streaming media data;
carrying out code stream encapsulation and splicing on the intermediate stream media data frame by frame to obtain spliced code stream data;
and determining and storing the target storage node position of the spliced code stream data according to the residual storage space value and the load path number corresponding to each distributed storage node.
Optionally, the step of adding a corresponding timestamp to the initial streaming media data according to a transmission protocol corresponding to the initial streaming media data to obtain intermediate streaming media data includes:
analyzing a transmission protocol corresponding to the initial streaming media data to obtain a transmission frame rate corresponding to the initial streaming media data of the current frame;
and adding a corresponding time stamp to the initial streaming media data according to the transmission frame rate to obtain intermediate streaming media data.
Optionally, the method further comprises:
calculating a time stamp difference value between a time stamp corresponding to the intermediate streaming media data of the previous frame and a time stamp corresponding to the intermediate streaming media data of the current frame;
comparing the absolute value of the timestamp difference value with a preset difference value threshold;
and if the absolute value of the timestamp difference value is larger than the difference value threshold value, adding a new timestamp to the initial streaming media data again according to the transmission frame rate to obtain new intermediate streaming media data.
Optionally, the step of determining and storing the target storage node position of the spliced code stream data according to the remaining storage space value and the load path number corresponding to each distributed storage node respectively includes:
performing data slicing on the spliced code stream data according to the residual storage space values corresponding to the distributed storage nodes respectively to obtain a plurality of sliced code stream data and corresponding time period information;
and determining and storing the target storage node position of the chip code stream data based on the load path number corresponding to each distributed storage node.
Optionally, the step of performing data slicing on the spliced code stream data according to the remaining storage space values respectively corresponding to the distributed storage nodes to obtain a plurality of sliced code stream data and respectively corresponding period information includes:
comparing the residual storage space values corresponding to the distributed storage nodes, and determining a minimum value as a minimum residual storage space value;
performing data slicing on the spliced code stream data according to a preset data slicing rule and the minimum residual storage space value to obtain a plurality of sliced code stream data;
calculating the ratio between the slicing capacity of the slicing code stream data and the byte length of the spliced code stream data of each frame to obtain the corresponding storage frame number of the slicing code stream data;
and calculating the sum of the storage frame numbers to obtain the time period information corresponding to the chip code stream data.
Optionally, the step of determining and storing the target storage node position of the sliced code stream data based on the load path number corresponding to each distributed storage node includes:
sequencing all the distributed storage nodes according to the load path numbers respectively corresponding to the distributed storage nodes, and determining sequencing numbers of each distributed storage node;
determining a target storage node position corresponding to the fragment code stream data based on a preset storage node calculation formula and combining the sequencing number, and storing the target storage node position;
the calculation formula of the storage node is as follows:
Node=(lastNode+1)%nodeNum;
the Node is a sorting number corresponding to the target storage Node position, the nodeNum is the total number of the distributed storage nodes currently, and the lastNode is a sorting number corresponding to the last target storage Node position.
Optionally, the method further comprises:
and respectively establishing the association information between each time period information and each target storage node position to obtain a time period key value table.
Optionally, the method further comprises:
when a data acquisition request sent by a user terminal is received, the data acquisition request is analyzed, and a corresponding data acquisition period is determined;
searching the time period key value table by adopting the data acquisition time period, and determining a plurality of storage node positions to be returned and time period information to be returned, which correspond to the data acquisition time period;
sequentially acquiring the fragment code stream data corresponding to the period to be returned from each storage node position to be returned as target code stream data, and returning to the user terminal;
and when the return progress of the target code stream data exceeds a preset return threshold value, returning the target code stream data in the next storage node to be returned in parallel.
A second aspect of the present invention provides a distributed storage device for streaming media, applied to a master manager, where the master manager is communicatively connected to a storage server, and the storage server includes a plurality of distributed storage nodes, and the device includes:
the streaming media data acquisition module is used for acquiring initial streaming media data frame by frame;
the time stamp adding module is used for adding a corresponding time stamp for the initial streaming media data according to a transmission protocol corresponding to the initial streaming media data to obtain intermediate streaming media data;
the data encapsulation and splicing module is used for carrying out code stream encapsulation and splicing on the intermediate stream media data frame by frame to obtain spliced code stream data;
and the node determining and storing module is used for determining and storing the target storage node position of the spliced code stream data according to the residual storage space value and the load path number which are respectively corresponding to each distributed storage node.
A third aspect of the present invention provides an electronic device comprising a memory and a processor, the memory storing a computer program, which when executed by the processor, causes the processor to perform the steps of the method for distributed storage of streaming media according to any of the first aspect of the present invention.
From the above technical scheme, the invention has the following advantages:
the method comprises the steps of obtaining initial streaming media data frame by frame, adding corresponding time stamps for the initial streaming media data based on a transmission protocol corresponding to the initial streaming media data to obtain intermediate streaming media data, and meanwhile, when one frame of intermediate streaming media data is generated, carrying out code stream encapsulation on the frame of intermediate streaming media data and splicing the frame of intermediate streaming media data with the last frame of intermediate streaming media data to obtain spliced code stream data; and finally, according to the residual storage space and the load path number corresponding to each distributed storage node, performing data slicing on the spliced code stream data, determining the position of a target storage node and storing the target storage node. Therefore, the technical problem that the transmission cost is increased due to excessive time consumption because the stored data is required to be intercepted again after being spliced in the prior art is solved, and the storage time is reduced while the transmission cost is lower.
Drawings
In order to more clearly illustrate the embodiments of the invention or the technical solutions of the prior art, the drawings which are used in the description of the embodiments or the prior art will be briefly described, it being obvious that the drawings in the description below are only some embodiments of the invention, and that other drawings can be obtained from these drawings without inventive faculty for a person skilled in the art.
Fig. 1 is a flowchart of a step of a method for distributed storage of streaming media according to a first embodiment of the present invention;
fig. 2 is a flowchart of a step of a distributed storage method of streaming media according to a second embodiment of the present invention;
fig. 3 is a schematic flow chart of code stream encapsulation and data splicing according to an embodiment of the present invention;
fig. 4 is a block and storage flow chart of spliced code stream data according to an embodiment of the present invention;
FIG. 5 is a flowchart of a target code stream data return provided in an embodiment of the present invention;
fig. 6 is a block diagram of a distributed storage device for streaming media according to a third embodiment of the present invention.
Detailed Description
The embodiment of the invention provides a distributed storage method, a device and equipment for streaming media, which are used for solving the technical problem that the transmission cost is increased due to excessive time consumption caused by intercepting transmission again after splicing storage data in the prior art.
In order to make the objects, features and advantages of the present invention more comprehensible, the technical solutions in the embodiments of the present invention are described in detail below with reference to the accompanying drawings, and it is apparent that the embodiments described below are only some embodiments of the present invention, but not all embodiments of the present invention. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
Referring to fig. 1, fig. 1 is a flowchart illustrating steps of a method for distributed storage of streaming media according to an embodiment of the present invention.
The invention provides a distributed storage method of streaming media, which is applied to a master control manager, wherein the master control manager is in communication connection with a storage server, the storage server comprises a plurality of distributed storage nodes, and the method comprises the following steps:
step 101, obtaining initial streaming media data frame by frame;
the initial streaming media data refers to media data which are continuous in time, such as audio, video, animation, multimedia and the like, the content of which can be transmitted without conversion by adopting streaming technology information, and in the embodiment of the invention, the initial streaming media data mainly comprises video streaming data in the format of H264/H265+AAC and the like.
In the embodiment of the invention, since the initial streaming media data is usually streaming, in order to ensure the display continuity of the subsequent streaming media data, the device acquires the initial streaming media data frame by frame and then processes the initial streaming media data acquired by each frame.
Step 102, adding a corresponding time stamp to the initial streaming media data according to a transmission protocol corresponding to the initial streaming media data to obtain intermediate streaming media data;
in a specific implementation, the user side generally performs data acquisition such as playback video recording, video skip and drag according to time sequence when searching for streaming media data.
Therefore, after receiving a frame of initial streaming media data, the corresponding transmission protocol can be further obtained from the initial streaming media data to determine the frame rate corresponding to the initial streaming media data of the current frame, and the frame rate is used as a basis to add a corresponding timestamp to the initial streaming media data of the current frame to obtain the intermediate streaming media data.
Step 103, performing code stream encapsulation and splicing on the intermediate stream media data frame by frame to obtain spliced code stream data;
after the intermediate streaming media data is acquired, the streaming media data is usually transmitted according to the format of H264/H265+AAC, and if the encoded data is decoded and stored, the storage cost and the time cost are increased; if the video data and the audio data are stored respectively, the subsequent acquisition needs to be spliced, and the time cost is high.
Therefore, in the embodiment of the invention, the intermediate stream media data can be subjected to code stream encapsulation frame by frame and spliced frame by frame so as to obtain spliced code stream data.
Note that, the code stream encapsulation refers to a process of generating code stream data by encapsulating a plurality of header files. For example, the following code Stream (PS) package is made for H264: each IDR NALU typically includes NALUs such as SPS and PPS, so that the NALU of SPS, PPS, IDR is encapsulated into a PS packet including PS header, and then PS system header, PS system map, PES header+h264 raw data is added. So an IDR NALU PS packet is in the outside-in order: PSHeader|PS system header|PS system map|PES header|h264raw data. For PS packets of other non-key frames, it is much simpler to add the PS header and PES header directly. The sequence is as follows: PS header|pes header|h264raw data. The above is the case for video only, if Audio is also packaged into PS packages. When audio data is present, the data plus PES header may be added to the video PES. The sequence is as follows: PS packet=ps header|pes (video) |pes (audio).
And 104, determining and storing the target storage node position of the spliced code stream data according to the residual storage space and the load path number corresponding to each distributed storage node.
The load path number refers to the number of data storage paths corresponding to each distributed storage node at the current moment, for example, one path is stored as 1 path of load, and 2 paths are stored as 2 paths of load.
After the spliced code stream data is acquired, since there are multiple distributed storage nodes in the storage server, the remaining storage space of each distributed storage node may be different, and the amount of stored data may also be different.
In order to balance the storage capacity of each distributed storage node and ensure the balance of network bandwidth, the minimum residual storage space can be selected from a plurality of distributed storage nodes as a target storage node position according to the residual storage space corresponding to each distributed storage node and the respective load path number, the last target storage node position and the current target storage node position are combined according to the load path number, the next target storage node position is further selected, and then the spliced code stream data is stored in each target storage node.
In the embodiment of the invention, the initial streaming media data is acquired frame by frame, and the corresponding time stamp is added to the initial streaming media data based on the transmission protocol corresponding to the initial streaming media data to obtain the intermediate streaming media data, and meanwhile, when one frame of intermediate streaming media data is generated, the frame of intermediate streaming media data is subjected to code stream encapsulation and spliced with the last frame of intermediate streaming media data to obtain spliced code stream data; and finally, according to the residual storage space and the load path number corresponding to each distributed storage node, performing data slicing on the spliced code stream data, determining the position of a target storage node and storing the target storage node. Therefore, the technical problem that the transmission cost is increased due to excessive time consumption because the stored data is required to be intercepted again after being spliced in the prior art is solved, and the storage time is reduced while the transmission cost is lower.
Referring to fig. 2, fig. 2 is a flowchart illustrating steps of a method for distributed storage of streaming media according to a second embodiment of the present invention.
The invention provides a distributed storage method of streaming media, which is applied to a master control manager, wherein the master control manager is in communication connection with a storage server, the storage server comprises a plurality of distributed storage nodes, and the method comprises the following steps:
step 201, obtaining initial streaming media data frame by frame;
the initial streaming media data refers to media data which are continuous in time, such as audio, video, animation, multimedia and the like, the content of which can be transmitted without conversion by adopting streaming technology information, and in the embodiment of the invention, the initial streaming media data mainly comprises video streaming data in the format of H264/H265+AAC and the like.
In the embodiment of the invention, since the initial streaming media data is usually streaming, in order to ensure the display continuity of the subsequent streaming media data, the device acquires the initial streaming media data frame by frame and then processes the initial streaming media data acquired by each frame.
Step 202, adding a corresponding time stamp to the initial streaming media data according to a transmission protocol corresponding to the initial streaming media data to obtain intermediate streaming media data;
optionally, step 202 may comprise the sub-steps of:
analyzing a transmission protocol corresponding to the initial streaming media data to obtain a transmission frame rate corresponding to the initial streaming media data of the current frame;
and adding a corresponding time stamp for the initial streaming media data according to the transmission frame rate to obtain intermediate streaming media data.
The transmission frame rate refers to the frequency (rate) at which bitmap images in frames called units continuously appear on the display. The term applies equally to film and video cameras, computer graphics and motion capture systems. The frame rate may also be referred to as the frame frequency and is expressed in hertz (Hz).
In the embodiment of the invention, after receiving a frame of initial streaming media data, the master control manager can analyze a transmission protocol corresponding to the frame of initial streaming media data to extract a transmission frame rate corresponding to the initial streaming media data, and then adds a corresponding time stamp to the initial streaming media data according to the transmission frame rate to obtain intermediate streaming media data.
Further, after performing step 202, the method may further include the following steps S11-S13:
s11, calculating a time stamp difference value between a time stamp corresponding to the middle streaming media data of the previous frame and a time stamp corresponding to the middle streaming media data of the current frame;
s12, comparing the absolute value of the timestamp difference value with a preset difference value threshold;
and S13, if the absolute value of the time stamp difference value is larger than the difference value threshold value, adding a new time stamp to the initial streaming media data again according to the transmission frame rate to obtain new intermediate streaming media data.
When the intermediate streaming media data is obtained, the time stamp may be added in error due to different data protocols corresponding to the initial streaming media data of different frames in the same file.
Therefore, the time stamp difference value between the time stamp corresponding to the previous frame of intermediate stream media data and the time stamp of the current frame of intermediate stream media data can be further calculated, whether the time stamp difference value is larger than a preset difference value threshold value is compared, and if so, a new time stamp can be added again according to the transmission frame rate to obtain new intermediate stream media data; if not, the original intermediate stream media data is kept, and the subsequent code stream package and data splicing are obtained.
It should be noted that after obtaining the new intermediate streaming media data, the step S11 may be further performed to check whether the timestamp of the intermediate streaming media data is correct.
Step 203, performing code stream encapsulation and splicing on the intermediate stream media data frame by frame to obtain spliced code stream data;
after the intermediate streaming media data is acquired, the streaming media data is usually transmitted according to the format of H264/H265+AAC, and if the encoded data is decoded and stored, the storage cost and the time cost are increased; if the video data and the audio data are stored respectively, the subsequent acquisition needs to be spliced, and the time cost is high.
Therefore, in the embodiment of the invention, the intermediate stream media data can be subjected to code stream encapsulation frame by frame and spliced frame by frame so as to obtain spliced code stream data.
Note that, the code stream encapsulation refers to a process of generating code stream data by encapsulating a plurality of header files. For example, the following code Stream (PS) package is made for H264: each IDR NALU typically includes NALUs such as SPS and PPS, so that the NALU of SPS, PPS, IDR is encapsulated into a PS packet including PS header, and then PS system header, PS system map, PES header+h264 raw data is added. So an IDR NALU PS packet is in the outside-in order: PSHeader|PS system header|PS system map|PES header|h264raw data. For PS packets of other non-key frames, it is much simpler to add the PS header and PES header directly. The sequence is as follows: PS header|pes header|h264raw data. The above is the case for video only, if Audio is also packaged into PS packages. When audio data is present, the data plus PES header may be added to the video PES. The sequence is as follows: PS packet=ps header|pes (video) |pes (audio).
Referring to fig. 3, fig. 3 is a schematic flow chart of a code stream encapsulation and data splicing in an embodiment of the invention.
In the embodiment of the invention, taking the initial streaming media data of the storage pool H264+AAC as an example, after processing to obtain one frame of intermediate streaming media data, PS header data of PS stream can be packaged for the intermediate streaming media data, PES/PSM header data can be packaged for H264/AAC, after obtaining a packaged PS data packet and PS header, the current frame of intermediate streaming media data and the last frame of intermediate streaming media data are spliced in a manner of splicing the PS header and the PS data packet, and spliced code stream data are obtained.
204, performing data slicing on the spliced code stream data according to the residual storage spaces respectively corresponding to the distributed storage nodes to obtain a plurality of sliced code stream data and respectively corresponding time period information;
optionally, step 204 may include the sub-steps of:
comparing the residual storage spaces corresponding to the distributed storage nodes respectively, and determining the minimum value as the minimum residual storage space;
performing data slicing on the spliced code stream data according to a preset data slicing rule and a minimum residual storage space to obtain a plurality of sliced code stream data;
calculating the ratio between the slicing capacity of the sliced stream data and the byte length of each frame of spliced stream data to obtain the corresponding storage frame number of the sliced stream data;
and calculating the sum of the storage frame numbers to obtain the time period information corresponding to the fragment code stream data.
In the embodiment of the invention, the distributed storage nodes upload the residual storage space to the main control manager according to the period, and after the main control manager receives each residual storage space at the current moment, the minimum value is selected as the minimum residual storage space by comparing the residual storage spaces respectively corresponding to each distributed storage node; and performing data slicing on the spliced code stream data according to a preset data slicing rule in combination with the minimum residual storage space to obtain a plurality of sliced code stream data.
For example, the minimum remaining storage space is m, the data slicing rule specifies that the slicing capacity is m/2, and at this time, the spliced code stream data may be sliced according to the slicing capacity of m/2, so as to obtain a plurality of m/2 sliced code stream data.
And when the sliced stream data is obtained, because multi-frame data exists in each sliced stream data, the ratio between the sliced capacity of the sliced stream data and the byte length of each frame of spliced stream data is calculated to obtain the corresponding storage frame number of the sliced stream data, and the sum of the storage frame numbers is calculated to obtain the corresponding time period information of each sliced stream data.
Step 205, determining and storing the target storage node position of the chip code stream data based on the load path number corresponding to each distributed storage node.
Optionally, step 205 may comprise the sub-steps of:
sequencing all the distributed storage nodes according to the load path numbers respectively corresponding to the distributed storage nodes, and determining the sequencing number of each distributed storage node;
determining and storing a target storage node position corresponding to the chip code stream data based on a preset storage node calculation formula and a sequencing number;
the calculation formula of the storage node is as follows:
Node=(lastNode+1)%nodeNum;
the Node is a sorting number corresponding to the target storage Node position, the nodeNum is the total number of the current distributed storage nodes, and the lastNode is a sorting number corresponding to the last target storage Node position.
In one example of the present invention, after the plurality of sliced code stream data is obtained, in order to balance the network bandwidth and the load of each distributed storage node, the distributed storage nodes may be further sequenced according to the number of load paths corresponding to each distributed storage node, and the sequencing number corresponding to each distributed storage node is determined according to the number of load paths from more to less. And determining a target storage node position corresponding to the fragment code stream data based on a preset storage node calculation formula and the sequencing number, and storing the fragment code stream data to the corresponding target storage node position.
Referring to fig. 4, fig. 4 is a block and storage flow chart of spliced code stream data according to an embodiment of the invention.
After splicing the intermediate stream media data is completed, spliced code stream data is obtained, the residual storage space of each storage node at the current moment, such as a storage node 1 and a storage node 2, is received; based on the minimum remaining storage space and a preset slicing rule, slicing and dividing the spliced code stream data to obtain a plurality of sliced code stream data; meanwhile, according to the load path numbers corresponding to the distributed storage nodes, calculating the storage states corresponding to the distributed storage nodes, and determining the target storage node positions of the fragmented code stream data; and storing the fragment code stream data to the target storage node position, and after one fragment code stream data is stored, calculating the next target storage node position again until all the fragment code stream data are stored. And simultaneously recording the positions of the distributed storage nodes and the corresponding time period information in the storage process.
Further, after performing step 205, the method further comprises the steps of:
and respectively establishing the association information between each time period information and each target storage node position to obtain a time period key value table.
In a specific implementation, the manner in which the user obtains the streaming media is generally obtained according to a time point, such as playback video, video skip, and progress bar dragging. In order to improve the efficiency of subsequent data return, association information between each time period information and each target storage node position can be respectively established so as to obtain a time period key value table. When a user needs a certain period, the time period key value table can be queried according to the time period information of the user, and the corresponding fragment code stream data can be rapidly obtained from the corresponding target storage node position and returned.
In another example of the present invention, the method further comprises the steps of S21-S24:
s21, when a data acquisition request sent by a user terminal is received, the data acquisition request is analyzed, and a corresponding data acquisition period is determined;
s22, searching a time period key value table by adopting a data acquisition time period, and determining a plurality of storage node positions to be returned and time period information to be returned, which correspond to the data acquisition time period;
s23, sequentially acquiring the fragment code stream data corresponding to the time period to be returned from each storage node position to be returned as target code stream data, and returning to the user side;
in this embodiment, after the spliced code stream data is stored in each distributed storage node, if the main control manager receives a data acquisition request sent by the user end, the data acquisition request is further analyzed to determine a data acquisition period required by the user end; searching a time period key value table by adopting a data acquisition time period, and determining a plurality of storage node positions to be returned corresponding to the data acquisition time period and corresponding time period information to be returned; and sequentially acquiring the fragment code stream data corresponding to the time period to be returned from each storage node position to be returned as target code stream data, and returning to the user terminal.
And S24, when the return progress of the target code stream data exceeds a preset return threshold, returning the target code stream data in the next storage node to be returned in parallel.
In a specific implementation, in order to better reduce network bandwidth, the target code stream data may not only return from a storage node position to be returned, at this time, the return progress of the target code stream data to be returned to the storage node position at the current moment needs to be monitored in real time, if the return progress exceeds a predetermined return threshold, the fragmented code stream data of the period to be returned in the next storage node position to be returned can be obtained in advance as the target code stream data, and returned to the user side in parallel until all the target code stream data have been returned.
Referring to fig. 5, fig. 5 shows a target code stream data return flowchart in an embodiment of the invention.
In the embodiment, when a data acquisition request sent by a user terminal is received, the main control manager analyzes the data acquisition request to determine the corresponding storage node positions to be returned, N target code stream data corresponding to the time period information to be returned are sequentially returned through the storage node positions to be returned, and the N target code stream data can be further returned to the user terminal in the form of a data packet; and when the return progress of the Nth target code stream data is greater than a return threshold value, for example, 80%, returning the next section of target code stream data from the next storage node position to be returned until all target code stream data of the period to be returned are returned.
In the embodiment of the invention, the initial streaming media data is acquired frame by frame, and the corresponding time stamp is added to the initial streaming media data based on the transmission protocol corresponding to the initial streaming media data to obtain the intermediate streaming media data, and meanwhile, when one frame of intermediate streaming media data is generated, the frame of intermediate streaming media data is subjected to code stream encapsulation and spliced with the last frame of intermediate streaming media data to obtain spliced code stream data; and finally, according to the residual storage space and the load path number corresponding to each distributed storage node, performing data slicing on the spliced code stream data, determining the position of a target storage node and storing the target storage node. Therefore, the technical problem that the transmission cost is increased due to excessive time consumption because the stored data is required to be intercepted again after being spliced in the prior art is solved, and the storage time is reduced while the transmission cost is lower.
Referring to fig. 6, fig. 6 is a block diagram illustrating a distributed storage device for streaming media according to a third embodiment of the present invention.
The embodiment of the invention provides a distributed storage device of streaming media, which is applied to a master control manager, wherein the master control manager is in communication connection with a storage server, the storage server comprises a plurality of distributed storage nodes, and the device comprises:
a streaming media data acquisition module 601, configured to acquire initial streaming media data frame by frame;
the timestamp adding module 602 is configured to add a corresponding timestamp to the initial streaming media data according to a transmission protocol corresponding to the initial streaming media data, so as to obtain intermediate streaming media data;
the data encapsulation and splicing module 603 is configured to encapsulate and splice the intermediate stream media data frame by frame to obtain spliced code stream data;
the node determining and storing module 604 is configured to determine a target storage node position of the spliced code stream data according to the remaining storage space value and the load path number corresponding to each distributed storage node respectively, and store the spliced code stream data.
Optionally, the timestamp adding module 602 includes:
the protocol analysis sub-module is used for analyzing a transmission protocol corresponding to the initial streaming media data to obtain a transmission frame rate corresponding to the initial streaming media data of the current frame;
and the timestamp adding sub-module is used for adding a corresponding timestamp to the initial streaming media data according to the transmission frame rate to obtain intermediate streaming media data.
Optionally, the timestamp adding module 602 further includes:
the time stamp difference value calculation sub-module calculates the time stamp difference value between the time stamp corresponding to the middle streaming media data of the previous frame and the time stamp corresponding to the middle streaming media data of the current frame;
the difference comparison sub-module is used for comparing the absolute value of the timestamp difference with a preset difference threshold;
and the intermediate stream media data updating sub-module is used for adding a new time stamp to the initial stream media data again according to the transmission frame rate if the absolute value of the time stamp difference value is larger than the difference value threshold value to obtain new intermediate stream media data.
Optionally, the node determining and storing module 604 includes:
the data segmentation sub-module is used for carrying out data segmentation on the spliced code stream data according to the residual storage space values corresponding to the distributed storage nodes respectively to obtain a plurality of segmented code stream data and corresponding time period information;
and the position determining and storing sub-module is used for determining and storing the target storage node position of the sliced code stream data based on the load path numbers respectively corresponding to the distributed storage nodes.
Optionally, the data-slicing submodule is specifically configured to:
comparing the residual storage space values corresponding to the distributed storage nodes, and determining the minimum value as the minimum residual storage space value;
performing data slicing on the spliced code stream data according to a preset data slicing rule and a minimum residual storage space value to obtain a plurality of sliced code stream data;
calculating the ratio between the slicing capacity of the sliced stream data and the byte length of each frame of spliced stream data to obtain the corresponding storage frame number of the sliced stream data;
and calculating the sum of the storage frame numbers to obtain the time period information corresponding to the fragment code stream data.
Optionally, the location determination and storage submodule is specifically configured to:
sequencing all the distributed storage nodes according to the load path numbers respectively corresponding to the distributed storage nodes, and determining the sequencing number of each distributed storage node;
determining and storing a target storage node position corresponding to the chip code stream data based on a preset storage node calculation formula and a sequencing number;
the calculation formula of the storage node is as follows:
Node=(lastNode+1)%nodeNum;
the Node is a sorting number corresponding to the target storage Node position, the nodeNum is the total number of the current distributed storage nodes, and the lastNode is a sorting number corresponding to the last target storage Node position.
Optionally, the apparatus further comprises:
and the time period key value pair table establishing module is used for respectively establishing the association information between each time period information and each target storage node position to obtain a time period key value pair table.
Optionally, the apparatus further comprises:
the data acquisition request receiving module is used for analyzing the data acquisition request when receiving the data acquisition request sent by the user terminal, and determining a corresponding data acquisition period;
the return position and time period determining module is used for searching a time period key value table by adopting the data acquisition time period to determine a plurality of storage node positions to be returned and time period information to be returned, which correspond to the data acquisition time period;
the target code stream data return module is used for sequentially acquiring the fragment code stream data corresponding to the time period to be returned from each storage node position to be returned as target code stream data and returning the target code stream data to the user side;
and the cache return module is used for returning the target code stream data in the next storage node to be returned in parallel when the return progress of the target code stream data exceeds a preset return threshold value.
The embodiment of the invention also provides an electronic device, which comprises a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor executes the steps of the distributed storage method of the streaming media according to any embodiment of the invention.
It will be clearly understood by those skilled in the art that, for convenience and brevity of description, specific working procedures of the apparatus, modules and sub-modules described above may refer to corresponding procedures in the foregoing method embodiments, which are not described herein again.
In the several embodiments provided by the present invention, it should be understood that the disclosed apparatus and method may be implemented in other manners. For example, the apparatus embodiments described above are merely illustrative, e.g., the division of the units is merely a logical function division, and there may be additional divisions when actually implemented, e.g., multiple units or components may be combined or integrated into another system, or some features may be omitted or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be an indirect coupling or communication connection via some interfaces, devices or units, which may be in electrical, mechanical or other form.
The units described as separate units may or may not be physically separate, and units shown as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of 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.
In addition, each functional unit in the embodiments of the present invention may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. The integrated units may be implemented in hardware or in software functional units.
The above embodiments are only for illustrating the technical solution of the present invention, and not for limiting the same; although the invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims (9)

1. A distributed storage method for streaming media, applied to a master manager, the master manager being communicatively connected to a storage server, the storage server including a plurality of distributed storage nodes, the method comprising:
acquiring initial streaming media data frame by frame;
adding a corresponding time stamp to the initial streaming media data according to a transmission protocol corresponding to the initial streaming media data to obtain intermediate streaming media data, wherein the method specifically comprises the following steps: analyzing a transmission protocol corresponding to the initial streaming media data to obtain a transmission frame rate corresponding to the initial streaming media data of the current frame;
adding a corresponding time stamp to the initial streaming media data according to the transmission frame rate to obtain intermediate streaming media data;
performing code stream encapsulation on the intermediate stream media data frame by frame, and splicing the intermediate stream media data subjected to code stream encapsulation with the intermediate stream media data of the last frame corresponding to the intermediate stream media data subjected to code stream encapsulation to obtain spliced code stream data;
and determining and storing the target storage node position of the spliced code stream data according to the residual storage space value and the load path number corresponding to each distributed storage node.
2. The method as recited in claim 1, further comprising:
calculating a time stamp difference value between a time stamp corresponding to the intermediate streaming media data of the previous frame and a time stamp corresponding to the intermediate streaming media data of the current frame;
comparing the absolute value of the timestamp difference value with a preset difference value threshold;
and if the absolute value of the timestamp difference value is larger than the difference value threshold value, adding a new timestamp to the initial streaming media data again according to the transmission frame rate to obtain new intermediate streaming media data.
3. The method according to claim 1, wherein the step of determining and storing the target storage node position of the spliced code stream data according to the remaining storage space value and the load path number corresponding to each of the distributed storage nodes, respectively, includes:
performing data slicing on the spliced code stream data according to the residual storage space values corresponding to the distributed storage nodes respectively to obtain a plurality of sliced code stream data and corresponding time period information;
and determining and storing the target storage node position of the chip code stream data based on the load path number corresponding to each distributed storage node.
4. The method according to claim 3, wherein the step of performing data slicing on the spliced code stream data according to the remaining storage space values corresponding to the distributed storage nodes respectively to obtain a plurality of sliced code stream data and the period information corresponding to the sliced code stream data respectively includes:
comparing the residual storage space values corresponding to the distributed storage nodes, and determining a minimum value as a minimum residual storage space value;
performing data slicing on the spliced code stream data according to a preset data slicing rule and the minimum residual storage space value to obtain a plurality of sliced code stream data;
calculating the ratio between the slicing capacity of the slicing code stream data and the byte length of the spliced code stream data of each frame to obtain the corresponding storage frame number of the slicing code stream data;
and calculating the sum of the storage frame numbers to obtain the time period information corresponding to the chip code stream data.
5. The method of claim 3, wherein the step of determining and storing the target storage node location of the fragmented stream data based on the respective number of load paths corresponding to each of the distributed storage nodes comprises:
sequencing all the distributed storage nodes according to the load path numbers respectively corresponding to the distributed storage nodes, and determining sequencing numbers of each distributed storage node;
determining a target storage node position corresponding to the fragment code stream data based on a preset storage node calculation formula and combining the sequencing number, and storing the target storage node position;
the calculation formula of the storage node is as follows:
Node=(lastNode+1)%nodeNum;
the Node is a sorting number corresponding to the target storage Node position, the nodeNum is the total number of the distributed storage nodes currently, and the lastNode is a sorting number corresponding to the last target storage Node position.
6. A method according to claim 3, characterized in that the method further comprises:
and respectively establishing the association information between each time period information and each target storage node position to obtain a time period key value table.
7. The method of claim 6, wherein the method further comprises:
when a data acquisition request sent by a user terminal is received, the data acquisition request is analyzed, and a corresponding data acquisition period is determined;
searching the time period key value table by adopting the data acquisition time period, and determining a plurality of storage node positions to be returned and time period information to be returned, which correspond to the data acquisition time period;
sequentially acquiring the fragment code stream data corresponding to the period to be returned from each storage node position to be returned as target code stream data, and returning to the user terminal;
and when the return progress of the target code stream data exceeds a preset return threshold value, returning the target code stream data in the next storage node to be returned in parallel.
8. A distributed storage device for streaming media, applied to a master manager, the master manager being communicatively connected to a storage server, the storage server comprising a plurality of distributed storage nodes, the device comprising:
the streaming media data acquisition module is used for acquiring initial streaming media data frame by frame;
the time stamp adding module is configured to add a corresponding time stamp to the initial streaming media data according to a transmission protocol corresponding to the initial streaming media data, so as to obtain intermediate streaming media data, and specifically includes: analyzing a transmission protocol corresponding to the initial streaming media data to obtain a transmission frame rate corresponding to the initial streaming media data of the current frame; adding a corresponding time stamp to the initial streaming media data according to the transmission frame rate to obtain intermediate streaming media data;
the data encapsulation and splicing module is used for encapsulating the code stream of the intermediate stream media data frame by frame, splicing the intermediate stream media data after the code stream encapsulation with the intermediate stream media data of the last frame corresponding to the intermediate stream media data after the code stream encapsulation, and obtaining spliced code stream data;
and the node determining and storing module is used for determining and storing the target storage node position of the spliced code stream data according to the residual storage space value and the load path number which are respectively corresponding to each distributed storage node.
9. An electronic device comprising a memory and a processor, wherein the memory stores a computer program that, when executed by the processor, causes the processor to perform the steps of the method for distributed storage of streaming media according to any of claims 1-7.
CN202111387482.7A 2021-11-22 2021-11-22 Distributed storage method, device and equipment for streaming media Active CN114125493B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111387482.7A CN114125493B (en) 2021-11-22 2021-11-22 Distributed storage method, device and equipment for streaming media

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111387482.7A CN114125493B (en) 2021-11-22 2021-11-22 Distributed storage method, device and equipment for streaming media

Publications (2)

Publication Number Publication Date
CN114125493A CN114125493A (en) 2022-03-01
CN114125493B true CN114125493B (en) 2023-06-09

Family

ID=80439197

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111387482.7A Active CN114125493B (en) 2021-11-22 2021-11-22 Distributed storage method, device and equipment for streaming media

Country Status (1)

Country Link
CN (1) CN114125493B (en)

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104954810B (en) * 2015-07-14 2018-04-24 电子科技大学 For ensureing the successional switching method of distributed video stream memory system data
CN104967862A (en) * 2015-07-22 2015-10-07 东方网力科技股份有限公司 Video storage method and device, and video searching method and device
CN106961613A (en) * 2017-03-30 2017-07-18 上海七牛信息技术有限公司 A kind of streaming real-time transcoding order method and system
CN107295425B (en) * 2017-06-12 2020-02-21 北京达沃时代科技股份有限公司 Method for rapidly splicing transcoding fragmented files
CN107404480B (en) * 2017-07-24 2019-10-29 平安科技(深圳)有限公司 A kind of transmission method of stream medium data, storage medium and streaming media server
CN112788366B (en) * 2020-12-28 2023-03-24 杭州海康威视***技术有限公司 Video processing method and device

Also Published As

Publication number Publication date
CN114125493A (en) 2022-03-01

Similar Documents

Publication Publication Date Title
US9961398B2 (en) Method and device for switching video streams
US9609338B2 (en) Layered video encoding and decoding
US10476928B2 (en) Network video playback method and apparatus
CN109714623B (en) Image display method and device, electronic equipment and computer readable storage medium
CN110662017B (en) Video playing quality detection method and device
CN109348309A (en) A kind of distributed video transcoding method suitable for frame rate up-conversion
CN113596518B (en) Video access method for improving double-speed playing performance
WO2014143988A1 (en) Method for decreasing the bit rate needed to transmit videos over a network by dropping video frames
CN105357229B (en) Video processing method and device
CN108419041A (en) A kind of method and apparatus of video data processing
CN111263164A (en) High frame frequency video parallel coding and recombination method
CN112714338B (en) Video transmission method, video playing method, video transmission device, video playing device, computer equipment and storage medium
CN114449291A (en) Data transmission method, device and computer storage medium
CN111741247B (en) Video playback method and device and computer equipment
CN114125493B (en) Distributed storage method, device and equipment for streaming media
US10116415B2 (en) Transmission device, receiving device, transmission method, and receiving method
CN110602555B (en) Video transcoding method and device
CN113014953A (en) Video tamper-proof detection method and video tamper-proof detection system
CN116980662A (en) Streaming media playing method, streaming media playing device, electronic equipment, storage medium and program product
US11599570B2 (en) Device and method to render multimedia data stream tamper-proof based on block chain recording
TWI735297B (en) Coding of video and audio with initialization fragments
JP2023007048A (en) Streaming server, transmission method, and program
CN115942000B (en) H.264 format video stream transcoding method, device, equipment and medium
CN116781973B (en) Video encoding and decoding method and device, storage medium and electronic equipment
US8875202B2 (en) Processing path signatures for processing elements in encoded video

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant