I've developed a Powershell script that can be used to:
PART 1 - Quick How to Guide
STEP #1:
STEP #2:
STEP #3:
STEP #4:
STEP #5:
STEP #6:
Script Zip File
- Create customized GIFs from any Blue Iris alert/clip (or DAT file if it exists), and
- Send these GIFs as a Pushover notification attachment.
- By default, this script creates GIFs by extracting JPG images from a Blue Iris Artificial Intelligence analysis DAT file (if it exists, and if it contains sufficient images).
Extracting JPGs from a DAT file versus from a 'live' BVR stream sends Pushover GIF notifications in a few seconds vs 10s of seconds.The reason why is that the HTTP interface command\file\clips
cannot extract JPGs while they are still buffered in an actively recording BVR stream.From my testing, JPG images cannot be grabbed from an actively recording BVR clip until the full alert duration has passed.- It is worth noting that for any fully recorded alert (those showing a duration in the Clips list), GIFs can be created (manually) in just a few seconds via either method (BVR or DAT file JPG extraction).
- Quick How-to Guide
- Script Usage / Parameters Guide (post #2)
- How to 'Tune' GIFs for individual Cameras (post #3)
PART 1 - Quick How to Guide
STEP #1:
You must install ffmpeg before you can use the script
If your Blue Iris PC does not already have ffmpeg installed, then I suggest the following:
- Download and install Chocolatey for Individual Use ... Installing Chocolatey
- Install the latest ffmpeg build by using the following command in cmd.exe. or powershell ... Builds - CODEX FFMPEG @ gyan.dev
choco install ffmpeg
This method ensures that ffmeg is properly configured, that it resides in the machine's environment path, and is ready to run.
STEP #2:
Install the script and its companion 'user settings file'
- Extract all the files from the attached zip file to your desktop, or scripts folder.
- Please note that the folder used must be in your PC's environment path.
- Create a root folder for this script - it will be used to process the GIF files; to archive GIF and DAT files, etc.
- To use the folder, you must edit a user setting in the appropriate Powershell script file (see Step #3)
NOTE: If you've never used PowerShell on your Blue Iris PC, you may first to need to change its default security policy.
Open PowerShell in Administrator mode, and type the following, then hit the Enter key:
Set-ExecutionPolicy RemoteSigned
(click here for a nice beginner's tutorial to using PowerShell).
STEP #3:
Edit the user settings file
The user settings file is named 'BI_gif_tool_user_settings.ps1'
- Open the file in a code text editor (I use Notepad++)
- Edit the REQUIRED variables in the USER SETTINGS section (see screenshot)
- Ignore the remaining settings for now. They provide customizations that you may want to explore later.
STEP #4:
Test the script from the console
- Open an Admin PowerShell window, or Powershell-ISE window
- Select and copy the following command and paste it into a text editor (notepad is fine)
BI_gif_tool.ps1 -UI3Rec xxxxxxxxx -Quiet
- Open UI3, select a camera, then select any alert that shows a duration (meaning it is done recording)
- Click in the UI3 browser's address bar, then select the value after the rec= argument, as in the screenshot below
- Copy the selected value to the clipboard.
- Return to Notepad, and paste the clipboard over the the
xxxxxxxxx
argument value - Select the entire command, then copy/paste it to the Powershell console.
- Hit the Enter key.
The response should look like one of the following 2 screenshots. You should also receive your first GIF Pushover notification,
If this camera was configured to create an AI DAT file with sufficient images, then the response will look like the 2nd screenshot
NOTE: The script can also be executed from an Admin cmd.exe window using a command like powershell.exe "C:\ps_scripts\{scriptname}.ps1 args"
STEP #5:
Test on a camera Alert action set
- Click 'Camera settings' > Alerts tab
- Click 'On action..." to open the action set
- Create a new 'Run a program' action, and configure it as shown in the following screenshot
- Safe the changes.
- Trigger the camera - by actually walking across its FOV
Here's the copy/paste code for the 'Parameters' field...
Please note that the backslash (\) in the
-AlertRec
parameter, and the triple double quotes (""") in the -Msg
parameter are ESSENTIAL.
Code:
"C:\ps_scripts\BI_gif_tool.ps1" -AlertRec \&ALERT_DB -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>"""
or...
Code:
"C:\ps_scripts\BI_gif_tool.ps1" -IgnoreDatFile -AlertRec \&ALERT_DB -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>"""
and/or test on a camera Preset
- Click 'Camera settings' > 'PTZ/Control' tab
- Click 'Edit Presets..." to open the preset editor
- Create a new 'Run a program' action, and configure it as shown in the following screenshot
- The code for the 'Parameters' field is the same as above
STEP #6:
Configure a Camera to always create an AI 'DAT' file
- Click 'Camera settings' > Trigger tab
- Click 'Artificial Intelligence..." to open the AI dialog
- Configure it as shown in the following screenshot
Script Zip File
PLEASE NOTE: if you are updating, you must edit & use the new user-settings-file
tip: to facilitate editing, rename the existing file before unzipping the update.
Attachments
Last edited: