Download all files from Blackvue dashcam to your Synology over Wifi

To archive all files from your Blackvue cloud-enabled dashcam to your Synology NAS without removing your SD card, simply do the following:

1. Connect your Blackvue dashcam to your local network using its cloud feature.
2. Find the IP of your Blackvue dashcam by checking the dhcp settings from your router, or by using an app like Fing for iPhone (look for network adapter with brand Pittasoft). It might be handy to use a dhcp reservation in your router to make sure the camera always has the same IP.
3. Open a good text editor like Notepad++ (Windows) or TextWrangler (Mac) and paste the code below in a new file.

#!/bin/bash
cd "$(dirname "$0")"
for file in `curl http://192.168.1.53/blackvue_vod.cgi | sed 's/^n://' | sed 's/F.mp4//' | sed 's/R.mp4//' | sed 's/,s:1000000//' | sed $'s/\r//'`; do wget -c http://192.168.1.53$file\F.mp4; wget -c http://192.168.1.53$file\R.mp4; wget -nc http://192.168.1.53$file\F.thm; wget -nc http://192.168.1.53$file\R.thm; wget -nc http://192.168.1.53$file.gps; wget -nc http://192.168.1.53$file.3gf; done

*Please note that the line “for file in” goes all the way to “done”. This needs to be one line!

Update: You can also download the script above here, but you will still need to edit the IP address using a decent texteditor like the ones mentioned above. No Word, Wordpad or any rich text editor.

4. Change the IP in the script to your Blackvue Dashcam IP.

5. Save this file to a (new)share on your Synology and call it blackvue.sh

6. Go to Synology DSM, Configuration, Task scheduler

7. Choose “User defined script” and enter
sh /volume1/name_of_your_blackvue_archive_share/blackvue.sh
and set the schedule to run every day at a time your Blackvue will be connected to your local network for a while.

The procedure above will let your NAS download all files on the Blackvue dashcam, it will skip files already downloaded, and it will resume partially downloaded .mp4 files.

If you want the Synology NAS to only download the files of that day, use this version of the script in stead:

#!/bin/bash
cd "$(dirname "$0")"
export BVDATE=`date +%Y%m%d`
echo $BVDATE
for file in `curl http://192.168.1.53/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://192.168.1.53$file\F.mp4; wget -c http://192.168.1.53$file\R.mp4; wget -nc http://192.168.1.53$file\F.thm; wget -nc http://192.168.1.53$file\R.thm; wget -nc http://192.168.1.53$file.gps; wget -nc http://192.168.1.53$file.3gf; done

*Please note that the line “for file in” goes all the way to “done”. This needs to be one line! This version is also included in the download above.

This script also skips all files that are already downloaded, so you can start it multiple times the same day without redownloading all files.

Note: The upload speed of the camera is very slow. In my case, I need one minute to download a one minute file. I take no responsibility for anything. Use at your own risk.

Full credits for the original script to Gadgetblogist

21 responses to “Download all files from Blackvue dashcam to your Synology over Wifi”

  1. Edward says:

    This works great. I’m using Mint Linux 18. I also made adjustments to the script to download “yesterday only” files in case I had no time to download “today only” files. I called it blackvue_yesterday.sh.
    The difference in the code is just this:
    export BVDATE=`date -d yesterday +%Y%m%d`

    See full code below
    ——————————————

    #!/bin/bash
    cd “$(dirname “$0″)”
    export BVDATE=`date -d yesterday +%Y%m%d`
    echo $BVDATE
    for file in `curl http://10.99.77.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:$

    —————————————————————–

  2. Arno says:

    I implemented this on my QNAP nas. Works great!
    Needed some extra handling to schedule the script in the crontab since QNAP does not have a graphical scheduling option. For who is interested in the crontab command, let me know.
    Now I want to figure out why the download script does does not work (access denied) when I disable the BlackVue’s own AP mode (change wifimode in config.ini). Idea’s are welcome.
    I want to disable the own AP so it automatically connects to my home WiFi once in reach

  3. Edward says:

    Looking for a modification on this script to download “today only from 4:00pm – current time” – not sure how to tweak it now.
    The reason why I wanted this is so if I know something happened commuting home after work (usually after 4:00pm) I can download just that block on files. Better yet, I would love to set a timeframe in the script say from 5:00pm – 5:45pm – any ideas?

  4. Edward says:

    This mod allows one to enter a specific date of which the script will download all files. Date format is always YYYYMMDD

    ————————-

    #!/bin/bash
    bold=$(tput bold)
    normal=$(tput sgr0)
    cd “$(dirname “$0″)”
    echo PLEASE ENTER DATE YYYYMMDD:
    read userdate
    export BVDATE=`date +$userdate`
    echo ${bold}NOW DOWLOANDING FILES FOR:${normal} $BVDATE
    for file in `curl http://10.99.77.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://10.99.77.1$file\F.mp4; wget -c http://10.99.77.1$file\R.mp4; wget -nc http://10.99.77.1$file\F.thm; wget -nc http://10.99.77.1$file\R.thm; wget -nc http://10.99.77.1$file.gps; wget -nc http://10.99.77.1$file.3gf; done

    ———————————-
    Modify the IP if you need to.

    E

  5. Marc says:

    Works like a charm! Thanks for the good work Bjorn! 🙂

  6. Alex says:

    Hi,
    How can the script to:
    1) create a directory of today’s date
    2) copy all files for today into that newly created directory?

    Many thanks.

    Alex

  7. Alex says:

    following up on my above post, I’ve tried to make a new directory using the mkdir command (mkdir $BVDATE) and no directory was created but neither was there any error. I’m baffled… Any help is appreciated. thanks.

  8. Aschwin Rutgers says:

    Finally, found something that can work for me! Thanks in advance.
    I also own a DR650-2channel, and want to upload the video`s instantly. The car has wifi and internet, is it possible to upload every frame automatic to NAS?
    I use the system for security instead as of dashcam, so i want every video in the cloud, in case the steal the dashcam.
    Because the wifi of the Blackvue shuts off, and its not clear to me when or how the Blackvue is transporting the video`s to the cloud?
    And can it handle 2 camera systems at the time, i`m planning to buy a one channel system for the rear.

    Best regards,
    Aschwin

  9. EDWARD says:

    Aschwin,
    I have the DR650S-2CH (main cam facing front and 2nd small cam facing rear) and a DR650S-1CH mounted on the front but facing the interior (driver / passenger).
    Currently I manually download files when I know there are videos of interest. Neither cams will automatically upload to the cloud. They don’t do that.
    Our car also has its own WiFi and allows for us to Live View it when so desired.
    To do what you want to do, you would need to have “perhaps” a Raspberry Pi in the vehicle running some sort of “Linux” OS. There you would want to set some kind of cron job to run every 2-3 minutes that would download the files into a dropbox folder that would then, sync with dropbox and you could then, retrieve files from your computer anywhere you have internet. There is a challenge there tho. If the Raspberry Pi is connecting to the camera, it means its not connected to the internet. Solution would be to connect to the same WiFi and hopefully “through the same network” find your camera(s) and download the files as I described.
    I have never done that before and I dont know if that would work actually. I wouldnt know of the top of my head how to set up the Raspberry Pi either.
    What you will have to figure out too is, battery power for both cameras and the Raspberry Pi.
    So have a good power scheme there. Power planning is everything! If your cameras, WiFi hotspot or Raspberry Pi have no power, you have a fancy useless system. Plan to have all batteries charging while the vehicle is running. Also figure out how long they will last when the vehicle shutdown / stops.
    If you have Mac at home you can setup some pretty sick automation that will move files from dropbox automatically all day so you dont have to buy dropbox premium space. Files would safely sit in your computer or NAS at home depending on how you set that automation.

    Good luck.
    I would love to try something like that but I have no time currently to build a raspberry pi and figure out a good script for the cron.

    Edward

  10. Aschwin Rutgers says:

    Thanks Edward for your reply.

    Whats the script of Bjorn doing then? I believed it would upload the images when connected to his local network( i assume at his home).
    I have a network 24/7 in the car. Only thing i want to upload automaticly is gshock and motion detect in parking mode. I have to say im a noob about computer electronics, and i dont understand how the DR650 is transmitting his images. I think you download the images thru the router in the car? So if the images running thru the router, is it possible to redirect it to a nas?

    Best regards,
    Aschwin

  11. Edward says:

    Aschwin
    Hi –
    What is the goal here? I thought you wanted to have files uploaded all the time even while driving… if thats the case, you can try what I previously suggested. If not, and you only want things to be downloaded when you park your car back home, you dont even need WiFi in your car. Just set the camera to connect to your home WiFi and it will connect automatically once in range. Then you can use the NAS script in this page with the particular NAS hardware mentioned here.
    Note the script will download all files, not just event files.

    • Aschwin Rutgers says:

      Dear Edward,

      Thanks again for your reply. When im driving and something happens, im there to get the records, those doesnt have to be uploaded all the time.
      What im interrested in is the records while in parking mode. when someone hits the car,scratch or entering the car. Those records i want to have in a cloud(which i believed this system was) or on a NAS(what i like more, because i dont like cloud computing). So when they brake into the car and steel the dashcam, i have the records who did it.

      Best regards,
      Aschwin

  12. Edward says:

    These cameras do not automatically upload anything to the cloud. For what you are trying to accomplish your option is an on-board WiFi and a raspberry pi running Bjorn’s script kicking in every few minutes automatically and copying your files into a dropbox sync folder.

    • Aschwin Rutgers says:

      Thanks Edward,

      The on-board wifi i have. I`m using a wifi router in the car. So if i find a technician that can put the Raspberry PI into my router, i can run scripts to upload.

      Best regards,
      Aschwin

      • Edward says:

        Cool… first work the script to your needs. You will need to findout what IP address the camera has in your vehicle network (not the direct camera WiFi IP but the IP the assigned to the camera in your network). The script will have to be looking for that particular IP. Once you a manual script run is successful and you verify it downloaded the files from the camera then its time to create a cron job that will automatically start that script every few minutes. You might also want to tweak the script to download only your parking and event videos. If it downloads everything at one point and the cron job kicks the script again, I believe it will just say files already exist.
        As long as your script is downloading the files into a dropbox folder that syncs automatically you should have all your files in your dropbox even if your camera is stolen or disabled by someone. Good luck!

  13. Joris says:

    Thanks! Below my version, based on your script.
    – It checks for the cam on two locations; home and office.
    – It checks if the dashcam is online, first at home and, if it is not, at the office.
    – If the dashcam cannot be found on one of the locations, the script will terminate.
    – The script will check if it is already running, to avoid duplicate runs.

    – The dashcam should get a fixed IP at home and at the office (MAC address is in the dhcp server)
    – The office IP should be accessible through VPN from the Synology at home
    – The script runs every 15 minutes
    – If the script is not running as root, you might want to make the ping command available by running this one time: sudo chmod u+s /bin/ping

    When I park my car at home, or at the office, the new dashcam files will be downloaded within 15 minutes if the dashcam connects to the wireless network.
    If it terminates (dashcam has no connection anymore) it will resume the next time the dashcam is connected at home or office.

    #!/bin/bash

    # IP addresses to check

    # Home
    DASHCAM_IP1=x.x.x.x.x
    # Office (accessable through VPN)
    DASHCAM_IP2=x.x.x.x.x

    # Location of dashcam files and PID file

    FILELOCATION=/volume1/dashcam/blackvue
    PIDFILE=/volume1/dashcam/scripts/blackvue.pid

    # check for running instances, to avoid duplicate runs

    if [ -f $PIDFILE ]
    then
    PID=$(cat $PIDFILE)
    ps -p $PID > /dev/null 2>&1
    if [ $? -eq 0 ]
    then
    echo “Process already running”
    exit 1
    else
    ## Process not found assume not running
    echo $$ > $PIDFILE
    if [ $? -ne 0 ]
    then
    echo “Could not create PID file”
    exit 1
    fi
    fi
    else
    echo $$ > $PIDFILE
    if [ $? -ne 0 ]
    then
    echo “Could not create PID file”
    exit 1
    fi
    fi

    # check if the dashcam can be found on one of the two ip addresses

    ping -c 3 $DASHCAM_IP1 > /dev/null 2>&1
    if [ $? -ne 0 ]
    then
    echo “✗ Dashcam not found on $DASHCAM_IP1”
    ping -c 3 $DASHCAM_IP2 > /dev/null 2>&1
    if [ $? -ne 0 ]
    then
    echo “✗ Dashcam not found on $DASHCAM_IP2”
    exit 1
    else
    DASHCAM_IP=$DASHCAM_IP2
    fi
    else
    DASHCAM_IP=$DASHCAM_IP1
    fi

    echo “✓ Dashcam found on $DASHCAM_IP”

    # Download all files

    cd $FILELOCATION
    for file in `curl –connect-timeout 10 http://$DASHCAM_IP/blackvue_vod.cgi | sed ‘s/^n://’ | sed ‘s/F.mp4//’ | sed ‘s/R.mp4//’ | sed ‘s/,s:1000000//’ | sed $’s/\r//’ | grep ‘Record’ | sort -u`;
    do
    wget -T 10 -t 2 -c http://$DASHCAM_IP$file\F.mp4;
    wget -T 10 -t 2 -c http://$DASHCAM_IP$file\R.mp4;
    wget -T 10 -t 2 -nc http://$DASHCAM_IP$file\F.thm;
    wget -T 10 -t 2 -nc http://$DASHCAM_IP$file\R.thm;
    wget -T 10 -t 2 -nc http://$DASHCAM_IP$file.gps;
    wget -T 10 -t 2 -nc http://$DASHCAM_IP$file.3gf;
    done

    # remove PID

    rm $PIDFILE

  14. Edward says:

    Very fancy! I like it. Mine looks for the camera IP only at home and it kicks off at a time I’m normally at home through a simple crontab.
    It downloads only today files.

    What I have been trying to do is tweaking the script to download only file within a timeframe.

    Anyway, great script!
    E

Leave a Reply

Your email address will not be published. Required fields are marked *