Summary of the invention
The objective of the invention is provides a kind of more perfect solution in order to overcome the shortcoming in the existing video push processing method.
The invention provides a kind of video push processing method of serving live broadcast of mobile terminal, comprising:
The new video files acquisition step is gathered video data and the said video data of being gathered is handled, and output new video files after treatment;
The new video files monitoring step is monitored the generation of said new video files, and sends and state the information that new video files generates to some extent;
Resource queue safeguards step, and the said new video files that is monitored is added resource queue, and will be identified on one's own initiative and utilize the said new video files that finishes from said resource queue, to delete, thereby accomplishes the maintenance to said resource queue;
The new video files checking procedure carries out size and legitimacy verification to safeguard the said new video files that step is safeguarded through said resource queue;
The new video files transmitting step will transfer to transfer server through the said new video files of said size and legitimacy verification;
New video seed file step of updating according to the said new video files that receives on the said transfer server, produce and the corresponding live video seed file of direct broadcast band, and the new video seed is updated to local file system and remote interface shown in inciting somebody to action.
Wherein, In said new video files transmitting step, will receive a video file first and carry out buffer memory, wait receive second video file after; Just not free compartment of terrain is a said video file and said second video file that receives first of transmission continuously; And behind said second video file, receive new video file at every turn, all can transmit at once.
Wherein, in said new video files monitoring step, monitor the generation of said new video files by application interface module.
Wherein, in said new video files checking procedure, before there is said new video files arrival the notifying communication unit, said new video files is carried out the verification of size and legitimacy in resource arrival notice inside modules.
Wherein, the said new video files of in said new video files acquisition step, exporting comprises high definition version video, clear version video and smooth version video.
Wherein, said high definition version video is that video resolution is 320 * 240; Said clear version video is that video resolution is 208 * 176; Said smooth version video is that video resolution is 176 * 144.
Wherein, said high definition version video is that 60 seconds small video file is formed by time span; Said clear version video is that 42 seconds small video file is formed by time span; Said smooth version video is that 31 seconds small video file is formed by time span.
The present invention also provides a kind of video push system that serves live broadcast of mobile terminal, comprising:
The new video files collecting unit is used to gather video data and the said video data of being gathered is handled, and output new video files after treatment;
The file monitoring means, the new video files that the said new video files collecting unit that is used to monitor generates, and send and state the information that new video files generates to some extent;
Conservation of resources unit; Be used for and add resource queue by the said new video files that said file monitoring means is monitored; And will be identified on one's own initiative and utilize the said new video files finish from said resource queue, to delete, thereby accomplish maintenance to said resource queue;
The data channel unit is used for the said new video files of safeguarding through said conservation of resources unit is carried out size and legitimacy verification, and the while is as the data channel of transmitting said new video files and can carry out initialization to said file monitoring means;
Communication unit is used for transferring to transfer server through the said size of said data channel unit and the said new video files of legitimacy verification;
The kind subelement according to the said new video files that receives on the said transfer server, produce and the corresponding live video seed file of direct broadcast band, and the new video seed is updated to local file system and remote interface shown in inciting somebody to action.
Wherein, Said communication unit will receive a video file first and carry out buffer memory; Wait receive second video file after, transmission is said continuously in just not free compartment of terrain receives a video file and said second video file first, and behind said second video file; Receive new video file at every turn, all can transmit at once.
Wherein, said file monitoring means calls application interface module is monitored the generation of said new video files.
Wherein, notifying said communication unit to have before said new video files arrives, said data channel cell call resource arrival notice module is also carried out the verification of size and legitimacy to said new video files in said resource arrival notice inside modules.
Wherein, the said new video files of in said new video files collecting unit, exporting comprises high definition version video, clear version video and smooth version video.
Wherein, said high definition version video is that video resolution is 320 * 240; Said clear version video is that video resolution is 208 * 176; Said smooth version video is that video resolution is 176 * 144.
Wherein, said high definition version video is that 60 seconds small video file is formed by time span; Said clear version video is that 42 seconds small video file is formed by time span; Said smooth version video is that 31 seconds small video file is formed by time span.
Through the technique scheme of embodiment of the present invention, solve various version that the PC the Internet pushes to the user and be inappropriate for cellphone subscriber, live problem such as delay, strengthened user's experience simultaneously.
Embodiment
Specify embodiment of the present invention below in conjunction with accompanying drawing.
Fig. 1 has shown the sketch map of the video living transmission system of portable terminal.As shown in Figure 1, the video living transmission system of portable terminal comprises computer (PC) 1, transfer server (live server) 2, mobile network 3 (for example GPRS network or CDMA1X network) and portable terminal 4 (for example mobile phone).Computer (PC) 1 is used for from the collection video, and the video of being gathered is pushed to transferserver 2 after treatment, and is stored on thetransfer server 2 as videosource.Transfer server 2 is used to store corresponding video source and carries out net cast for portable terminal 4 obtains.Portable terminal 4 obtains corresponding video and plays at these portable terminal 4 preassembled media players from the stored video source oftransfer server 2 throughmobile network 3.
Computer 1 has the video push system, and it is responsible for to the corresponding video oftransfer server 2 directional transmissions, the video file of preferred high definition version video, clear version video and three versions of smooth version video.So-called high definition version video is meant that video resolution is 320 * 240 the video that is suitable on portable terminal, playing; So-called clear version video is meant that video resolution is 208 * 176 the video that is suitable on portable terminal, playing; So-called smooth version video is meant that video resolution is 176 * 144 the video that is suitable on portable terminal, playing.The video of above-mentioned high definition version video, clear version video and three versions of smooth version video can be to adopt the H.264+AAC video of the MP4 file format of compression generation respectively, and their frame per second also all can be for 7 frame/seconds (fps).Certainly, the video of above-mentioned high definition version video, clear version video and three versions of smooth version video also can adopt other any video file formats such as ASF, 3GP, FLV respectively.In the present invention, the user can be according to current network environment situation and self hobby, selects the video of the respective version in the video resource of transfer server 2.When user's network environment better and when liking seeing higher-quality video, the user can select high definition version video to watch.Otherwise, make that when user's network environment is relatively poor when seeing that the video council of high definition version causes video not smooth, the user can select a clear version video or a smooth version video to watch.
Fig. 2 has shown the sketch map of the video push system of live broadcast of mobile terminal.As shown in Figure 2; The video push system of live broadcast of mobile terminal comprisesvideo acquisition unit 11, file monitoring (FileMonitor)unit 12, the conservation of resources (MediaQueue)unit 13, data channel (Communicator)unit 14, communication (Communicator)unit 15 and seed (Seed)unit 16, and CPU18, thecommunication interface 19 ofvideo acquisition unit 11, FileMonitorunit 12, MediaQueueunit 13, ChannelMonitorDlgunit 14,Communicator unit 15,Seed unit 16 and computer 1 are connected through bus 20.This video push system is connected withtransfer server 2 communications through communication interface 19.CPU18 is through the operation ofvideo acquisition unit 11, FileMonitorunit 12, MediaQueueunit 13, ChannelMonitorDlgunit 14,Communicator unit 15 and theSeed unit 16 ofbus 20 control of video supplying systems.
Video acquisition unit 11 can be gathered corresponding video data and the video data of being gathered is handled from the outside; For example the video data of being gathered is separated conversion of coding, combination, encapsulation and file format etc.; Generate corresponding new video files, and export the video file that generates with the form of video flowing.In this execution mode;Video acquisition unit 11 forms the new video stream of high definition version video, clear version video and three versions of smooth version video respectively with the video data of being gathered, and these new video stream all adopt the video flowing of being made up of a plurality of little new video files.But in the video living transmission system of this portable terminal, these little new video files are by one by one transmission, and after certain little new video files wherein only was moved the terminal and receives fully, portable terminal just began to play this little new video files.Thus, the time span that in video, comprised of this little new video files has directly determined live size time of delay.In a preferred embodiment of the invention, for balance real-time index and fluency index, for high definition version video file, the time span thatvideo acquisition unit 11 was distributed 60 seconds is cut corresponding video data and is generated corresponding small video file; For clear version video file, the time span of distributing 42 seconds is cut corresponding video data and is generated corresponding small video file; For smooth version video file, the time span of distributing 31 seconds is cut corresponding video data and is generated corresponding small video file.
FileMonitorunit 12 mainly is used for the video file that monitorvideo collecting unit 11 generates; Monitor the increase and the state of the video file thatvideo acquisition unit 11 generates, the preferred MP4 file of new video files that above-mentioned FileMonitorunit 12 generates through the calling system application programming interfaces.In casevideo acquisition unit 11 has new video file to generate, FileMonitorunit 12 will add resource queue with newly-generated video file, and notice MediaQueueunit 13 is correspondingly processed with ChannelMonitorDlgunit 14.
MediaQueueunit 13 mainly is used for being responsible for maintenance resources (video file thatvideo acquisition unit 11 generates) formation, constantly receives the video file that FileMonitorunit 12 adds, and for transmitting thread video file information is provided.And resource also is responsible for reclaiming in MediaQueueunit 13, definite video file that has utilized, and can initiatively will be determined the video file deletion that has utilized.
ChannelMonitorDlgunit 14 be this video push system graphic user interface (Graphical User Interface, GUI) main thread, be the transmission new video files data channel.Simultaneously, ChannelMonitorDlgunit 14 can also carry out initialization to FileMonitor unit 12.And the said new video files of 14 pairs of 13 maintenances through the MediaQueue unit in ChannelMonitorDlg unit is carried out size and legitimacy verification.Preferably, ChannelMonitorDlgunit 14 calls resource arrival notice module (AnnounceMediaArrival module)notice Communicator unit 15 has new video file to arrive.In the AnnounceMediaArrival inside modules, before there is new video file arrivalnotice Communicator unit 15, can carry out size and legitimacy verification to video file.If find that the video file size is too little, can get into the small video file status.
Communicator unit 15 is main to be responsible for and the communicating by letter of transfer server (live server).ThisCommunicator unit 15 ceaselessly detects new video files signal EUSR1, in case there is new video files to arrive, just the memory on its buffer memory to the computer 1 17 perhaps givendirect communication interface 19 through computer 1 and transfers to transfer server 2.Specifically; When thisCommunicator unit 15 receives a video file (begin first, begin after perhaps suspending, perhaps connection begins after breaking off) first; This video file that receives first tomemory 17 of meeting buffer memory; Wait receive second video file after, just throughcommunication interface 19 above-mentioned two video file to transferservers 2 of transmission continuously, and between above-mentioned two video files of transmission not at interval.Then, afterCommunicator unit 15 has transmitted above-mentioned two video files, receive new video file at every turn, all can transmit to transferserver 2 throughcommunication interface 19 at once.
In addition,Communicator unit 15 is responsible in addition when the state oftransfer server 2 changes, and generates perhaps more new seed video file.Afternew transfer server 2 successful connections,Communicator unit 15 can increase this chained address in the seed video file, or when connection failure repeatedly, judges that transferserver 2 is unavailable or shuts down, and deletes this chained address.
The Seed unit mainly is used for being responsible for the generation live video seed file corresponding with direct broadcast band; And responsible more new video seed file is to local file system and remote interface, and this live video seed is the information that is used for the recording of video file-related information and needs setting.
Fig. 3 shows the transfer process figure of video file.As shown in Figure 3, in step S1, create Socket to transferserver 2, make that communication of formation is connected between computer 1 and the transfer server 2.That is to say; Computer 1 uses Socket that the mutually deserved port of transfer server is sent connection request; In case successful connection can communicate session between computer 1 and thetransfer server 2, promptly computer 1 can perhaps be replied the request of computer 1 to transferserver 2 request of sending.In step S1, if (the step 2: not), return step S1 and create Socket again of connection failure between computer 1 and thetransfer server 2 to transferserver 2; If successful connection between computer 1 and the transfer server 2 (step S2: be), computer 1 sends the request (step S3) of uploading (UPLOAD) video file to transfer server 2.If the request of the above-mentioned uploaded videos file oftransfer server 2 refusal or to not response of the request (step 4: not), return step S1 and create Socket again of above-mentioned uploaded videos file to transferserver 2; Iftransfer server 2 has been accepted the request (step 4: be) of above-mentioned uploaded videos file, detect new video files signal EUSR1 (step S5).IfCommunicator unit 15 does not detect has new video file in the resource queue (step S6: deny), return step S1 and create Socket again to transferserver 2; New video file is arranged (step S6: be) in the resource queue ifCommunicator unit 15 detects,Communicator unit 15 sends Stream request (step S7) to transfer server 2.That is to say that whenCommunicator unit 15 detects when new video file is arranged in the resource queue,Communicator unit 15 sends the request of setting up the transmission data channel to transfer server 2.Set up above-mentioned transmission data channel (step 8: not), return step S1 and create Socket again to transferserver 2 if fail; If successfully set up above-mentioned transmission data channel (step S8: be), then begin to transferserver 2 transmission detected new video files (step S9).Specifically, when sending the Stream request and when successfully setting up the transmission data channel throughCommunicator unit 15 to transferserver 2, the passage of the transmission data that this has just been set up is the passage of data to be transmitted such as.Then, call such as Stream.Write () method and Stream.Read () method and just send data through this passage respectively and read the data in the passage.Wherein, in step S8, the connection thread of Communicator unit 15 can be according to the state of the situation definition transfer server (live server) 2 that connects.When in step S7, attempt connecting again when all failing for 15 times,Communicator unit 15 just is defaulted astransfer server 2 and shuts down in step S8, deletes corresponding chained address and dormancy and returns step 1 beginning in 10 seconds later on again and connect again.If successful connection again makes into the state oftransfer server 2 active and this chained address of increase in the video seed file again.
If in step S9,, return step S1 and create Socket again to transferserver 2 to transferserver 2 transmitting video files unsuccessful (step S10: deny); If in step S9,, return the arrival that step S5 detects next new video files to transferserver 2 transmitting video files successes (step S10: be).
Fig. 4 pushes flow chart for video file.As shown in Figure 4,video acquisition unit 11 is gathered corresponding video data and the video data of being gathered is handled from the outside, the video file (step S101) that output simultaneously generates.In step S102, the video file that Filemonitorunit 12 monitoringvideo acquisition unit 11 generate.When Filemonitorunit 12 monitorsvideo acquisition unit 11 when having new video file to generate, the information that notice MediaQueueunit 13 and ChannelMonitorunit 14 have new video files to generate.Wherein, the new video files ofFi lemonitor unit 12 calls application interface module monitorsvideo acquisition unit 11 generations.Receive when coming from that the Filemonitor12 unit is above-mentioned to have the information that new video files generates when MediaQueueunit 13, receive this newly-generated video file and it is added resource queue, accomplish safeguard (step S103) resource queue.Simultaneously, whether certain video file in MediaQueueunit 13 definite resource queues has utilized and has finished.Finish when definite certain video file has been utilized, MediaQueueunit 13 is initiatively deleted it from resource queue, so that resource queue is safeguarded.In step S104, the ChannelMonitor14 unit carries out size and legitimacy verification to the new video files in the resource queue of process maintenance, and noticeCommunicator unit 15 has new video file to arrive.If the ChannelMonitor14 unit finds that the video file size is too little, can get into the small video file status.Preferably, before there is new video file arrivalnotice Communitor unit 15, new video files is carried out the verification of size and legitimacy in the AnnounceMediaArrival inside modules.In step S105, ifCommunicator unit 15 detects the newly-generated video file signal EUSR1 that comes from the ChannelMonitor14 unit, just to transferserver 2 these newly-generated video files of transmission.Specifically; WhenCommunicator unit 15 detects newly-generated video file signal EUSR1; IfCommunicator unit 15 is to receive a video file first, with this video file buffer memory that receives first to memory, wait receive second video file after; Just transmit above-mentioned two video files continuously, and between above-mentioned two video files of transmission, do not have at interval.What is called receives a video file first, be meant first begin, or suspend after begin, or connect when beginning after breaking off, first video file thatCommunicator unit 15 is received.Then,Communicator unit 15 has transmitted after above-mentioned two video files, receives new video file at every turn, all can transmit at once.At step S106,Seed unit 16 produces and the corresponding live video seed of direct broadcast band according to the video file that receives on thetransfer server 2, and the new video seed is updated to local file system and remote interface.
The invention is not restricted to above-mentioned execution mode,, various deformation and displacement can be arranged as long as in aim scope of the present invention.Such as in the above-described embodiment, can the small video file configuration time span of versions such as high definition version video, clear version video and smooth version video be respectively 60 seconds, 42 seconds and 31 seconds.But the invention is not restricted to this, to such an extent as to turn down to reduce live time of delay such as also continuing according to the actual requirements.
Aforesaid detailed description and accompanying drawing carry out through literal interpretation and diagram, and its purpose does not lie in the protection range that limits claim.Each mutation of embodiment in this specification is obvious for those of ordinary skill, and is in the protection range of claim and equivalent technologies thereof.