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

Simon_rb

New Member
Joined
Jan 3, 2016
Messages
13
Reaction score
1
Country
United Kingdom
@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.
 

Simon_rb

New Member
Joined
Jan 3, 2016
Messages
13
Reaction score
1
Country
United Kingdom
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.
 

bpsmicro

Active Member
Joined
Jul 13, 2017
Messages
214
Reaction score
102
Country
Canada
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. :-(
 

Simon_rb

New Member
Joined
Jan 3, 2016
Messages
13
Reaction score
1
Country
United Kingdom
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
 

Simon_rb

New Member
Joined
Jan 3, 2016
Messages
13
Reaction score
1
Country
United Kingdom
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 :(
 
OP
acolomba

acolomba

Member
Joined
Dec 2, 2018
Messages
25
Reaction score
28
Country
United States
Dash Cam
Blackvue DR750S-2CH
@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

New Member
Joined
Jan 3, 2016
Messages
13
Reaction score
1
Country
United Kingdom
@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.
 

Simon_rb

New Member
Joined
Jan 3, 2016
Messages
13
Reaction score
1
Country
United Kingdom

Attachments

Simon_rb

New Member
Joined
Jan 3, 2016
Messages
13
Reaction score
1
Country
United Kingdom
Its all good; managed to figure it out. If anyone wants the script I can upload! Thank you so so much :)
 

wheatman

New Member
Joined
Dec 4, 2019
Messages
2
Reaction score
0
Location
Florida
Country
United States
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"
 

Op911

New Member
Joined
Feb 6, 2018
Messages
20
Reaction score
7
Country
Canada
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:

carverstone1

New Member
Joined
Feb 20, 2020
Messages
1
Reaction score
0
Location
Earth
Country
Canada
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?
 

wheatman

New Member
Joined
Dec 4, 2019
Messages
2
Reaction score
0
Location
Florida
Country
United States
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
 

SawMaster

Well-Known Member
Joined
Apr 10, 2015
Messages
5,971
Reaction score
5,347
Location
SC
Country
United States
Dash Cam
G1W-S, G1W-HC, G1W clone, B1W, K2S, B2W, (ex N2Pro & Mobius)
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
 
Top