TMC is an independent, primarily volunteer organization that relies on ad revenue to cover its operating costs. Please consider whitelisting TMC on your ad blocker and becoming a Supporting Member. For more info: Support TMC

Blackvue Downloading Program

Discussion in 'Tesla' started by jayman, Apr 15, 2017.

  1. jayman

    jayman Member

    Joined:
    Aug 31, 2013
    Messages:
    270
    Location:
    Illinois
    I came up with this simple program I called BlackvueDaily. Basically it downloads the videos from your blackvue wirelessly without you having to remove the SD car from the recorder. It's a simple .exe program that takes certain parameters. You can download the program from here: Dropbox - BlackvueDaily.exe

    There are parameters you can use and one of the parameters that has to be there is the location of where you want the downloads to go preceded by a "-". It automatically uses the IP address of the blackvue recorder when a computer is connected to its SSID, ie http://10.99.77.1. However, one can put in there own IP address of the camcorder as a parameter such as "-192.168.1.22" if you don't have a wireless dongle connecting to the recorder. Only one other parameter will work for now as listed:

    -all ---- This will download all the videos from today

    -front ---- This will download all the videos from the front camera from today

    -rear ----- This will download all the videos from the rear camera from today

    -park ----- This will download all the videos while car was parked from today

    -event ---- This will download all the videos that records when an "event" occurred

    For instance, one CD's to the location of the BlackvueDaily.exe

    Ex. C:\Users\Me\Documents\My exe folder>BlackvueDaily.exe -event -S:\

    This would download all the "event" videos from the day to the S drive.

    This program may be buggy as I have not tested it extensively. Let me know of any problems or anything that may be worth adding.
     
    • Like x 4
  2. MarkS22

    MarkS22 Member

    Joined:
    Apr 6, 2015
    Messages:
    368
    Location:
    Morris County, NJ
    #2 MarkS22, Apr 15, 2017
    Last edited: Apr 15, 2017
    Many thanks for this. It looks like it's working when I manually add the IP address.

    How does it determine "today"? In other words, I can have this run at 11:55pm every night. In theory, something recorded in those interim 5 minutes would be missed?

    Maybe a "-yesterday" parameter would be optimal? This way, you can run it overnight (say between 1am and 4am) on technically the next day and it will go and grab everything from the prior day? I feel like this would leave a much more reliable window for running a cronjob?

    Also note that I'm much more likely to be using the computer/network around midnight, so being able to set it to transfer the prior day gives me flexibility to have it run during a downtime.

    Ultimately, it would be nice to have it save the date/time of last transfer (even to a simple TXT file in the same directory). When you run, it can load all files after that date. This way, if you're away for a few days, it'll grab everything it missed.

    If it can't find the IP address (e.g. the car isn't on local WiFi when the program runs), does it time out gracefully and quit?

    Finally, how does it handle existing files? If I run this twice in a single day, does it simply overwrite the existing files? Or skip? (It seems like it just re-downloads, but I think it would be more graceful to skip if a file with the same date directory and name already exists.)

    Of course, I know this is free and it's much appreciated. Just throwing out some ideas. This is a damn cool idea and incredibly convenient.
     
  3. MarkS22

    MarkS22 Member

    Joined:
    Apr 6, 2015
    Messages:
    368
    Location:
    Morris County, NJ
    #3 MarkS22, Apr 15, 2017
    Last edited: Apr 15, 2017
    For anyone trying to set this up in Windows as a task, here's a quick guide:

    (1) Do a search for "Task Scheduler" and run it. (In Windows 10, type "task" into "Ask Me Anything" to the right of the Start Menu)
    (2) Once it's open, in the "Actions" column on the right side, select "Create Basic Task..."
    (3) Name the task (e.g. "Blackvue Video Download") and add an optional description, then hit next.
    (4) Set the task to start "daily" (the default selection) then hit next.
    (5) Set the time to 11:55pm and "Recur every 1 days" and hit next.
    (6) Under action, select "Start a program" and hit next.
    (7) "Browse..." to the file location of when you saved BlackvueDaily.exe on your system.
    (7a) Under arguments, add the necessary parameters, as noted by @jayman above. (e.g. -all -192.168.0.100 -D:\Dashcam)
    (7b) Leave "Start In" blank and hit next.

    That should run the program and grab the videos daily right before midnight.

    Note: If you need to find the local IP address of your Blackvue, you can use an app like Fing to view the devices on your network. You can confirm it's correct by entering the IP address into your web browser and you should see the word "BlackVue" appear. If it doesn't, it's the wrong address or it's not connected to your network.
     
    • Informative x 2
    • Like x 1
  4. TampaRich

    TampaRich Member

    Joined:
    Jul 7, 2013
    Messages:
    136
    Location:
    Tampa, FL
    Would you consider posting the code on GitHub?
     
  5. jayman

    jayman Member

    Joined:
    Aug 31, 2013
    Messages:
    270
    Location:
    Illinois
    I certainly would and would have to figure that out. I'm not a programmar and would have to reconcile myself with the critique of people who are much more knowledgeable than myself. That said, i'll look into doing that.
     
  6. jayman

    jayman Member

    Joined:
    Aug 31, 2013
    Messages:
    270
    Location:
    Illinois
    That yesterday parameter shouldn't be hard to add, will try to do it today or tomorrow. I'll look to into the other things you mentioned. I think it does just overwrite files that are already there
     
  7. swaltner

    swaltner Member

    Joined:
    Oct 13, 2012
    Messages:
    621
    Location:
    Kansas, USA
    Nice concept.

    For situations where the sync process failed for whatever reason, you may want to have this program operate something along the lines of robocopy (Windows world) or rsync (unix world). Basically, any video file on the SD card that isn't on the local storage gets copied locally, not restricting the sync to files that were generated today or tomorrow. Avoid the complexities of today/yesterday and just copy anything that hasn't already been copied. If a file is already on the local storage, you don't need to bother copying it again. A simple filename compare would work when determining if the file had already been copied to the local storage.

    Most operating systems don't like having tens and hundreds of thousands of files in the same directory. The actual limits before performance suffers will depend upon the OS and underlying hardware (hard drive or SSD, single HD/SSD or RAID of multiple drives). Automatically creating a hierarchy of directories on the download directory would solve that. I would suggest automatically creating a new directory for each month of video files that is sucked off the BlackView camera. Just base the day off the timestamp embedded in the filename when determining where to drop the file.

    c:\videos\2015\
    c:\videos\2016\
    c:\videos\2017\
    c:\videos\2017\01\ - (videos from Jan 2017)
    c:\videos\2017\02\ - (videos from Feb 2017)
    c:\videos\2017\03\ - (videos from Mar 2017)
    c:\videos\2017\04\ - (videos from Apr 2017)
    etc...
     
  8. MarkS22

    MarkS22 Member

    Joined:
    Apr 6, 2015
    Messages:
    368
    Location:
    Morris County, NJ
    It does seem to create a directory for each day already. For example, I'm seeing a "4-16-2017" folder with the individual files being placed in there. I do like the idea of having a master directory with the year at the very least. So, you're not looking at more than 365 directories per year, which is fine for the OS. But I like your month idea as well.
     
  9. swaltner

    swaltner Member

    Joined:
    Oct 13, 2012
    Messages:
    621
    Location:
    Kansas, USA
    Whoops. That's what I get for commenting without trying the program. :) Good to hear it's creating daily directories for the files as they are downloaded. It would be decades before you got to 10,000 entries in the top level directory. That's where many systems start having trouble. Then it just become a question of organizational preferences on how and if there should be a more hierarchical directory structure.
     
  10. MarkS22

    MarkS22 Member

    Joined:
    Apr 6, 2015
    Messages:
    368
    Location:
    Morris County, NJ
    Screen Shot 04-16-17 at 07.15 PM.PNG

    Seeing an error for some of the file names not being found.
     
  11. jayman

    jayman Member

    Joined:
    Aug 31, 2013
    Messages:
    270
    Location:
    Illinois
    Yeah, I'll have to look at that. Do you have a rear camera installed? The program guesses that one does which is probably a mistake and therefore presumes to download the .thm for the rear camera. The file must not exist is why you are getting the exception. It was my workaround for not being able to see a list of the ancillary files like .gps, .3gf, etc and it just assumes they are there.
     
  12. MarkS22

    MarkS22 Member

    Joined:
    Apr 6, 2015
    Messages:
    368
    Location:
    Morris County, NJ
    No rear camera... must be it. It looks like it's working fine, though. (I see all the front camera ancillary files coming through just fine.)

    Need another command line switch -frontonly

    See what you get for being helpful? It's a downward spiral. You should put up a Paypal link for donations once you get stable.
     
  13. jayman

    jayman Member

    Joined:
    Aug 31, 2013
    Messages:
    270
    Location:
    Illinois
    Nah, I just do it for fun and because I wanted a way to get my videos. I'm gonna try to get to a lot of these issues this week but works a bear.
     
  14. jayman

    jayman Member

    Joined:
    Aug 31, 2013
    Messages:
    270
    Location:
    Illinois
    I changed some things with the program. There is now a parameter "-y" one can use to get yesterday's videos. The folder now has a hierarchy starting with a 2017 folder, and some other fixes. It's called version 1.1. Can download it here. Dropbox - BlackvueDaily.1.1.exe
     
    • Like x 2
  15. MarkS22

    MarkS22 Member

    Joined:
    Apr 6, 2015
    Messages:
    368
    Location:
    Morris County, NJ
    Hey, thanks for the updates. They look great.

    When using the Windows Scheduler, I noticed that the program doesn't close after completing successfully. Despite instructing the scheduler to end the program after two hours no matter what, the CMD window remains open. While closing this window isn't a big deal, I noticed that a second instance wouldn't run when I didn't manually close the window last night. So that day's events didn't transfer. Is there something you could do to force the program to close when it's done?
     
  16. jayman

    jayman Member

    Joined:
    Aug 31, 2013
    Messages:
    270
    Location:
    Illinois
    No problem. I'll probably write the results to a log file and put in each download folder. That way we'll have evidence of what it did, etc after the program closes...
     
  17. jayman

    jayman Member

    Joined:
    Aug 31, 2013
    Messages:
    270
    Location:
    Illinois
    I posted Blackvuedaily.1.2 here: Dropbox - BlackvueDaily.1.2.exe It should close on its own gracefully now with results posted to a log file in each folder. I also added an overwrite parameter: -o . The idea is that if your disk gets down to less than 30 gb it is going to search back through 10 years of folders that are named by year, like 2017 and delete the oldest folder in that year. It will keep doing this until you have more than 30 gb left on disk. If you don't want anything deleted don't add the -o parameter. I take no responsibility for deleted files so use at your own risk. I just wanted a way for the program to work on a daily basis and if that occurs, after say 100 days I might fill up a 500 gb disk.
     
    • Like x 2
  18. MarkS22

    MarkS22 Member

    Joined:
    Apr 6, 2015
    Messages:
    368
    Location:
    Morris County, NJ
    Many thanks for this. I just did a quick test and it did close instantly after finishing with a log file. Very cool.

    So, yesterday, I noticed no files downloaded. When I checked the SD card, it had not been recording anything for ~48 hours. In the year or so I've had it, this has never happened. Now, it could be a coincidence, but do you think there's a chance daily dumping of ~15GB could lock up the system?

    I don't think it's anything you're doing but maybe there should be a "throttle" like an artificial pause between each video? Download video, wait 1 minute, etc. Do you think there's a chance dumping directly from WiFi regularly could be introducing some kind of glitch in their firmware?

    Perhaps if 0 files are downloaded yesterday, there could be some kind of notification? Or if, when running, it finds nothing in the past 24 hours? Had I not checked for the new folders, I could've been driving for days or weeks with nothing recording.
     
  19. jayman

    jayman Member

    Joined:
    Aug 31, 2013
    Messages:
    270
    Location:
    Illinois
    I can't imagine it would lock it up but I guess anything is possible. I haven't had that issue. Do you reformat your card weekly? Let me know if it's more than just a random occurrence.
     
  20. MarkS22

    MarkS22 Member

    Joined:
    Apr 6, 2015
    Messages:
    368
    Location:
    Morris County, NJ
    Will do. And I forgot to add: When I tried to access the camera via IP, it timed out. I unplugged and rebooted and it worked fine. So, it wasn't just the files not writing but the internal web server was down.
     

Share This Page