While working with regular streaming on OBS and Restream, I found that WiFi cameras could be a good use for streaming tasks. You can power them up with powerbank and drop to any location of the room, you can then easily move their position or rotate them remotely.
The only problem is that you need ONVIF camera interface. While working with OBS (openbroadcaststudio) software it's uncomfortable to switch windows just to control the camera and you actually don't need additional view window because you already have one in OBS. So I though of creating hotkeys so I could move my PTZ-enabled WiFi ONVIF camera without switching a desktop or window and without any actual interface for that.
So I found ONVIF node sources, checked and re-written them so they could use single config file (one-time setup) and now they can be easily runned like scripts from the system hotkey setup.
It's easy now to use this repo as a basis for your own online service or desktop app.
This source code repository helps you to write own nodejs-based ONVIF camera application or set up system hotkeys to use the camera. This repository aims to make super-easy, basic camera controls with NodeJS.
This is minimal node framework so it uses solo node(js) and 3 node modules.
sudo apt install npm git; npm install xml2js html node-onvifgit clone https://github.com/sxiii/node-onvifcd node-onvifnode onvifcamtest.jsnode streaminfo.jsYou can use this script to make an instant camera snapshot, or, for example, control the camera while streaming from it with OBS (OpenBroadcastStudio). For this usecase (eg.: turn the camera right), just create keyboard shotcut with the following command: node /home/username/node-onvif/turnright.js and then arrange the hotkey. You could set up keys for rotating the camera to all directions, taking the snapshot, etc etc.
Please replace the IP, port and user/pass combination according to found information (onvifcamtest.js output) and/or the datasheet of the camera. The file should look like this:
module.exports = {
xaddr: 'http://192.168.1.100:5000/onvif/device_service',
user : 'admin',
pass : '123456'
};
All other scripts (except onvifcamtest.js) takes camera configuration from this file.
Start the discovery process.
1 devices were found.
- urn:uuid:2419d68a-2dd2-21b2-a205-000C437D0EF6
- IPC 10704807
- http://192.168.1.100:5000/onvif/device_service
{
"Manufacturer": "Technology",
"Model": "IPC",
"FirmwareVersion": "21.00.00.35",
"SerialNumber": "10704807",
"HardwareId": "Ver 2.1"
}
rtsp://192.168.1.100:554/onvif1
Look for file saved in the directory: snapshot.jpg
Done!
Done!
I would like to improve this repo but not making it monstrous. If you have your commits for better ONVIF snapshot features or some other useful (but still small) functions, please add them. Found a bug? Make an issue in this repo. You can support my work - contact me on telegram @fakesnowden for details.
Hope this repository will be useful for your camera and ONVIF tasks.
Independent steemit & golos author,
Den Ivanov aka @sxiii