Disclosure of Invention
In view of the above, the main objective of the present invention is to provide a real-time video gateway method and apparatus, which ensure the real-time performance of watching video programs by users and reduce the construction cost and operation cost of communication links.
In order to achieve the purpose, the technical scheme of the invention is realized as follows:
the invention provides a real-time video gateway method, which comprises the following steps:
searching a matched video program in a local first-level cache according to video request information of a client terminal and video request information of the client terminal, if the matched video program is searched, converting the format of the matched video program into the specification requested by the client terminal when the specification of the matched video program is determined to be different from that requested by the client terminal, then sending the converted video program to the client terminal to play the video program, and directly sending the converted video program to the client terminal to play the video program when the specification of the matched video program is determined to be the same as that requested by the client terminal;
if the matched video program is not searched, searching the matched video program in the local second-level cache, if the matched video program is searched in the local second-level cache, converting the format of the matched video program into the specification requested by the client terminal when the specification of the matched video program is determined to be different from that requested by the client terminal, then sending the converted video program to the client terminal to play the video program, and directly sending the converted video program to the client terminal to play the video program when the specification of the matched video program is determined to be the same as that requested by the client terminal; if the video program is not searched in the local second-level cache, requesting the video content server for the video program, and receiving the matched video program sent by the video content server;
after the matched video program is obtained, when the specification of the matched video program is determined to be different from that requested by the client terminal according to the video request information of the client terminal, the format of the matched video program is converted into the specification requested by the client terminal, then the matched video program is sent to the client terminal to play the video program, and when the specification of the matched video program is determined to be the same as that requested by the client terminal, the matched video program is directly sent to the client terminal to play the video program.
In the above scheme, the matched video program is: a video program having a specification not lower than that requested by the client terminal.
In the foregoing solution, after receiving the matched video program sent by the video content server, the method further includes: and storing the matched video programs sent by the video content server in a local two-level cache.
In the above scheme, the local first-level cache is: local caching of a video playing/caching module of the video gateway; the local second-level cache is: the video source of the video gateway requests/caches local caching of the module.
In the foregoing solution, before searching for a matching video program in the local two-level cache according to the video request information of the client terminal, the method further includes: and receiving request information of the client terminal, and authenticating the client terminal according to the identification information.
The invention also provides a real-time video gateway device, comprising:
the video cache module is used for searching matched video programs in the local two-level cache according to the video request information of the client terminal, requesting the video programs to the video content server when the matched video programs are not searched, and receiving the matched video programs sent by the video content server; after the matched video program is obtained, when the specification of the matched video program is determined to be different from that requested by the client terminal according to the video request information of the client terminal, the video program is sent to a video conversion module, the converted video program sent by the video conversion module is sent to the client terminal to play the video program, and when the specification of the received video program is determined to be the same as that requested by the client terminal, the video program is directly sent to the client terminal to play the video program;
the video conversion module is used for receiving the video program sent by the video cache module, converting the format of the video program into the specification requested by the client terminal and then sending the specification to the video cache module;
the video cache module comprises: a video playing/caching module and a video source requesting/caching module,
the video playing/caching module is used for searching matched video programs in a local cache according to the video request information of the client terminal; when the matched video program is not searched, sending video request information of a client terminal to a video source request/cache module, and receiving the matched video program; after the matched video program is obtained, when the specification of the video program is determined to be different from that requested by the client terminal according to the video request information of the client terminal, the video program is sent to a video conversion module, the converted video program sent by the video conversion module is sent to the client terminal to play the video program, and the specification of the video program is determined to be the same as that requested by the client terminal, and the video program is sent to the client terminal to play the video program;
the video source request/cache module is used for searching matched video programs in a local cache according to the video request information of the client terminal; when the matched video program is not searched, requesting the video content server for the video program, and receiving the matched video program sent by the video content server; after the matched video program is obtained, when the specification of the video program is determined to be different from that requested by the client terminal according to the video request information of the client terminal, the video program is sent to a video conversion module, and when the specification of the video program is determined to be the same as that requested by the client terminal, the video program is sent to the client terminal through a video playing/caching module to play the video program;
the video conversion module is specifically configured to: the format of the video program sent by the video playing/caching module or the video source requesting/caching module is converted into the specification requested by the client terminal and then sent to the video playing/caching module.
In the foregoing solution, the video cache module is further configured to: and caching the matched video programs sent by the video content server.
In the above solution, the apparatus further includes: and the access control module is used for receiving the request information sent by the client terminal, authenticating the client terminal according to the identification information in the request information, and sending the video request information in the request information to the video cache module after the client terminal passes the authentication.
In the above solution, the video playing/caching module is further configured to cache the received video program;
the video source request/cache module is further used for caching the video programs sent by the video content server.
Therefore, the real-time video gateway method and the device provided by the invention have the following advantages and characteristics:
through a local two-level cache mechanism, the calculation amount of video format conversion processing in the video gateway is reduced, the hardware cost and the realization complexity of the video gateway are reduced, the video gateway can meet various video formats requested by a client terminal, and the requirement on the transmission bandwidth of a communication link between the video gateway and a video content server is reduced, so that the construction cost of a transmission network is reduced; the utilization rate of the current network bandwidth is improved, and the transmission network bandwidth pressure in the peak time period is relieved, so that more client terminal video playing requests can be supported, and the requirement of watching video programs in real time is met.
Detailed Description
The basic idea of the invention is: the video gateway searches for matched video programs in the local two-level cache according to the video request information of the client terminal, and when the matched video programs are not searched, the video gateway requests the video content server for the video programs and receives the matched video programs sent by the video content server; after the matched video program is obtained, when the specification of the matched video program is determined to be different from that requested by the client terminal according to the video request information of the client terminal, the format of the matched video program is converted into the specification requested by the client terminal, then the matched video program is sent to the client terminal to play the video program, and when the specification of the matched video program is determined to be the same as that requested by the client terminal, the matched video program is directly sent to the client terminal to play the video program.
Wherein the matched video program refers to: a video program having a specification not lower than that requested by the client terminal. And the matched video program is the searched matched video program or the matched video program sent by the video content server.
Further, the video gateway stores the video programs sent by the video content server in a local two-level cache.
The searching for the matched video program in the local two-level cache specifically includes: searching a matched video program in a local first-level cache according to video request information of a client terminal, if the matched video program is searched, converting the format of the matched video program into the specification requested by the client terminal when the specification of the matched video program is determined to be different from that requested by the client terminal, then sending the converted format to the client terminal to play the video program, and directly sending the converted format to the client terminal to play the video program when the specification of the matched video program is determined to be the same as that requested by the client terminal; if the matched video program is not searched, searching the matched video program in the local second-level cache, if the matched video program is searched in the local second-level cache, converting the format of the matched video program into the specification requested by the client terminal when the specification of the matched video program is determined to be different from that requested by the client terminal, then sending the converted video program to the client terminal to play the video program, and directly sending the converted video program to the client terminal to play the video program when the specification of the matched video program is determined to be the same as that requested by the client terminal; if not, a video program is requested from the video content server.
The present invention will be described in further detail with reference to the accompanying drawings and specific embodiments.
The real-time video gateway method of the invention is shown in figure 1, and comprises the following specific steps:
step 101: after receiving the request information of the client terminal, the video gateway authenticates the client terminal according to the identification information therein, and if the client terminal passes the authentication, the step 102 is entered; if the client terminal is not authenticated, the current flow is ended.
The request information includes identification information and video request information. The identification information is specifically information such as user identification, passwords and the like, after an access control module of the video gateway receives request information of a client terminal, when the client terminal is authenticated, whether matched user information exists or not is searched in the user information stored in the access control module, and if the matched user information exists, the client terminal sends video request information in the request information to a video playing/caching module through authentication; if not, the client terminal is not authenticated.
Step 102: and the video gateway analyzes the video request information of the client terminal and distributes a client terminal identification number which is unique in the whole network to the client terminal.
The video gateway specifically includes: after receiving the video request information, a video playing/caching module of the video gateway analyzes the video request information, wherein the video request information comprises: video program number, video image resolution, frame rate, code rate, encoding protocol, etc.
The video gateway allows each unique client terminal identification number to request video programs of various specifications to support a single user to watch the same or different video programs by using different client terminals.
Step 103: the video gateway searches whether a video program with the same specification as that requested by the client terminal exists in a local first-level cache according to the analyzed video program number, video image resolution, frame rate, code rate, coding protocol and the like, and if so, the step 108 is carried out; if not, step 104 is entered.
Step 103 may also be: the video gateway searches whether a video program with the same specification as that requested by the client terminal exists in a local first-level cache, and if the video program with the same specification as that requested by the client terminal exists, the step 108 is carried out; if there is no video program with the same specification as the client terminal request, then it is searched in the local first-level cache whether there is a video program with a specification higher than the client terminal request, if so, then step 107 is entered, and if not, then step 104 is entered.
In step 103, the local first-level cache of the video gateway specifically refers to a local cache of the video playing/caching module, and if the video playing/caching module does not find a video program with the same specification as the specification requested by the client terminal or a video program with a specification higher than the specification requested by the client terminal in the local cache, the video playing/caching module sends video request information and a client terminal identification number to the video source requesting/caching module of the video gateway, and then step 104 is performed; if the video playing/caching module finds the video program with the specification higher than the specification requested by the client terminal in the local cache, the video playing/caching module sends the video program data and the target specification to the video conversion module of the video gateway, and then the step 107 is performed.
The target specification specifically refers to a specification requested by the client terminal.
Step 104: the video gateway searches whether a video program with the specification not lower than or equal to that requested by the client terminal exists in the local second-level cache, and if so, the step 107 is executed; if not, step 105 is entered.
The video program with the specification not lower than or equal to that requested by the client terminal specifically means that the frame rate, the code rate and the resolution of the video program are all larger than the specification requested by the client terminal.
Step 104 may also be: the video gateway searches whether a video program with the same specification as that requested by the client terminal exists in a local second-level cache, and if the video program with the same specification as that requested by the client terminal exists, the step 108 is carried out; if there is no video program with the same specification as the client terminal request, then look up in the local second level cache if there is a video program with a specification higher than the client terminal request, if there is, go to step 107, if there is not, go to step 105.
In step 104, the local second-level cache of the video gateway specifically refers to the local cache of the video source request/cache module, and the video source request/cache module analyzes the video program number, the video image resolution, the frame rate, the code rate, the coding protocol and the like in the video request information after receiving the video request information,
if the video program with the specification not lower than the specification requested by the client terminal is found in the local cache, sending the video program data and the target specification to a video conversion module of the video gateway, and then entering step 107; if the video program which is not lower than the specification requested by the client terminal is not found in the local cache, the step 105 is entered;
or,
if the video program with the same specification as the client terminal request is found in the local cache, sending the video program data to a video playing/caching module, and then entering step 108; if the video program with the specification higher than the specification requested by the client terminal is found in the local cache, sending the video program data and the target specification to a video conversion module of the video gateway, and then entering step 107; if no video program above the specification requested by the client terminal is found in the local cache, step 105 is entered.
Step 105: the video gateway sends a video request to a video content server, wherein the video request comprises video request information of a client terminal and a gateway identification number (gateway _ ID) unique to the whole video gateway so as to request a corresponding video program; and after receiving the video request of the video gateway, the video content server issues a video program with a specification not lower than the requested video program to the video gateway according to the video request information.
If the video content server directly issues the largest-size video program to the video gateway when the video gateway requests the video program from the video content server, the video request sent by the video gateway to the video content server may not include the video request information of the client terminal. Wherein the maximum specification means: maximum frame rate, maximum code rate, maximum resolution, any coding protocol.
In step 105, a video source request/cache module of the video gateway is specifically used for sending the video request to the video content server.
Step 106: after receiving the video program sent by the video content server, the video gateway compares the video program with the specification requested by the client terminal, and if the video program is the same as the specification requested by the client terminal, the step 108 is entered; otherwise step 107 is entered.
Further, the video gateway stores the video program delivered by the video content server in a local second-level cache.
A video source request/cache module of the video gateway receives a video program sent by a video content server, stores the video program in a local cache, compares the specification of the received video program with the specification requested by a client terminal based on the video request information of the client terminal, and directly sends the video program data to a video playing/cache module if the video program data are the same as the specification requested by the client terminal; if not, the video program data and the target specification are sent to the video conversion module of the video gateway, and then the process goes to step 107.
Step 107: the video gateway converts the format of the received video program into the specification requested by the client terminal according to the video request information of the client terminal.
The video conversion module of the video gateway converts the format of the video program sent by the video source request/cache module according to the video image resolution, the frame rate, the code rate, the coding protocol and the like in the video request information so as to enable the format to accord with the specification requested by the client terminal, and then sends the converted video program data to the video playing/cache module of the video gateway.
Step 108: the video gateway sends the video program data to the requesting client terminal, and the client terminal plays the requested video program.
Further, the video gateway stores the converted video program in a local first level cache.
Specifically, the video playing/caching module of the video gateway directly stores the received video program in the local cache, and sends the video program to the requesting client terminal, and the client terminal plays the requested video program.
As shown in fig. 2, the real-time video gateway apparatus of the present invention includes: a video buffer module 21 and a video conversion module 22. Wherein,
the video cache module 21 is configured to search a local two-level cache for a matched video program according to video request information of the client terminal, and when the matched video program is not searched, request the video content server for the video program and receive the matched video program sent by the video content server; after the matched video program is obtained, when the specification of the matched video program is determined to be different from that requested by the client terminal according to the video request information of the client terminal, the video program is sent to the video conversion module 22, the converted video program sent by the video conversion module 22 is sent to the client terminal to play the video program, and when the specification of the received video program is determined to be the same as that requested by the client terminal, the video program is directly sent to the client terminal to play the video program;
and the video conversion module 22 is configured to receive the video program sent by the video cache module 21, convert the format of the video program into a specification requested by the client terminal, and then send the specification to the video cache module 21.
The video cache module 21 is further configured to cache the matched video program sent by the video content server.
The video gateway further includes an access control module 23, configured to receive request information sent by the client terminal, authenticate the client terminal according to the identification information in the request information, and send the video request information in the request information to the video cache module 21 after the client terminal passes the authentication.
The video cache module 21 may include a video play/cache module 211 and a video source request/cache module 212, as shown in fig. 3, wherein,
the video playing/caching module 211 is configured to search for a matching video program in a local cache according to the video request information of the client terminal; when the matched video program is not searched, sending the video request information of the client terminal to the video source request/cache module 212, receiving the matched video program, and sending the matched video program to the client terminal to play the video program; after the matched video program is obtained, when the specification of the video program is determined to be different from that requested by the client terminal according to the video request information of the client terminal, the video program is sent to the video conversion module 22, the converted video program sent by the video conversion module 22 is sent to the client terminal to play the video program, and the specification of the video program is determined to be the same as that requested by the client terminal and is sent to the client terminal to play the video program;
a video source request/cache module 212, configured to search for a matching video program in a local cache according to video request information of the client terminal; when the matched video program is not searched, requesting the video content server for the video program, and receiving the matched video program sent by the video content server; after the matched video program is obtained, when the specification of the video program is determined to be different from that requested by the client terminal according to the video request information of the client terminal, the video program is sent to the video conversion module 22, and when the specification of the video program is determined to be the same as that requested by the client terminal, the video program is sent to the client terminal through the video playing/caching module 211 to play the video program;
the video conversion module 22 is specifically configured to convert the format of the video program sent by the video playing/caching module 211 or the video source requesting/caching module 212 into the specification requested by the client terminal, and then send the converted format to the video playing/caching module 211.
The above-mentioned obtaining the matched video program specifically refers to searching the matched video program or the received matched video program.
The video playing/buffering module 211 is further configured to buffer the received video program.
The video source request/cache module 212 is further configured to cache the matching video programs sent by the video content server.
In addition, the video conversion module 22 may include a plurality of video conversion sub-modules for respectively performing format conversion tasks of different video programs.
Since the specification of the video program from the video source requesting/caching module 212 to the video playing/caching module 211 may also be converted by the video converting module 22, it can be seen that the specification of the video program stored in the video source requesting/caching module 212 is not lower than that of the video program stored in the video playing/caching module 211, and therefore, in the specific embodiment of the present invention, the number of times of requesting the video program from the video content server is reduced by the two-level caching mechanism.
The invention can be applied to systems with real-time video format conversion requirements, such as an IPTV system, a broadcast digital television VOD video on demand system, a comprehensive video service system after three networks are fused, and the like. For example, when the method and the video gateway of the invention are applied to an IPTV system, the transmission network bandwidth pressure in a peak time period can be relieved.
The above description is only a preferred embodiment of the present invention, and is not intended to limit the scope of the present invention.