Create GIFs from alerts & clips; Send Pushover notifications with GIF attachments [Part 1/3]

It may be a bug... checking now.

EDIT: Confirmed bug. I mistyped the -Priority parameter as [string] instead of [int]. PS7 was forgiving, but PS5 was not.
When Powershell is executed in the background (e.g., from a Blue Iris Run-a-program action), scripts are executed using PS5.
When I test scripts from the Console, I'm usually using PS7. I forgot to test also in Powershell-ISE, which uses PS5.

Makes perfect sense. I should have caught that myself; I appreciate your help!!

New update works a treat. Awesome work!

If time permits, my plan is to write an add-on script or maybe fork yours to work with Home Assistant. My hope is to eventually have more granular control over notifications tied into home automation (i.e. quiet hours, notification debouncer, priority handling when alarm is set, etc)
 
  • Like
Reactions: jaydeel
New in Blue Iris version 5.7.9.0 (link),
Ken has added a new feature to the Clips list that makes it much easier to get any clip's or alert's database record ID,
Just right-click while holding down the Ctrl key over an alert in the Clips list
. This copies the item's database record to the clipboard.

An example of how this might be might be handy if you ever want to create/send an on-demand GIF file using the script in post #1.
  1. Ctrl-Right click on the Alert of interest in the Blue Iris Clips list (hit the Esc key to close the context menu).
  2. Type the following command in the Powershell.exe or Powershell-ISE console BI_gif_tool.ps1 -AlertRec ""
  3. Use the back arrow to move the cursor between the quotes
  4. Type Ctrl-V to paste the db record id into the command ... yielding something like BI_gif_tool.ps1 -AlertRec "@173695285"
  5. Hit the enter key to execute the script.
This new feature is an improvement over the previous recommendation:
  1. Open UI3,
  2. Locate the Alert of interest, then play it,
  3. Grab the alert's database record id from the browser's address bar, and
  4. Paste the database record id in the following command BI_gif_tool.ps1 -UI3Rec xxxxxx.
 
Script updated to V1.9. see post #1.

Changelog:
  1. FIXED BUG: SendPushover() call lacked grave accent (`) after -Camera param line; caused malformed value
  2. FIXED BUG: all DAT-extracted JPG files lacked JPEG Interchange Format end-of-image byte marker ('FF D9')
  3. IMPROVED: JPG validation function 'IsJpegFileValid()' - now also tests for valid end-of-image byte marker
  4. ADDED: a repair is now attempted for situations where the JPG start- & end-of-image byte markers appear to be unbalanced
  5. CHANGED: The -Help argument (usage guide) no longer displayed by default
  6. DISABLED: argument -NukeDatFile has been disabled until Blue Iris provides a safe method to delete DAT files
 
Last edited:
first of all, Thank You! amazing work.

in order to make it work with jpeg from bvr, I needed to add the ip of the machine running the script to the setting -> web server -> advanced
with ^ prefix so no password is required (at least on my computer it didn't work until added)
example:
^192.168.1.50
1697809183535.png


But my issue is with DAT extract, my export location for bvr & alerts is with some sub folders to make it easier for windows to browse...
the extract works but the create gif command is searching in another folder (without the sub folders) for the jpgs...

my Video "special" path is : (D:\Blueiris\New) + %Y-%m-%d\&CAM\&CAM.%Y%m%d_%H%M%S (example: "D:\BlueIris\New\2023-10-20\Front\Front.20231020_160000.bvr")
my Alerts "special" path is : (D:\Blueiris\Alert) + %Y-%m-%d\&CAM\&CAM.%Y%m%d_%H%M%S (example: "D:\BlueIris\Alerts\2023-10-20\Front\Front.20231020_142356.289015.3-1.dat")
1697807517491.png


Regards.
 
Last edited:
  • Like
Reactions: EvanVanVan
first of all, Thank You! amazing work.

in order to make it work with jpeg from bvr, I needed to add the ip of the machine running the script to the setting -> web server -> advanced
with ^ prefix so no password is required (at least on my computer it didn't work until added)
example:
^192.168.1.50
View attachment 175519

But my issue is with DAT extract, my export location for bvr & alerts is with some sub folders to make it easier for windows to browse...
the extract works but the create gif command is searching in another folder (without the sub folders) for the jpgs...

my Video "special" path is : (D:\Blueiris\New) + %Y-%m-%d\&CAM\&CAM.%Y%m%d_%H%M%S (example: "D:\BlueIris\New\2023-10-20\Front\Front.20231020_160000.bvr")
my Alerts "special" path is : (D:\Blueiris\Alert) + %Y-%m-%d\&CAM\&CAM.%Y%m%d_%H%M%S (example: "D:\BlueIris\Alerts\2023-10-20\Front\Front.20231020_142356.289015.3-1.dat")
View attachment 175514

Regards.
Thanks.
I’ve had another similar request for my bi_clip_usage script.
I think I have a solution. It will be a few days. Stay tuned.
 
  • Love
Reactions: LazySecurity247
After using this for months with no problems (thanks again @jaydeel !) I've run into a weird edge case problem.
For various reasons, I had to reconfigure my blueiris server to use a network share for clip storage.

After moving to network share for storage, I noticed GIF files were no longer animated. The script was only able to generate still images. After investigating, it seems that the script run from BlueIris seems to have some sort of problem accessing dat files. To test, I ran the following command manually from powershell, and it worked perfectly. However, when I run the same command from BI, the script switches over to bvr file source.

Has anyone run into a similar problem? If so, any insights on possible solutions?

Thanks!

Command
Code:
"C:\BlueIris\custom-scripts\BI_gif_tool.ps1" -UI3Rec 997990779

BI_gif_tool.ps1.csv results
Code:
"Timestamp","SourceFile","GifMethod","GifImagesCnt","GifHeight","GifFPS","GifTrimBegPct","GifTrimEndPct","GifTrimCustPct","GifDurSec","GifSizeKb","GifMakeMs","GifJpgWxH","AlertRecId"
powershell results (GIF working): "2024/02/27_16:56:43","PorchDB-DS.20240227_150207.380056.3-1.dat","viaDat","5","320","2","0","40","40","5.1","220","2875.2","640x480",""
run in BI results (GIF not working): "2024/02/27_16:54:36","D:\BlueIris\New\PorchDB-DS.20240227_150207.bvr","viaClip","10","320","2","0","40","40","5.1","48","4225.1","x",""
 
Last edited:
  • Like
Reactions: jaydeel
After using this for months with no problems (thanks again @jaydeel !) I've run into a weird edge case problem.
For various reasons, I had to reconfigure my blueiris server to use a network share for clip storage.

After moving to network share for storage, I noticed GIF files were no longer animated. The script was only able to generate still images. After investigating, it seems that the script run from BlueIris seems to have some sort of problem accessing dat files. To test, I ran the following command manually from powershell, and it worked perfectly. However, when I run the same command from BI, the script switches over to bvr file source.

Has anyone run into a similar problem? If so, any insights on possible solutions?

Thanks!

Command
Code:
"C:\BlueIris\custom-scripts\BI_gif_tool.ps1" -UI3Rec 997990779

BI_gif_tool.ps1.csv results
Code:
"Timestamp","SourceFile","GifMethod","GifImagesCnt","GifHeight","GifFPS","GifTrimBegPct","GifTrimEndPct","GifTrimCustPct","GifDurSec","GifSizeKb","GifMakeMs","GifJpgWxH","AlertRecId"
powershell results (GIF working): "2024/02/27_16:56:43","PorchDB-DS.20240227_150207.380056.3-1.dat","viaDat","5","320","2","0","40","40","5.1","220","2875.2","640x480",""
run in BI results (GIF not working): "2024/02/27_16:54:36","D:\BlueIris\New\PorchDB-DS.20240227_150207.bvr","viaClip","10","320","2","0","40","40","5.1","48","4225.1","x",""
Please confirm that the user_settings file setting $bi_alert_folder_path has been updated to reflect the new location for the Alerts folder (if indeed it has changed).

The script will attempt to extract 10 images from the BVR file if the DAT file cannot be found. These images will span the duration of the alert.
 
Last edited:
Appreciate your reply jaydeel. Yes, confirmed that the pathing is correct for $bi_alert_folder_path.

EDIT: Actually, now that you mention it, I tried using the UNC path (/server/bi/alerts) instead of the locally mapped path (D:/bi/alerts) and it seems to be working. Thanks!!!
 
Last edited:
  • Like
Reactions: jaydeel
Appreciate your reply jaydeel. Yes, confirmed that the pathing is correct for $bi_alert_folder_path.

EDIT: Actually, now that you mention it, I tried using the UNC path (/server/bi/alerts) instead of the locally mapped path (D:/bi/alerts) and it seems to be working. Thanks!!!
Good catch. This is mentioned in the Help PDF in the 'Testing the Action Set' section of the 'Alerts and Actions' chapter.

Screenshot_20240228_050608_Dropbox.jpg
 
  • Like
Reactions: silencery
Script updated to V2. see post #1 to download the file

Key features of this new version are:
  • An improved usage guide (-Help argument, see screenshot #1).
  • Added argument -Latest to make GIF from a camera's most recent alert.
  • Eliminated the delay when using the -Live argument
  • Improved support for BVR-derived GIFs (for users that don't wish to create DAT files)
    • script now supports multiple Blue Iris 'New' folders
    • script now supports the use of non-default folder naming patterns in Camera settings > Record > Video (ADDED: 3/21/2024)
    • argument -TrimBegPct may be negative to include pre-trigger images in the GIF
  • Improved support for DAT-derived GIFs
    • added argument -DatImageMsec to improve GIF duration estimates
    • arguments -TrimBegPct & -TrimEndPct now ALSO work for these GIFs (by skipping the the extraction of an appropriate number of JPGs from the DAT file)
  • Added 2 columns ('PushoverMs' & 'TotalMs
    IHRvIG5vdCBicmVhayBvdGhlciB1dGlsaXRpZXMgdGhhdCBleHRyYWN0L3VzZSB0aGlzIHNjcmlwdCdzDQoJIyBwZXJmb3JtYW5jZSBkYXRhIGZyb20g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gew0KCVdyaXRlLUhvc3QgIiINCn0NCg0KI1N0b3AtVHJhbnNjcmlwdA==
    ') to the script's performance log (see screenshot #2)

Screenshot #1 - shows improved usage guide

V2_usage_guide.png

Screenshot #2 - shows the new columns in the the script's performance csv file

V2_perf_csv_log.png
 
Last edited:
V2 usage examples...

Make and send a 'Live' GIF from a camera

bi_gif_tool.ps1 -Camera "DW1" -Live -Seconds 5
Note: the default duration without the -Seconds argument is 10 seconds

Make and send a GIF from a DAT file (if it exists), or a BVR file (if the DAT file does not exist)
bi_gif_tool.ps1 -Camera "DW1" -Latest

Force a GIF to be derived from the BVR clip
bi_gif_tool.ps1 -Camera "DW1" -Latest -IgnoreDatFile

Add pre-trigger images to a BVR-derived GIF
bi_gif_tool.ps1 -Camera "DW1" -Latest -IgnoreDatFile -TrimBegPct -50
How this works... the script extracts images from the BVR file before the alert's offset. the number of images is calculated as a percentage of the duration of the GIF (10 seconds, by default).

Add pre-trigger images to a DAT-derived GIF
Edit the camera's settings... Camera settings > Alerts > AI configuration > '+ pre-tre-trigger images'
V2_dat_pretrigger_images.png

Trim 2 images from both ends of a DAT-derived GIF, where the DAT file contains 10 images
bi_gif_tool.ps1 -Camera "DW1" -Latest -TrimBegPct 20 -TrimEndPct 20
The resulting GIF should contain 6 images
 
Last edited:
  • Like
Reactions: jrbeddow
V2 Blue Iris Alert Action Set examples

This is the 'Run a program' Action 'Parameters' string that I'm currently using for most of my cameras...
Code:
"C:\ps_scripts\BI_gif_tool.ps1" -Camera '&CAM' -Latest -Msg """<b>&CAM</b> &MEMO <a href='&WAN/alerts/&ALERT_DB?fulljpeg'>Hi-Res</a> <a href='&WAN/ui3.htm?rec=&ALERT_DB'>UI3</a>""" -Priority 2 -FPS 2 -Height 320
1710864845622.png


This is the 'Run a program' Action 'Parameters' string that I'm currently using for my driveway cameras... It adds the -AlertMemo argument for custom trimming based on AI labels.
Code:
"C:\ps_scripts\BI_gif_tool.ps1" -Camera '&CAM' -Latest -AlertMemo '&MEMO' -Msg """<b>&CAM</b> &MEMO <a href='&WAN/alerts/&ALERT_DB?fulljpeg'>Hi-Res</a> <a href='&WAN/ui3.htm?rec=&ALERT_DB'>UI3</a>""" -Priority 2 -FPS 2 -Height 320
For example:
1710864963197.png
 
Last edited:
Hi @jaydeel,

Thank you for sharing your impressive script!

I'm currently using a Telegram bot to send alerts as photos with a simple command. I'm interested in expanding its capabilities to include GIFs and MP4s, and I was looking at your script for guidance. However, at over 6k lines, it’s quite extensive and I'm not really that strong in PowerShell.

Could you help summarize the key points for extracting images? From a quick glance, I see that you're making requests to the BI web server and mentioned that you extract images using either BVR or DAT files. I'm already familiar with using FFmpeg for creating GIFs, so I don’t need help with that part.

I'm mainly interested in the technical details of extracting the images for GIF creation or exporting the alerts as MP4. Do you think exporting the alert as an MP4 might be more efficient?

Thanks in advance!

Cheers!
 
Hi @jaydeel,

Thank you for sharing your impressive script!

I'm currently using a Telegram bot to send alerts as photos with a simple command. I'm interested in expanding its capabilities to include GIFs and MP4s, and I was looking at your script for guidance. However, at over 6k lines, it’s quite extensive and I'm not really that strong in PowerShell.

Could you help summarize the key points for extracting images? From a quick glance, I see that you're making requests to the BI web server and mentioned that you extract images using either BVR or DAT files. I'm already familiar with using FFmpeg for creating GIFs, so I don’t need help with that part.

I'm mainly interested in the technical details of extracting the images for GIF creation or exporting the alerts as MP4. Do you think exporting the alert as an MP4 might be more efficient?

Thanks in advance!

Cheers!
It would be MUCH more efficient to write a function that works with the Telegram API, and use it instead of the current SendPushover() function. I'd be happy to try to create it, if that would work.

If you are instead wanting to recreate the script in another language, then all I can suggest is reading my code. It is well-commented. The key steps are these:
  1. get key properties for the alert (like the alert's clip offset and duration) from the Blue Iris database using the Blue Iris JSON interface alertlist and clipisitats commands
  2. extract JPGs from the binary DAT file (see function ExtractDatImages())
  3. or asynchronously extract JPGs from the alert's parent BVR file using multiple Blue Iris HTTP interface commands, like this
    $url = $bi_webserver_address + "/file/clips/" + $al_db_path + "?time=" + $time + "&cache=1&h=" + $Height
At first blush, I am doubtful that sending MP4 files is an option. The Pushover API has a modest size limit for attachments of (2.5MB). I've not looked at the Telegram API in a long time.
 
Last edited:
I've just updated the script to send Telegram Bot GIF notifications (as an alternative to Pushover).

I could use a few beta testers. If you are game, please send me a DM.
 
Script updated to V2.1. see post #1 to download the zip file.

Key features of this new version are:
  • BREAKING CHANGE: must replace old user-settings file
  • NEW: script now supports Telegram Bot notifications (alternative to Pushover);
  • NEW: added argument -PushService ('Pushover' or 'Telegram') to support on-demand service selection (case-insensitive)
  • NEW: added argument -Sound ('Pushover' only) to support on-demand service selection
  • NEW: script can now make GIFs via BI Clipboard clips (or Alerts created via Clipboard clips)
  • FIXED: script now handles DAT files with JPG images stored oldest to newest; effective BI 5.9.4.11+
  • IMPROVED: DAT extraction more efficient (gets BI version from registry instead of JSON call)
  • IMPROVED: -Live argument now supports the use of non-default folder naming patterns in Camera settings > Record > Video
Why you might want to use this update:
  1. This update solves the problem with GIFs playing in reverse after 5.9.4.11... as first described in this post.
  2. This update is a bit in faster in creating GIFs from DAT files. And the total script time for Pushover messages is ~5 seconds. See the performance charts below.

Performance results...
I'm routinely seeing GIF make times of ~4 sec for DAT files containing 10-13 JPG images.
This chart also shows Pushover notification process times.
V2.1_chart_viaDat_pushover.png


Telegram notifications appear to be 1+ second slower than Pushover notifications (while this is a smaller data set than the chart above, I've observed this in other testing as well).
V2.1_chart_viaDat_telegram.png


Updated usage guide...
V2.1_usage_guide.png
 
Last edited:
  • Like
Reactions: looney2ns