MET-ECOM live snapshot
Joe Hebert
Junior Member
in AMX Hardware
Is there a way to grab a live snapshot from a MET-ECOM via code?
Thanks.
Thanks.
Comments
-
As a follow up: There currently isn’t an option to retrieve a live snapshot like there is with most cams/video servers and I submitted it as a feature request.
What I did get is a path to the stream and I figured out an acceptable workaround to extract one frame from it. Here’s how if anyone is interested:
This is the path to the stream:http://<Met-Ecom IP>/pages/stream_cam_wg.mjpeg?source=1
Open an IP connection to the Met-Ecom and in the ONLINE: handler send a GET for the stream.
In the STRING: handler -
Look for a valid header which is terminated by a CRLF CRLF and looks like this:HTTP/1.0 200 OK Date: Tue Feb 17 03:10:20 1981 Server: GoAhead-Webs Pragma: no-cache Cache-Control: no-cache Content-type: multipart/x-mixed-replace; boundary=--amxBoundraryV1ID
Look for the next CRLF CRLF which describes the first boundary and looks like this:--amxBoundraryV1ID1 Content-Type: image/jpeg Content-Length: 11007
From that you get the length of the first frame of the stream, 11007 in this case.
Let your buffer fill until it has enough bytes to complete the image.
Close the IP connection to the Met-Ecom.
In the OFFLINE: handler -
Lop off any extra data that will most likely get in the buffer before the faucet turns off.
Then you can save the .jpg to flash for future use like as an attachment in an email or text or for whatever.
It would be easier and faster to just ask for a snapshot and get everything done in the ONLINE: and OFFLINE: handlers without having to parse through the data as it comes in and then close the IP connection manually but the method described above gets the job done so life is good. -
Yup, it’s me again talking to myself. I know it’s been over 3 years but someone messaged me this week asking for sample code so I’m posting it here in case anyone else can use it. Code is at a minimum, just enough to get the job done.
Directions:
1) Compile and download to the master
2) Enable Diagnostics
3) Push button 1 to take a snapshot
After you push button 1:
1) The diagnostics window will show you the progress of the data retrieval.
2) When transmission is complete a live snapshot from the Met-Ecom will be stored on the master in the form of a jpg.
3) Also saved to flash will be the raw contents retrieved from the HTTP GET.
I wonder what's significant about - Tue Feb 17 01:45:00 1981. That’s the date and time that the web server of the Met-Ecom initializes to after a reboot. -
Hi Joe,
Thanx... I can try this next week on site.
Thanx for the example!
Regards,
Niels
Leave a Comment
Categories
- All Categories
- 2.5K AMX General Discussion
- 922 AMX Technical Discussion
- 514 AMX Hardware
- 502 AMX Control Products
- 3 AMX Video Distribution Products
- 9 AMX Networked AV (SVSI) Products
- AMX Workspace & Collaboration Products
- 3.4K AMX Software
- 151 AMX Resource Management Suite Software
- 386 AMX Design Tools
- 2.4K NetLinx Studio
- 135 Duet/Cafe Duet
- 248 NetLinx Modules & Duet Modules
- 57 AMX RPM Forum
- 228 MODPEDIA - The Public Repository of Modules for Everyone
- 943 AMX Specialty Forums
- 2.6K AMXForums Archive
- 2.6K AMXForums Archive Threads
- 1.5K AMX Hardware
- 432 AMX Applications and Solutions
- 249 Residential Forum
- 182 Tips and Tricks
- 146 AMX Website/Forums