+42
Discuss

Still Image Media Tile from Arlo Camera?

Ken Washington 2 years ago in Media Tiles / Video Camera Feeds updated by Terry (ActionTiles) (Co-Founder) 2 weeks ago 22

Is there any way known to extract a still image to use in a media tile from Arlo? For my DLink cameras I FTP them to my online web space which works great, but I can't find any similar function in the Arlo app.

Answer

I believe it's not available with first-generation Arlo and Arlo Pro. I don't know about the Q model though.

+1

Found that someone put together what seems to be a Python wrapper around the Arlo cameras.  It's not a supported API, but if enough people use it maybe Arlo opens it up?


https://github.com/jeffreydwalter/arlo

Good find, David.


Unfortunately, if a hack like this spreads, the vendor is actually more likely to update the firmware and lock it down, rather than open up. ☹ 

+1

Lu think Terry is right... so let’s just keep this among us enlightened developers shall we?


I look forward to trying it out. Good find. 

+1

There's also this one here, which I'm having good luck with:

https://github.com/tchellomello/python-arlo


Any details on your success or lack of success, Allrak?

+1

Hey guys - I have this working using a simple python script and the notes library. Works amazingly well. Will post it later when I get home. 

That will be super, Ken! Thanks!


...Terry.

+1

This just grabs the latest video file from any of my cameras and saves it as a .mp4 file. Similar calls can be used to save static images. The library is very well written. Kudos to the author.


Here is the python script that I wrote that uses the Arlo library noted.


getarlo-sample.py

Thanks for the excellent share, Ken!


I don't have an Arlo but looking forward to the feedback and might get Arlo to experiment too.


We would like to assist our Customers with "the most popular feasible cameras", but that list changes frequently - Blink, for example, became infeasible after Amazon's acquisition.

hi ken, are you doing something with the latest video in Action Tiles?

+1

The House Panel self-hosted dashboard App, has a tile type capable of embedding the MP4 files scraped from Arlo.  https://community.smartthings.com/t/release-housepanel-dashboard-for-smartthings-and-hubitat/108342/1704?u=tgauchat

ActionTiles currently does not have a similar Tile Type due to the low demand; i.e., most folks are not going to set up a server running the "getarlo.py" Python script to serve the latest MP4 clip. But we'll keep this concept in mind.

Thank you, Terry. 


makes sense now as to why i couldn't find an option for it in the media tile. i actually just bought your service yesterday. i'd be very interested in mp4 support. thank you for the detailed information.

+2

With the popular and low cost to host the app on Azure and AWS, it is more likely to have this integration in place.


I have hosted an AWS lamda to pull static image from Arlo via the python library and upload it to S3 bucket, using CloudWatch to trigger the function every 15 mins.

I then put the media tile url with the S3 jpeg url and works gracefully.

So this solution does apply to mp4 as well, in fact I got the script to make a time lapse mp4 for all the snapshot being taken during the day and I can host them on S3. If the tile supports that then it will be a nice view to have on the panel.


would you mind sharing your steps for this setup to pull a static image from each of my Arlo cameras?


if you want to skip the AWS part and just focus on the python, i'll just run it on a windows VM at home for now.

I would love to know this as well. I have a server running in my home and would like to pull this into a folder with a web server serving up the images to AT.

+1

Would love a tutorial on how to do this :-)

hi ken, are you doing something with the latest video in Action Tiles?

I would find this as a very high valued functionality and would be will to pay for it as an add on service if needed. 

Here is the quick overview on setting up the static images from Arlo into media tiles.

The original implementation is coming from https://github.com/Notalifeform/arlo-timelapse-lambda


I made an minor enhancement on the code so it can pull and handle images from multiple cameras that connected to the same base.


# Get the list of devices and filter on device type to only get the camera.
# This will return an array which includes all of the camera's associated metadata.
cameras = arlo.GetDevices('camera')
for index in range(len(cameras)):
            print('Looking up sequence number')
            sequence = 0
            try:
                s3.Bucket(S3_BUCKET_NAME).download_file('{}/sequence.txt'.format(cameras[index]['deviceName']), '/tmp/sequence.txt')
                with open('/tmp/sequence.txt', 'r') as myfile:
                    data=myfile.read().replace('\n', '')
                    sequence = int(data)
            except botocore.exceptions.ClientError as e:
                if e.response['Error']['Code'] == "404":
                    print("Sequence file does not exist")
                else:
                    raise
            sequence = sequence + 1 
            print('requesting snapshot from {}'.format(cameras[index]['deviceName']))
            if cameras[index]['state'] == 'provisioned':
                # Tells the Arlo basestation to trigger a snapshot on the given camera.
                # This snapshot is not instantaneous, so this method waits for the response and returns the url
                # for the snapshot, which is stored on the Amazon AWS servers.
                snapshot_url = arlo.TriggerFullFrameSnapshot(basestations[0], cameras[index])

                # This method requests the snapshot for the given url and writes the image data to the location specified.
                # In this case, to the current directory as a file named "snapshot.jpg"
                # Note: Snapshots are in .jpg format.
                tag = datetime.now().strftime('%Y-%m-%d_%H-%M-%S')
                filename = 'snapshot_{}_{}.jpg'.format(tag, "{:09d}".format(sequence))

                while  snapshot_url == None:
                    print("RETRY...")
                    def callback(basestation, event):
                        print("Re-grab event: {}".format(event))
                        if event.get("from") == basestation.get("deviceId") and event.get("resource") == "cameras/"+camera.get("deviceId") and event.get("action") == "fullFrameSnapshotAvailable":
                            return event.get("properties", {}).get("presignedFullFrameSnapshotUrl")
                        return None
                    snapshot_url = self.HandleEvents(basestation, callback)

                print('retrieving and storing {}'.format(filename))
                arlo.DownloadSnapshot(snapshot_url, '/tmp/' + filename)
                data = open('/tmp/' + filename, 'rb')
                data.seek(0)
                print('upload to S3 - {}/{}'.format(cameras[index]['deviceName'],filename))
                s3.Bucket(S3_BUCKET_NAME).put_object(Key='{}/{}'.format(cameras[index]['deviceName'],filename), Body=data, ContentType='image/jpeg')
                
                print('upload to S3 - {}/latest.jpg'.format(cameras[index]['deviceName']))
                data.seek(0)
                s3.Bucket(S3_BUCKET_NAME).put_object(Key='{}/latest.jpg'.format(cameras[index]['deviceName']), Body=data, ContentType='image/jpeg')


                # store the sequence
                fh = open("/tmp/sequence.txt","w")
                fh.write(str(sequence))
                fh.close()

                data = open('/tmp/sequence.txt', 'rb')
                s3.Bucket(S3_BUCKET_NAME).put_object(Key='{}/sequence.txt'.format(cameras[index]['deviceName']), Body=data)
            else:
                print('{} is in {} state, moving on...'.format(cameras[index]['deviceName'], cameras[index]['state']))

        arlo.Logout()
        print('Script complete at {}'.format(str(datetime.now())))

The image from each camera will be uploaded to S3 bucket as 2 files 

- Latest.jpg (used for medial URL) in the media tiles

- timestamped jpg which is used to create the time-lapsed mp4 for the day (using ffmpeg in the tutorial)


I am doing some research on embedding the ffmpeg as part of Lamda function to avoid the separate linux server to do the time-lapse video, and convert the time-lapsed mp4 into mpeg to be supported by the media tiles. Progress is sloooow.... with my limited free time remaining after all the works/family and kids commitment though. Will keep all posted.