Summary of the invention
In view of this, technical problem to be solved by this invention provides a kind of video data transmission method and system, sends but network bandwidth adaptive carries out video data, guarantees the smooth playing of video to greatest extent; And in distribution procedure, transmit the partial content in the video file at every turn, and avoided a video file is divided into a plurality of video clips files, simplified file management.
A kind of video data transmission method that the embodiment of the invention provides comprises:
Reception sends the request of first video segment from the requirement of client, and this request carries described first video segment identification information and current available network bandwidth parameter;
Adjust the video data volume of described first video segment according to described available network bandwidth, and adjusted first video segment is sent to described client;
Reception sends the request of second video segment from the requirement of client, and this request carries described second video segment identification information and detected network bandwidth parameter;
Adjust the video data content of described second video segment, itself and the network bandwidth parameter that obtains that detects are complementary;
Send adjusted second video segment to described client.
The embodiment of the invention also provides a kind of video data transfer system, comprises video server and client;
Described client, the message that is used to send request distribution of video fragment be to described video server, and provide the video segment identification information of being asked and network bandwidth information to video server;
Described video server is adjusted the video data volume of described video segment according to described network bandwidth information, and itself and the network bandwidth parameter that obtains that detects are complementary; And send adjusted video segment to described client.
The embodiment of the invention also provides a kind of video server, comprising:
Receiving element is used to receive the request that sends video segment from the requirement of client, and this request carries described video segment identification information and current available network bandwidth parameter;
Adjustment unit is adjusted the video data volume of described video segment according to described available network bandwidth, and itself and the described network bandwidth are complementary;
Transmitting element is used for adjusted video segment is sent to described client.
Ground preferably, this video server also comprises:
Judging unit is used to judge whether the video data volume of described video segment multiply by the data volume that the described required time of video clips normal play obtains greater than the described network bandwidth;
If described judging unit judges that the video data volume of described video segment multiply by the data volume that the described required time of video clips normal play obtains greater than the described network bandwidth, then indicate adjustment unit to delete the video data volume in the described video segment, to adapt to the network bandwidth.
Compare with video data distribution technology scheme of the prior art, video data tranmission techniques scheme provided by the invention, under the heterogeneous networks bandwidth condition, can select to transmit the content of only data volume according to user's different bandwidth automatically, guarantee smoothness, the high-quality broadcast of video; Traditional stream media system is in order to provide the self-adaption code rate distribution function, by storing realizing of many parts of video copy.Use the method disclosed in the present and system, only need the video file of single part of storage, saved memory space and cost.Video data distribution method provided by the invention and system, in video data transmission process, not whole part of video content of disposable transmission, but according to a segment of the each transmitted video content of client-requested, and transmit based on current available network bandwidth, made full use of network bandwidth resources.In the video data distribution flow of prior art, from the streaming media server to end-user customer, used a lot of caching technologys in each intermediate link of end, CDN buffer memory for example, video file is data-intensive, and the video data volume is big, is unfavorable for the caching system processing.Video data distribution method provided by the invention and system are that unit transmits with the video clips, and the data volume of video clips is little more a lot of than whole video file, more help caching system and handle, and improve buffer efficiency.Method of video distribution of the prior art and system have taked single video file explicitly is divided into the way of a plurality of video clips files, distribute single video clips file at every turn, and this has increased very burden for the management of video file.Can guarantee the smooth playing of video to greatest extent according to the present invention; The object of storage and management remains complete video file in the technical scheme provided by the invention, and in distribution procedure, each partial content that transmits in the video file has been avoided a video file is divided into a plurality of video clips files, thereby has been simplified storage administration.
Embodiment
In order to solve problems of the prior art or drawback as described in the background art, the invention provides a kind of method that sends video file content piecemeal that can network bandwidth adaptive.In fact usually said video file comprises the file mark information data, audio coding decoding information data, coding and decoding video information data, audio content data and video content data.Video file sending method provided by the invention, its basic principle is, from server to the process of transmitting of client, each part (being called video segment) that only sends the whole video file, and, according to the dynamic video data of adjusting in the video segment to be sent of network bandwidth parameter, such as under the prerequisite that does not influence the vision signal normal play, abandon wherein unessential data, make from server and satisfy network bandwidth condition to the overall data amount that client sends.Usually adopt this simple, effective code check adaptation method of frame losing (Dropping Frame), promptly by abandoning the data volume that the coded frame of some in the video sequence reduces video, the variation of network bandwidth adaptive.Discardable frame is the coded frame less to user's subjective perception quality influence, thereby guarantees the video reconstruction quality to greatest extent.
With reference to Fig. 1, a kind of video data transmission method provided by the invention comprises the steps:
S101, the user end to server request is about the metamessage of certain video file to be sent, and this metamessage comprises video segment quantity and each video segment identification information of described video file to be sent;
S102, server feeds back to client with the metamessage of this video file;
In advance video file to be sent is divided into some video segments, each video segment comprises picture group (the Group of Pictures) unit that is provided with when some video files are encoded, and for each video segment is provided with sign, this sign can adopt this video segment sequence number or the start position information of this video segment in video file.As the case may be, the picture group element number that comprises of each video segment can be identical also can be different.
In addition, client also can obtain the metamessage of video file by other approach.Therefore S101 and S102 are optional step.
S103, client sends the request that requires distribution first video segment, and this request carries the first video segment identification information and current available network bandwidth parameter;
Client is according to the metamessage of video file and the current available network bandwidth parametric configuration request message to a certain segment contents in this video, and sends to server.
S104, server be according to the video data volume of network bandwidth parameter adjustment first video segment in the request message that receives, and adjusted first video segment is sent to described client;
Under the prerequisite that does not influence the vision signal normal play, abandon wherein unessential data, make from server and satisfy network bandwidth condition to the overall data amount that client sends.
Usually, the video segment content comprises:
The file header sign data of this video file;
Video section essential decoding parametric data of when decoding in this video file;
Essential decoding parametric data during this video file sound intermediate frequency partial decoding of h;
In this video file from the original position of video segment of request to the audio content data the final position;
In this video file from the original position of video segment of request to the video data the final position, and the bandwidth parameter of data volume size and client-requested is complementary.
Particularly, shown in Fig. 2 a, a video file includes three video segments, and each fragment has some video data frames, as I frame, B frame and P frame and corresponding voice data.
In video coding, the basic procedure of I frame coding is: carry out infra-frame prediction, the intra prediction mode that decision is adopted; Pixel value deducts predicted value, obtains residual error; Residual error is carried out transform and quantization; Variable-length encoding and arithmetic coding; Reconstructed image and filtering, the image that obtains is as the reference frame of other frame.
Only with reference to the frame of front, the B frame can be with reference to the frame of front or back for the P frame, and the basic procedure of P frame and B frame coding is:
At first, carry out estimation, calculate rate distortion function (joint) value that adopts interframe encoding mode, carry out infra-frame prediction, frame mode and the inter-frame mode of choosing rate distortion function value minimum compare, determine to adopt which kind of coding mode, calculate the difference of actual value and predicted value, residual error is carried out transform and quantization, entropy coding, if interframe encoding mode, encoding motion vector.
Hence one can see that, and the I frame is a key frame, belongs to compression in the frame, and the P frame is to search for forward, and the B frame is bidirectional research, and the two all comes packed data based on the I frame.The I frame is as the reference frame, adopts infra-frame prediction, the P frame with the I frame of front or P frame as the reference frame, the B frame with the P frame of the I frame of front or P frame and back as the reference frame.
If the video data volume of video segment multiply by the data volume that the described required time of video clips normal play obtains greater than the described network bandwidth, then server is deleted the video data volume in the described video segment, to adapt to the network bandwidth.Therefore, with video data B frame deletion, obtain the first new video segment and send to client.
S105, client detects current video delivery network bandwidth;
The detection computations method of the network bandwidth is specially:
The data volume that client received in certain unit interval time period during receiving first video segment.The data volume of the current video fragment that received divided by receiving the used time of these data, is promptly obtained current video delivery network bandwidth.
S106, client send to require the request of distribution second video segment to server, and this request carries the network bandwidth parameter that the described second video segment identification information and detection computations obtain;
The client request that send to require distribution second video segment is to server in the following cases:
Client is received the first video segment content; Or
Client has been received the first video segment content, and from time that finishes of first video segment less than predetermined threshold value; Or
Client stop to play (such as, because of accident or user initiatively change other programs) first video segment, and ask another video segment.
S107, server are complementary itself and the network bandwidth parameter that obtains that detects according to the video data content of detect network bandwidth parameter adjustment second video segment that obtains;
S104 is similar with step, based on the detect network bandwidth that obtains the video data content of second video segment is adjusted, and makes itself and network bandwidth parameter matching.
The video data volume of described adjusted video segment is determined according to following step:
Calculate the data value that multiplies each other and obtain described video segment according to the time span that the normal play of described network bandwidth parameter and video segment is required;
If the video data volume of second video segment multiply by the data volume that the described required time of video clips normal play obtains greater than the described network bandwidth, then server is deleted the video data volume in the described video segment, to adapt to the network bandwidth.Therefore, with video data B frame (being the V5 frame) deletion, obtain video segment shown in Fig. 2 b as the second new video segment.
S108 sends adjusted second video segment to described client.
Give described client with second video segment behind the deletion video data frame V5.
As shown in Figure 3, a kind of video data transfer system 200 that the embodiment of the invention provides comprises video server 210 and at least one client 220.
Client 220, the message that is used to send request distribution of video fragment be to described video server, and provide the video segment identification information of being asked and network bandwidth information to video server;
Video server 210, the video data volume according to described network bandwidth information adjustment video segment is complementary itself and the network bandwidth parameter that obtains that detects; And send adjusted video segment to client 220.
Wherein, network bandwidth information is the current available network bandwidth, or detects the network bandwidth parameter that obtains between described video segment transmission period.
When the video data volume of video segment multiply by the data volume that the required time of normal play obtains greater than the described network bandwidth, then video server is deleted the video data volume in this video segment, to adapt to the network bandwidth.
In one of following situation, the request that client will require to send another video segment sends to video server:
Client is received the current video segment contents; Or
Client has been received the current video fragment data, and from time that finishes of current video fragment less than predetermined threshold value; Or
Client stops to play the current video fragment, and asks another video segment.
In the video data transfer system that the embodiment of the invention provides, the reciprocal process between server and the client is method flow as described above, does not repeat them here.
With reference to Fig. 4, the embodiment of the invention also provides a kind of video server 300, comprising:
Receiving element 310 is used to receive the request that sends video segment from the requirement of client, and this request carries described video segment identification information and current available network bandwidth parameter;
Adjustment unit 320 is adjusted the video data volume of described video segment according to described available network bandwidth, and itself and the described network bandwidth are complementary;
Transmitting element 330 is used for adjusted video segment is sent to described client.
This video server 300 also comprises:
Judging unit 340 is used to judge whether the video data volume of video segment to be sent multiply by the data volume that the required time of this video segment normal play obtains greater than the described network bandwidth;
If judging unit 340 judges that the video data volume of video segment to be sent multiply by the data volume that the required time of this video segment normal play obtains greater than the described network bandwidth, then indicate adjustment unit 320 to delete the video data volume in this video segment to be sent, to adapt to the network bandwidth.
Compare with video data distribution technology scheme of the prior art, video data tranmission techniques scheme provided by the invention, under the heterogeneous networks bandwidth condition, can select to transmit the content of only data volume according to user's different bandwidth automatically, guarantee smoothness, the high-quality broadcast of video; Traditional stream media system is in order to provide the self-adaption code rate distribution function, by storing realizing of many parts of video copy.Use the method disclosed in the present and system, only need the video content of single part of storage, saved memory space and cost.Video data distribution method provided by the invention and system, in video data transmission process, not whole part of video content of disposable transmission, but according to a segment of the each transmitted video content of client-requested, and transmit based on current available network bandwidth, made full use of network bandwidth resources.In the video data distribution flow of prior art, from the streaming media server to end-user customer, used a lot of caching technologys in each intermediate link of end, content distributing network CDN buffer memory for example, video file is data-intensive, and the video data volume is big, is unfavorable for the caching system processing.Video data distribution method provided by the invention and system are that unit transmits with the video clips, and the data volume of video clips is little more a lot of than whole video file, more help caching system and handle, and improve buffer efficiency.Method of video distribution of the prior art and system have taked single video file explicitly is divided into the way of a plurality of video clips files, distribute single video clips file at every turn, and this has increased very burden for the management of video file.Can guarantee the smooth playing of video to greatest extent according to the present invention; The object of storage and management remains complete video file in the technical scheme provided by the invention, and in distribution procedure, each partial content that transmits in the video file has been avoided a video file is divided into a plurality of video clips files, thereby has been simplified storage administration.
According to described disclosed embodiment, can be so that those skilled in the art can realize or use the present invention.To those skilled in the art, the various modifications of these embodiment are conspicuous, and the general principles of definition here also can be applied to other embodiment on the basis that does not depart from the scope of the present invention with purport.Above-described embodiment only is preferred embodiment of the present invention, and is in order to restriction the present invention, within the spirit and principles in the present invention not all, any modification of being done, is equal to replacement, improvement etc., all should be included within protection scope of the present invention.