Python CLI for embedding DJI drone telemetry from SRT logs into MP4 videos
Project description
DJI Drone Metadata Embedder
A Python tool to embed telemetry data from DJI drone SRT files into MP4 video files. This tool extracts GPS coordinates, altitude, camera settings and other telemetry data from SRT files and embeds them as metadata in the corresponding video files.
Production Ready ✅
All major milestones (M1-M4) completed! The tool features comprehensive documentation, professional CLI, automated testing, and supports major DJI drone models. Future releases focus on new model support and community enhancements.
See the Development Roadmap for plans to expand this CLI tool into a Windows application with a graphical interface. For detailed setup instructions and a quick-start tutorial, see docs/installation.md and docs/user_guide.md. Common problems are covered in docs/troubleshooting.md. Answers to frequently asked questions can be found in the FAQ.
Easy Windows install
Option 1: Windows Package Manager (Recommended)
winget install dji-embed
Option 2: Bootstrap Script (Includes FFmpeg/ExifTool)
iwr -useb https://raw.githubusercontent.com/CallMarcus/dji-drone-metadata-embedder/master/tools/bootstrap.ps1 | iex
Option 3: Direct Download
Download the ready-to-run dji-embed.exe from the GitHub Releases page.
Option 4: Python Package
pip install dji-drone-metadata-embedder
macOS / Linux quick-start
brew install ffmpeg exiftool
sudo apt update && sudo apt install ffmpeg exiftool
pip install dji-drone-metadata-embedder
docker run --rm -v "$PWD":/data callmarcus/dji-embed -i *.MP4
Advanced
- Build from source with
pip install -r requirements.txt - Use the provided
Dockerfilefor custom images - Review CI scripts under
.github/workflows
Features
- Batch Processing: Process entire directories of DJI drone footage automatically
- GPS Metadata Embedding: Embed GPS coordinates as standard metadata tags
- Subtitle Track Preservation: Keep telemetry data as subtitle track for overlay viewing
- Multiple Format Support: Handles different DJI SRT telemetry formats
- Telemetry Export: Export flight data to JSON, GPX, or CSV formats
- DAT Flight Log Support: Merge
.DATflight logs into metadata - Cross-Platform: Works on Windows, macOS, and Linux
- Progress Bar: See processing status while videos are being embedded
Supported DJI Models
Fully Tested & Documented (with sample fixtures):
- DJI Mini 3/4 Pro - Square bracket format
[latitude: xx.xxx] [longitude: xx.xxx] - DJI Air 3 - HTML-style format with extended telemetry data
- DJI Avata 2 - Legacy GPS format
GPS(lat,lon,alt)with BAROMETER data - DJI Mavic 3 Enterprise - Extended format with RTK precision data
Community Supported:
- DJI Air 2S, Mavic 3, and other models using similar SRT formats
- See troubleshooting guide for model-specific issues
New model support welcomed! See Contributing Guide.
Requirements
- Python 3.10 or higher
- FFmpeg
- ExifTool (optional, for additional metadata embedding)
Usage
If the command python is not recognized, use py instead.
Basic Usage
Process a single directory:
dji-embed embed /path/to/drone/footage
Commands
dji-embed [OPTIONS] COMMAND [ARGS]...
Commands:
embed Embed telemetry from SRT files into MP4 videos
check Check media files for embedded metadata
convert Convert SRT telemetry to GPX or CSV
doctor Show system information and verify dependencies
wizard Launch interactive setup wizard
gui Launch graphical interface (placeholder)
init Perform initial setup (placeholder)
Global Options:
--version Show the version and exit
-h, --help Show this message and exit
Embed Command Options
dji-embed embed [OPTIONS] DIRECTORY
Arguments:
DIRECTORY Directory containing MP4 and SRT files
Options:
-o, --output DIRECTORY Output directory
--exiftool Also use ExifTool for GPS metadata
--dat PATH DAT flight log to merge
--dat-auto Auto-detect DAT logs matching videos
--redact [none|drop|fuzz] Redact GPS coordinates (default: none)
-v, --verbose Verbose output
-q, --quiet Suppress progress output
By default, processing shows a progress bar for each file.
Use --verbose for detailed output or --quiet to reduce messages.
Examples
Process footage with custom output directory:
dji-embed embed "D:\DroneFootage\Flight1" -o "D:\ProcessedVideos"
Process with ExifTool for additional metadata:
dji-embed embed "D:\DroneFootage\Flight1" --exiftool
Check existing metadata in files:
dji-embed check "D:\DroneFootage\Flight1"
Run system diagnostics:
dji-embed doctor
Convert Telemetry to Other Formats
Extract GPS track to GPX:
dji-embed convert gpx DJI_0001.SRT
Export telemetry to CSV:
dji-embed convert csv DJI_0001.SRT -o telemetry.csv
Batch convert directory to GPX:
dji-embed convert gpx /path/to/srt/files --batch
Batch convert directory to CSV:
dji-embed convert csv /path/to/srt/files --batch
Check Existing Metadata
You can check if your videos or photos already contain GPS or altitude information using the check command:
dji-embed check DJI_0001.MP4
dji-embed check /path/to/footage
See docs/METADATA_CHECKER.md for details.
CLI Reference
All Commands
dji-embed embed - Process Videos
Embed telemetry from SRT files into MP4 videos.
dji-embed embed [OPTIONS] DIRECTORY
Arguments:
DIRECTORY Directory containing MP4 and SRT files
Options:
-o, --output DIRECTORY Output directory
--exiftool Also use ExifTool for GPS metadata
--dat PATH DAT flight log to merge
--dat-auto Auto-detect DAT logs matching videos
--redact [none|drop|fuzz] Redact GPS coordinates (default: none)
-v, --verbose Verbose output
-q, --quiet Suppress progress output
dji-embed check - Check Metadata
Check media files for existing embedded metadata.
dji-embed check [OPTIONS] [PATHS]...
Arguments:
PATHS... Files or directories to check
Options:
-v, --verbose Verbose output
-q, --quiet Suppress info output
dji-embed convert - Export Formats
Convert SRT telemetry to GPX or CSV formats.
dji-embed convert [OPTIONS] {gpx|csv} INPUT
Arguments:
{gpx|csv} Output format (GPX or CSV)
INPUT SRT file or directory to convert
Options:
-o, --output PATH Output file path
-b, --batch Batch process directory
-v, --verbose Verbose output
-q, --quiet Suppress info output
dji-embed doctor - System Diagnostics
Show system information and verify all dependencies.
dji-embed doctor
No arguments or options required.
dji-embed wizard - Interactive Setup
Launch interactive setup wizard (under development).
dji-embed wizard
No arguments or options required.
Output
The tool creates a processed subdirectory containing:
*_metadata.MP4- Video files with embedded metadata and telemetry subtitles*_telemetry.json- Flight summary with GPS data, altitude, and camera settings
Example JSON output:
{
"filename": "DJI_0158.MP4",
"first_gps": [59.302335, 18.203059],
"average_gps": [59.302336, 18.203058],
"max_altitude": 132.86,
"max_relative_altitude": 1.5,
"flight_duration": "00:00:00 - 00:00:32",
"num_gps_points": 967,
"camera_settings": {
"iso": "2700",
"shutter": "1/30.0",
"fnum": "170"
},
"location": "Stockholm, Sweden"
}
How It Works
- SRT Parsing: Extracts telemetry data from DJI SRT subtitle files
- Metadata Embedding: Uses FFmpeg to:
- Add SRT as subtitle track (preserves all telemetry)
- Embed GPS coordinates in video metadata
- Add altitude and other metadata tags
- No Re-encoding: Uses stream copy for fast processing without quality loss
- Summary Generation: Creates JSON files with flight statistics
SRT Format Support
The tool supports multiple DJI SRT formats:
Format 1 (DJI Mini 3 Pro):
[latitude: 59.302335] [longitude: 18.203059] [rel_alt: 1.300 abs_alt: 132.860]
Format 2 (Older models):
GPS(59.302335,18.203059,132.860)
Use Cases
- Photo Management: Videos become searchable by location in Windows Photos, Google Photos, etc.
- Video Editing: Telemetry subtitle track can be used for overlay effects
- Flight Analysis: Export GPX tracks for Google Earth visualization
- Archival: Preserve all flight data within the video file itself
Troubleshooting
See docs/troubleshooting.md for comprehensive troubleshooting.
Check tool versions
Display the application, FFmpeg and ExifTool versions:
dji-embed --version
Quick Fixes
"Python was not found"
Use py instead of python:
dji-embed doctor
"ffmpeg is not recognized"
Ensure FFmpeg is in your PATH. Test with:
ffmpeg -version
Note: ffmpeg uses a single dash. Using ffmpeg --version will result in Unrecognized option '--version'.
"Command not found: dji-embed"
If the command isn't found after installation:
python -m pip install --user dji-drone-metadata-embedder
# or
pipx install dji-drone-metadata-embedder
No GPS data in JSON output
- Check that your SRT files contain GPS coordinates:
dji-embed check /path/to/your/files
- Open an SRT file in a text editor to verify the format
- Run diagnostics to check for parsing issues:
dji-embed doctor
Processing fails with "No matching MP4/SRT pairs"
Ensure your files follow the naming convention:
- Video:
DJI_0001.MP4 - Subtitle:
DJI_0001.SRT
Permission errors on Windows
Run PowerShell as Administrator or use the bootstrap installer:
iwr -useb https://raw.githubusercontent.com/CallMarcus/dji-drone-metadata-embedder/master/tools/bootstrap.ps1 | iex
Contributing
Contributions are welcome! Please feel free to submit issues or pull requests.
Commit Message Format
This project uses Conventional Commits for automatic changelog generation:
feat(cli): add new validate command
fix(parser): handle malformed SRT timestamps
docs: update troubleshooting guide
See docs/CHANGELOG_AUTOMATION.md for detailed guidelines.
Adding Support for New Models
If your DJI model uses a different SRT format:
- Open an issue with a sample SRT file
- Or submit a PR with regex patterns for the new format
Release
See docs/RELEASE.md for instructions on publishing a new version.
License
MIT License - see LICENSE file for details
Acknowledgments
- Thanks to the DJI drone community for format documentation
- FFmpeg and ExifTool teams for their excellent tools
Related Projects
- exiftool - Read/write metadata in media files
- ffmpeg - Media processing framework
- gpx.py - GPX file parser (for further processing)
Disclaimer
This tool is not affiliated with or endorsed by DJI. Use at your own risk.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dji_drone_metadata_embedder-1.1.2.tar.gz.
File metadata
- Download URL: dji_drone_metadata_embedder-1.1.2.tar.gz
- Upload date:
- Size: 26.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
38b1320ec061bd23b21798c467889574efda1a05e951e6df905a1ae0621e1446
|
|
| MD5 |
e8abb3e6b0654784d21f274e0e1eee4c
|
|
| BLAKE2b-256 |
e92831009fbab368533fe824562ac74de7d2c250f3fa385d60b56370db4a8e59
|
Provenance
The following attestation bundles were made for dji_drone_metadata_embedder-1.1.2.tar.gz:
Publisher:
release-pypi.yml on CallMarcus/dji-drone-metadata-embedder
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dji_drone_metadata_embedder-1.1.2.tar.gz -
Subject digest:
38b1320ec061bd23b21798c467889574efda1a05e951e6df905a1ae0621e1446 - Sigstore transparency entry: 395063185
- Sigstore integration time:
-
Permalink:
CallMarcus/dji-drone-metadata-embedder@8dd7856deb189488da016a85af0c5a4c1293fc2a -
Branch / Tag:
refs/tags/v1.1.2 - Owner: https://github.com/CallMarcus
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-pypi.yml@8dd7856deb189488da016a85af0c5a4c1293fc2a -
Trigger Event:
push
-
Statement type:
File details
Details for the file dji_drone_metadata_embedder-1.1.2-py3-none-any.whl.
File metadata
- Download URL: dji_drone_metadata_embedder-1.1.2-py3-none-any.whl
- Upload date:
- Size: 33.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
adc138db39d8afe8a855b59ef5c72cdb68f6ac3bea1cc9b3f2eb9e9ee16b1f11
|
|
| MD5 |
8dc99248fc0b2e291e58dbca6a875eba
|
|
| BLAKE2b-256 |
0d7cb5d9c82b8e3362680c671c6dd570d27a94d35394f83570927bcfa0d78ae7
|
Provenance
The following attestation bundles were made for dji_drone_metadata_embedder-1.1.2-py3-none-any.whl:
Publisher:
release-pypi.yml on CallMarcus/dji-drone-metadata-embedder
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dji_drone_metadata_embedder-1.1.2-py3-none-any.whl -
Subject digest:
adc138db39d8afe8a855b59ef5c72cdb68f6ac3bea1cc9b3f2eb9e9ee16b1f11 - Sigstore transparency entry: 395063201
- Sigstore integration time:
-
Permalink:
CallMarcus/dji-drone-metadata-embedder@8dd7856deb189488da016a85af0c5a4c1293fc2a -
Branch / Tag:
refs/tags/v1.1.2 - Owner: https://github.com/CallMarcus
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-pypi.yml@8dd7856deb189488da016a85af0c5a4c1293fc2a -
Trigger Event:
push
-
Statement type: