tracking.js
tracking.js copied to clipboard
face detection using IP camera
Hi all,
Please suggest how can i access IP camera and undergo face detection
Thanks vijay
i think i need to configure rtsp://xx.xx.xx.xx:554/Streaming/Channels/1 to read the video feed. Currently am stuck how to do face detection on RTSP
I don't believe html5 video tags can accept RTSP. You might consider using video.js with the HLS add-on to make it work. Once you have your RTSP feed rendering correctly inside the video tag, tracking.js should work normally.
Thanks Alex,
Pls suggest using tracking.js can i read http stream remotely from IP camera ?
Not directly. You will need to figure out how to make the video output of the IP camera stream compatible with an HTML5 video tag, i.e. HLS or MPEG-DASH. I do not know how to accomplish that, but video.js with the HLS add-on (links in my prior response) may be your answer. Once that is setup, you can use tracking.js as it is documented.
Connecting IP camera to trackingJS
I have connected IP camera to tracking.js by using jsmpeg (https://github.com/phoboslab/jsmpeg). I am using ubuntu Linux. My face tracking is not working but at least you can see how to use IP camera.
Use ffmpeg to stream IP camera to jsmpeg: ffmpeg -i rtsp://192.168.8.105:554/onvif1 -b:v 50k -r 30 http://127.0.0.1:8096/jsmpeg_secret/1280/720
In my test html page: consume the incoming video
// rough copy, from my code
< canvas id="videoFeed1" width="640" height="480" >< / canvas >
window.onload = function() { var client1 = new WebSocket( 'ws://192.168.8.101:8097/' ); var feed1 = document.getElementById('videoFeed1'); var player1 = new jsmpeg(client1, {canvas:feed1}); var tracker = new tracking.ObjectTracker('face');
tracker.setInitialScale(4); tracker.setStepSize(2); tracker.setEdgesDensity(0.1); tracking.track(player1.canvas, tracker);
... rest of the tracking code etc };
To get your face tracking working, you probably don't want everything in window.onload, particularly the tracking.track(...). Try moving that into a callback from the video element (something like, feed1.onloadedmetadata = (e) => { feed1.play(); tracking.track(...); }; )
Very true. Will try that thank you very much.