Skip to main content

BlackVue Sync

CI Build Docker image Quality Gate Status Coverage Bugs Code Smells Maintainability Rating Reliability Rating Security Rating

Synchronizes recordings from a BlackVue dashcam with a local directory over a LAN.

BlackVue dashcams expose an HTTP server that can be used to download all recordings. This project downloads only recordings that are not already downloaded, optionally limiting downloads in a local directory to a date range.

A typical setup would be a periodic cron job or a Docker container running on a local server.

Features

  • Portable runtimes:
  • Smart: Only downloads recordings that haven't already been downloaded.
  • Resilient: If a download interrupts for whatever reason, the script resumes where it left off the next time it runs. This is especially useful for possibly unreliable Wi-Fi connections from a garage.
  • Hands-off: Optionally retains recordings for a set amount of time. Outdated recordings are automatically removed.
  • Cron-friendly: Only one process is allowed to run at any given time for a specific download destination.
  • Safe: Stops executing if the destination disk is almost full.
  • Friendly error reporting: Communicates a range of known error conditions with sensible verbosity.

Prerequisites

Software

  • Python 3.9+ or Docker.
  • Sufficient disk space on a file system local to the script. Plan for about 5GB/hr per camera.
  • BlackVue Viewer or a media player to view the recordings.

Hardware

A cloud-enabled BlackVue dashcam must be connected via Wi-Fi to the local network with a static IP address.

The dashcam must be kept powered for some time after the vehicle is turned off. BlackVue offers hardwiring kits and batteries.

The camera should stay active for a period sufficiently long for recordings to be downloaded. Consult the dashcam manual for the bit rate for your chosen image quality, and compare it with the download speed reported by BlackVue Sync.

Example with a DR750S-2CH recording with two cameras at the highest quality setting and a good but conservative download speed:

# dashcam bitrates
dashcam_bitrate_front = 12Mbps
dashcam_bitrate_back = 10Mbps
dashcam_bitrate = dashcam_bitrate_front + dashcam_bitrate_back

download_speed = 20Mbps

# hours on the timer for every hour of recording
ratio = dashcam_bitrate / download_speed => 1.1

Verifying Connectivity

For illustration purposes, all examples assume that the camera is reachable at the dashcam.example.net address. A static numeric IP address works just as well.

A quick way to verify that the dashcam is online is by using curl.

$ curl http://dashcam.example.net/blackvue_vod.cgi
v:1.00
n:/Record/20181026_135003_PF.mp4,s:1000000
n:/Record/20181026_140658_PF.mp4,s:1000000
n:/Record/20181026_140953_PF.mp4,s:1000000
...
$

Another way is by browsing to: http://dashcam.example.net/blackvue_vod.cgi.

Usage

Installation

BlackVue Sync is a single script, and can be obtained in a number of ways:

  • uv: Run with uvx blackvuesync <args>, or install with uv tool install blackvuesync and run with blackvuesync <args>.
  • Pip: Install with pip install blackvuesync and run with blackvuesync <args>.
  • Direct: Download from GitHub, save to the desired location, and either run it with python3 blackvuesync.py <args>, or mark it executable and run it with blackvuesync.py <args>.
  • Docker Hub: The Docker image can be pulled with docker pull acolomba/blackvuesync.

The interactive instructions assume a uv or Pip installation.

Manual Usage

The dashcam address is the only required parameter. The --dry-run option makes it so that the script communicates what it would do without actually doing anything. Example:

blackvuesync dashcam.example.net --dry-run

It's also possible to specify a destination directory other than the current directory with --destination:

blackvuesync dashcam.example.net --destination /data/dashcam --dry-run

A retention period can be indicated with the --keep option. Recordings prior to the retention period will be removed from the destination directory. Accepted units are d for days and w for weeks. If no unit is indicated, days are assumed.

blackvuesync dashcam.example.net --destination /data/dashcam --keep 2w --dry-run

A typical invocation would be:

blackvuesync dashcam.example.net --destination /data/dashcam --keep 2w

Other options:

  • --grouping: Groups downloaded recordings in directories according to different schemes. Grouping speeds up loading recordings in the BlackVue Viewer app. The supported groupings are:
    • daily: By day, e.g. 2018-10-26;
    • weekly: By week, with the directory indicating the date of that week's monday, e.g. 2018-10-22;
    • monthly: By month, e.g. 2018-10;
    • yearly: By year, e.g. 2018;
    • none: No grouping, the default.
  • --priority: Downloads recordings with different priorities: date downloads oldest to newest; rdate downloads newest to oldest; type downloads manual, event (all types), normal and (non-event) parking recordings in that order. Defaults to date.
  • --max-used-disk: Downloads stop once the specified used disk percentage threshold is reached. Defaults to 90 (i.e. 90%.)
  • --timeout: Sets a timeout for establishing a connection to the dashcam, in seconds. Defaults to 10.0 seconds.
  • --retry-failed-after: Sets the minimum elapsed time before retrying a failed download. Accepted units are s for seconds, h for hours, d for days and w for weeks. If no unit is indicated, days are assumed. Defaults to 1d.
  • --skip-metadata: Skips downloading metadata file types. Takes a string of characters: t for thumbnail (.thm), 3 for accelerometer (.3gf)1, g for GPS (.gps). For example, --skip-metadata t3g skips all metadata files, downloading only the .mp4 video recordings.
  • --include: Downloads only recordings matching the given codes. Each code is a recording type letter optionally followed by a camera direction letter, comma-separated. For example, --include P,NF downloads all Parking recordings and Normal Front recordings. See the table below for valid codes.
  • --exclude: Excludes recordings matching the given codes, same format as --include. Takes priority over --include. For example, --include N,E --exclude NR downloads all Normal and Event recordings except Normal Rear.
  • --quiet: Quiets down output messages, except for unexpected errors. Takes precedence over --verbose.
  • --verbose: Increases verbosity. Can be specified multiple times to indicate additional verbosity.
  • --log-format: Sets log output format. Supported values are text and json; defaults to text.
  • --metrics-file: Writes Prometheus text format metrics to the given path.
  • --metrics-pushgateway-url: Pushes Prometheus text format metrics to the given Pushgateway URL.
  • --metrics-job: Sets the Pushgateway job grouping value. Defaults to blackvuesync.
  • --metrics-instance: Sets the Pushgateway instance grouping value. Defaults to the dashcam address.
  • --metrics-state-file: Persists cross-run metrics state at the given path. Defaults to .blackvuesync.metrics-state.json under the destination when metrics are enabled.

Recording type and direction codes

Recording type codes:

Code Type
N Normal
E Event
P Parking
M Manual
I Impact
O Overspeed
A Acceleration
T Cornering
B Braking
R Geofence (R)
X Geofence (X)
G Geofence (G)
D DMS (D)
L DMS (L)
Y DMS (Y)
F DMS (F)

Direction codes:

Code Direction
F Front
R Rear
I Interior
O Optional

Unattended Usage

Plain cron

The script can run periodically by setting up a cron job on UNIX systems.

Simple example with crontab for a hypothetical media user:

*/15 * * * * /home/media/bin/blackvuesync.py dashcam.example.net --keep 2w --destination /data/dashcam --cron

The --cron option changes the logging level with the assumption that the output may be emailed. When this option is enabled, the script only produces logs when it downloads recordings and when it encounters unexpected errors. One would typically see an email only after driving or when something goes wrong.

Note that if the dashcam is unreachable for whatever reason, in --cron mode no output is generated, since this is an expected condition whenever the dashcam is away from the local network.

If cron jobs overlap, the script recognizes that another instance is currently running via a lock file on the destination directory. For the lock to work correctly, the destination directory must be on a local filesystem relative to the script.

Prometheus metrics

BlackVueSync can emit Prometheus text format metrics at the end of each run. For a host or Docker setup, write a metrics file that can be collected by node_exporter's textfile collector:

blackvuesync dashcam.example.net --destination /data/dashcam --cron --metrics-file /var/lib/node_exporter/textfile_collector/blackvuesync.prom

For Kubernetes CronJob-style deployments, push the same metrics payload to a Pushgateway:

blackvuesync dashcam.example.net --destination /data/dashcam --cron --metrics-pushgateway-url http://pushgateway.monitoring.svc:9091

Metrics are opt-in. When enabled, BlackVueSync persists the last successful file pull timestamp in .blackvuesync.metrics-state.json under the destination unless --metrics-state-file is set. Metrics delivery failures are logged as warnings and do not replace the sync exit result. Run-level failures such as dashcam index timeouts are exposed through blackvuesync_last_run_failure{reason="..."}. Per-file failures are exposed through blackvuesync_file_download_failures_last_run{reason="..."}.

Useful alert expressions include:

blackvuesync_last_run_success == 0
blackvuesync_last_run_failure{reason=~"network|timeout"} == 1
time() - blackvuesync_last_run_timestamp_seconds > 3600
time() - blackvuesync_last_successful_file_pull_timestamp_seconds > 86400
sum(max_over_time(blackvuesync_file_download_failures_last_run[1h])) > 0

NAS

Many NAS systems allow running commands periodically at set intervals.

openmediavault

The openmediavault NAS solution allows running scheduled jobs with support for mail notifications.

Example:

openmediavault Scheduled Job

Docker

Overview

The acolomba/blackvuesync docker image sets up a cron job internal to the container that runs the synchronization operation every 15 minutes.

Quick Start

It's a good idea to do a single, interactive dry run first with verbose logging:

docker run -it --rm \
    -e ADDRESS=dashcam.example.net \
    -v $PWD:/recordings \
    -e DRY_RUN=1 \
    -e VERBOSE=1 \
    -e RUN_ONCE=1 \
    --name blackvuesync \
acolomba/blackvuesync

Once that works, a typical invocation would be similar to:

docker run -d --restart unless-stopped \
    -v /data/dashcam:/recordings \
    -e ADDRESS=dashcam.example.net \
    -e PUID=$(id -u) \
    -e PGID=$(id -g) \
    -e TZ="America/New_York" \
    -e KEEP=2w \
    --name blackvuesync \
acolomba/blackvuesync
Docker Compose

Docker Compose may offer an easier, more repeatable and extensible option for running a BlackVueSync Docker container.

After downloading the Docker Compose file and editing its values as desired, BlackVueSync can be started with:

docker-compose up -d

OR, depending on the Docker version:

docker compose up -d
Reference

These options are required for the docker image to operate correctly:

  • The /recordings volume mapped to the desired destination of the downloaded recordings.
  • The ADDRESS parameter set to the dashcam address.
  • The PUID and PGID parameters set to the desired destination directory's user id and group id.
  • The TZ parameter set to the same timezone as the dashcam. Note that BlackVue dashcams do not respect Daylight Savings Time, so their clock needs to be adjusted periodically.

Other parameters:

  • GROUPING: Groups downloaded recordings in directories, daily, weekly, monthly, yearly and none are supported. (Default: none.)
  • KEEP: Sets the retention period of downloaded recordings. Recordings prior to the retention period will be removed from the destination. Accepted units are d for days and w for weeks. If no unit is indicated, days are assumed. (Default: empty, meaning recordings are kept forever.)
  • PRIORITY: Sets the priority to download recordings. Pick date to download from oldest to newest; pick rdate to download from newset to oldest; pick type to download manual, event (all types), normal and (non-event) parking recordings in that order. Defaults to date.
  • MAX_USED_DISK: If set to a percentage value, stops downloading if the amount of used disk space exceeds the indicated percentage value. (Default: 90, i.e. 90%.)
  • TIMEOUT: If set to a float value, sets the timeout in seconds for connecting to the dashcam. (Default: 10.0 seconds.)
  • RETRY_FAILED_AFTER: If set, sets the minimum elapsed time before retrying a failed download. Accepted units are s for seconds, h for hours, d for days and w for weeks. If no unit is indicated, days are assumed. (Default: 1d.)
  • VERBOSE: If set to a number greater than zero, increases logging verbosity. (Default: 0.)
  • SKIP_METADATA: If set, skips downloading the indicated metadata file types. Takes a string of characters: t for thumbnail (.thm), 3 for accelerometer (.3gf)1, g for GPS (.gps). For example, t3g skips all metadata files. (Default: empty.)
  • INCLUDE: If set, downloads only recordings matching the given codes. Each code is a recording type letter optionally followed by a camera direction letter, comma-separated. For example, P,NF downloads all Parking recordings and Normal Front recordings. (Default: empty, meaning all recordings are downloaded.)
  • EXCLUDE: If set, excludes recordings matching the given codes, same format as INCLUDE. Takes priority over INCLUDE. For example, setting INCLUDE=N and EXCLUDE=NR downloads all Normal recordings except Normal Rear. (Default: empty.)
  • QUIET: If set to any value, quiets down logs: only unexpected errors will be logged. (Default: empty.)
  • LOG_FORMAT: If set, changes log output format. Supported values are text and json. (Default: empty, meaning text.)
  • METRICS_FILE: If set, writes Prometheus text format metrics to this path. (Default: empty.)
  • METRICS_PUSHGATEWAY_URL: If set, pushes Prometheus text format metrics to this Pushgateway URL. (Default: empty.)
  • METRICS_JOB: Sets the Pushgateway job grouping value. (Default: blackvuesync.)
  • METRICS_INSTANCE: Sets the Pushgateway instance grouping value. (Default: empty, meaning the dashcam address.)
  • METRICS_STATE_FILE: If set, stores cross-run metrics state at this path. (Default: empty, meaning .blackvuesync.metrics-state.json under the destination when metrics are enabled.)
  • CRON: Set by default, makes it so downloads of normal recordings and unexpected error conditions are logged. Can be set to "" to disable.
  • DRY_RUN: If set to any value, makes it so that the script communicates what it would do without actually doing anything. (Default: empty.)
  • RUN_ONCE: If set to any value, the docker image runs the sync operation once and exits without setting up the cron job. (Default: empty. Not supported in Docker Compose.)

License

This project is licensed under the MIT License - see the COPYING file for details

Copyright 2018-2026 Alessandro Colomba

Footnotes

  1. In firmware V1.009+, accelerometer data is embedded in the video recordings and no separate .3gf file exists, so the 3 flag has no effect. ↩ ↩2

Metadata

Release files for blackvuesync 2.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for blackvuesync 2.2.0
File Size Uploaded Provenance Actions
blackvuesync-2.2.0.tar.gz 27.7 kB With provenance Details for blackvuesync-2.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for blackvuesync 2.2.0
File Interpreter ABI Platform Actions
blackvuesync-2.2.0-py3-none-any.whl Python 3 none any Details for blackvuesync-2.2.0-py3-none-any.whl

Total release size: 53.9 kB

Release files / blackvuesync-2.2.0.tar.gz

Download URL blackvuesync-2.2.0.tar.gz
Size 27.7 kB
Tags Source
SHA-256 checksum
How to use checksums
d98c4cef037b3f1b7f8d693bc3847ec6b94c6a8dc64bb6c5b3016d8d300dc07a
BLAKE2b-256 checksum
How to use checksums
f7eeb51b8f1542e7147300367f8892635524d7cfaf97f9923e6c52701e01b682
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 3, 2026.

Transparency log

Release files / blackvuesync-2.2.0-py3-none-any.whl

Download URL blackvuesync-2.2.0-py3-none-any.whl
Size 26.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f9b32f7d90ba63c1ccb73e70c2004995cb83206594e87e13717fa5a8f98bbbf4
BLAKE2b-256 checksum
How to use checksums
5d5b579059655d77bfc9b834049ac13d8245a973e292d14fad8ecd6a0a3e8a68
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 3, 2026.

Transparency log

Security for blackvuesync 2.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for blackvuesync-2.2.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 3, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page