Welcome to Tesla Motors Club
Discuss Tesla's Model S, Model 3, Model X, Model Y, Cybertruck, Roadster and More.
Register
  • We just completed a significant update, but we still have some fixes and adjustments to make, so please bear with us for the time being. Cheers!

Tesla Motors Club

I installed a pair of BlackVue 900s in my car and wrote a script to download
the files and store them on my array.

The script will download all files to a root directory, the date and finally front or rear.

Note this script is for a quad channel set up aka 2 dual blackvue dash cams. Each
folder for the given location will have both dash cam channels for that camera.

So, with my particular setup the front folder will have the front dashcam video and the passenger right video.
The rear folder will have the rear dash cam and the passenger left video.

I pieced this together from a few internet sources and mixed and matched between them to improve the solution and allow for better throughput and better storage arragement

Sources:
Dashcam file auto download script
https://www.bjornsblog.nl/tips-and-...-from-blackvue-dashcam-to-your-synology-wifi/

If you have any questions feel free to ask, just offering this back to the community and hope it helps others.

I have this setup on a cronjob to run every night at 1am and 4am ( in case of broken connections), but the script will not duplicate files, so you can have this run more often if needed, it will also resume downloaded files that haven't finished automatically when run again for the same day in case the dash cam drops the connection which happens occasionally I found.

Code:
#!/bin/bash

#################################################################################################
#   This script is used to download blackvue dashcam files to the specified root storage directory.
#   No warranty express or implied comes with this script, and improvements or bugs for this script
#   please let the OP know so all can recieve the fix.
#
#    Files will be downloaded to the root directory then the date the file was captured and then a front
#    and rear folder will be created if dual dashcasm's are installed.
#
#    This script ONLY works with blackvue dashcams (tested on 900S, but should work on 600 and later models)
#
#    -- BigD0g
#################################################################################################

#The top level directory of where to store your dashcam files
DASHCAM_ROOT_STORAGE=~/jarvis-dashcam

#The IP Address of the FRONT blackvue dashcam
DASHCAM_FRONT_IP=192.168.0.21

#The IP Address of the REAR blackvue dashcam if installed aka 4 channel install 2 seperate blackvues
DASHCAM_REAR_IP=192.168.0.22

export BVDATE=`date +%Y%m%d`
echo $BVDATE

function downloadTodaysFiles() {
    
    count=$(ping -c4 $1 | grep 'received' | awk -F',' '{ print $2}' | awk '{ print $1}')

    if [ $count -eq 4 ]; then
        echo "Successful connection! for " $1
        cd $DASHCAM_ROOT_STORAGE/$BVDATE/$2
        for file in `curl http://$1/blackvue_vod.cgi | sed 's/^n://' | sed 's/F.mp4//' | sed 's/R.mp4//' | sed 's/,s:1000000//' | sed $'s/\r//' | grep $BVDATE`; do
            wget -c http://$1$file\F.mp4;
            wget -c http://$1$file\R.mp4;
            wget -nc http://$1$file\F.thm;
            wget -nc http://$1$file\R.thm;
            wget -nc http://$1$file.gps;
            wget -nc http://$1$file.3gf;
        done
    fi
    
}

#Setup directories for todays files
if [ ! -d "$DASHCAM_ROOT_STORAGE/$BVDATE" ]; then
  mkdir -p $DASHCAM_ROOT_STORAGE/$BVDATE/front
  mkdir $DASHCAM_ROOT_STORAGE/$BVDATE/rear
fi

#Set this one off into the background so we can do both cameras at the sametime.
downloadTodaysFiles $DASHCAM_FRONT_IP front &

#If you do not have a second blackvue installed delete this next line
downloadTodaysFiles $DASHCAM_REAR_IP rear &

exit 0

About Us

Formed in 2006, Tesla Motors Club (TMC) was the first independent online Tesla community. Today it remains the largest and most dynamic community of Tesla enthusiasts. Learn more.

Do you value your experience at TMC? Consider becoming a Supporting Member of Tesla Motors Club. As a thank you for your contribution, you'll get nearly no ads in the Community and Groups sections. Additional perks are available depending on the level of contribution. Please visit the Account Upgrades page for more details.


SUPPORT TMC
Top