Home AMX User Forum AMXForums Archive Threads AMX Hardware

MET-ECOM live snapshot

Is there a way to grab a live snapshot from a MET-ECOM via code?



  • Options
    Joe HebertJoe Hebert Posts: 2,159
    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:
    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.
  • Options
    Joe HebertJoe Hebert Posts: 2,159
    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.

    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.
  • Options
    nielsynielsy Posts: 32
    Hi Joe,

    Thanx... I can try this next week on site.
    Thanx for the example!

Sign In or Register to comment.