The control method of video format and system thereof in the video communication
Technical field
The present invention relates to field of computer technology, the control method and the system thereof of video format in particularly a kind of video communication.
Background technology
During existing instant messaging was used, video communication is one to be used very widely, and along with popularizing of video communication, the user is also more and more higher to the various demands of video communication, comprised quality, size, fluency of video or the like.Wherein, the video in the current communication adopt big video still be small video also be that the user pays close attention to, and the size of so-called video just is meant a kind of of video format, so need carry out better controlled to satisfy user's different demands to video format.
Video communication is generally based on a kind of video format, communication two party can be when the initialization communication connects, consult an identical video format, and jointly carry out video and obtain with this video format, coding, decoding, operations such as demonstration in actual applications, need change video format sometimes in the video communication process, do not see such as picture is too for a short time, need become big to picture, perhaps network condition is too poor, and big picture bandwidth consumed is too big, need become little picture and transmit etc., these just need be changed video format.
Why video format wants both sides unified, is that receiving terminal then reduces video according to unified video format, and shows with this form because transmitting terminal will send to receiving terminal to video data compression again.If the video format disunity is then received and can't correctly be reduced behind the video data and correctly show, also just can't carry out video communication.
In the prior art, the general mode that adopts of Switch Video form is: stop local video earlier, send a message then to the other side, tell the video format that the other side will change, the other side obtains stopping corresponding video after the message, carries out the video setting again with new video format again, return the message of an affirmation then, after the message of affirmation is received in this locality, restart video, begin the video communication under the new video format then with new video format.
Above-mentioned prior art has following shortcoming: at first, the mutual process of confirming of both sides is very loaded down with trivial details, and carries out such can expending a lot of times alternately, further can make the user wait for the long time; In addition, when network condition is bad, the situation of packet time-delay or packet loss can take place, if the affirmation packet delay in the reciprocal process, will expend the more stand-by period, and, may cause video communication can't continue normally to carry out in case the affirmation bag is lost.
Summary of the invention
In view of this, the present invention proposes the control method of video format in a kind of video communication, its purpose is, transmits video format information the video communication both sides effectively immediately.Further aim of the present invention is for being implemented in the quick Switch Video form of video communication both sides.
Another object of the present invention is to propose the control system of video format in a kind of video communication.
According to above-mentioned purpose, the invention provides the control method of video format in a kind of video communication, this method is provided with the packet header that can hold video format information at least in video packets of data, and this method further may further comprise the steps:
A. transmitting terminal obtains video data according to the current video form, and compresses this video data and obtain video packets of data;
B. in described video packets of data packet header, write the current video format information, and send to receiving terminal;
C. receiving terminal judges whether the represented video format of video format information in the video packets of data packet header is identical with the presently used video format of receiving terminal, if identical then according to the video format decode video data bag and the display video image of current use; Otherwise behind the configuration of the video format in video packets of data packet header decoder, decode video data bag and display video image.
Further comprise the step that transmitting terminal is provided with video format and disposes sending ending equipment according to set video format before the steps A.
Further comprise before the steps A and change the current video form and according to the step of the current video format configuration sending ending equipment after changing.
Further comprise the step of obtaining the current video form before the step B.
Described current video format information is the code of current video form or expression current video form.
Described video format comprises video size and/or video code model.
The present invention also provides the control system of video format in a kind of video communication, and this system comprises transmitting terminal and receiving terminal.Wherein, the transmitting terminal of this system comprises: video capture device is used for obtaining video data according to the current video form; Encoder is used for obtaining video packets of data according to the coding video data of current video form to being obtained; The video sending module is used for writing the current video format information in video packets of data packet header, and sends to receiving terminal.The receiving terminal of this system comprises: the video reception module, be used to receive described video packets of data, judge whether the represented video format of video format information in the video packets of data packet header is identical with the presently used video format of receiving terminal, if identical then send decoder to according to the video format decode video data bag of current use and with video packets of data; Otherwise behind the configuration of the video format in video packets of data packet header decoder, send video packets of data to decoder; Decoder is used for obtaining video data according to current video formats video packets of data, and sends video data to video display apparatus; Video display apparatus is used for according to decoded video data display video image.
The transmitting terminal of this system comprises that further video format is provided with module, and this video format is provided with module and is used for disposing video capture device, encoder and video sending module according to the new video format of user's setting.
From such scheme, as can be seen,, thereby can transmit video format information the video communication both sides effectively immediately because the present invention has increased the packet header of carrying video format information in the video packets of data that transmitting terminal sends.And further, in needs Switch Video form, need not both sides sends message repeatedly and determines new video format, can automatically switch to new video format, not only remove reciprocal process loaded down with trivial details when switching from, allowed video format switch and carry out fast, guaranteed both sides' video format unanimity, and avoided time-delay in the prior art or influence that packet loss brought, guaranteed the correctness of video format.
Description of drawings
Fig. 1 is a video packets of data transmission flow common in the prior art;
Fig. 2 is the schematic flow sheet according to the method for the embodiment of the invention;
Fig. 3 is the structured flowchart according to the system of the embodiment of the invention.
Embodiment
For making the purpose, technical solutions and advantages of the present invention clearer, the present invention is described in more detail by the following examples.
Video format among the present invention can be to comprise contents such as video size, video coding mode.Only be the example explanation in the following embodiments, but it will be appreciated by those skilled in the art that the present invention does not limit to therewith with the video size.
As shown in Figure 1, common video packets of data process of transmitting is: at first obtain video data from the video capture device camera, by obtaining video packets of data after the encoder compresses, then video packets of data is directly sent then.In the present embodiment, in the video packets of data that is sent, increase a packet header, wherein write down the employed video format information of current video bag.When the video communication connection is set up, both sides have just negotiated a unified video format, and when sending video packets of data, the video format that this is unified writes video packets of data packet header so, send to the other side in the lump, the other side then is correspondingly processed according to the video format in the packet header.
Fig. 2 is the schematic flow sheet of the embodiment of the invention.With reference to Fig. 2, present embodiment may further comprise the steps:
Step 101 sets in advance packet header of video packets of data, and this packet header can hold video format information at least.This setting up procedure also comprises the implication of informing video format information representative in the both sides packet header, so that both sides are consistent.
Video format information can directly be the current video form, also can be the code of expression current video form.With the video size is example, if the current video size is 320*240, video format information can be 320*240 so, also can be the code of expression 320*240, as long as both sides can identification.
Step 102, change the current video form if the user sends instruction, then transmitting terminal receives the video format that the user changes, and the relevant device of transmitting terminal is set according to the video format that changes, for example video capture device, encoder etc. are with as new current video form.
If the user does not change the current video form, execution in step 102 not then.This moment, the current video form of transmitting terminal was the video format that is provided with before this, and transmitting terminal has disposed the relevant device of transmitting terminal, for example video capture device, encoder etc. according to set video format after video format is set.
Step 103, video capture device obtains video data according to the current video form.
Step 104, the encoder video data that compression is obtained according to the current video form obtains video packets of data.
Step 105 is obtained the current video form, writes the current video format information in the packet header of video packets of data, i.e. the video format information of this packet.
Step 106, transmitting terminal sends to the other side with video packets of data, i.e. receiving terminal.
Following step 107 to step 113 is described receiving terminal according to the video format information decode video data bag in the video packets of data packet header and the flow process of display video image.
Step 107 after receiving terminal receives video packets of data, is resolved packet header and is obtained video format information.
Step 108 judges whether the local current video form of the described video format that obtains and receiving terminal is identical from packet header, if identical then execution in step 109 and subsequent step; Otherwise expression the other side has changed video format, and the video data that is sent also is to handle with new video format, so need at first change the video format of receiving terminal, then receiving terminal execution in step 111 and subsequent step.
Step 109, the decoder of receiving terminal is according to current video formats video data.
Step 110 according to decoded video data display video image, finishes current handling process.
Step 111, according to new video format, the video format configuration relevant device that promptly obtains from packet header comprises decoder etc.
Step 112, decoder is with new video format decode video data.
Step 113 is according to decoded video data display video image.
Fig. 3 is the system configuration schematic diagram according to the embodiment of the invention.With reference to Fig. 3, this system comprises transmitting terminal and receiving terminal.
Transmitting terminal comprises video capture device, encoder, video sending module.Wherein, video capture device obtains video data according to the current video form; Encoder to the coding video data that video equipment obtains, obtains video packets of data according to the current video form; The video sending module writes the current video format information in the packet header of described video packets of data, and sends to receiving terminal.Transmitting terminal can further include video format module is set, this video format is provided with new video format configuration video equipment, encoder and the video sending module that module is provided with according to the user, thereby makes these equipment to operate accordingly according to new video format.
The receiving terminal of this system comprises video reception module, decoder, video display apparatus.Wherein, the video packets of data that video reception module receiving end/sending end is sent, the packet header of resolving wherein obtains video format information, and judges whether the described video format that obtains from packet header is identical with receiving terminal this locality current video form, if identical then send video packets of data to decoder; Otherwise dispose decoder according to new video format, and send video packets of data to decoder.Decoder is according to current video formats video data, and decoded video data is sent to video display apparatus.Video display apparatus is according to decoded video data display video image.
The above 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.