The content of the invention
Present invention is primarily targeted at providing a kind of video capture method and device based on Linux multi-core environments, purport
In the efficiency for improving video acquisition.
For achieving the above object, the present invention provide a kind of video capture method based on Linux multi-core environments include as
Lower step:
The instruction of collection video data is issued to corresponding video camera;
Start its respective thread and receive the video data that video camera is sended over;
Received video data is stored into data repository;
Wherein, also include before the step of video data that the reception video camera is sended over:
Start epoll network modeies, when listen to there is readable event when, then respond its respective thread processing data.
Preferably, the instruction for issuing collection video data includes to before the step of corresponding video camera:
Transmission is set up with the video camera to communicate;
Start with the udp port for transmitting communication adaptation to gather the video data that the video camera sends.
Preferably, the data repository is the storage cluster of distributed file system.
Preferably, also include before the step of video data that the startup its respective thread reception video camera is sended over:
Ensure that video data stream is added in an orderly manner in receiving queue using hash algorithm.
Preferably, the instruction for issuing collection video data also includes to before the step of corresponding video camera:
Send video camera of the corresponding detection information in the range of;
If receiving the feedback information of video camera, confirm and the video camera successful matching;
Send the video camera of the instruction to successful matching of collection video data.
Additionally, for achieving the above object, the present invention also provides a kind of video acquisition device based on Linux multi-core environments,
The video acquisition device based on Linux multi-core environments includes:
First sending module, for issuing the instruction of collection video data to corresponding video camera;
Receiver module, for starting its respective thread the video data that video camera is sended over is received;
Memory module, for received video data to be stored into data repository;
Wherein, the video acquisition device based on Linux multi-core environments also includes:
First starting module, for starting epoll network modeies, when listen to there is readable event when, then respond corresponding
Thread process data.
Preferably, the video acquisition device based on Linux multi-core environments also includes:
Communication module, communicates for setting up transmission with the video camera;
Starting module, for regarding for starting the udp port with the transmission communication adaptation to gather that the video camera sends
Frequency evidence.
Preferably, the data repository is the storage cluster of distributed file system.
Preferably, the receiver module is additionally operable to ensure that video data stream is added in an orderly manner reception using hash algorithm
In queue.
Preferably, the video acquisition device based on Linux multi-core environments includes:
Detecting module, for sending video camera of the corresponding detection information in the range of;
Matching module, for when the feedback information of video camera is received, then confirming and the video camera successful matching;
Second sending module, for sending the video camera of the instruction to successful matching of collection video data
The present invention is by issuing the instruction of collection video data to corresponding video camera;What reception video camera was sended over regards
Frequency evidence;Received video data is stored into data repository;Wherein, what the reception video camera was sended over regards
Frequency according to the step of before also include:Start epoll network modeies, when listen to there is readable event when, then respond corresponding line
Journey processing data.The video data of the multiple video cameras of multiple camera acquisitions is corresponded to by a thread and epoll is used cooperatively
Network model, improves the efficiency to camera video collection.
Specific embodiment
It should be appreciated that specific embodiment described herein is not intended to limit the present invention only to explain the present invention.
A kind of video capture method based on Linux multi-core environments of present invention offer, reference Fig. 1, in the first embodiment,
The video capture method of Linux multi-core environments should be based on to be included:
Step S10, issues the instruction of collection video data to corresponding video camera;
Include numerous video cameras and server in monitoring system, it is provided in an embodiment of the present invention based on Linux multinuclears
The video capture method of environment is used to realize a kind of video data acquiring of the multiple video cameras of multi-core environment next one thread correspondence
Method, improves video acquisition efficiency.
In the present embodiment, server issues the instruction of collection video data to corresponding video camera, mentioned here corresponding
Video camera refer to can be with server pairing or the video camera that can search of server, a server may
Can with multiple video camera successful matchings or search multiple video cameras in corresponding network, then server will issue collection
The instruction of video data is to multiple paired video cameras.
In the present embodiment, in order to make full use of multi-core environment under gather video data efficiency, be that each caryogamy is standby
Epoll network modeies, making the performance of each core can be fully utilized, and substantially increase the efficiency of collection.It should be noted that
Be that epoll creates the maximum check figure no more than system of number.
Step S21, starts epoll network modeies, when listen to there is readable event when, then respond its respective thread and process number
According to;
Step S20, starts its respective thread and receives the video data that video camera is sended over;
Video camera is received after the instruction of collection video data, corresponding video data is gathered, by the video data after collection
Send to server.Server is received before the video data that video camera is sended over, and server system will start epoll network moulds
Type, now, if listen to the presence of readable event, that is, has video data to send, then respond corresponding thread and receive video camera
The video data for sending over.
It should be noted that during video data is received, while ensure video data stream using hash algorithm having
It is added in receiving queue to sequence.
Step S30, received video data is stored into data repository.
Collect from video camera and write in the disk of backstage in the way of object after video data, wherein, the backstage magnetic
Disk is the storage cluster of distributed file system.
The advantage write in the way of object be pair as if by distributed file system distribute data to configure
In associative disk, storage is realized according to certain algorithm, relative to single disk is directly stored in, capacity is bigger, single-point occurs
Disk failure can carry out Data Migration and recover, it is ensured that the reliability of data.
Additionally, compared with the prior art on market, by being encoded using state-of-the-art H264 on market and H265
The code check of transmission is reduced, under comparable bandwidths memory space is saved, while using distributed during distributed storage
Storage characteristics in the concurrent storage of video data to each sub- storage system, will realize efficient video data storage, during
Record the parameters such as channel number, date, time.
If to check certain history video data afterwards, according to querying condition such as:The parameters such as channel number, date, time
Optimal path is found from distributed storage cluster, Video stream information is read, and is transmitted to supervision platform.
Server storage after video data is received that video data is concurrent is realized in each sub- storage system
Efficient video data storage, and be easy to search the video data in the future.Additionally, after being caused using the writing mode of object
Platform disk is bigger relative to single disk, capacity is directly stored in, occur single-point disk failure can carry out Data Migration with it is extensive
It is multiple, it is ensured that the reliability of data.
The present invention is by issuing the instruction of collection video data to corresponding video camera;What reception video camera was sended over regards
Frequency evidence;Received video data is stored into data repository;Wherein, what the reception video camera was sended over regards
Frequency according to the step of before also include:Start epoll network modeies, when listen to there is readable event when, then respond corresponding line
Journey processing data.The video data of the multiple video cameras of multiple camera acquisitions is corresponded to by a thread and epoll is used cooperatively
Network model, improves the efficiency to camera video collection.
Further, Fig. 2 is referred to, is implemented based on the video capture method first of Linux multi-core environments based on the present invention
Example, in video capture method second embodiment of the present invention based on Linux multi-core environments, also includes before above-mentioned steps S10:
Step S11, sets up transmission and communicates with the video camera;
Step S12, starts with the udp port for transmitting communication adaptation to gather the video counts that the video camera sends
According to.
In the present embodiment, built by real time streaming transport protocol (Real Time Streaming Protocol, RTSP)
Write a biography defeated communication.
The transmission communication includes sending OPTION requests, DESCRIBE requests, SETUP successively to the web camera
Request and PLAY requests, and successful information is confirmed one by one.Specifically, can be with the successful return value of setting check as 100.
After the transmission communication readiness, startup UDP (User Datagram Protocol,
UDP) port, the video data adopts RTP (Real-time Transport by the udp port
Protocol, RTP) video data transmitting is delivered to into the server, the server receives the video data.It is described
RTP includes the parameters such as serial number and timestamp.
In the present embodiment, the server is facilitated with the net by parameters such as the serial numbers and timestamp in the RTP
Network video camera ensures the reliability and integrity of data in transmission communication, and is easy to search the video data in the future.
The present embodiment is communicated by setting up transmission with video camera, using UDP transmitting video datas, selects the telephone network of UDP
It is very smooth in the case of well, though frame can be abandoned in the case where network condition is very undesirable, rather than always in effect
Data, therefore will not block, it is ensured that the fluency of video.
Further, Fig. 3 is referred to, based on video second embodiment of the present invention based on Linux multi-core environments, at this
In the bright video 3rd embodiment based on Linux multi-core environments, also include before above-mentioned steps S10:
Step S101, sends video camera of the corresponding detection information in the range of;
In the present embodiment, server is issuing corresponding collection video data to before corresponding server, first sends phase
Video camera of the detection information answered in the range of.It is understood that when server sends detection information in a network, as long as
It is that network shooting function receives the detection information, then all can beams back feedback information, wherein feedback letter for the detection information
Breath includes the information such as the IP address of itself.
Step S102, if receiving the feedback information of video camera, confirms and the video camera successful matching;
Step S103, sends the video camera of the instruction to successful matching of collection video data.
Further, if video camera receives after detection information send feedback information to corresponding server, then it represents that should
Video camera is the video camera that can be matched with the server, and now, server can further send as needed collection and regard
The information of frequency evidence is to the video camera.
The present embodiment, by carrying out pairing check with the video camera, so as to the shooting that can be matched with server
Machine carries out communication connection, further gathers the video data of the video camera, improves the efficiency of video acquisition data.
A kind of video acquisition device based on Linux multi-core environments of present invention offer, reference Fig. 4, in the first embodiment,
The video acquisition device of Linux multi-core environments should be based on to be included:
First sending module 10, for issuing the instruction of collection video data to corresponding video camera;
Include numerous video cameras and server in monitoring system, it is provided in an embodiment of the present invention based on Linux multinuclears
The video capture method of environment is used to realize a kind of video data acquiring of the multiple video cameras of multi-core environment next one thread correspondence
Method, improves video acquisition efficiency.
In the present embodiment, server issues the instruction of collection video data to corresponding video camera, mentioned here corresponding
Video camera refer to can be with server pairing or the video camera that can search of server, a server may
Can with multiple video camera successful matchings or search multiple video cameras in corresponding network, then server will issue collection
The instruction of video data is to multiple paired video cameras.
In the present embodiment, in order to make full use of multi-core environment under gather video data efficiency, be that each caryogamy is standby
Epoll network modeies, making the performance of each core can be fully utilized, and substantially increase the efficiency of collection.It should be noted that
Be that epoll creates the maximum check figure no more than system of number.
First starting module 21, for starting epoll network modeies, when listen to there is readable event when, then respond phase
Answer thread process data;
Receiver module 20, for starting its respective thread the video data that video camera is sended over is received;
Video camera is received after the instruction of collection video data, corresponding video data is gathered, by the video data after collection
Send to server.Server is received before the video data that video camera is sended over, and server system will start epoll network moulds
Type, now, if listen to the presence of readable event, that is, has video data to send, then respond corresponding thread and receive video camera
The video data for sending over.
It should be noted that during video data is received, while ensure video data stream using hash algorithm having
It is added in receiving queue to sequence.
Memory module 30, for received video data to be stored into data repository.
Collect from video camera and write in the disk of backstage in the way of object after video data, wherein, the backstage magnetic
Disk is the storage cluster of distributed file system.
The advantage write in the way of object be pair as if by distributed file system distribute data to configure
In associative disk, storage is realized according to certain algorithm, relative to single disk is directly stored in, capacity is bigger, single-point occurs
Disk failure can carry out Data Migration and recover, it is ensured that the reliability of data.
Additionally, compared with the prior art on market, by being encoded using state-of-the-art H264 on market and H265
The code check of transmission is reduced, under comparable bandwidths memory space is saved, while using distributed during distributed storage
Storage characteristics in the concurrent storage of video data to each sub- storage system, will realize efficient video data storage, during
Record the parameters such as channel number, date, time.
If to check certain history video data afterwards, according to querying condition such as:The parameters such as channel number, date, time
Optimal path is found from distributed storage cluster, Video stream information is read, and is transmitted to supervision platform.
Server storage after video data is received that video data is concurrent is realized in each sub- storage system
Efficient video data storage, and be easy to search the video data in the future.Additionally, after being caused using the writing mode of object
Platform disk is bigger relative to single disk, capacity is directly stored in, occur single-point disk failure can carry out Data Migration with it is extensive
It is multiple, it is ensured that the reliability of data.
In the present embodiment, the collection of video data is realized based on Linux multi-core environments, multiple taking the photograph is corresponded to using a thread
As the video data acquiring method of head, video data acquiring efficiency is improve.
The present invention is by issuing the instruction of collection video data to corresponding video camera;What reception video camera was sended over regards
Frequency evidence;Received video data is stored into data repository;Wherein, what the reception video camera was sended over regards
Frequency according to the step of before also include:Start epoll network modeies, when listen to there is readable event when, then respond corresponding line
Journey processing data.The video data of the multiple video cameras of multiple camera acquisitions is corresponded to by a thread and epoll is used cooperatively
Network model, improves the efficiency to camera video collection.
Further, Fig. 5 is referred to, is implemented based on the video acquisition device first of Linux multi-core environments based on the present invention
Example, in video acquisition device second embodiment of the present invention based on Linux multi-core environments, based on regarding for Linux multi-core environments
Frequency harvester also includes:
Communication module 11, communicates for setting up transmission with the video camera;
Second starting module 12, is sent out with the udp port of the transmission communication adaptation for starting with gathering the video camera
The video data for going out.
In the present embodiment, built by real time streaming transport protocol (Real Time Streaming Protocol, RTSP)
Write a biography defeated communication.
The transmission communication includes sending OPTION requests, DESCRIBE requests, SETUP successively to the web camera
Request and PLAY requests, and successful information is confirmed one by one.Specifically, can be with the successful return value of setting check as 100.
After the transmission communication readiness, startup UDP (User Datagram Protocol,
UDP) port, the video data adopts RTP (Real-time Transport by the udp port
Protocol, RTP) video data transmitting is delivered to into the server, the server receives the video data.It is described
RTP includes the parameters such as serial number and timestamp.
In the present embodiment, the server is facilitated with the net by parameters such as the serial numbers and timestamp in the RTP
Network video camera ensures the reliability and integrity of data in transmission communication, and is easy to search the video data in the future.
The present embodiment is communicated by setting up transmission with video camera, using UDP transmitting video datas, selects the telephone network of UDP
It is very smooth in the case of well, though frame can be abandoned in the case where network condition is very undesirable, rather than always in effect
Data, therefore will not block, it is ensured that the fluency of video.
Further, Fig. 6 is referred to, is implemented based on the video acquisition device second of Linux multi-core environments based on the present invention
Example, it is above-mentioned based on Linux multi-core environments in video acquisition device 3rd embodiment of the present invention based on Linux multi-core environments
Video acquisition device also include:
Detecting module 101, for sending video camera of the corresponding detection information in the range of;
In the present embodiment, server is issuing corresponding collection video data to before corresponding server, first sends phase
Video camera of the detection information answered in the range of.It is understood that when server sends detection information in a network, as long as
It is that network shooting function receives the detection information, then all can beams back feedback information, wherein feedback letter for the detection information
Breath includes the information such as the IP address of itself.
Matching module 102, for when the feedback information of video camera is received, then confirming and the video camera successful matching;
Second sending module 103, for sending the video camera of the instruction to successful matching of collection video data.
Further, if video camera receives after detection information send feedback information to corresponding server, then it represents that should
Video camera is the video camera that can be matched with the server, and now, server can further send as needed collection and regard
The information of frequency evidence is to the video camera.
The present embodiment, by carrying out pairing check with the video camera, so as to the shooting that can be matched with server
Machine carries out communication connection, further gathers the video data of the video camera, improves the efficiency of video acquisition data.
The preferred embodiments of the present invention are these are only, the scope of the claims of the present invention is not thereby limited, it is every using this
Equivalent structure or equivalent flow conversion that bright description and accompanying drawing content are made, or directly or indirectly it is used in other related skills
Art field, is included within the scope of the present invention.