Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Onvif Support #225

Open
captainerd opened this issue Jun 21, 2022 · 10 comments
Open

Onvif Support #225

captainerd opened this issue Jun 21, 2022 · 10 comments
Labels
enhancement New feature or request

Comments

@captainerd
Copy link

Okay, i'm getting the feeling seyxd died by covid or vax since don't see activity/replies.. here is the deal

Most cameras if not all except some old i expecting to support ONVIF, onvif is really usefull because i didn't knew what the rtsp url is to put the cameras on the app, it toke me a while to figure out what is going on. with onvif we can detect all the cameras in the network and automatically grab A. a live url for snapshot, B. stream A and low B, and C. motion detect proccessed by camera.

To do this i used two packages.

import onvif from 'node-onvif'; <- for discovery of streaming urls, camera names, etc.
import onvifEvents from 'node-onvif-events'; <- for motion detection provided by the camera it self.

Note: node-onvif-events had to be manually installed as npm produced some errors when installing.

The following two functions return an array of objects, each object has these info. ob.snapshot is the url for a live fresh snapshot jpeg image, rtsp is an array of profiles, with urls for streaming note that to pass that info on ffmpeg you will need to replace :// with ://user:password@url

eg. rtsp://192.168.7.25:8554/profile0 needs to be http://user:pass@192.168.7.25:8554/profile0

[ { snapshot: 'http://192.168.7.25:6688/snapshot/PROFILE_001', rtsp: [ 'rtsp://192.168.7.25:8554/profile0', 'rtsp://192.168.7.25:8554/profile1' ], urn: 'urn:uuid:2171bb3f-aa30-aa30-3030-e062905c7634', name: 'HD%20IPC', xaddr: 'http://192.168.7.25:6688/onvif/device_service' },

`async function testme(username, password) {
return new Promise(async (resolve, reject) => {
let camojb = {};
const cameras_info = [];
console.log('Start the discovery process.');
// Find the ONVIF network cameras.
// It will take about 3 seconds.
onvif.startProbe().then(async (device_info_list) => {
for (let i=0; i<device_info_list.length; i++) {
let info = device_info_list[i];
let device = new onvif.OnvifDevice({
xaddr: info.xaddrs[0],
user : username,
pass : password
});
camojb = await getURLs(device);
//set obj
camojb.urn = info.urn;
camojb.name = info.name;
camojb .xaddr = info.xaddrs[0];
// Initialize the OnvifDevice object
cameras_info.push(camojb);
}
resolve(cameras_info)
}).catch((error) => {
console.error(error);
})
})
}

async function getURLs(device) {
return new Promise(async function(resolve) {
let camojb = {};
camojb.snapshot = [];
camojb.rtsp = [];
device.init().then(() => {

let profile_list =   device.getProfileList();

for(let i=0; i<profile_list.length; i++) {
  camojb.snapshot = profile_list[i].snapshot;
  camojb.rtsp[i] = profile_list[i].stream.rtsp;
}  

}).then(() => {
resolve(camojb)

}).catch((error) => {
console.error(error);
});
});
}`

Now as for motion detection:

`const startMotion = async () => {
const detector = await onvifEvents.MotionDetector.create(options.id, options);
console.log(new Date(), '>> Motion Detection Listening!!');
detector.listen((motion) => {
if (motion) {
console.log(new Date(), '>> Motion Detected');
} else {
console.log(new Date(), '>> Motion Stopped');
}
});
}

startMotion();`

tested both packages inside camera.ui as console.prints and works wonders.. now we need to impelement those into the app.
a second feature that i find very important is to use .mkv for filenames and -copy for codecs, as almost all cameras provide already codec video and ffmpeg by default decodes video with mp4 or other extions in filename despite if you are u trying to use -codec copy, codec copy is only accepted on mkv.

@captainerd captainerd added the enhancement New feature or request label Jun 21, 2022
@captainerd
Copy link
Author

@seydx
Copy link
Owner

seydx commented Jun 22, 2022

Haha, no I'm still alive :D

I am actively working on version 2 of camera.ui and always read all the posts here

I have already implemented a lot (plugins, ring, webRTC, bugfixes, sound detection, new widgets, support for webpush etc etc).

Onvif will also be implemented

@datomi79
Copy link

is version 2 coming soon?

@hassaniqbaluk
Copy link

Hey @seydx - Just checking to see if ONVIF is on the table and/or if Camera UI is still being developed? As I can see there's been no updates since April and worried I'll be committing to something which is no longer being supported..

@hassaniqbaluk
Copy link

hassaniqbaluk commented Dec 10, 2022

I feel this may be an inactive project now…

happy to sponsor @seydx if it’s still active.

@Sceptersax
Copy link

I just stumbled on this. It's awesome! Is this still being developed? Version 2 ETA??

@WEZANGO
Copy link

WEZANGO commented Mar 31, 2023

UI wise, this seems to be the best NVR project out there. That would be a shame if development on this is stopped.

@hassaniqbaluk
Copy link

I agree; it seems to have been stopped and unsupported at this point by the looks of things

@captainerd
Copy link
Author

Haha, no I'm still alive :D

I am actively working on version 2 of camera.ui and always read all the posts here

I have already implemented a lot (plugins, ring, webRTC, bugfixes, sound detection, new widgets, support for webpush etc etc).

Onvif will also be implemented

Are you going to push a version of what you did up to now ?

@iurycarlos
Copy link

it would be great to follow those new features!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

7 participants