seydx / camera.ui

NVR like user Interface for RTSP capable cameras
https://github.com/seydx/camera.ui
MIT License
615 stars 98 forks source link

Onvif Support #225

Open captainerd opened 2 years ago

captainerd commented 2 years ago

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 commented 2 years ago

URL for packages i tested.

https://www.npmjs.com/package/node-onvif-events https://github.com/futomi/node-onvif

seydx commented 2 years ago

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 commented 1 year ago

is version 2 coming soon?

hassaniqbaluk commented 1 year ago

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 commented 1 year ago

I feel this may be an inactive project now…

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

Sceptersax commented 1 year ago

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

WEZANGO commented 1 year ago

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

hassaniqbaluk commented 1 year ago

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

captainerd commented 1 year ago

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 commented 1 year ago

it would be great to follow those new features!

mkz212 commented 1 day ago

🎉 A new version of camera.ui

A new version of camera.ui is currently under active development. An initial alpha/beta release and previews are coming soon. Stay tuned for exciting updates: https://github.com/seydx/camera.ui/issues/448 .

This version will no longer be developed / fixed. The new version contains many novelties and fixes (most important is for HKSV recording).