Real-time flow-medium transmission method and system based on the frame of video fractionation
(1) technical field
The present invention relates in a kind of P2P peer-to-peer network the flow-medium transmission method and the system that split based on frame of video.
(2) background technology
P2P is the abbreviation of " peer-to-peer ", and P2P also just can be understood as the meaning of " point-to-point ", or is called peer-to-peer network.On the mode of Network Transmission, point-to-point is a kind of transmission mode, and the conventional transmission mode comprises broadcasting and multicast etc.The notion of peer-to-peer network is meant in network topology structure, has a lot of equipment and network host, is point-to-point so long as begin all to be called to the transfer of data of other single network main frames with the single network main frame, and is irrelevant with software, agreement and the mode of specific implementation.
The P2P technology is a kind of being used between the different pc users, without the technology of direct swap data of server apparatus or service.It has broken traditional Client/Server pattern, and the status of each node all is identical in peer-to-peer network, possesses the client and server double grading, can be simultaneously as service user and ISP.Because the develop rapidly of P2P technology, the memory module of the Internet will " content be positioned at the " center " pattern and changes " content is positioned at the edge " pattern into, and what change Internet was present is the state at center with big website, returns to " decentralization " by present.
P2P real time flow medium technology is that the Streaming Media that produces on P2P peer-to-peer network basis is used.In the traditional approach, the user watches video stream media on the internet, need download one section video data from server end, plays one section on user's the computer then, repeats this process, realizes video playback capability.Therefore the user can only be from the server end downloaded resources in the C/S structure, and the P2P Streaming Media makes the user when watching video stream media, can and simultaneously carry out the utilization of resources between the user of this video watching, the user can be from these users foradownloaded video data simultaneously, this method has improved efficient and speed greatly.The P2P streaming media server is at first given several users with video Data Transmission, and the user of back directly obtains data from server, but obtains data from the user of front.
The data of real time flow medium obtain in real time according to OB apparatus and compress, in P2P real time flow medium transmission course, video data at first compresses in server, and the time period with length-specific is boundary then, carries out transfer of data in the P2P peer-to-peer network.Therefore, this mode is a kind of transmission means of coarseness, promptly is difficult in the transmission course to accomplish adjust video effect according to the variation of actual bandwidth.It is multi code Rate of Chinese character (MBR) compression that the adaptive approach of employing is also arranged, and this method is when carrying out video compression a plurality of code checks to be calculated, thereby adapts to different client bandwidth.But multi code Rate of Chinese character compression increase at double the load of server, and video transmission still carries out on a time period, and slower to regulating the speed of bandwidth fluctuation.
(3) summary of the invention
In order to overcome coarseness and the slow deficiency of network speed fluctuation self adaptation that the video data period of real time flow medium is compressed in the P2P peer-to-peer network in the prior art, the invention provides and a kind ofly can support the various video compression method, carrying out fine granularity on the level of video compression frame splits, frame of video after the fractionation is independent transmission in P2P peer-to-peer network topological structure, but network speed is dynamically adjusted flow-medium transmission method and the system that splits based on frame of video in a kind of P2P peer-to-peer network of video frame rate.
Technical scheme of the present invention is:
A kind of real-time flow-medium transmission method that splits based on frame of video may further comprise the steps:
(1) the control flows media server is surveyed the topological structure of whole P2P peer-to-peer network, obtains the information of all receiving terminal nodes in the peer-to-peer network, comprises internet address, available port, upstream bandwidth, downlink bandwidth;
(2) catch original video data and compression:
Transmitting terminal is caught the interior original video data bitmap of time period of setting, then video data is compressed;
(3) split frame of video and encapsulate the Network Transmission unit:
(3.1) from video data, split out I frame, B frame or P frame;
(3.2) each frame of video that splits out is numbered sequentially, and the joining day stabs and the frame type sign;
(3.2) each frame of video, its numbering, timestamp and frame type sign are encapsulated;
The I frame is the frame of video that compression method produces in the frame, therefore can independently decode, and does not rely on other frame of video; B frame and P frame are the interframe compression methods, and the frame of video that relies on other is decoded.
(4) frame of video transmission:
(4.1) transmitting terminal is searched the optimal transmission paths that is connected to receiving terminal in the current P2P peer-to-peer network, it is the shortest path of transmission lag, optimal path is meant a shortest path is provided between the node that provided by P2P peer-to-peer network topology and the node, be the shortest forward node sequence of transmission delay, this path obtains by inquiring that each known paths is judged;
(4.2) frame of video is sent to receiving terminal by this path, and in each process of transmitting, all search optimal transmission paths again;
(5) frame of video receives:
(5.1) receiving terminal is created the buffering area that the time limit is arranged, and the non-frame of video that should arrive in the time limit is dropped;
(5.2) receiver, video frame from the P2P peer-to-peer network, and sort in buffering area in limited time by the timestamp order and to deposit;
(6) frame of video in the buffering area of prescribing a time limit is carried out verification and adjustment: check whether frame of video arranges according to the sequencing of timestamp; Whether the frame of video that P frame and B frame are relied on is present in the buffering area, as not existing, then this P frame or B frame is eliminated buffering area;
(7) receiving terminal decompress(ion) and broadcast: receiving terminal carries out decompress(ion) to the video data through verification and adjustment in the buffering area of prescribing a time limit.
H.261 described various compression algorithm comprise, H.263, MPEG2 or MPEG4.
A kind of system of constructing based on the real-time flow-medium transmission method of frame of video fractionation that uses mainly comprises: transmitting terminal and receiving terminal:
Described transmitting terminal comprises:
Detecting module: the information that is used for obtaining all receiving terminal nodes of peer-to-peer network;
Path calculation module: be used to calculate the information of all receiving terminal nodes, draw optimal transmission paths;
Video Capture module: be used for from the original image of external video collecting device capturing video;
Video compressing module: be used for calling as required video compression algorithm, original video data is compressed;
Frame of video splits module: each frame of video after will compressing splits from the video data of compression;
Network Transmission unit package module: the transmission unit that is used for each frame of video, its numbering, timestamp and frame type sign are encapsulated as the P2P structure;
P2P peer-to-peer network transport module: be used for transmission unit is sent to the P2P peer-to-peer network;
Described receiving terminal comprises:
P2P peer-to-peer network transport module: be used for receiving transmission unit from the P2P peer-to-peer network;
Buffering area operational module in limited time: be used to set up and keep a buffering area with time restriction;
Frame of video verification module: be used to check whether frame of video arranges according to the sequencing of timestamp; Whether the frame of video that P frame and B frame are relied on is present in the buffering area, as not existing, then this P frame or B frame is eliminated buffering area;
Video decode module: be used for calling as required various existing video decompression algorithm.
Operation principle of the present invention is: on the basis of existing P2P peer-to-peer network, real-time flow-medium transmission method is improved, for adopting in the frame video data compression method of compression and interframe compressed mixed all can realize, comprise H.261, H.263, MPEG2, MPEG4 etc.Motion compensation is not used in compression in the frame, needn't carry out compressed encoding with reference to other frames, only utilizes the spatial coherence in the single-frame images, is the reference frame of decoding.The interframe compression has utilized the correlation on the image information room and time simultaneously, and employing motion detection and forward direction time prediction improve compression efficiency and picture quality, and its decoding must be with reference to frame before.This method all independently is split as independent Network Transmission unit with the I frame in the video compression data, P frame and B frame, and joining day stamp and dependence information, each is independently arrived acceptance point by P2P peer-to-peer network transmission path in the Network Transmission unit, storing in the buffering area in limited time temporarily.In limited time buffering area is used to deposit the video compression data in the time period, if arrive the time limit then put the consistency and the dependence of the frame of video that has received in the buffering area in order.Buffering area after the verification is carried out video compression can obtain corresponding video data.Be subjected to the influence of network speed fluctuation, have that one or more frame of video are lost or do not arrive on time in network transmission process, then abandon this frame, realized bandwidth fluctuation is provided the fine granularity adaptive characteristic of different video frame per second.
The real-time flow-medium transmission method that splits based on frame of video of the present invention and the beneficial effect of system mainly show: the video data compression method that 1, adopts compression and interframe compressed mixed in the frame for video image, can change fine-grained video requency frame data into from video compression data to making the Network Transmission unit based on the time period, further utilize the efficient of P2P peer-to-peer network, improved transmission speed; 2, buffering area is set and receives interior frame of video of time limit, and sort and reduce according to the correlation of frame of video and timestamp, and inspection data consistency, get rid of the invalid video frame in the buffering area of prescribing a time limit, realization is to the self adaptation adjustment of network bandwidth fluctuation, for different users provides different video image effects; 3, can be under the situation of using the single compressed method the different play frame rate of self adaptation, thereby reduce the load of streaming media server.
(4) description of drawings
Fig. 1 is based on the flow chart of the real-time flow-medium transmission method of frame of video fractionation.
Fig. 2 is based on the structure chart of the real time flow medium transmission system of frame of video fractionation.
(5) embodiment
Below in conjunction with accompanying drawing the present invention is further described.
Embodiment one
Referring to Fig. 1: a kind of real-time flow-medium transmission method that splits based on frame of video may further comprise the steps:
(1) the control flows media server is surveyed the topological structure of whole P2P peer-to-peer network, obtains the information of all receiving terminal nodes in the peer-to-peer network, comprises internet address, available port, upstream bandwidth, downlink bandwidth;
(2) catch original video data and compression:
Transmitting terminal is caught the interior original video data bitmap of time period of setting, then video data is compressed;
(3) split frame of video and encapsulate the Network Transmission unit:
(3.1) from video data, split out I frame, B frame or P frame;
(3.2) each frame of video that splits out is numbered sequentially, and the joining day stabs and the frame type sign;
(3.2) each frame of video, its numbering, timestamp and frame type sign are encapsulated;
The I frame is the frame of video that compression method produces in the frame, therefore can independently decode, and does not rely on other frame of video; B frame and P frame are the interframe compression methods, and the frame of video that relies on other is decoded.
(4) frame of video transmission:
(4.1) transmitting terminal is searched the optimal transmission paths that is connected to receiving terminal in the current P2P peer-to-peer network, it is the shortest path of transmission lag, optimal path is meant a shortest path is provided between the node that provided by P2P peer-to-peer network topology and the node, be the shortest forward node sequence of transmission delay, this path obtains by inquiring that each known paths is judged;
(4.2) frame of video is sent to receiving terminal by this path, and in each process of transmitting, all search optimal transmission paths again;
(5) frame of video receives:
(5.1) receiving terminal is created the buffering area that the time limit is arranged, and the non-frame of video that should arrive in the time limit is dropped;
(5.2) receiver, video frame from the P2P peer-to-peer network, and sort in buffering area in limited time by the timestamp order and to deposit;
(6) frame of video in the buffering area of prescribing a time limit is carried out verification and adjustment: check whether frame of video arranges according to the sequencing of timestamp; Whether the frame of video that P frame and B frame are relied on is present in the buffering area, as not existing, then this P frame or B frame is eliminated buffering area;
(7) receiving terminal decompress(ion) and broadcast: receiving terminal carries out decompress(ion) to the video data through verification and adjustment in the buffering area of prescribing a time limit.
H.261 described various compression algorithm comprise, H.263, MPEG2 or MPEG4.
Flow-medium transmission method based on frame of video splits comprises following concrete steps:
The first step: streaming media server is surveyed the topological structure of whole P2P peer-to-peer network, obtains the information of all receiving terminal nodes in the peer-to-peer network, comprises internet address, available port, upstream bandwidth, downlink bandwidth.
Second step: video source data is caught, and initial data is the bitmap format without overcompression.
The 3rd step: catch the data bitmap in the regular hour section, then video data compressed, compression algorithm for H.261, H.263, MPEG2 or MPEG4 etc.
The 4th step: from video compression data, split out each frame of video, comprise I frame, B frame and P frame.
The 5th step: add timestamp and dependence information to frame of video, be encapsulated as independently transmission unit, whether the marking video frame is the I frame.
The 6th step: in the P2P peer-to-peer network, search the current optimal path from the transmitting terminal to the receiving terminal, optimal path is meant a shortest path is provided between the node that provided by P2P peer-to-peer network topology and the node, be the shortest forward node sequence of transmission delay, this path obtains by inquiring that each known paths is judged.This path may directly connect two internet hosts, also may be by other forward node among one or more P2P.
The 7th step: transmitting terminal sends to a transmission unit in the P2P peer-to-peer network in chronological order.
The 8th step: whether check that all transmission units that comprise frame of video all send in the P2P peer-to-peer network,, then jumped to for the 7th step if having transmission or not.
The 9th step: receiving terminal is created the time limit buffering area, and this buffering area has a time limit, and promptly the frame of video that arrives in this time limit is effective.
The tenth step: receiving terminal receives transmission unit from peer-to-peer network, and they is sorted in buffering area in limited time by the timestamp order deposit.
The 11 step: check that whether the frame of video in the time limit buffering area receives, and jumps to for the 15 step if receive.
The 12 step: check time limit of overstepping the time limit buffering area whether current time, if with ing above jumped to for the tenth step.
The 13 step: the frame of video in the buffering area of prescribing a time limit is carried out verification.Whether the consistency desired result of frame of video is all arranged according to the sequencing of timestamp all frame of video.
The 14 step: the dependence to frame of video is adjusted, if frame of video is P frame or B frame, other frame of video that then it relied on must also be present in the buffering area, if there is no, then this frame of video is eliminated buffering area.
The 15 step: the frame of video in the time limit buffering area is carried out decompress(ion).
The 16 step: whether transmission course finishes, and goes on foot if do not finish then jump to second.
The 17 step: transmission course finishes, and withdraws from circulation.
Embodiment two
Referring to Fig. 2: a kind of real time flow medium transmission system that splits based on frame of video mainly comprises: transmitting terminal and receiving terminal:
Described transmitting terminal comprises:
P2P network operation module: be used for obtaining the information of all receiving terminal nodes of peer-to-peer network, and calculate the information of all receiving terminal nodes, draw optimal transmission paths;
Video Capture module: be used for from the original image of external video collecting device capturing video;
Video compressing module: be used for calling as required video compression algorithm, original video data is compressed;
Frame of video splits module: each frame of video after will compressing splits from the video data of compression;
Network Transmission unit package module: the transmission unit that is used for each frame of video, its numbering, timestamp and frame type sign are encapsulated as the P2P structure;
P2P peer-to-peer network transport module: be used for transmission unit is sent to the P2P peer-to-peer network; Described receiving terminal comprises:
P2P peer-to-peer network transport module: be used for receiving transmission unit from the P2P peer-to-peer network;
Buffering area operational module in limited time: be used to set up and keep a buffering area with time restriction;
Frame of video verification module: be used to check whether frame of video arranges according to the sequencing of timestamp; Whether the frame of video that P frame and B frame are relied on is present in the buffering area, as not existing, then this P frame or B frame is eliminated buffering area;
Video decode module: be used for calling as required various existing video decompression algorithm.
Video playback module: the video image behind the broadcast decompress(ion).