Extract JPG Images from any Blue Iris DAT file (Database or AI)

jaydeel

BIT Beta Team
Nov 9, 2016
1,432
1,452
SF Bay Area
I've created a basic PowerShell script for extracting JPG images from ANY Blue Iris DAT file.

This includes the Database DAT files, as well as the more familiar AI DAT files.

Actually, this script will extract JPG images from any binary file.


My purpose for this script is mainly educational. I've created other utilities that process images from the AI DAT file.

Output and Features:
Here's a screenshot of the Help menu...
V1.usage_guide.png

Here are some typical commands...
BI_dat_img_extract.ps1 -SourceFile 'C:\BlueIris\db\clips.dat' ... counts the embedded JPG images
BI_dat_img_extract.ps1 -SourceFile 'C:\BlueIris\db\clips.dat' -Extract ... first image only
BI_dat_img_extract.ps1 -SourceFile 'C:\BlueIris\db\clips.dat' -Extract -Range 1,10 ... first 10 images
BI_dat_img_extract.ps1 -SourceFile 'C:\BlueIris\db\clips.dat' -Extract -Range 10 ... ditto
BI_dat_img_extract.ps1 -SourceFile 'C:\BlueIris\db\clips.dat' -Extract -Range -10 ... last 10 images
BI_dat_img_extract.ps1 -SourceFile 'C:\BlueIris\db\clips.dat' -Extract -Range 0 ... all images

To inspect AI DAT files, replace the -SourceFile value to something like 'D:\BlueIris\Alerts\DW2.20250124_150000.2814048.5-0.dat'.

By default, the JPG images are extracted to folder C:\temp\BI_dat_img_extract\extracted_jpgs.
The destination folder is user-configurable using the -DestPath argument.
The JPG filenames are like 01.0000005F.jpg, where the first value is image number and the second value is the hexadecimal offset of the start of the JPG image in the binary file.

The screenshots below illustrate typical output...
V1.clips_dat_output_1.png

V1.clips_dat_output_2.png V1.clips_dat_output_2_files.png

V1.clips_dat_output_3.png V1.clips_dat_output_3_files.png

V1.clips_dat_output_4.png V1.clips_dat_output_4_files.png

V1.clips_dat_output_5.png V1.clips_dat_output_5_files.png

Caveats:
1. You cannot specify the alert/clip to extract a specific JPG from the BI Database clips.dat file. For that you should use HTTP commands below.
2. The script will not directly use active BI database files; they are ALWAYS copied to the script's working folder before use.
3. The script can take awhile to interrogate the BI Database clips.dat file; you should see a progress indicator that it's working.

HTTP interface commands for getting specific JPGs from the BI Database clips.dat file
Specific Blue Iris database thumbnail images can be user-accessed via the following HTTP interface commands
http:\\webserver_address_and_port\thumbs\{filename}
http:\\webserver_address_and_port \thumbs\{@record}

I prefer the 2nd command. The easy way to get and use a database @record is to ctrl-right-click an item in the BI Windows app clips list (more here).
When you do this, the @record is loaded to the Windows clipboard, ready to paste into the HTTP command.

Download:
To use this script, simply extract the 'BI_dat_img_extract.ps1' file from the attached zip file to your desktop, or scripts folder.
Run the script from a PowerShell window.
The script can also be executed from cmd.exe using a command like powershell.exe "C:\ps_scripts\BI_dat_img_extract.ps1"
 

Attachments

Last edited:
  • Like
Reactions: TonyR
Just for fun, from the Blue Iris database clips.dat file, I extracted all the thumbnail images.

Here are the stats on the clips.dat file:
  • Total embedded images = 8976
  • Time to count the images = 20 seconds
  • Time to extract the images = 168 seconds (18.8 msec/image)
  • Total size of extracted images = 158 MB (17.6 KB/image)
  • Size of the source file (clips.dat) = 164 GB
  • Size percentage of images in the clips.dat file = 158/164 = 96%
The results are shown in the screenshots below.

Note the use of the optional -DevMode argument to show the timing information.
V1.clips_dat_output_6.png


Used Ctrl-A to select all the extracted files
V1.clips_dat_output_6_files.png


V1.clips_dat_file_props.png
 
Last edited: