Video playback method based on point-to-point communication of embedded monitoring equipment

文档序号:1601727 发布日期:2020-01-07 浏览:8次 中文

阅读说明:本技术 基于嵌入式监控设备点对点通信的录像回放方法 (Video playback method based on point-to-point communication of embedded monitoring equipment ) 是由 肖萌璐 王健 陈东亮 朱健立 刘凯琨 于 2019-09-19 设计创作,主要内容包括:本发明提供了一种基于嵌入式监控设备点对点通信的录像回放方法,所述方案通过TCP的NAT穿越方法,实现了手机与设备不经过服务器直接进行音视频点播。用户在手机客户端上输入开始时间和结束时间,手机客户端将该时间段传给设备端,设备端将该时间段的所有录像返回给手机客户端,实现了远程录像检索、远程时间段点播、远程文件点播、远程播放控制功能。本发明所述的一种基于嵌入式监控设备点对点通信的录像回放方法,减少了对数据源Source Server的依赖,同时数据的存储、传输、运算等任务被相对平均地分摊到系统的各个部分,从而大大减小了网络以及带宽的压力,增强了数据及传输的稳定性。(The invention provides a video playback method based on point-to-point communication of embedded monitoring equipment, which realizes that audio and video on demand can be directly carried out between a mobile phone and equipment without a server through a NAT traversal method of TCP. The user inputs the start time and the end time on the mobile phone client, the mobile phone client transmits the time period to the equipment terminal, and the equipment terminal returns all the videos in the time period to the mobile phone client, so that the functions of remote video retrieval, remote time period on-demand, remote file on-demand and remote play control are realized. The video playback method based on the point-to-point communication of the embedded monitoring equipment reduces the dependence on the Source Server of the data Source, and simultaneously, tasks such as storage, transmission, calculation and the like of the data are relatively evenly distributed to all parts of the system, thereby greatly reducing the pressure of the network and the bandwidth and enhancing the stability of the data and the transmission.)

1. A video playback method based on point-to-point communication of embedded monitoring equipment is characterized in that: by means of the NAT traversal method of the TCP, the audio and video on demand of the mobile phone and the equipment is directly realized without passing through a server;

the user inputs the start time and the end time on the mobile phone client, the mobile phone client transmits the time period to the equipment end, and the equipment end returns all the videos in the time period to the mobile phone client, so that the remote video retrieval function is realized;

the user inputs the start time and the end time on the mobile phone client, the mobile phone client transmits the time slot to the equipment end, and the equipment end plays all the videos in the time slot from the first one to the last one, so that the remote time slot on-demand function is realized;

after inquiring the file list at the mobile phone client, the user selects the file to be played and transmits the file name to the equipment end, and the equipment end plays the file, namely, the audio and video stream is transmitted to the mobile phone client, so that the remote file on-demand function is realized;

the user carries out fast forward, fast backward, pause and time positioning related operations on the equipment end at the mobile phone client, thereby realizing the remote play control function.

2. The video playback method based on embedded monitoring device point-to-point communication of claim 1, characterized in that: the mode of the NAT traversal method of the TCP is to traverse the NAT, namely, punching and penetrating P2P on the NAT and a firewall.

3. The video playback method based on embedded monitoring device point-to-point communication of claim 2, characterized in that: the method for opening the penetration of the P2P on the NAT and the firewall comprises the following steps:

s1, Client A logs in the Server, NAT A allocates a port for the Session, and the address of the Client A received by the Server S is the external network address of the Client A;

s2, the Client B logs in the Server S, the NAT B allocates another port for the Session, and then the Server S receives the address corresponding to the B;

s3, optimizing a hole punching mode, and punching a hole with the direction same as the external network address of the Client A on the NATB, wherein the Client B receives the same information as the information sent to the Server S by the Client A;

s4, when the device end receives the message which is sent by the mobile device to the embedded device and contains the extracted inquiry video time, the embedded device carries out UTC time conversion on the received message, inquires the related video file according to the time and returns the result to the mobile device;

s5, the mobile device sends the relevant playing protocol to the embedded device, and the embedded device carries out the following operations after receiving the message:

(1) applying for session resources through a record _ AllocPlayBackSession command;

(2) setting a function for sending a file stream to an upper layer and releasing a session callback through a record _ SetUserCallbackfunction command;

(3) performing a playback operation through a record _ StartPlayBack command;

(4) and the memory leakage condition is avoided by stopping the session and releasing related resources through the record _ SetStopStatus command.

4. The video playback method based on embedded monitoring device point-to-point communication of claim 1, characterized in that: the method comprises the following steps that the mobile phone client sends related operation instructions of fast forward, fast backward, pause and time positioning to the equipment end, and the mode of the equipment end responding to the instructions is as follows: by reducing the distance between the I frame and the P frame in the video stream next to the current position.

Technical Field

The invention belongs to the field of video monitoring, and particularly relates to a video playback method based on point-to-point communication of embedded monitoring equipment.

Background

In the existing video monitoring field, each subsystem and even a user terminal in a network heavily depend on a data Source Server, and tasks such as data storage, transmission, calculation and the like are performed in the same system. The pressure of the network and the bandwidth is greatly increased, and the stability of data and transmission is reduced. Meanwhile, the embedded equipment user is difficult to retrieve the remote video file, the interaction cost is high, and the functions are not suitable for use.

Disclosure of Invention

In view of this, the present invention aims to provide a video playback method based on embedded monitoring device point-to-point communication, which reduces the dependence on the Source Server of the data Source, and distributes tasks such as storage, transmission, and calculation of the data to each part of the system relatively evenly, thereby greatly reducing the pressure of the network and the bandwidth, and enhancing the stability of the data and transmission.

In order to achieve the purpose, the technical scheme of the invention is realized as follows:

a video playback method based on point-to-point communication of embedded monitoring equipment realizes the function of directly playing audio and video on demand by a mobile phone and equipment without a server through a NAT traversal method of TCP.

The user inputs the start time and the end time on the mobile phone client, the mobile phone client transmits the time period to the equipment end, and the equipment end returns all the videos in the time period to the mobile phone client, so that the remote video retrieval function is realized;

the user inputs the start time and the end time on the mobile phone client, the mobile phone client transmits the time slot to the equipment end, and the equipment end plays all the videos in the time slot from the first one to the last one, so that the remote time slot on-demand function is realized;

after inquiring the file list at the mobile phone client, the user selects the file to be played and transmits the file name to the equipment end, and the equipment end plays the file, namely, the audio and video stream is transmitted to the mobile phone client, so that the remote file on-demand function is realized;

the user carries out fast forward, fast backward, pause and time positioning related operations on the equipment end at the mobile phone client, thereby realizing the remote play control function.

Further, the way of the NAT traversal method of TCP is to traverse NAT, i.e. punch a hole to make the P2P pass through on NAT and firewall.

Further, the method for opening the penetration of the P2P on the NAT and the firewall includes:

s1, Client A logs in the Server, NAT A allocates a port for the Session, and the address of the Client A received by the Server S is the external network address of the Client A;

s2, the Client B logs in the Server S, the NAT B allocates another port for the Session, and then the Server S receives the address corresponding to the B;

s3, optimizing a hole punching mode, and punching a hole with the direction same as the external network address of the Client A on the NATB, wherein the Client B receives the same information as the information sent to the Server S by the Client A;

s4, when the device end receives the message which is sent by the mobile device to the embedded device and contains the extracted inquiry video time, the embedded device carries out UTC time conversion on the received message, inquires the related video file according to the time and returns the result to the mobile device;

s5, the mobile device sends the relevant playing protocol to the embedded device, and the embedded device carries out the following operations after receiving the message:

(1) applying for session resources through a record _ AllocPlayBackSession command;

(2) setting a function for sending a file stream to an upper layer and releasing a session callback through a record _ SetUserCallbackfunction command;

(3) performing a playback operation through a record _ StartPlayBack command;

(4) and the memory leakage condition is avoided by stopping the session and releasing related resources through the record _ SetStopStatus command.

Further, the mobile phone client sends the related operation instructions of fast forward, fast backward, pause and time positioning to the device side, and the mode of the device side responding to the instructions is as follows: by reducing the distance between the I frame and the P frame in the video stream next to the current position.

Compared with the prior art, the video playback method based on the point-to-point communication of the embedded monitoring equipment has the following advantages:

the video playback method based on the point-to-point communication of the embedded monitoring equipment reduces the dependence on the Source Server of the data Source, and simultaneously, tasks such as storage, transmission, calculation and the like of the data are relatively evenly distributed to all parts of the system, thereby greatly reducing the pressure of the network and the bandwidth and enhancing the stability of the data and the transmission.

Drawings

The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate an embodiment of the invention and, together with the description, serve to explain the invention and not to limit the invention. In the drawings:

fig. 1 is a schematic diagram of a timing chart of a video playback start method based on embedded monitoring device point-to-point communication according to an embodiment of the present invention;

fig. 2 is a schematic view illustrating a playback start flow of a video playback method based on embedded monitoring device peer-to-peer communication according to an embodiment of the present invention;

fig. 3 is a schematic view illustrating a playback callback processing flow of a video playback method based on embedded monitoring device peer-to-peer communication according to an embodiment of the present invention.

Detailed Description

It should be noted that the embodiments and features of the embodiments may be combined with each other without conflict.

In the description of the present invention, it is to be understood that the terms "center", "longitudinal", "lateral", "up", "down", "front", "back", "left", "right", "vertical", "horizontal", "top", "bottom", "inner", "outer", and the like, indicate orientations or positional relationships based on those shown in the drawings, and are used only for convenience in describing the present invention and for simplicity in description, and do not indicate or imply that the referenced devices or elements must have a particular orientation, be constructed and operated in a particular orientation, and thus, are not to be construed as limiting the present invention. Furthermore, the terms "first", "second", etc. are used for descriptive purposes only and are not to be construed as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first," "second," etc. may explicitly or implicitly include one or more of that feature. In the description of the present invention, "a plurality" means two or more unless otherwise specified.

In the description of the present invention, it should be noted that, unless otherwise explicitly specified or limited, the terms "mounted," "connected," and "connected" are to be construed broadly, e.g., as meaning either a fixed connection, a removable connection, or an integral connection; can be mechanically or electrically connected; they may be connected directly or indirectly through intervening media, or they may be interconnected between two elements. The specific meaning of the above terms in the present invention can be understood by those of ordinary skill in the art through specific situations.

The present invention will be described in detail below with reference to the embodiments with reference to the attached drawings.

A video playback method based on point-to-point communication of embedded monitoring equipment is disclosed, as shown in figures 1 to 3, the invention realizes remote video file retrieval: the mobile phone client inputs the start time and the end time, transmits the time period to the equipment end, and the equipment end returns all the videos in the time period to the mobile phone client.

The invention realizes the remote time slot on demand: the mobile phone client inputs the start time and the end time, and transmits the time period to the equipment end, and the equipment end broadcasts all the videos in the time period from the first to the last, namely, the audio and video stream is transmitted to the mobile phone client.

The invention realizes the remote file on demand: after the mobile phone client inquires the file list, a file to be played is selected, the file name is transmitted to the equipment end, and the equipment end plays the file, namely, the audio and video stream is transmitted to the mobile phone client.

The invention realizes remote play control, including fast forward (2-8 times speed), fast backward (2-8 times speed), pause, time positioning: the mobile phone client can select the multiplying power of fast forward and fast backward, including 2, 4 and 8 times, and the maximum support is 8 times; the interface of the mobile phone client side is clicked for pause, the picture is paused, and the equipment side stops sending the audio and video stream; the time positioning means that after the specified time is reached through dragging, the picture is adjusted to the specified time.

The invention realizes that the mobile phone and the equipment directly carry out audio and video on demand without a server: and the TCP crossing technology is realized.

The invention realizes the starting of the playback, the ending of the playback, the pause of the playback, the fast forward of the playback and the fast backward of the playback, and additionally comprises the picture downloading.

In order to allow the mobile phone client and the embedded device to directly interact in a point-to-point manner, first, the mobile phone client needs to traverse the NAT, i.e., punch through (P2P penetrates through the NAT and the firewall). The following basic logic of hole making is briefly described below.

Firstly, Client A (Peer A) logs in a Server, NAT A allocates a port 32102 for the Session, then the address of the Client A received by Server S is 192.0.2.150:32102, which is the external network address of the Client A;

secondly, Client B (TURN Client) logs in Server S, the port allocated to the Session by NAT B is 7000, then the address of B received by Server S is 192.0.2.1: 7000;

optimizing a hole punching mode, and punching a hole with the direction of 192.0.2.150 (namely the external network address of the Client A) on the NATB, so that the Client A sends information of 192.0.2.1:7000, and the Client B can receive the information. The primary task is completed, so that the mobile device and the embedded device can directly interact (message information and the like), and the video package of the video can be transmitted.

And receiving a json message sent by the mobile equipment to the embedded equipment, taking out the query video time from the json, and after the time is taken by the embedded equipment, carrying out UTC time conversion and then querying related video files according to the time and returning the result to the mobile equipment.

Then the mobile device sends a relevant playing protocol (remote time slot on demand or remote file on demand) to the embedded device, and the embedded device carries out the following operations after taking the message:

(1) the record _ AllocPlayBackSession applies for session resources;

(2) the record _ SetUserCallbackFunction sets a callback function, and the callback function is used for the upper layer to send a file stream and release a session callback;

(3) recording _ StartPlayBack starts playback;

(4) and the record _ SetStopStatus stops the session and releases related resources, thereby avoiding memory leakage.

And receiving json message analysis related operations (fast forward, fast backward, pause, time positioning and the like) sent by the mobile equipment to the embedded equipment, wherein the fast forward operation is realized by reducing the distance between I frames and P frames in the next video stream, and the faster mode is realized by dropping all P frames and only playing the I frames. And fast backward is the same as the fast backward, namely the video stream after the processing is played reversely. And pausing, namely pausing the transmission of the video stream, wherein the time is determined as the analysis and playing according to the designated time transmitted by the mobile equipment.

The most basic operation of a video playback system for peer-to-peer communication is to ensure the existence of "holes" because it is the basis for implementing the subsequent operations for playing back a video stream and the related operations. The optimization rule is that even if no P2P data packet needs to be transmitted, in order for the application to maintain the "hole" to work properly, the application must send a "hole" heartbeat packet to the other party to maintain the timeliness of the "hole". And both sides of the P2P client "punch" again before the current "hole" times out, discarding the original "hole".

The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents, improvements and the like that fall within the spirit and principle of the present invention are intended to be included therein.

8页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:一种多格式解码视频解释播放的系统和方法

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!

技术分类