Interacting with an IP Camera
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- Posts: 641
- Joined: Tue Jul 29, 2014 12:52 am
- Location: Brazil
Interacting with an IP Camera
Greetings, I wonder if someone has experience (and ideally a stack to share) interacting with one of those popular Interact / IP Cameras.
There are several, relatively cheap, so called IP Cameras (example https://www.vstarcam.com/support/) that are controlled by a propiatary APP and/or are able to upload the image stream to the cloud. In my case what I'd like to do is to control one of such cameras from a LC App and instead of getting the full image stream I'd like to grab an image snapshot as a response of a command issued by the LC APP.
Many of those cameras support a protocol called ONVIF and last year there was a post (with no answer) about it ...viewtopic.php?f=7&t=33030&p=182518&hilit=onvif#p182518
Any ideas/suggestions?
As always many thanks in advance...
There are several, relatively cheap, so called IP Cameras (example https://www.vstarcam.com/support/) that are controlled by a propiatary APP and/or are able to upload the image stream to the cloud. In my case what I'd like to do is to control one of such cameras from a LC App and instead of getting the full image stream I'd like to grab an image snapshot as a response of a command issued by the LC APP.
Many of those cameras support a protocol called ONVIF and last year there was a post (with no answer) about it ...viewtopic.php?f=7&t=33030&p=182518&hilit=onvif#p182518
Any ideas/suggestions?
As always many thanks in advance...
Simon
________________________________________
To ";" or not to ";" that is the question
________________________________________
To ";" or not to ";" that is the question
-
- VIP Livecode Opensource Backer
- Posts: 9852
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: Interacting with an IP Camera
What sort of control over the device are you looking for?
Are you looking to manage the device remotely (on/off, tilt, zoom, etc.), or to capture the stream?
I would imagine the control protocols would be accomplishable with reasonable effort, depending on how they handle security.
Capturing the stream is probably not something you want to take on, and certainly not in a scripting language. Stream codecs are complex, and often patent-encumbered with steep licensing fees. If you're after stream capture it may be best to consider LC in a supporting role integrating with an app dedicated to that purpose.
Are you looking to manage the device remotely (on/off, tilt, zoom, etc.), or to capture the stream?
I would imagine the control protocols would be accomplishable with reasonable effort, depending on how they handle security.
Capturing the stream is probably not something you want to take on, and certainly not in a scripting language. Stream codecs are complex, and often patent-encumbered with steep licensing fees. If you're after stream capture it may be best to consider LC in a supporting role integrating with an app dedicated to that purpose.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
-
- VIP Livecode Opensource Backer
- Posts: 190
- Joined: Sat Apr 08, 2006 7:55 am
- Location: Lübbecke, Germany
- Contact:
Re: Interacting with an IP Camera
Simon,
without more information about how to communicate with the camera it is very difficult.
I am pretty sure you've already had a look at the examples at https://www.onvif.org/resources/.
I've used there the link to the VBS ONVIF Scripting tools at https://github.com/mrrekcuf/ONVIF-scripting-tools
and had a quick look at some of the scripts. It looks like it should be possible to do this with LC, but it seems to be hard work. A documented api would be much better.
But what i could see so far in the .vbs is that the request has to be done as POST and before posting your request to the camera you have to set the requestHeaders first. I would try to "convert" one of the smaller .vbs scripts for testing if i were you. For example the onvifQuery.vbs
without more information about how to communicate with the camera it is very difficult.
I am pretty sure you've already had a look at the examples at https://www.onvif.org/resources/.
I've used there the link to the VBS ONVIF Scripting tools at https://github.com/mrrekcuf/ONVIF-scripting-tools
and had a quick look at some of the scripts. It looks like it should be possible to do this with LC, but it seems to be hard work. A documented api would be much better.
But what i could see so far in the .vbs is that the request has to be done as POST and before posting your request to the camera you have to set the requestHeaders first. I would try to "convert" one of the smaller .vbs scripts for testing if i were you. For example the onvifQuery.vbs
-
- Posts: 641
- Joined: Tue Jul 29, 2014 12:52 am
- Location: Brazil
Re: Interacting with an IP Camera
Hi team, many thanks for the replies.
@FourthWorld, as you expected I don't want to capture the whole stream, I just want to remotely be able to capture a snapshot of the image.
@matthiasr, your suggested approach makes sense to me but as you said it will be a hard work and I'm not sure is worth but I will probably will give it a try...
I'm considereing a much simpler approach, let me know what you think about (I don't have a camera available at the moment to run a quick and dirty test)...
Since the stream of these cameras can be reached through a standard URL I'm thinking about using LC's Browser Widget and then capture (and manipulate) the Browser output. Any downsides on such approach?
Best
@FourthWorld, as you expected I don't want to capture the whole stream, I just want to remotely be able to capture a snapshot of the image.
@matthiasr, your suggested approach makes sense to me but as you said it will be a hard work and I'm not sure is worth but I will probably will give it a try...
I'm considereing a much simpler approach, let me know what you think about (I don't have a camera available at the moment to run a quick and dirty test)...
Since the stream of these cameras can be reached through a standard URL I'm thinking about using LC's Browser Widget and then capture (and manipulate) the Browser output. Any downsides on such approach?
Best
Simon
________________________________________
To ";" or not to ";" that is the question
________________________________________
To ";" or not to ";" that is the question
-
- VIP Livecode Opensource Backer
- Posts: 190
- Joined: Sat Apr 08, 2006 7:55 am
- Location: Lübbecke, Germany
- Contact:
Re: Interacting with an IP Camera
If LC is able to capture the content of the browser widget (i am currently not sure if that is working), then this would really be the easiest and fastest way to get it working.Since the stream of these cameras can be reached through a standard URL I'm thinking about using LC's Browser Widget and then capture (and manipulate) the Browser output. Any downsides on such approach?
Give it a try and let us know.
All the best.
Matthias
-
- Posts: 641
- Joined: Tue Jul 29, 2014 12:52 am
- Location: Brazil
Re: Interacting with an IP Camera
Matthias as you suspected it doesn't work
I created a group with a button and the browser
and then took a snapshot of the group
The file is created but is just a black screen with the button
Any better ideas?
I created a group with a button and the browser
and then took a snapshot of the group
Code: Select all
export snapshot from group "Grupo" to file "screen.jpg" as JPEG
Any better ideas?
Simon
________________________________________
To ";" or not to ";" that is the question
________________________________________
To ";" or not to ";" that is the question
-
- VIP Livecode Opensource Backer
- Posts: 190
- Joined: Sat Apr 08, 2006 7:55 am
- Location: Lübbecke, Germany
- Contact:
Re: Interacting with an IP Camera
I am not sure if this is working, but you could call the macOS command line tool screencapture to capture the the stack/card.
Here's a little overview.
https://osxdaily.com/2011/08/11/take-sc ... -mac-os-x/
There are much more flags available. You can define the screenarea for example or the windowid and so on.
Regards,
Matthias
Here's a little overview.
https://osxdaily.com/2011/08/11/take-sc ... -mac-os-x/
There are much more flags available. You can define the screenarea for example or the windowid and so on.
Regards,
Matthias
-
- VIP Livecode Opensource Backer
- Posts: 190
- Joined: Sat Apr 08, 2006 7:55 am
- Location: Lübbecke, Germany
- Contact:
Re: Interacting with an IP Camera
In an other forum thread someone wrote that export snapshot from rect would work for him. Post #2 at viewtopic.php?t=28384
I just tried it and it definitely works.
So you can do it with LC without external tool.
Regards,
Matthias
I just tried it and it definitely works.
Code: Select all
export snapshot from rect (the rect of widget "browser") to file "~/desktop/File1.png" as PNG
So you can do it with LC without external tool.
Regards,
Matthias
-
- Posts: 641
- Joined: Tue Jul 29, 2014 12:52 am
- Location: Brazil
Re: Interacting with an IP Camera
Indeed it works, great! Many thanks.
Regards
Regards
Simon
________________________________________
To ";" or not to ";" that is the question
________________________________________
To ";" or not to ";" that is the question