Saturday, February 11, 2017

Record Google Nest Cam from Blue Iris

(Updated May 2018)

Since Nest is pushing their expensive ($10 to $30 per month) cloud recording feature, the Nest Cam is pretty locked down to prevent recording video locally to your own network. There are APIs you can use to scrape some information, but nothing to record video and audio to a local file share/FTP/NAS out of the box.

I use Blue Iris to record my other network cameras and found a hack to do the same on Nest.

There are some privacy concerns using this method, but the tradeoff is you can have both cloud and local storage of video events. Also, more flexibility of live video and video playback.

Requirements: An apache server with PHP installed. Also, obviously, a Nest cam and Blue Iris.

The first step is to allow sharing of the video. No one will be able to access this feed without the url, and if found, they cannot view archived video or manipulate settings.

Nest UUID

Open the Nest camera properties and select "Camera sharing".

Make sure the "Preferred video player" camera settings are set to Flash instead of HTML5.

Select "Share publicly" and click "Agree & Share"

You will get a URL like this:
https://video.nest.com/live/xxxxxxxxxx
Open that link in a new tab. View the page source and search for UUID. You will have a result like this:

https://nexusapi.dropcam.com/get_image?uuid=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&width=560
(obviously xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx is your uuid)

Apache script

On your Apache server, create a directory called "nest"
mkdir /var/www/html/nest && cd /var/www/html/nest
Create a php file called nest.php
vi nest.php
Add this code. (Don't forget to change xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx to your unique uuid)
<?php

{

file_put_contents('image.jpg',fopen("https://nexusapi.camera.home.nest.com/get_image?uuid=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&cachebuster=".rand(10,1000000)."&height=512", 'r'));

}

?>

Verify you can run it with PHP
php nest.php
If you get a file called "image.jpg" in "/var/www/html/nest/" and can browse to http://<yourserverip>/nest/image.jpg you should be ready to add it to blueiris.

Run a watch command to generate that file every 0.1 seconds (or 10 frames a second). Watch does not allow more than this speed.
watch -n 0.1 php nest.php
(There are many ways of doing this that are much better. It can be added to cron and many other things to improve reliability and performance. This is just a simple test and needs a lot of improvement.)


Blue Iris configuration

Once you have your url
http://<yourip>/nest/image.jpg

In Blue Iris, add a camera, go into the video tab and click configure.



Address
<your apache server ip>
Path
/nest/image.jpg
Click OK



Check "Anamorphic (force size)" then change "Image format" to 904 x 512

You can play with the sizes but I've noticed a performance hit when trying to run anything greater than 720p.

Rant...

Until Google updates the firmware to allow local file storage from the Nest camera, this is the only solid way I've found to import the feed and save it locally. I don't want to pay for their cloud service when I can just upload my own clips to dropbox or any other free file service.

Google's integration with Dropcam/Nest doesn't seem well implemented. You would think that Nest would allow you to save your video clips to Google Drive. A perk to paying for the premium Google Drive service should be that you can record your Nest clips there for free. Instead, you are essentially billed twice for storage.

I'd go so far as to say do not purchase this device if you want more options such as using Blue Iris. Amcrest/D-Link/Netgear and dozens of vendors all do the same and are ONVIF compliant... and I can link those to my Google Drive/Dropbox storage for cloud backups.

Nest is not ONVIF compliant and their app sucks. It's the same app as the (awesome) Nest thermostat... but there should be a separate, dedicated app for the Nest cameras. It's too cluttered and not intuitive.

For the same price of a Nest cam, you can get two wifi PTZ cameras with the same quality video (if not better) and many more features such as the ability to save to a MicroSD card.

If your internet goes out with the Nest, your camera stops recording.

1 comment:

  1. Thanks, hopefully we can delve deeper into this cam in order to record video and audio eventually.
    That, might require reverse-engineering though...

    ReplyDelete