BlackVue Sync - A new portable, hands-off, automatic recording downloader for NAS or Docker

@Simon_rb Always good to hear success stories, thank you.

As to the shutdown, I'm hesitant to tack on very specialized behavior. It's also a bit tricky to do "the right thing" because the dash cam Wi-Fi connection can't be assumed to be stable. You wouldn't want to shut down the dashcam after it downloaded only half the files.

So my thinking is that you'd want to download recordings with "--priority type", and turn the dashcam off only once it has downloaded at least all driving/manual(/event?) recordings.

If that's the case, and assuming you're a programmer, I think the best spot would be the last loop in the sync() function. You'd add each downloaded recording to a downloaded_recordings list. Then you'd catch and rethrow exceptions around that last for loop, and in a finally clause you'd compare the two lists, and if current_dashcam_recordings minus downloaded_recordings only has parking (and event?) recordings, it would be safe to trigger your shutdown code.

Btw, I'd be curious to know how well a Pi works out in practice. I'm waiting for a Pi 4 which I'm sure would do fine, but I'm not sure about older models.

On my Mac I was getting 46Mbps downloads taking 22 secs per 1 min video clip. I hope to try the raspberry Pi this weekend time permitting. It is only a raspberry pi 2 that doesn't do much; all wired in and the camera connects to a router in the garage. The connection for me has been rock solid with my limited testing. I'll take a look at the above as a way to shut it down. I could always monitor the destination folder and once nothing is being written to for X amount of time then shut the camera down.
 
This piqued my interest. You have knowledge of a JSON command that the BV cameras support to shut themselves off? Can you share how that works? I'm aware of all the semi-documented HTTP commands to get files, but this capability is new and interesting to me.

Brad.
Sorry to disappoint Brad; I've not looked into controlling the camera via JSON. The relay powering the camera can be turned off via a JSON command. As the cars are in the garage there isn't much point in the camera recording 24/7; only recording when out driving and parked away from home.
 
Sorry to disappoint Brad; I've not looked into controlling the camera via JSON. The relay powering the camera can be turned off via a JSON command. As the cars are in the garage there isn't much point in the camera recording 24/7; only recording when out driving and parked away from home.
Drat. I was rather hoping you'd found some magical extra set of camera commands we could use for something. :-(
 
Managed to get it running tonight and getting 35Mbps or so; it was 49Mbps on my Mac so not that shabby really. Raspberry Pi CPU is running at around 49%. Think its a raspberry pi 2.

Untitled.png
 
Actually monitoring the folder won't help as the camera is always recording so there is always something being downloaded from camera to it. Hmmm.. Not sure how to implement your suggestion :(
 
@Simon_rb Again not sure about your level of proficiency in Python, but this is more or less what I was trying to describe -- typed but not tested!

At the bottom of the sync() function, where it says:

Code:
    for recording in current_dashcam_recordings:
        download_recording(base_url, recording, destination)

You'd do something like:

Code:
    # successfully downloaded recordings
    downloaded_recordings = []

    try:
        for recording in current_dashcam_recordings:
            download_recording(base_url, recording, destination)
            # recording downloaded successfully, so we add it to the list
            downloaded_recordings.append(recording)
    finally:
        # recordings that were not downloaded
        remaining_recordings = [r for r in current_dashcam_recordings if r not in downloaded_recordings]
        # returns true if any normal, event or manual recordings are remaining
        return any(r.type in "NEM" for r in remaining_recordings)

Then in the run() function, where it says:

Code:
        try:
            sync(args.address, destination, grouping, args.priority)
        finally:

You'd do:

Code:
        try:
            unfinished = sync(args.address, destination, grouping, args.priority)
            if not unfinished:
                turn_camera_off()
        finally:

The idea being that if we have normal, event or manual recordings that we weren't able to download for whatever reason, that we'll keep trying. But once they've all been downloaded, it means that the car is parked, so the dash cam can be turned off.
 
@Simon_rb Again not sure about your level of proficiency in Python, but this is more or less what I was trying to describe -- typed but not tested!

At the bottom of the sync() function, where it says:

Code:
    for recording in current_dashcam_recordings:
        download_recording(base_url, recording, destination)

You'd do something like:

Code:
    # successfully downloaded recordings
    downloaded_recordings = []

    try:
        for recording in current_dashcam_recordings:
            download_recording(base_url, recording, destination)
            # recording downloaded successfully, so we add it to the list
            downloaded_recordings.append(recording)
    finally:
        # recordings that were not downloaded
        remaining_recordings = [r for r in current_dashcam_recordings if r not in downloaded_recordings]
        # returns true if any normal, event or manual recordings are remaining
        return any(r.type in "NEM" for r in remaining_recordings)

Then in the run() function, where it says:

Code:
        try:
            sync(args.address, destination, grouping, args.priority)
        finally:

You'd do:

Code:
        try:
            unfinished = sync(args.address, destination, grouping, args.priority)
            if not unfinished:
                turn_camera_off()
        finally:

The idea being that if we have normal, event or manual recordings that we weren't able to download for whatever reason, that we'll keep trying. But once they've all been downloaded, it means that the car is parked, so the dash cam can be turned off.

Thanks for the above; it's a little past my experience in Python. I would like the script to download everything including the parking events. I'll try and have a play around with it although I don't want to break it now it currently works; just need it to send a curl command once its finished and that it knows it's finished. Thanks a lot for your help this far and such a easy to use script.
 

Attachments

  • blackvuesync copy.txt
    25.9 KB · Views: 8
Its all good; managed to figure it out. If anyone wants the script I can upload! Thank you so so much :)
 
I am using a Synology NAS DS1815+ and Docker. I have download it and created the container. However, even with setting the environment variables for "Keep" to 3d, it does not purge older files. I know there are extra slashes but this is the export from the container. Does not seem the execution is correct "/bin/sh -c /setuid.sh\\ \\&\\&\\ su\\ -m\\ dashcam\\ /blackvuesync.sh\\ \\ \\ \\ \\ \\&\\&\\ test\\ -z\\ \\\"\\$RUN_ONCE\\\"\\ \\&\\&\\ crond\\ -f"
 
I am using a Synology NAS DS1815+ and Docker. I have download it and created the container. However, even with setting the environment variables for "Keep" to 3d, it does not purge older files. I know there are extra slashes but this is the export from the container. Does not seem the execution is correct "/bin/sh -c /setuid.sh\\ \\&\\&\\ su\\ -m\\ dashcam\\ /blackvuesync.sh\\ \\ \\ \\ \\ \\&\\&\\ test\\ -z\\ \\\"\\$RUN_ONCE\\\"\\ \\&\\&\\ crond\\ -f"

I run a Synology with Docker as well and have the same problem with the same default execution command. I never was able to get it to recognize the "Keep" environment variable, so I have to go in and manually delete files once in a while which is a pain especially if I let it go too long... the system starts to grind to a halt due to the sheer volume of files.
Is there some other execution command that should be defaulted to to enable those environment variables reported by Docker?
 
Last edited:
Hey there.

This looks pretty cool!
I have a Synology NAS 1815+. I have 40TB of space altogether and 4 house cams going into it.

I was looking around for a dash cam. I've gone through a few cheap ones where the sd reader usually breaks trying to transfer footage off etc. I googled dashcam and synology and ended up here.
I was looking at the BlackVue900s dual channel camera. Does that model work with this method of download? I'm decent with python but I havent looked at the script yet. I saw some bad reviews on Amazon about the night quality of the camera, can anyone verify this at all? Is the 900 the best one to get? or are there cheaper models that do the same thing?
 
Hey there.

This looks pretty cool!
I have a Synology NAS 1815+. I have 40TB of space altogether and 4 house cams going into it.

I was looking around for a dash cam. I've gone through a few cheap ones where the sd reader usually breaks trying to transfer footage off etc. I googled dashcam and synology and ended up here.
I was looking at the BlackVue900s dual channel camera. Does that model work with this method of download? I'm decent with python but I havent looked at the script yet. I saw some bad reviews on Amazon about the night quality of the camera, can anyone verify this at all? Is the 900 the best one to get? or are there cheaper models that do the same thing?
Works great except on the Synology using Docker, you need to go in and periodically delete the files since I cannot get the "keep" part to work so it auto deletes after x days or weeks
 
I saw some bad reviews on Amazon about the night quality of the camera, can anyone verify this at all? Is the 900 the best one to get? or are there cheaper models that do the same thing?

Welcome to DCT @carverstone1 :) On connectivity, the Blackvue DR900s seems to be as good as you can get, but they have never really put the same amount of effort into image quality :( If you need this kind of connectivity the only other cam I know of which might work for you would be the Thinkware U1000. It's pretty new and may still have a few bugs to be worked out. Other cams are coming along with better connectivity features but how long the wait and how well it's done is anyone's guess :rolleyes: You can't get what you don't pay for, but you can pay too much for what you get.

It's mostly about you deciding what you want most, then getting whatever cam best satisfies your needs. No one cam does everything best. The DR900s doesn't do well at night compared to many other cams, but the others don't have this kind of connectivity. YouTube compresses vids downloaded there so what you see may be somewhat worse than what a raw vid looks like, but it can give you a start on doing comparisons. With most popular cams you can find someone here on DCT who has DL'ed raw vids and shared them with us in each cam's forum. Those are what you need to see for final comparison and judgement of vid quality ;)

Phil
 
Was really hoping the developer would chime in for the Synology Docker issue
 
Just thought I'd mention I did end up with the 900s front and rear. Took me like 3 months to actually go out and finally install it nicely. Have this script running and it does work as advertised. I had to throw an old router in the garage and make it a repeater for the WIFI as the signal wasn't strong enough and kept timing out. Even after I did get a few timeouts but so far it seems to be working pretty well. Will see if it purges the data older than two weeks as I have specified. Will take a closer look at the code if any issues.

Thanks to the original contributor for submitting this. Would be cool if we could view the footage in Syn video viewer but doesnt look like thats really possible without a lot of work. The blackvue viewing app is kinda trash. You can point it at the folders you want each day as you have it grouped but its not recursive and .. just sucks.

Did figure out you can live view the cams when in parking mode though
http://<ip-of-cam>/blackvue_live.cgi?direction=F
 
Was really hoping the developer would chime in for the Synology Docker issue
Hi Wheatman,

I made task schedule with this command

find /volume1/yourfolder -type f -atime +5 -delete

and It works +5 means that everything older than 5 days will be deleted.

I hope it help.

Cheers Ales
 
The HTTP API does not seem to be available via the hotspot connection. I don't know what the BlackVue phone app does.

Hi! I'm quoting an ancient message, but this is an interesting point.

I don't have any camera yet. The new DR590X looks really good for the price, but it doesn't have Wifi Cloud support which means it can't connect to home wifi at all. It does have the hotspot for android connection, though!

So, I'm thinking.. I have a spare ddwrt wifi router that could easily be configured as an access point to connect to the Blackvue wifi. Then it would route the traffic between my local network and dashcam.

Has anyone tried recently how android app is communicating with the hotspot? Maybe the www server is just in different port or something simple like that?

Looks like only real difference between DR590X and DR750X is GPS and Wifi Cloud.. I'm not interested in the cloud, but I would like to copy everything from camera to my NAS on daily basis.
 
Howdy, author here. I just released version 1.8 with support for the new BlackVue firmware and a fix for the KEEP option bug in the Docker image that @wheatman reported.

Changes:

* Supports new event types produced by the May 2021 BlackVue firmware update.
* The Docker image now respects the KEEP option.
* Docker compose file for a possibly quicker quickstart.
* Friendlier hardware requirement descriptions.
* More reliable removal of outdated directories when grouping by day, month or year.
* Better handling of unexpected 500 errors or remote disconnections.
* Updated docker image to alpine 3.13.5

 
Back
Top