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

The routine probestream works fine, but the discoverCameras doesn't. #17

Open
fabriciorsf opened this issue Sep 18, 2021 · 6 comments
Open

Comments

@fabriciorsf
Copy link
Contributor

The routine probestream works fine, but the discoverCameras doesn't.

Follow the result from test:

> curl --request POST --url http://localhost:8000/v1/rpc/probestream --header 'content-type: application/json' --data '{\"url\" : \"rtsp://192.168.128.1:8554/cam\"}'
{"streams":[{"index":0,"codec_name":"h264","codec_long_name":"H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10","profile":"High 4:2:2","codec_type":"video","codec_time_base":"1/60","codec_tag_string":"[0][0][0][0]","codec_tag":"0x0000","width":640,"height":480,"coded_width":640,"coded_height":480,"has_b_frames":0,"sample_aspect_ratio":"0:1","display_aspect_ratio":"0:1","pix_fmt":"yuv422p","level":30,"color_range":"unknown","color_space":"unknown","color_transfer":"unknown","color_primaries":"unknown","chroma_location":"left","field_order":"progressive","timecode":"N/A","refs":1,"is_avc":"false","nal_length_size":0,"id":"N/A","r_frame_rate":"30/1","avg_frame_rate":"30/1","time_base":"1/90000","start_pts":17219,"start_time":0.191322,"duration_ts":"N/A","duration":"N/A","bit_rate":"N/A","max_bit_rate":"N/A","bits_per_raw_sample":8,"nb_frames":"N/A","nb_read_frames":"N/A","nb_read_packets":"N/A","disposition":{"default":0,"dub":0,"original":0,"comment":0,"lyrics":0,"karaoke":0,"forced":0,"hearing_impaired":0,"visual_impaired":0,"clean_effects":0,"attached_pic":0,"timed_thumbnails":0}}],"format":{"filename":"rtsp://192.168.128.1:8554/cam","nb_streams":1,"nb_programs":0,"format_name":"rtsp","format_long_name":"RTSP input","start_time":0.191322,"duration":"N/A","size":"N/A","bit_rate":"N/A","probe_score":100,"tags":{"title":"Stream"}},"chapters":[]}

> curl --request GET --url http://localhost:8000/v1/rpc/discoverCameras --header 'content-type: application/json'
{"status":"success","data":[]}

Follow the log from camerasdiscovery docker running in a Windows 10 host Machine:

> docker run --rm --name=camerasdiscovery -p 8000:8000 saurabhshandy/camerasdiscovery
Requested URL to probe: rtsp://192.168.128.1:8554/cam
'successfully probed URL:'
probing finished!
POST /v1/rpc/probestream 200 12005.425 ms - 1357
Starting the discovery process.
GET /v1/rpc/discoverCameras 200 3001.606 ms - 30

The routine discoverCameras failed to discover the RTPS stream rtsp://192.168.128.1:8554/cam.

@beyondszine
Copy link
Owner

Hi @fabriciorsf,
one really important thing for discoverCamras to work is that you pass on the host network as well to find cameras from. The way discoverCameras work is by sending multicast packets to figure out who all are there in the network.
currently, this is making call to docker network. So, please do pass host network as well so that the queries can be sent to your network where cameras are. As per my understanding, cameras & the program have to be in same broadcast network.

docker run --rm --name=camerasdiscovery ---network=host saurabhshandy/camerasdiscovery

Please do check if --network=host is the right flag to use incase of windows machine. I am not sure of that.

@fabriciorsf
Copy link
Contributor Author

Tks @beyondszine, but the --network=host flag doesn't work in windows host machines, and my network is composed only of windows machines.
I have to look for another solution without docker!

If your API will have new features, please let me know.

@beyondszine
Copy link
Owner

Ohh I see. I had never tried this on windows actually.
What you can do is simply run the npm i && npm start command after cloning the repository.

Yes, they have got a few updates, but I couldn't get the time to update it here on github. My work primarily resides in gitlab.
Will try to push to this remote origin as well.

@fabriciorsf
Copy link
Contributor Author

I ran at Windows:

> npm i

up to date, audited 771 packages in 3s

10 packages are looking for funding
  run `npm fund` for details

23 vulnerabilities (4 low, 9 moderate, 9 high, 1 critical)

To address issues that do not require attention, run:
  npm audit fix

To address all issues (including breaking changes), run:
  npm audit fix --force

Run `npm audit` for details.

Until here, seems ok!

But the next command npm start didn't start.
Follow the trace with this command:

> npm start

> [email protected] start
> HOST='0.0.0.0' nodemon ./bin/www

'HOST' não é reconhecido como um comando interno
ou externo, um programa operável ou um arquivo em lotes.

As i running at Windows, I had to create env var with command setx HOST='0.0.0.0', and to change package.json at the line 6 to:
"start": "nodemon ./bin/www",
I tried this to set env var according to Windows.

And now started:

> npm start

> [email protected] start
> nodemon ./bin/www

[nodemon] 2.0.4
[nodemon] to restart at any time, enter `rs`
[nodemon] watching path(s): *.*
[nodemon] watching extensions: js,mjs,json
[nodemon] starting `node ./bin/www`
[nodemon] restarting due to changes...
[nodemon] starting `node ./bin/www

Then the routine probestream works fine again:

> curl --request POST --url http://10.0.0.11:8000/v1/rpc/probestream --header 'content-type: application/json' --data '{\"url\" : \"rtsp://10.0.0.11:8554/cam\"}'
{"streams":[{"index":0,"codec_name":"h264","codec_long_name":"H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10","profile":"High 4:2:2","codec_type":"video","codec_tag_string":"[0][0][0][0]","codec_tag":"0x0000","width":640,"height":480,"coded_width":640,"coded_height":480,"closed_captions":0,"has_b_frames":0,"sample_aspect_ratio":"N/A","display_aspect_ratio":"N/A","pix_fmt":"yuv422p","level":30,"color_range":"unknown","color_space":"unknown","color_transfer":"unknown","color_primaries":"unknown","chroma_location":"left","field_order":"progressive","refs":1,"is_avc":"false","nal_length_size":0,"id":"N/A","r_frame_rate":"30/1","avg_frame_rate":"30/1","time_base":"1/90000","start_pts":188189,"start_time":2.090989,"duration_ts":"N/A","duration":"N/A","bit_rate":"N/A","max_bit_rate":"N/A","bits_per_raw_sample":8,"nb_frames":"N/A","nb_read_frames":"N/A","nb_read_packets":"N/A","disposition":{"default":0,"dub":0,"original":0,"comment":0,"lyrics":0,"karaoke":0,"forced":0,"hearing_impaired":0,"visual_impaired":0,"clean_effects":0,"attached_pic":0,"timed_thumbnails":0}}],"format":{"filename":"rtsp://10.0.0.11:8554/cam","nb_streams":1,"nb_programs":0,"format_name":"rtsp","format_long_name":"RTSP input","start_time":2.090989,"duration":"N/A","size":"N/A","bit_rate":"N/A","probe_score":100,"tags":{"title":"Stream"}},"chapters":[]}

But the the discoverCameras didn't work yet...

> curl --request GET --url http://10.0.0.11:8000/v1/rpc/discoverCameras --header 'content-type: application/json'
{"status":"success","data":[]}

The local network is 10.0.0.0/24.
And I checked that port 8554 is open on the firewall.

@beyondszine
Copy link
Owner

Its great that are able to run it on windows as well. For the problem yet persists, Can you let me know if cameras are ONVIF enabled ?
because this strategy only searches for cameras which are ONVIF enabled. Onvif compatibility can also be cross checked via this

@fabriciorsf
Copy link
Contributor Author

Ohh, sorry!
I used only an RTSP server to stream my webcam only to test.
Then I will simulate an ONVIF server too.
I found this repo to help me with ONVIF: https://github.com/BreeeZe/rpos

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

No branches or pull requests

2 participants