CN109361871B - Method for simulating network camera as USB camera - Google Patents
Method for simulating network camera as USB camera Download PDFInfo
- Publication number
- CN109361871B CN109361871B CN201811456207.4A CN201811456207A CN109361871B CN 109361871 B CN109361871 B CN 109361871B CN 201811456207 A CN201811456207 A CN 201811456207A CN 109361871 B CN109361871 B CN 109361871B
- Authority
- CN
- China
- Prior art keywords
- equipment
- network camera
- camera
- network
- online
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N23/00—Cameras or camera modules comprising electronic image sensors; Control thereof
- H04N23/60—Control of cameras or camera modules
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F13/00—Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
- G06F13/10—Program control for peripheral devices
- G06F13/102—Program control for peripheral devices where the programme performs an interfacing function, e.g. device driver
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L12/00—Data switching networks
- H04L12/02—Details
- H04L12/16—Arrangements for providing special services to substations
- H04L12/18—Arrangements for providing special services to substations for broadcast or conference, e.g. multicast
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N23/00—Cameras or camera modules comprising electronic image sensors; Control thereof
- H04N23/60—Control of cameras or camera modules
- H04N23/64—Computer-aided capture of images, e.g. transfer from script file into camera, check of taken image quality, advice or proposal for image composition or decision on when to take image
Abstract
The invention discloses a method for simulating a network camera into a USB camera, which comprises the steps of packaging a network camera interaction protocol in an L inux kernel layer, loading a device driver in a L inux kernel, finishing initialization of the network camera interaction protocol and the network camera discovery protocol, searching online devices, generating a device node under a/dev path for converting the operation of the camera into the operation of a L inux standard driver, configuring device parameters for single devices or configuring parameter templates for batch setting of the devices, and controlling the devices for realizing capture, reading audio and video streams and reporting of shielding alarms for the single devices.
Description
Technical Field
The invention relates to the technical field of a driving program of a network camera, in particular to a method for simulating the network camera into a USB camera.
Background
The network camera is a network device, needs to have a communication protocol, does not have a unified specification in the early stage, and a network camera hardware provider adopts a private protocol, along with the networking application of video monitoring, the division of an industrial chain is more and more detailed, some manufacturers specially make the camera, some manufacturers specially make a video server, some manufacturers possibly specially make a platform and the like, and then are integrated by an integrator to be provided for a final client.
Disclosure of Invention
The invention aims to provide a method for simulating a network camera into a USB camera, which is used for solving the problem that an application program in the prior art needs to process the network camera and the USB camera at the same time and is relatively complex.
The invention solves the problems through the following technical scheme:
a method for simulating a network camera as a USB camera comprises the following steps:
s100, encapsulating the network camera interaction protocol in an L inux kernel layer, and after loading a device driver in a L inux kernel, finishing the initialization of the network camera interaction protocol and the initialization of a network camera discovery protocol;
s200, searching for online equipment, and generating an equipment node under a/dev path after finding the online equipment, wherein the equipment node is used for converting the operation on the camera into the operation on L inux standard drive;
step S300: the equipment parameter configuration is used for carrying out parameter configuration on single equipment or configuring a parameter template for carrying out batch setting on the equipment;
step S400: and the equipment control is used for realizing snapshot, reading of audio and video streams and reporting of shielding alarm for a single equipment.
L inux driver, simulating the network camera as USB camera, hiding complex network camera interactive protocol, encapsulating the protocol implementation in linux kernel layer L inux kernel loading corresponding device driver, completing the protocol initialization, generating a device node in/dev path when new device is accessed, changing the camera operation into linux standard driving operation, setting and obtaining the device control and parameters, calling through standard linux driving mode, the application program does not need to care the device model, device access mode and connection protocol between devices, having highly efficient development mode, L inux driver includes device discovery, device parameter configuration and device control, device discovery is used for searching on-line device, devices conforming to ONVIF protocol specification can be found, the device parameter configuration is mainly used for configuring parameters and configuring parameter templates for single device, and is convenient for batch setting of devices, the device control part is mainly used for realizing single device capturing, reading audio and video stream, capturing audio and reporting alarm functions.
Further, the step S200 specifically includes:
step S210: actively searching online equipment which accords with a network camera protocol in a local area network according to a set search mode;
step S220: and when the online equipment is accessed, generating an equipment node under/dev.
Further, the search mode includes an automatic search for searching for online devices within the same subnet as the system by sending a multicast message to a fixed address and a manual search for searching for online devices within a specified subnet by sending a multicast message to a specified address.
Further, the step S200 includes: when the new device accesses the local area network, the information is sent to the local area network in a multicast mode, and after the device discovery program receives the multicast information, the security authentication is carried out to obtain the specific information of the device.
Further, the step S300 specifically includes:
A. modifying the network configuration of the network camera;
B. acquiring/modifying video resolution, code rate, frame rate, OSD and pan-tilt control of the network camera;
C. modifying the system date and time of the network camera;
D. and acquiring manufacturer information and version information of the network camera.
Further, the device control in step S400 includes:
periodically accessing the accessed equipment and judging whether the equipment is online or not;
opening or closing the equipment through an open function and a close function, and completing equipment access through an ioctl function, wherein the equipment access comprises equipment information modification, equipment control and network media stream acquisition;
and when the equipment is disconnected, deleting the equipment node under/dev.
Compared with the prior art, the invention has the following advantages and beneficial effects:
(1) the invention simplifies the realization of the application program, greatly improves the development efficiency of the application, and the application program does not need to pay attention to the protocol details, the equipment model and the access mode of the network camera, and simplifies all the operations related to the network camera into the operations of linux standard equipment.
(2) The invention has great advantages in the application scene that the network camera and the USB camera need to be accessed simultaneously, and the application program can complete the control and management of two types of devices which are not communicated without special treatment.
Drawings
FIG. 1 is a flow chart of the present invention.
Detailed Description
The present invention will be described in further detail with reference to examples, but the embodiments of the present invention are not limited thereto.
Example 1:
referring to fig. 1, a method for simulating a network camera into a USB camera is used to simulate the network camera into the USB camera, and an application program can manage the network camera only by calling a standard linux device driver interface. The present invention will be described in detail with reference to the accompanying drawings.
And the software overall framework comprises device discovery, device parameter configuration and device control. The program is presented in the form of linux ko (kernel driver). The device discovery function is mainly used for searching online devices and comprises two search modes, namely automatic search and manual search. The equipment parameter configuration is mainly used for parameter configuration of single equipment and parameter template configuration, and is convenient for batch setting. And equipment control, which comprises the operations of realizing snapshot, reading audio and video stream, reporting of shielding alarm and the like on a single equipment.
The program execution flow comprises the following steps,
step 1: loading device drivers
The program exists in a ko (linux device driver) form, the linux kernel is started, and after network initialization is completed, the device driver corresponding to the network camera can be loaded through a linux standard command. The device driver firstly initializes a local running environment, then initializes a network camera to find a protocol and waits for the next operation of a user;
step 2: device discovery
And searching in the local area network through a search mode set by the application program. When a new device is accessed to the local area network, the information can be sent to the local area network in a multicast mode. After receiving the multicast information, the device discovery program further performs security authentication to acquire specific information of the device. Meanwhile, the device discovery program can also actively search whether the local area network has the device which conforms to the network camera protocol.
And step 3: creating a device node
When the device discovery program searches for a new device, a device node is added under/dev. Thus, the operation of the webcam is similar to that of the usb webcam. The corresponding equipment node can be opened through an open method, and parameter setting and further operation of the equipment are completed.
And 4, step 4: heartbeat
After the device node is added, regular interaction is needed to judge whether the device node is online or not. The driver implements a device with periodic access.
And 5: device access
Device access is critical to the program and includes acquisition of device information, modification of device information, and device control, and acquisition of network media streams. The access mode is that the equipment is opened and closed through open and close, and the specific operation is carried out on the equipment through ioctl.
Step 6: device disconnection
The equipment is disconnected, and is divided into normal disconnection and abnormal disconnection. Normally disconnected, the driver will receive the device leave message. Abnormal disconnection, such as power failure, network failure. For both cases. The driver deletes the device node under/dev.
And 7: device unloading
The device unloading realizes the unloading function of the network camera drive, and the application program can complete the unloading of the program through the step.
The invention changes the complex implementation mode of the IPC camera application program, and the application program can more simply and conveniently complete the management of the IPC equipment.
Although the present invention has been described herein with reference to the illustrated embodiments thereof, which are intended to be preferred embodiments of the present invention, it is to be understood that the invention is not limited thereto, and that numerous other modifications and embodiments can be devised by those skilled in the art that will fall within the spirit and scope of the principles of this disclosure.
Claims (6)
1. A method for simulating a network camera as a USB camera is characterized by comprising the following steps:
s100, encapsulating the network camera interaction protocol in an L inux kernel layer, and after loading a device driver in a L inux kernel, finishing the initialization of the network camera interaction protocol and the initialization of a network camera discovery protocol;
s200, searching for online equipment, and generating an equipment node under a/dev path after finding the online equipment, wherein the equipment node is used for converting the operation on the camera into the operation on L inux standard drive;
step S300: the equipment parameter configuration is used for carrying out parameter configuration on single equipment or configuring a parameter template for carrying out batch setting on the equipment;
step S400: and the equipment control is used for realizing snapshot, reading of audio and video streams and reporting of shielding alarm for a single equipment.
2. The method according to claim 1, wherein the step S200 specifically includes:
step S210: actively searching online equipment which accords with a network camera protocol in a local area network according to a set search mode;
step S220: and when the online equipment is accessed, generating an equipment node under/dev.
3. The method of claim 2, wherein the search mode comprises an automatic search for searching for online devices within the same subnet as the system by sending multicast messages to a fixed address and a manual search for searching for online devices within a specified subnet by sending multicast messages to a specified address.
4. The method according to claim 1, wherein the step S200 comprises: when the new device accesses the local area network, the information is sent to the local area network in a multicast mode, and after the device discovery program receives the multicast information, the security authentication is carried out to obtain the specific information of the device.
5. The method according to claim 1, wherein the step S300 specifically includes:
A. modifying the network configuration of the network camera;
B. acquiring/modifying video resolution, code rate, frame rate, OSD and pan-tilt control of the network camera;
C. modifying the system date and time of the network camera;
D. and acquiring manufacturer information and version information of the network camera.
6. The method according to claim 1, wherein the device control in step S400 comprises:
periodically accessing the accessed equipment and judging whether the equipment is online or not;
opening or closing the equipment through an open function and a close function, and completing equipment access through an ioctl function, wherein the equipment access comprises equipment information modification, equipment control and network media stream acquisition;
and when the equipment is disconnected, deleting the equipment node under/dev.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811456207.4A CN109361871B (en) | 2018-11-30 | 2018-11-30 | Method for simulating network camera as USB camera |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811456207.4A CN109361871B (en) | 2018-11-30 | 2018-11-30 | Method for simulating network camera as USB camera |
Publications (2)
Publication Number | Publication Date |
---|---|
CN109361871A CN109361871A (en) | 2019-02-19 |
CN109361871B true CN109361871B (en) | 2020-07-24 |
Family
ID=65330690
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201811456207.4A Active CN109361871B (en) | 2018-11-30 | 2018-11-30 | Method for simulating network camera as USB camera |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN109361871B (en) |
Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102333208A (en) * | 2011-10-14 | 2012-01-25 | 浪潮电子信息产业股份有限公司 | Third-generation (3G)-network-based wireless monitoring system |
CN102413320A (en) * | 2011-12-21 | 2012-04-11 | 上海大学 | Method for realizing wireless network intelligent video monitoring system |
CN102497538A (en) * | 2011-12-14 | 2012-06-13 | 北方工业大学 | High-speed image acquisition and transmission platform based on ARM |
CN103780900A (en) * | 2014-01-16 | 2014-05-07 | 国家电网公司 | ONVIF simulating testing device and method |
CN107528919A (en) * | 2017-09-25 | 2017-12-29 | 江苏英索纳智能科技有限公司 | The method and device that a kind of lan device is found and driver is installed automatically |
CN107733858A (en) * | 2017-09-01 | 2018-02-23 | 北京知道未来信息技术有限公司 | A kind of monitoring device and method of intelligent protection camera information |
CN108449555A (en) * | 2018-05-04 | 2018-08-24 | 北京化工大学 | Image interfusion method and system |
Family Cites Families (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20140092004A1 (en) * | 2012-09-28 | 2014-04-03 | Ashok K. Mishra | Audio information and/or control via an intermediary device |
US10104704B2 (en) * | 2014-02-07 | 2018-10-16 | Cisco Technology, Inc. | Dynamic acceleration of prioritized mobile application traffic |
-
2018
- 2018-11-30 CN CN201811456207.4A patent/CN109361871B/en active Active
Patent Citations (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102333208A (en) * | 2011-10-14 | 2012-01-25 | 浪潮电子信息产业股份有限公司 | Third-generation (3G)-network-based wireless monitoring system |
CN102497538A (en) * | 2011-12-14 | 2012-06-13 | 北方工业大学 | High-speed image acquisition and transmission platform based on ARM |
CN102413320A (en) * | 2011-12-21 | 2012-04-11 | 上海大学 | Method for realizing wireless network intelligent video monitoring system |
CN103780900A (en) * | 2014-01-16 | 2014-05-07 | 国家电网公司 | ONVIF simulating testing device and method |
CN103780900B (en) * | 2014-01-16 | 2016-02-17 | 国家电网公司 | A kind of ONVIF simulating test device and method |
CN107733858A (en) * | 2017-09-01 | 2018-02-23 | 北京知道未来信息技术有限公司 | A kind of monitoring device and method of intelligent protection camera information |
CN107528919A (en) * | 2017-09-25 | 2017-12-29 | 江苏英索纳智能科技有限公司 | The method and device that a kind of lan device is found and driver is installed automatically |
CN108449555A (en) * | 2018-05-04 | 2018-08-24 | 北京化工大学 | Image interfusion method and system |
Also Published As
Publication number | Publication date |
---|---|
CN109361871A (en) | 2019-02-19 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN111611054B (en) | Application deployment method and device | |
CN110958299A (en) | Edge computing processing platform integrating multi-group network protocol multi-edge computing framework | |
US20210334061A1 (en) | Synchronous Display Method and Apparatus, Storage Medium and Electronic Device | |
CN109547567B (en) | Proxy connection method and device | |
CN112152969A (en) | Internet of things gateway and method for accessing Internet of things equipment into gateway | |
CN113168334A (en) | Data processing method and device, electronic equipment and readable storage medium | |
CN107358506A (en) | Product customization method, apparatus and equipment for customizing | |
CN115357308B (en) | Docker-based edge Internet of things agent device, system and application method | |
CN115248692A (en) | Device and method for supporting cloud deployment of multiple deep learning framework models | |
JP2005174319A (en) | Apparatus and method for sharing services on network | |
WO2022156316A1 (en) | Configuration method and system supporting heterogeneous environment | |
CN111182074A (en) | Intelligent device terminal with edge computing capability and computer-readable storage medium | |
WO2007022676A1 (en) | A system for reporting and obtaining device information and the method therefor | |
JP2006236348A (en) | Service framework of home network | |
CN109361871B (en) | Method for simulating network camera as USB camera | |
CN107846609B (en) | Real-time transmission method, device and system for control room data | |
CN113572822A (en) | Cloud terminal simulation control method and device, storage medium and electronic equipment | |
CN112966833A (en) | Machine learning model platform based on Kubernetes cluster | |
Krainyk et al. | Internet-of-Things Device Set Configuration for Connection to Wireless Local Area Network. | |
CN111897565A (en) | Data processing method, device and equipment based on Internet of things | |
CN102821302A (en) | Video download method, gateway equipment and network video monitoring system | |
CN107347126B (en) | The method of Configuration network camera | |
US20070157158A1 (en) | Software implementation of hardware platform interface | |
CN112597022A (en) | Remote diagnosis method, device, storage medium and electronic equipment | |
CN112367297A (en) | Service control method and device |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |