Background technology
OSD(On Screen Display, on-screen menu shows) principle be: the ad-hoc location at video image shows specific information (osd information), thereby makes user can recognize easily the important information outside video.Wherein, in video monitoring, conventional osd information is when and where.As shown in Figure 1, for the osd information of configuration, the time is " 2011-06-1809:39:31 ", and place is " A4 laboratory ", and based on above-mentioned osd information, user can observe important information intuitively.
In prior art, in order to show osd information to user, need to synthesize to osd information (osd information and video data being synthesized), current synthesis mode comprises:
Mode one: as shown in Figure 2 osd information is carried out to synthetic schematic diagram, synthesizing at encoding device (being headend equipment) of osd information completes; Under which, encoding device synthesizes the video data collecting (being original image) and osd information, obtain composograph (part that osd information is composograph), at synthetic images, carry out, after Video coding, by network, the composograph after Video coding being sent to client; Afterwards, by client, it is carried out to video decode, obtain above-mentioned composograph, by showing this composograph, can demonstrate osd information.
Mode two: as shown in Figure 3 osd information is carried out to synthetic schematic diagram, synthesizing in client of osd information completes; Under which, encoding device carries out Video coding and obtains coding video frequency data together with osd information to the video data collecting, and now osd information also needs to encode, and the part that is coding video frequency data of the osd information after coding.Afterwards, client can obtain osd information by decoding and coding video data, and restores video data from coding video frequency data, afterwards, client is synthesized video data and osd information, obtains composograph, and by showing this composograph, can demonstrate osd information.
In aforesaid way one, at least there is following problem: (1) osd information be transfer of data in composograph to client, when client is carried out video decode, cannot restore original video data, thereby cause partial data to be lost.(2) encoding device generally adopts embedded device (comprising CPU, chip etc.), and the image building-up process of OSD can consume the performance of encoding device.
In aforesaid way two, at least there is following problem: coding, standard decoding storehouse that (1) current standard code storehouse relates to video data relate to the decoding to video data; Encoding device utilizes standard code storehouse to obtain coding video frequency data to coding video data, and utilize correlative coding algorithm osd information to be encoded in the redundant area (as the afterbody of coding video frequency data) of above-mentioned coding video frequency data based on self strategy, the part that now osd information is coding video frequency data; When client utilizes standard decoding storehouse to decode to coding video frequency data, can decode video data; But can not decode to osd information in standard decoding storehouse, therefore cannot decode osd information by the standard storehouse of decoding.
(2) because encoding device need to be encoded to osd information in coding video frequency data by concrete encryption algorithm, to the VC-1 supporting in the future, the encryption algorithms such as WMV9, all will support osd information to be encoded in coding video frequency data, and expansion is inconvenient.
Summary of the invention
The invention provides a kind of transmission method and equipment of osd information, to reduce the performance consumption of encoding device.
In order to achieve the above object, the invention provides a kind of transmission method of osd information, be applied to comprise that in the system of encoding device and client, the method comprises the following steps:
Described encoding device is processed the coding video data obtaining, and obtains coding video frequency data;
Described encoding device is encapsulated into described coding video frequency data and the osd information of processing of encoding in the data field of transport stream, and osd information sign and coding video frequency data sign are set in the header of described transport stream;
Described osd information sign is used for representing that described data field exists osd information, and described coding video frequency data sign is used for representing that described data field exists coding video frequency data;
Described encoding device sends to described client by network by described transport stream;
When described client obtains coding video frequency data sign from the header of transport stream, and while obtaining osd information sign, described client is known in the data field of transport stream and is had coding video frequency data, and there is osd information, described client obtains osd information from the data field of transport stream, OSD is set and is masked as TRUE, and preserve described osd information; Described client obtains coding video frequency data from the data field of transport stream, to the processing of decoding of described coding video frequency data, obtains video data;
After obtaining described video data, described client judges whether OSD sign is TRUE, and if so, described client is synthesized osd information and the described video data preserved before, obtains composograph, and shows composograph; Otherwise described client directly shows described video data.
Described method further comprises: described encoding device judges whether to show osd information; If so, described encoding device is encapsulated into described coding video frequency data and osd information in the data field of transport stream; Otherwise described encoding device is encapsulated into described coding video frequency data in the data field of transport stream.
Described method further comprises: when described client obtains coding video frequency data sign from the header of transport stream, and while not obtaining osd information sign, described client is known in the data field of transport stream and is had coding video frequency data, and there is not osd information, described client obtains coding video frequency data from the data field of transport stream, to the processing of decoding of described coding video frequency data, obtain video data.
Described transport stream comprises: TS stream, rtp streaming and PS stream; When described transport stream is TS stream, described TS stream comprises the header of 4 bytes and the data field of 184 bytes, is set to designated identification and represents that osd information identifies, and osd information is encapsulated in the data field of 184 bytes by the PID in the header of 4 bytes;
When described transport stream is PS when stream, described PS stream comprises Header and Payload, and the Stream type by Header is set to designated identification and represents that osd information identifies, and osd information is encapsulated in the Data pack of Payload;
When described transport stream is rtp streaming, described rtp streaming comprises Header and Payload, and the Payload type by Header is set to designated identification and represents that osd information identifies, and osd information is encapsulated in Payload.
Described method further comprises: described encoding device is encapsulated into described osd information in the data field of described transport stream with binary form or character style.
The invention provides a kind of transmission equipment of osd information, comprise encoding device and client, described encoding device comprises:
Processing module, for the coding video data obtaining is processed, obtains coding video frequency data; Described coding video frequency data and the osd information of processing of encoding are encapsulated in the data field of transport stream, and osd information sign is set in the header of described transport stream and coding video frequency data identifies, wherein, described osd information sign is used for representing that described data field exists osd information, and described coding video frequency data sign is used for representing that described data field exists coding video frequency data; Sending module, for sending to described client by network by described transport stream;
Described client, for receiving the transport stream from described encoding device; When the header from transport stream, obtain coding video frequency data sign, and while not obtaining osd information sign, know in the data field of transport stream and have coding video frequency data, and there is not osd information, from the data field of transport stream, obtain coding video frequency data, to the processing of decoding of described coding video frequency data, obtain video data; When the header from transport stream, obtain coding video frequency data sign, and while obtaining osd information sign, know in the data field of transport stream and have coding video frequency data, and there is osd information, from the data field of transport stream, obtain osd information, OSD is set and is masked as TRUE, and preserve described osd information, from the data field of transport stream, obtain coding video frequency data, to the processing of decoding of described coding video frequency data, obtain video data; After obtaining described video data, judge whether OSD sign is TRUE, if so, osd information and the described video data preserved are before synthesized, obtain composograph, and show composograph; Otherwise, directly show described video data.
Described processing module, need to show osd information specifically for judging whether; If so, described coding video frequency data and osd information are encapsulated in the data field of transport stream; Otherwise, described coding video frequency data is encapsulated in the data field of transport stream.
Described transport stream comprises: TS stream, rtp streaming and PS stream; Described processing module, specifically for when described transport stream being TS when stream, described TS stream comprises the header of 4 bytes and the data field of 184 bytes, is set to designated identification and represents that osd information identifies, and osd information is encapsulated in the data field of 184 bytes by the PID in the header of 4 bytes;
When described transport stream is PS when stream, described PS stream comprises Header and Payload, and the Stream type by Header is set to designated identification and represents that osd information identifies, and osd information is encapsulated in the Data pack of Payload;
When described transport stream is rtp streaming, described rtp streaming comprises Header and Payload, and the Payload type by Header is set to designated identification and represents that osd information identifies, and osd information is encapsulated in Payload.
Described processing module, is further used for described osd information to be encapsulated in the data field of described transport stream with binary form or character style.
Compared with prior art, the present invention at least has the following advantages: by transport stream, directly osd information is sent to client, by client, osd information and video data are synthesized, can reduce the performance consumption of encoding device, and the performance of encoding device can be used for promoting image effect.By transport stream, osd information is sent to client, can reduces the coupling between compression algorithm.And client can provide abundant font to osd information, size, and special efficacy, OSD effect is better.In addition, the video data that client decodes is out original video data, can be because osd information causes damage.
Embodiment
The present invention proposes a kind of transmission method of osd information, and the method is applied to comprise that in the system of encoding device (as encoder, IPC equipment etc.) and client, as shown in Figure 4, the method comprises the following steps:
Step 401, encoding device is processed the coding video data obtaining, and obtains coding video frequency data.
Encoding device can collect video data, and the code database (H264, MPEG2, MPEG4) that video data transmitting is given standard is carried out to video data encoding processing, thereby obtains coding video frequency data.
Step 402, encoding device is encapsulated into coding video frequency data and the osd information of processing of encoding in the data field of transport stream, and osd information sign (for representing that data field exists osd information) and coding video frequency data sign (for representing that data field exists coding video frequency data) are set in the header of transport stream.It should be noted that when coding video frequency data and osd information are encapsulated into data field, osd information need to be independent of coding video frequency data and have (be the two it doesn't matter, osd information is not the part of coding video frequency data).
In the present invention, by osd information sign and coding video frequency data are set in the header of transport stream, identify, illustrate and in the data field of transport stream, have osd information and coding video frequency data, and the two is self-existent.
Before this step, whether encoding device can also judge needs to show osd information at present; If so, carry out the process in the data field that coding video frequency data and osd information is encapsulated into transport stream in this step; Otherwise encoding device is directly encapsulated into coding video frequency data in the data field of transport stream, osd information sign need to be set in the header of transport stream in this situation.
In the present invention, encoding device can be encapsulated into osd information in the data field of transport stream with binary form or character style.
Step 403, encoding device sends to client by network by transport stream.
Step 404, client is from the transport stream of encoding device, and from the header of transport stream, obtains osd information sign.
When encoding device is encapsulated into the data field of transport stream by coding video frequency data and osd information, osd information sign can be set in the header of transport stream, therefore, client can obtain osd information sign from the header of transport stream, then knows in the data field of transport stream and has osd information.
In addition, when encoding device is encapsulated into the data field of transport stream by coding video frequency data and osd information, coding video frequency data sign also can be set in the header of transport stream, therefore, client can also obtain coding video frequency data sign from the header of transport stream, then knows in the data field of transport stream and has coding video frequency data.
Step 405, client obtains osd information and coding video frequency data from the data field of transport stream.
It should be noted that if encoding device is only encapsulated into coding video frequency data the data field of transport stream, osd information sign can be set in the header of transport stream, so client is known in the data field of transport stream and do not had osd information; In this situation, only need to from the data field of transport stream, obtain coding video frequency data, to the coding video frequency data processing of decoding, obtain video data, and be shown to user.
Step 406, client, to the coding video frequency data processing of decoding, obtains video data.
Step 407, client is synthesized video data and osd information, obtains composograph, and shows composograph.In showing the process of composograph, osd information can be shown to user.
It should be noted that after obtaining osd information, need to preserve osd information, and OSD is set is masked as TRUE; After obtaining video data, if judge OSD, be masked as TRUE, osd information and the video data preserved are before synthesized, obtain composograph, and show composograph; If judge OSD sign for this situation of TRUE(is for being directly encapsulated into coding video frequency data the mode in the data field of transport stream for encoding device), directly video data is shown to user.
In order more clearly setting forth, osd information to be encapsulated in the data field of transport stream, and the process of osd information sign to be set in the header of transport stream, below in conjunction with several application of transport stream, be elaborated.In the present invention, this transport stream comprises but is not limited to: TS(transport stream, transport stream) stream, RTP(Real-time Transport Protocol, real time transport protocol) stream and PS(Program Stream, program stream) stream etc.
(1) when transport stream is TS stream, the form schematic diagram of TS stream as shown in Figure 5, the length of each the TS bag in TS stream is 188 fixing bytes, comprises the header of 4 bytes and the data field of 184 bytes (wherein adaptive district is for optional); In the header of 4 bytes, at least comprise PID(Packet identification, bag sign), PMT(Program Map Table, Program Map Table), time synchronization information etc. are carried data content in the data field of 184 bytes.
In the present invention, encoding device can be set to by the PID in the header of 4 bytes designated identification (as 0xA4) and represent osd information sign, and osd information is encapsulated in the data field of 184 bytes; Therefore, client, when resolving TS stream, can be obtained osd information according to pid value as above.
(2) when transport stream is PS stream, the form schematic diagram of PS stream as shown in Figure 6, PS stream is that with the difference of TS stream TS stream pack arrangement is regular length, and the packet format of PS stream is variable-length.Wherein, PS message is by a packet header (Header), and the pack(of optional system head (sys Head) and any amount comprises Video pack, Audio pack, data packet) grouping composition, the pack of this any amount is Payload(load).
In the present invention, encoding device can be by by the Stream type(stream type of Header) be set to designated identification (as 0xA4) and represent osd information sign, and osd information is encapsulated into the Data pack(packet of Payload) in; Therefore, client, when resolving PS stream, can get corresponding osd information according to Stream type value as above.
(3) when transport stream is rtp streaming, the form schematic diagram of rtp streaming as shown in Figure 7, RTP message consists of packet header (Header) and load (Payload).In the present invention, encoding device can be by by the Payload type(loadtype of Header) be set to designated identification (as 0xA4) and represent osd information sign, and osd information is encapsulated in Payload.Therefore, client, when resolving rtp streaming, can get corresponding osd information according to payload type value as above.
In sum, existing by encoding device composograph in the situation that in compatibility, in the present invention, osd information can be carried at respectively in transport stream or video data, thereby can adopt according to different scenes different processing modes.For example, some are (as public security, finance etc.) using osd information as the crucial industry of evidence obtaining, can adopt the mode of encoding device composograph, by osd information is carried at, sends to client in video data; For some unessential industries, can adopt the mode of client composograph, by being carried at, osd information in transport stream, sends to client.
Inventive concept based on same with said method, the invention allows for a kind of encoding device, is applied to comprise that, in the system of described encoding device and client, as shown in Figure 8, described encoding device comprises:
Processing module 11, for the coding video data obtaining is processed, obtains coding video frequency data; Described coding video frequency data and the osd information of processing of encoding are encapsulated in the data field of transport stream, and osd information sign and coding video frequency data sign are set in the header of described transport stream;
Described osd information sign is used for representing that described data field exists osd information, and described coding video frequency data sign is used for representing that described data field exists coding video frequency data;
Sending module 12, for sending to described client by network by described transport stream.
Described processing module 11, need to show osd information specifically for judging whether; If so, described coding video frequency data and osd information are encapsulated in the data field of transport stream; Otherwise, described coding video frequency data is encapsulated in the data field of transport stream.
Described transport stream comprises: TS stream, rtp streaming and PS stream; Described processing module 11, specifically for when described transport stream being TS when stream, described TS stream comprises the header of 4 bytes and the data field of 184 bytes, is set to designated identification and represents that osd information identifies, and osd information is encapsulated in the data field of 184 bytes by the PID in the header of 4 bytes;
When described transport stream is PS when stream, described PS stream comprises Header and Payload, and the Stream type by Header is set to designated identification and represents that osd information identifies, and osd information is encapsulated in the Data pack of Payload;
When described transport stream is rtp streaming, described rtp streaming comprises Header and Payload, and the Payload type by Header is set to designated identification and represents that osd information identifies, and osd information is encapsulated in Payload.
Described processing module 11, is further used for described osd information to be encapsulated in the data field of described transport stream with binary form or character style.
Inventive concept based on same with said method, the invention allows for a kind of client, is applied to comprise that, in the system of encoding device and described client, as shown in Figure 9, described client comprises:
Receiver module 21, for receiving the transport stream from described encoding device;
Processing module 22, for the header when from transport stream, obtain coding video frequency data sign, and while not obtaining osd information sign, know in the data field of transport stream and have coding video frequency data, and there is not osd information, from the data field of transport stream, obtain coding video frequency data, to the processing of decoding of described coding video frequency data, obtain video data;
When the header from transport stream, obtain coding video frequency data sign, and while obtaining osd information sign, know in the data field of transport stream and have coding video frequency data, and there is osd information, from the data field of transport stream, obtain osd information, OSD is set and is masked as TRUE, and preserve described osd information; From the data field of transport stream, obtain coding video frequency data, to the processing of decoding of described coding video frequency data, obtain video data;
Display module 23, for after obtaining described video data, judges whether OSD sign is TRUE, if so, osd information and the described video data preserved is before synthesized, and obtains composograph, and shows composograph; Otherwise, directly show described video data.
Wherein, the modules of apparatus of the present invention can be integrated in one, and also can separatedly dispose.Above-mentioned module can be merged into a module, also can further split into a plurality of submodules.
Through the above description of the embodiments, those skilled in the art can be well understood to the present invention and can realize by hardware, and the mode that also can add necessary general hardware platform by software realizes.Understanding based on such, technical scheme of the present invention can embody with the form of software product, it (can be CD-ROM that this software product can be stored in a non-volatile memory medium, USB flash disk, portable hard drive etc.) in, comprise some instructions with so that computer equipment (can be personal computer, server, or the network equipment etc.) carry out the method described in each embodiment of the present invention.
It will be appreciated by those skilled in the art that accompanying drawing is the schematic diagram of a preferred embodiment, the module in accompanying drawing or flow process might not be that enforcement the present invention is necessary.
It will be appreciated by those skilled in the art that the module in the device in embodiment can be distributed in the device of embodiment according to embodiment description, also can carry out respective change and be arranged in the one or more devices that are different from the present embodiment.The module of above-described embodiment can be merged into a module, also can further split into a plurality of submodules.
The invention described above sequence number, just to describing, does not represent the quality of embodiment.
Disclosed is above only several specific embodiment of the present invention, and still, the present invention is not limited thereto, and the changes that any person skilled in the art can think of all should fall into protection scope of the present invention.