Disclosure of Invention
The embodiment of the invention provides a system for adding a two-dimension code to a video source and a two-dimension code adding method, which are used for adding two-dimension code information to an H265 video.
The system for adding the two-dimensional code to the video source provided by the embodiment of the invention comprises the following steps: the gateway service module and the transcoding platform;
the transcoding platform comprises a transcoding board cluster consisting of a plurality of transcoding cards, a signaling interaction module, a video processing module, a watermark management module and a video sending module;
the signaling interaction module is used for negotiating two-dimensional code parameters with the gateway service module, selecting an idle transcoding card from the transcoding board cluster, and sending a negotiation result to the video processing module and the video forwarding module; sending the identifier of the transcoding card in the idle state to the watermark management module; the negotiation result comprises an IP address and a port number of the video stream;
the video processing module is used for receiving the video stream sent by the gateway service module according to the negotiation result sent by the signaling interaction module, and decapsulating the video stream to obtain a source video;
the watermark management module is used for controlling the transcoding card selected by the signaling interaction module to add the two-dimensional code to the source video and sending the video added with the two-dimensional code to the video sending module;
and the video sending module is used for packaging the video added with the two-dimension code and sending the packaged video carrying the two-dimension code to the gateway service module according to the IP address and the port number of the video stream.
In the technical scheme, when the two-dimension code adding is carried out through the system, the time delay can be reduced, the concurrency is improved, and the two-dimension code information can be effectively added to videos with different formats.
Optionally, the gateway service module includes a gateway SIP (Session Initiation Protocol) module and a gateway RTP (Real-time Transport Protocol) module;
the gateway SIP module is used for negotiating two-dimension code parameters with the signaling interaction module;
the gateway RTP module is used for sending a video stream to the video processing module and receiving the encapsulated video carrying the two-dimensional code sent by the video sending module.
Optionally, the video processing module includes a transcoding scheduling sub-module and a video parsing sub-module;
the transcoding scheduling submodule is used for creating a video receiving task according to a negotiation result sent by the signaling interaction module; determining a transcoded video format; detecting the idle state of the transcoding card, and informing the signaling interaction module of the identifier of the transcoding card in the idle air conditioner;
and the video analysis submodule is used for de-encapsulating the video stream sent by the gateway service module to obtain a source video.
Optionally, the negotiation result further includes two-dimensional code information;
the watermark management module generates a two-dimensional code according to the two-dimensional code information, and controls the transcoding card in the idle state to convert the two-dimensional code into first data in a YUV format and decode the source video and convert the source video into second data in the YUV format; and merging the first data and the second data and then transcoding.
Optionally, the video forwarding module creates a port according to the IP address and the port number of the video stream, and after the video to which the two-dimensional code is added is encapsulated, sends the encapsulated video to the gateway service module through the port.
Correspondingly, the embodiment of the invention also provides a two-dimensional code adding method based on the system, which comprises the following steps:
acquiring a negotiation result sent by a gateway service module, wherein the negotiation result comprises two-dimension code information, an IP address and a port number of a video stream;
receiving the video stream sent by the gateway service module according to the IP address and the port number of the video stream, and decapsulating the video stream to obtain a source video;
adding and transcoding the two-dimension code to the source video according to the two-dimension code information and the source video;
and sending the video added with the two-dimensional code to the gateway service module according to the IP address and the port number of the video stream.
Optionally, the adding and transcoding the two-dimensional code to the source video according to the two-dimensional code information and the source video includes:
generating a two-dimensional code according to the two-dimensional code information;
converting the two-dimensional code into first data in a YUV format;
decoding the source video and converting the source video into second data in the YUV format;
and merging the first data and the second data and then transcoding.
Optionally, the sending the video to which the two-dimensional code is added to the gateway service module according to the IP address and the port number of the video stream includes:
creating a port according to the IP address and the port number of the video stream;
and after the video added with the two-dimensional code is packaged, the packaged video is sent to the gateway service module through the port.
Correspondingly, an embodiment of the present invention further provides a computing device, including:
a memory for storing program instructions;
and the processor is used for calling the program instruction stored in the memory and executing the signal lamp fault detection method according to the obtained program.
Correspondingly, the embodiment of the invention also provides a computer-readable non-volatile storage medium, which comprises computer-readable instructions, and when the computer reads and executes the computer-readable instructions, the computer is enabled to execute the signal lamp fault detection method.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention clearer, the present invention will be described in further detail with reference to the accompanying drawings, and it is apparent that the described embodiments are only a part of the embodiments of the present invention, not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Fig. 1 exemplarily illustrates a system for adding a two-dimensional code to a video source according to an embodiment of the present invention, and as shown in fig. 1, the system may include: a gateway services module 100 and a transcoding platform 200.
The transcoding platform 200 may include a transcoding board cluster composed of a plurality of transcoding cards, a signaling interaction module, a video processing module, a watermark management module, and a video sending module.
In the embodiment of the invention, the system forms a hardware cluster of the transcoding board by integrating 8 transcoding cards. Thereby realizing that 16-way 1080P video is added with their respective two-dimensional codes concurrently. The method can be realized by accessing video source equipment such as MPEG4, H264, H265 and the like and outputting the two-dimensional code with independent information.
Specifically, the signaling interaction module may be configured to perform negotiation with the gateway service module for two-dimensional code parameters, select a transcoding card in an idle state from the transcoding board cluster, and send a negotiation result to the video processing module and the video forwarding module. And sending the identifier of the transcoding card in the idle state to a watermark management module. The negotiation result includes the IP address and port number of the video stream. Namely, the two-dimension code negotiation with the SIP service module in the gateway is carried out; and meanwhile, the system is responsible for selecting an idle transcoding card for OSD management.
The video processing module may be configured to receive the video stream sent by the gateway service module according to the negotiation result sent by the signaling interaction module, and decapsulate the video stream to obtain a source video. Namely, receiving the video stream incoming by the gateway video forwarding service, and performing PS unpacking.
And the watermark management module is used for controlling the transcoding card selected by the signaling interaction module to add the two-dimensional code to the source video and sending the video added with the two-dimensional code to the video sending module. Namely, the two-dimensional code adding process is performed on the video.
And the video sending module is used for packaging the video added with the two-dimension code and sending the packaged video carrying the two-dimension code to the gateway service module according to the IP address and the port number of the video stream. Namely, the gateway service module is responsible for forwarding the repackaged video code stream and sending the repackaged video code stream to the gateway service module.
As shown in fig. 1, the gateway service module may include a gateway SIP module and a gateway RTP module.
The gateway SIP module is used for negotiating the two-dimension code parameters with the signaling interaction module. And the gateway RTP module is used for sending a video stream to the video processing module and receiving the encapsulated video carrying the two-dimensional code sent by the video sending module.
As shown in fig. 2, the video processing module may include a transcoding scheduling sub-module and a video parsing sub-module.
And the transcoding scheduling submodule is used for creating a video receiving task according to the negotiation result sent by the signaling interaction module and determining a transcoded video format. And detecting the idle state of the transcoding card, and informing the signaling interaction module of the identifier of the transcoding card in the idle air conditioner. And the video analysis submodule is used for de-encapsulating the video stream sent by the gateway service module to obtain a source video.
In the embodiment of the present invention, the negotiation result may further include two-dimensional code information. The watermark management module can generate a two-dimensional code according to the two-dimensional code information, and control the transcoding card in the idle state to convert the two-dimensional code into first data in a YUV format and decode the source video and convert the source video into second data in the YUV format; and merging the first data and the second data and then transcoding.
After the watermark management module carries out video transcoding, the video forwarding module creates a port according to the IP address and the port number of the video stream, and after the video added with the two-dimensional code is packaged, the packaged video is sent to the gateway service module through the port.
Specifically, the signaling interaction module is responsible for performing signaling interaction with the gateway SIP module. The signaling interaction module is mainly responsible for receiving the two-dimension code parameters sent by the gateway SIP module and responding to the two-dimension code parameters. And the signaling interaction module and the gateway SIP module use an http protocol as a carrier and communicate according to a json data format conforming to the rest rule. The two-party communication instruction is divided into a two-dimension code adding request command, a two-dimension code adding request command response, a video processing stopping command and a video processing stopping command response, and the content contained in the instruction is shown in table 1.
TABLE 1
And the video processing module mainly comprises a transcoding scheduling submodule and a video analyzing submodule.
The transcoding scheduling submodule mainly has the following functions:
(1) creating a video receiving task according to the address information obtained by the signaling interaction module;
(2) reading transcoding information configured in a database, and determining a transcoded video format;
(3) and the transcoding management service detects the idle state of the transcoding board and determines the transcoding board of the video flow direction.
The video analysis submodule mainly has the following functions:
(1) receiving an RTP video forwarded by a gateway RTP module;
(2) carrying out RTP decapsulation on the video data received in the step (1) to obtain a PS stream;
(3) decapsulating the PS stream in (2) to obtain an ES stream;
(4) and (4) transcoding the ES stream generated in the step (3) by using a transcoding board transcoding interface.
The execution flow of the video processing module may be as shown in fig. 3, and specifically may include:
step 301, creating a task according to the address information required for receiving the video, which is obtained by the signaling interaction module.
And creating a task according to the IP address and the port number of the video stream in the negotiation result transmitted by the signaling interaction module, wherein the task can be creating a socket.
Step 302, receiving video stream data by using socket.
The video stream data is received with the socket created in step 301.
Step 303, RTP decapsulation.
Step 304, the PS decapsulates.
And 305, calling a transcoding card transcoding interface to transcode.
And sending the decapsulated video stream to a transcoding card by calling a transcoding interface of the transcoding card so that the watermark management module controls the transcoding card to transcode. And finally, sending the video added with the two-dimensional code and subjected to transcoding to a video sending module.
The watermark management module has the main functions as follows:
(1) and generating the two-dimension code according to the two-dimension code information received by the signaling interaction module.
(2) And converting the generated two-dimensional code dot matrix diagram into YUV420 data.
(3) The source video image frame is decoded and converted into YUV420 data.
(4) And (4) merging the data generated in the step (2) and the step (3) as new image frame data.
The video sending module has the following main functions:
(1) and creating a socket according to the IP and the port of the gateway RTP module sent by the signaling interaction module.
(2) And caching the video stream transcoded by the transcoding plate.
(3) And (3) carrying out PS packaging on the video stream with the OSD added in the step (2).
(4) And (4) carrying out RTP encapsulation on the PS stream encapsulated in the step (3).
(5) And (4) sending the encapsulated video stream to the socket specified in (1) by using the socket created in (1).
Based on the above system for adding a two-dimensional code to a video source, an embodiment of the present invention further provides a flow for adding a two-dimensional code, where the flow may be as shown in fig. 4, and specifically includes:
step 401, obtaining a negotiation result sent by the gateway service module.
Step 402, receiving the video stream sent by the gateway service module according to the IP address and the port number of the video stream, and decapsulating the video stream to obtain a source video.
And 403, adding and transcoding the two-dimension code to the source video according to the two-dimension code information and the source video.
Specifically, a two-dimensional code can be generated according to the two-dimensional code information, the two-dimensional code is converted into first data in a YUV format, a source video is decoded and converted into second data in the YUV format, and finally the first data and the second data are combined and then transcoded.
And step 404, sending the video added with the two-dimensional code to the gateway service module according to the IP address and the port number of the video stream.
Specifically, a port is created according to the IP address and the port number of the video stream, and then after the video to which the two-dimensional code is added is encapsulated, the encapsulated video is sent to the gateway service module through the port.
The above steps have been described in detail in the above system, and are not described again here.
In order to better explain the flow of adding the two-dimensional code provided by the embodiment of the present invention, the following description is given in a specific implementation scenario, and as shown in fig. 5, the specific implementation scenario specifically includes:
step 501, the gateway SIP module sends a signaling negotiation request to the signaling interaction module.
Step 502, the signaling interaction module sends a signaling negotiation result to the gateway SIP module.
Step 503, the signaling interaction module sends a start video receiving processing thread to the video processing module.
Step 504, the signaling interaction module sends the two-dimensional code parameter setting to the OSD management module.
And 505, the signaling interaction module sends video destination address information to the video sending module.
In step 506, the video processing module receives the original video sent by the gateway RTP module.
In step 507, the video processing module decodes the RTP packet.
In step 508, the video processing module unpacks the PS packet.
In step 509, the video processing module sends the source video stream to the OSD management module.
Step 510, the OSD management module adds the two-dimensional code.
The OSD management module is used for controlling the transcoding card to add the two-dimensional code to the source video stream and then transcoding the source video stream.
In step 511, the OSD management module adds the video stream after the two-dimensional code to the video sending module.
And step 512, the video sending module performs PS + RTP encapsulation.
The video sending module firstly carries out PS encapsulation and then carries out RTP encapsulation.
Step 513, the video sending module sends the two-dimensional code video stream to the gateway RTP module.
The above steps have been described in detail in the above system, and are not described again here.
The system for adding the two-dimensional code to the video source provided by the embodiment of the invention can comprise a gateway service module and a transcoding platform. The transcoding platform comprises a transcoding board cluster consisting of a plurality of transcoding cards, a signaling interaction module, a video processing module, a watermark management module and a video sending module. The signaling interaction module is used for negotiating two-dimensional code parameters with the gateway service module, selecting an idle transcoding card from the transcoding board cluster, and sending a negotiation result to the video processing module and the video forwarding module; and sending the identifier of the transcoding card in the idle state to a watermark management module. And the video processing module is used for receiving the video stream sent by the gateway service module according to the negotiation result sent by the signaling interaction module, and decapsulating the video stream to obtain the source video. And the watermark management module is used for controlling the transcoding card selected by the signaling interaction module to add the two-dimensional code to the source video and sending the video added with the two-dimensional code to the video sending module. And the video sending module is used for packaging the video added with the two-dimension code and sending the packaged video carrying the two-dimension code to the gateway service module according to the IP address and the port number of the video stream. When the two-dimension code adding is carried out through the system, the time delay can be reduced, the concurrency is improved, and the two-dimension code information can be effectively added to videos in different formats.
Based on the same technical concept, an embodiment of the present invention further provides a computing device, including:
a memory for storing program instructions;
and the processor is used for calling the program instruction stored in the memory and executing the two-dimensional code adding method according to the obtained program.
Based on the same technical concept, the embodiment of the invention also provides a computer-readable non-volatile storage medium, which comprises computer-readable instructions, and when the computer reads and executes the computer-readable instructions, the computer is enabled to execute the two-dimensional code adding method.
It should be noted that, in the embodiment of the present invention, when the OSD service is added, the concurrency is improved while the time delay is reduced. The scheme of embedding the transcoding board hardware cluster system in the gateway is used for the first time in the industry. Private software is used in a code conversion board to generate two-dimensional code image data and combine the two-dimensional code image data into a video, and a flow path of video streams is carried in two-dimensional code information contents, so that the two-dimensional code image data is used for the first time on security related products. The patent firstly provides an integral solution of hardware integration deployment and software architecture based on a video gateway, and the solution can effectively add two-dimensional codes for videos with different formats.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
While preferred embodiments of the present invention have been described, additional variations and modifications in those embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. Therefore, it is intended that the appended claims be interpreted as including preferred embodiments and all such alterations and modifications as fall within the scope of the invention.
It will be apparent to those skilled in the art that various changes and modifications may be made in the present invention without departing from the spirit and scope of the invention. Thus, if such modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include such modifications and variations.