Thursday, June 28, 2018

Fix malformed SQLite DB in Tautuli (PlexPy) server in Windows

For those running Tautuli to monitor their Plex servers, sometimes DB issues happen. After upgrading from PlexPy to Tautuli I never had a solid footing on strange issues until I found a DB error and fixed it.

I kept seeing the following error in the logs:

Can't connect to the database: database disk image is malformed

To fix this, it's pretty simple. First you will need DB Browser for SQLite. The portable app works just fine if you don't want to install anything.

(if you need a more graphical guide, look at where I got most this info from)

Copy the tautuli.db file out of your plexpy/tautuli directory to work on.

In DB Browser for SQLite, click Open Database.

Execute SQL (tab)

Run the following: PRAGMA integrity_check

Then click the Play button.

You will see errors if there are DB issues (if the integrity check passes, it's not DB related).

Export the DB to SQL format and leave all the default options checked.

Once the database export is complete, import the database. This will essentially "clean" it. It will take some time to import

Import the database and select a new file name/location to store it. Replace this database with your main Tautuli database and relaunch the app.

Saturday, May 19, 2018

Installing OpenIPC on WyzeCam v2 and adding to BlueIris

Wyze Cam is a fully functional $20 security camera. Out of the box, it works great.

The only problem is that there, currently, isn't a website you can go to to manage the camera or view footage. It's only available via a smartphone app.

While the app works great pushing files to the cloud and local storage, the camera doesn't utilize open standards like RTSP, so it's not compatible with Blue Iris.

That's where OpenIPC steps in. This is very new firmware so expect these steps to change quite a bit. I'll try to keep it updated. There is a subreddit dedicated to OpenIPC as well.

This firmware will not erase or modify the built-in firmware, so no worries about bricking your device. If you remove the sd card and reboot the device, it will go back to the standard config.

While this can be annoying to some, the firmware is only in Alpha with non-open source code. There could be serious security risks, so this should only be used for testing and not production!

To install

Download Win32DiskImager

Try to use a 4GB or smaller MicroSD card for the install, if possible.

Download the latest IMG release file from here. (For instance openipc_v2-0.2.5.img or whichever release is newer). This will only work with the WyzeCamV2 not the V1

Open Win32DiskImager and select the IMG file and the target MicroSD drive.

To set the Wifi password, edit the file <drive letter>:\config\wpa_supplicant.conf and change

to whatever your network name is. Also, change the password field.

Save the file and remove the card. Unplug the Wyze Camera and insert the MicroSD card.

To write the firmware, press and hold the bottom setup button while plugging the camera back in.

In about 6 seconds, when the light turns blue, release the button. Wait a few minutes to see it on your network.

You can scan your network with a smartphone app like Fing or a Windows app like Angry IP Scanner to locate the camera. It will register ports:

21 ftp
22 ssh
23 telnet
80 http

If you browse to the ip from a browser, the login prompt will ask for a password. The default being:

Blue Iris Setup

Adding the Wyze cam to Blue Iris is pretty straightforward. When you go to the config page it will provide you with the RTSP url. Just import this and that's it.

Just, bear in mind... this should not be used for anything other than testing. You cannot change the password (easily) and even then, the firmware changes are not permanent. 

An ideal solution would be to wait for the firmware to have a release candidate that allows you to add extra storage space that is instead being used for the OS.

Wednesday, June 14, 2017

Best IP POE camera compatible with Blue Iris

I recently purchased, and ultimately returned, a LaView 4 1080P NVR/POE IP Cam combo from Amazon for $600 (It's listed cheaper now).

They claimed to be ONVIF compliant, but for the life of me I was not able to set up Blue Iris to connect to the cameras. I noticed that the IPs in the NVR chose a subnet at random and I could not connect to the individual cameras directly without passing through the NVR.

When I gave the individual cameras a manual IP it was unreachable. If I bypassed the NVR and went straight to the network with POE, it wouldn't get a DHCP IP.

My old setup was a Night Owl (forget the model number). Since it was the old analog BNC type camera setup, I had no choice but to go through the DVR. Although, I could connect through the streams RTSP directly by addressing the CAMNO (1-4). This was a breeze to add to Blue Iris.

The LaView was a hassle. I thought, with the price, it would beat cheaper NVR alternatives but I found the UI to be clunky, slow and unintuitive.

I have indoor Amcrest wifi cameras and saw they now sell POE outdoor cameras. I've never had an issue with my Amcrest so I decided to get rid of the NVR model and feed from the source.

While I have a POE switch, it does not provide the adequate wattage to power all my cameras so I purchased a standalone 8 port POE injector for $40.

I purchased 2 of each of the Amcrest outdoor POE styles Amcrest IP2M-844E and Amcrest IP2M-842E.

Which match or exceed the specs of the LaView option. They cost $75 each (both models).

The total for the Amcrest setup was $340... almost half the price of the LaView and very easy to set up in Blue Iris.

I also have another 4 ports on my POE injector to add more cameras if I choose.

Long story short, skip the NVR, go directly to your own recording device. If you don't want to pay the proprietary software license for Blue Iris and/or Windows; there are alternatives.

You could set up a Linux box and use Motion by Foswiki to create your own NVR with a lot of flexibility.

Blue Iris costs money, but it does a lot. It's also a GUI app, which I like when dealing with videos due to the instant gratification of knowing if it's working.

Motion works great, but you can get bogged down in options and the Linux+CLI nature is off-putting to most.

One of the downsides to most DVRs, NVRs and standalone IP Cameras has to be the requirement for IE with an addon. I usually just spin up a test VM with Windows and install/config it there... then deleting the VM. I noticed with the LaView this did not work. I could modify the settings, but could not view the live stream. It did not like the virtual VGA adaptor.

The Amcrest worked, but still required IE to set up. At least I was able to verify I had a stream before I added it to Blue Iris. I hope one day IP Cameras just work in Chrome over HTML5 without any plugins or software required.

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.


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:
Open that link in a new tab. View the page source and search for UUID. You will have a result like this:
(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)


file_put_contents('image.jpg',fopen("".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

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

<your apache server ip>
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.


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.