Is there a way to create dynamic overlay text based on a text file or similar?

BrownChiLD

Young grasshopper
Joined
Jul 5, 2022
Messages
37
Reaction score
9
Location
Philippines
I'm a dev and I wanted to output text on the overlay display of the camera... to simplify as an example, i want the overlay text to show "FRONT DOOR SECURED" when it is locked, and FRONT DOOR UNSECURED when not.
I have the smart door lock and awareness all figured out, I just need a way to tell BI to display X Y Z on the overlay.

The several ways I can think of is if BI had an option to load text from a file, or a URL, on an interval or so. This way my software can simply change that text file or output the necessary text.

I don't know how BI is developed but it would be nice if it it currently fetches overlay text for each camera from a text file, then i can simply edit that, provided it's in plain text of course. But I dont know where BI stores that file.

Anyway just looking for ideas how I can implement this. Thank you
 

ThomasCamFan

Pulling my weight
Joined
Dec 14, 2020
Messages
145
Reaction score
234
Location
USA
Dahua, Amcrest, and some other IP branded cameras have an HTTP API that allows writing text overlays directly to the camera image.

Here is an example for Dahua / Amcrest cams (tested on a Amcrest IP5M-T1179EW):

Turn on the overlay feature for the camera at 192.168.1.240:
Code:
http://192.168.1.240/cgi-bin/configManager.cgi?action=setConfig&VideoWidget[0].CustomTitle[1].EncodeBlend=true
Write the text on the camera image:
Code:
http://192.168.1.240/cgi-bin/configManager.cgi?action=setConfig&VideoWidget[0].CustomTitle[1].Text=DOOR%20IS%20LOCKED
You can find the CustomTitle commands in the Amcrest HTTP Protocol API Specifications document, which can be found with assistance from Google. The commands are also used by Dahua.

- Thomas
 

TonyR

IPCT Contributor
Joined
Jul 15, 2014
Messages
16,916
Reaction score
39,355
Location
Alabama
Yes, Blue Iris can have several overlays for each camera, each determined by text assigned to a macro. It matters not what brand or model of camera is being used.

IMO, the easiest way is to use "BIT" or Blue Iris Tools, and if your program can write that value into a text file, then you can create a macro in BIT to display it.

More info here in Blue Iris Tool Help

BIT stores the text files that it assigns to the macros here =>> C:\Program Files (x86)\Blue Iris Tools\txt
 
Last edited:

Flintstone61

Known around here
Joined
Feb 4, 2020
Messages
6,665
Reaction score
11,042
Location
Minnesota USA
Interesting. So is the address 192.168.1.240 an example of a specific camera? or a global thing? or?
 

Mike A.

Known around here
Joined
May 6, 2017
Messages
3,840
Reaction score
6,415
Interesting. So is the address 192.168.1.240 an example of a specific camera? or a global thing? or?
Example. You'd use your cam's IP. 192.168.x.x is a private IP range used for internal networks (as are 172.16.x.x and 10.x.x.x).
 

BrownChiLD

Young grasshopper
Joined
Jul 5, 2022
Messages
37
Reaction score
9
Location
Philippines
Yes, Blue Iris can have several overlays for each camera, each determined by text assigned to a macro. It matters not what brand or model of camera is being used.

IMO, the easiest way is to use "BIT" or Blue Iris Tools, and if your program can write that value into a text file, then you can create a macro in BIT to display it.

More info here in Blue Iris Tool Help

BIT stores the text files that it assigns to the macros here =>> C:\Program Files (x86)\Blue Iris Tools\txt

Interesting. I actually installed BIT before but removed it since it was freezing up. I would try it again.
but for now, if I don't use BIT, can i still achieve this? can you please point me to the right direction? :) Where do I find that macro thing? in CAMERA PREFERENCES?
 

TonyR

IPCT Contributor
Joined
Jul 15, 2014
Messages
16,916
Reaction score
39,355
Location
Alabama
Interesting. I actually installed BIT before but removed it since it was freezing up. I would try it again.
but for now, if I don't use BIT, can i still achieve this? can you please point me to the right direction? :) Where do I find that macro thing? in CAMERA PREFERENCES?
Blue Iris can have several overlays for each camera, each determined by text assigned to a macro.

I have attached the Blue Iris "Help" file below for the version of 4/5/22.

In that Help you can read more about "Overlays" on page 59 and "Macros" on page 199.
 

Attachments

jaydeel

BIT Beta Team
Joined
Nov 9, 2016
Messages
1,152
Reaction score
1,257
Location
SF Bay Area
You can only edit 9 macros (1-9) using the Blue Iris app.

You can add macros up to 999 by directly editing the registry.
1657390311809.png

Alternatively you can add and dynamically edit macros using the following HTTP interface command. Be sure to use %20 for spaces.
Example:
/admin?macro=991&text=file:/C:\Blue%20Iris\My%20Overlays\windspeed.txt
 
Last edited:

TonyR

IPCT Contributor
Joined
Jul 15, 2014
Messages
16,916
Reaction score
39,355
Location
Alabama
So glad @jaydeel posted the above...I was looking for that and could not locate, but it fit in perfectly with my instructions below.

The several ways I can think of is if BI had an option to load text from a file, or a URL, on an interval or so. This way my software can simply change that text file or output the necessary text.
How about with an HTTP URL? Read on......
_

Blue Iris - Changing a camera’s overlay text via HTTP command

Section 1.
Creating the overlay for the macro’s text

Refer to Image 1.
Decide on a macro number to be displayed
Go to “camera Settings” => “Video” tab.
Check the box next to “Display overlays live”.
Click on the “Edit Overlays” button.

Refer to Image 2.
Click on “Add text/time” button.
Up at top, enter the desired macro number, 1-99, preceded by the percent (%) sign such as “%9”.
Toward the bottom in the preview area if that macro has not already been assigned elsewhere you’ll see the text “Macro9”, so it’s OK to proceed.
Click on the “OK” button then “OK” again to save the previous entries.

Refer to Image 3.
You should now see the text “Macro9” in the camera’s live view.

Section 3 will deal with fine tuning the text’s size, color, location, etc. which can be done later or at any time so let’s move on to the next section, Section 2, where we actually use the HTTP command to change the text.

Section 2. Sending the HTTP command to change the overlay’s text

Send an HTTP command to change the text displayed in the overlay from “Macro9” to your desired text; for now, let’s have it say “WARNING!” by using the URL format below:

http://BI-Server-IP:BI-Port/admin?macro=9&text=WARNING!&user=YourUsername&pw=YourPassword

NOTE: Under BI’s “Settings” => “Web server” tab => “Advanced”, insure you have “Use secure session keys and login page” UNchecked and then you must append a username and password to the end of the HTTP URL command as shown above.

Should you want to turn off the display of Macro9 (which is now “WARNING!”), simply issue an HTTP command with no text where “WARNING!” is, like this:

http://BI-Server-IP:BI-Port/admin?macro=9&text=&user=YourUsername&pw=YourPassword

Note that the URL above contains “text=” with no text after the “=” sign. This will cause the overlay for Macro 9 to be blank.

Section 3. Fine tuning the macro’s displayed text

Refer to Image 1 again.
You can go back later any time to change the macro overlay’s location on the screen and its appearance such as font, size, color and background. To do that, go to “Camera settings” => “Video” tab => “Edit overlays” button.

Refer to Image 4.
On the preview screen, click once on the “Macro9” text to highlight it, then click on the “Edit” button.

Refer to Image 5.
Now you can change the font, size, color, justification, etc. and background. Be sure to click on “OK” to save your changes.

Refer to Image 4 again.
Click on the “Macro9” text to highlight it and note that the cursor becomes a hand; you can now drag the text where you want to. Also note the boxes at the corners, sides, top and bottom when it’s highlighted; click on a box and, while holding down the left mouse button, drag a box and adjust the width and height of the text box. Be sure to click on “OK” to save your changes.

You can have several “live” macros being displayed as overlays on one or more camera live views, all with different colors, sizes, fonts, location on screen, etc. and control them via HTTP.

Experiment and enjoy!

Image1.jpg Image2.jpg Image3.jpg

Image4.jpg Image5.jpg Image6.jpg
 
Last edited:

TonyR

IPCT Contributor
Joined
Jul 15, 2014
Messages
16,916
Reaction score
39,355
Location
Alabama
Example:
/admin?macro=991&text=file:/C:\Blue%20Iris\My%20Overlays\windspeed.txt
Did the forum software remove 1 of the 2 forward slashes ( "/" ) before "C:\" ?
I will try 2 below inside CODE brackets so we'll know for sure:
Code:
/admin?macro=991&text=file:/C:\Blue%20Iris\My%20Overlays\windspeed.txt
EDIT: Yep, sure did. I knew it did it when trying to post RTSP URLs....we'll all have to watch out for that, @Mike is aware for some time but it's still an issue.
I tried your URL unsuccessfully several times until it dawned on me to put in a second " / ". ;)
 
Last edited:

DLONG2

Known around here
Joined
May 17, 2017
Messages
765
Reaction score
457
I'm trying to imagine a use for the cool macro overlays. The notifications I need all come to my mobile device already.
 

jaydeel

BIT Beta Team
Joined
Nov 9, 2016
Messages
1,152
Reaction score
1,257
Location
SF Bay Area
I'm trying to imagine a use for the cool macro overlays. The notifications I need all come to my mobile device already.
Besides weather conditions, here are three… all using macros pointed dynamically managed *.txt files.

1. Real-time status of sensors - the 1st image shows the battery and wifi connection status of two Shelly Wifi motion sensors used in the field of view (one in the mailbox, the other overlooking in the front yard).
1657728102892.png

I do something similar on an indoor camera to show the difference between two Shelly H&T sensors located on both floors in my home.

2. Real-time sun position… I’ve used this overlay to log sun position ranges where I need alter the camera settings to avoid ‘blinding’ sun glare (e.g., by dynamically changing the preset and/or exposure settings).
1657728232915.png

3. Home automation flags… this overlay verifies that a scheduled script has indeed automatically executed (in this case a script that pauses all outdoor cams, moves PTZ cams to alternate presets, etc.).
1657728414689.png
 
Top