dji-drone-metadata-embedder 1.0.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (20) hide show
  1. dji_drone_metadata_embedder-1.0.3/.gitignore +84 -0
  2. dji_drone_metadata_embedder-1.0.3/LICENSE +21 -0
  3. dji_drone_metadata_embedder-1.0.3/PKG-INFO +343 -0
  4. dji_drone_metadata_embedder-1.0.3/README.md +293 -0
  5. dji_drone_metadata_embedder-1.0.3/pyproject.toml +64 -0
  6. dji_drone_metadata_embedder-1.0.3/src/__init__.py +0 -0
  7. dji_drone_metadata_embedder-1.0.3/src/dji_metadata_embedder/__init__.py +23 -0
  8. dji_drone_metadata_embedder-1.0.3/src/dji_metadata_embedder/cli.py +128 -0
  9. dji_drone_metadata_embedder-1.0.3/src/dji_metadata_embedder/core/__init__.py +0 -0
  10. dji_drone_metadata_embedder-1.0.3/src/dji_metadata_embedder/core/processor.py +20 -0
  11. dji_drone_metadata_embedder-1.0.3/src/dji_metadata_embedder/core/validator.py +13 -0
  12. dji_drone_metadata_embedder-1.0.3/src/dji_metadata_embedder/dat_parser.py +36 -0
  13. dji_drone_metadata_embedder-1.0.3/src/dji_metadata_embedder/embedder.py +545 -0
  14. dji_drone_metadata_embedder-1.0.3/src/dji_metadata_embedder/metadata_check.py +129 -0
  15. dji_drone_metadata_embedder-1.0.3/src/dji_metadata_embedder/per_frame_embedder.py +53 -0
  16. dji_drone_metadata_embedder-1.0.3/src/dji_metadata_embedder/telemetry_converter.py +299 -0
  17. dji_drone_metadata_embedder-1.0.3/src/dji_metadata_embedder/utilities.py +120 -0
  18. dji_drone_metadata_embedder-1.0.3/src/dji_metadata_embedder/utils/__init__.py +0 -0
  19. dji_drone_metadata_embedder-1.0.3/src/dji_metadata_embedder/utils/dependency_manager.py +127 -0
  20. dji_drone_metadata_embedder-1.0.3/src/dji_metadata_embedder/utils/system_info.py +71 -0
@@ -0,0 +1,84 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ *.egg-info/
24
+ .installed.cfg
25
+ *.egg
26
+ MANIFEST
27
+
28
+ # PyInstaller
29
+ *.manifest
30
+ *.spec
31
+
32
+ # Installer logs
33
+ pip-log.txt
34
+ pip-delete-this-directory.txt
35
+
36
+ # Virtual environments
37
+ venv/
38
+ ENV/
39
+ env/
40
+ .venv
41
+
42
+ # IDEs
43
+ .vscode/
44
+ .idea/
45
+ *.swp
46
+ *.swo
47
+ *~
48
+ .DS_Store
49
+
50
+ # Project specific
51
+ processed/
52
+ output/
53
+ *.MP4
54
+ *.mp4
55
+ *.MOV
56
+ *.mov
57
+ *.avi
58
+ *.AVI
59
+ *.SRT
60
+ *.srt
61
+ *.gpx
62
+ *.GPX
63
+
64
+ # Keep example files
65
+ !examples/*.SRT
66
+ !examples/*.srt
67
+
68
+ # Temporary files
69
+ *.tmp
70
+ *.temp
71
+ *.log
72
+
73
+ # OS specific
74
+ Thumbs.db
75
+ desktop.ini
76
+ .DS_Store
77
+ ._*
78
+
79
+ # Test files
80
+ test/
81
+ !tests/
82
+
83
+ # MkDocs build output
84
+ site/
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 DJI Drone Metadata Embedder Contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,343 @@
1
+ Metadata-Version: 2.4
2
+ Name: dji-drone-metadata-embedder
3
+ Version: 1.0.3
4
+ Summary: Python CLI for embedding DJI drone telemetry from SRT logs into MP4 videos
5
+ Project-URL: Homepage, https://github.com/CallMarcus/dji-drone-metadata-embedder
6
+ Project-URL: Issues, https://github.com/CallMarcus/dji-drone-metadata-embedder/issues
7
+ Project-URL: Repository, https://github.com/CallMarcus/dji-drone-metadata-embedder.git
8
+ Author-email: "Marcus W." <marcus.westermark@altal.fi>
9
+ License: MIT License
10
+
11
+ Copyright (c) 2024 DJI Drone Metadata Embedder Contributors
12
+
13
+ Permission is hereby granted, free of charge, to any person obtaining a copy
14
+ of this software and associated documentation files (the "Software"), to deal
15
+ in the Software without restriction, including without limitation the rights
16
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
17
+ copies of the Software, and to permit persons to whom the Software is
18
+ furnished to do so, subject to the following conditions:
19
+
20
+ The above copyright notice and this permission notice shall be included in all
21
+ copies or substantial portions of the Software.
22
+
23
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
24
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
26
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
28
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
29
+ SOFTWARE.
30
+ License-File: LICENSE
31
+ Keywords: dji,drone,gps,metadata,srt,telemetry,video
32
+ Classifier: Development Status :: 4 - Beta
33
+ Classifier: Intended Audience :: End Users/Desktop
34
+ Classifier: License :: OSI Approved :: MIT License
35
+ Classifier: Programming Language :: Python :: 3
36
+ Classifier: Programming Language :: Python :: 3.10
37
+ Classifier: Programming Language :: Python :: 3.11
38
+ Classifier: Programming Language :: Python :: 3.12
39
+ Classifier: Topic :: Multimedia :: Video
40
+ Classifier: Topic :: Scientific/Engineering :: GIS
41
+ Requires-Python: >=3.10
42
+ Requires-Dist: click>=8.0.0
43
+ Requires-Dist: rich>=10.0.0
44
+ Provides-Extra: dev
45
+ Requires-Dist: black; extra == 'dev'
46
+ Requires-Dist: mypy; extra == 'dev'
47
+ Requires-Dist: pytest>=6.0; extra == 'dev'
48
+ Requires-Dist: ruff; extra == 'dev'
49
+ Description-Content-Type: text/markdown
50
+
51
+ # DJI Drone Metadata Embedder
52
+
53
+ [![Winget]][winget]
54
+ [![GitHub Release]][release]
55
+ [![PyPI]][pypi]
56
+
57
+ A Python tool to embed telemetry data from DJI drone SRT files into MP4 video files.
58
+ This tool extracts GPS coordinates, altitude, camera settings and other telemetry data from SRT files and embeds
59
+ them as metadata in the corresponding video files.
60
+
61
+ See the [Development Roadmap](docs/development_roadmap.md) for plans to expand this CLI tool into a Windows
62
+ application with a graphical interface.
63
+ For detailed setup instructions and a quick-start tutorial, see
64
+ [docs/installation.md](docs/installation.md) and [docs/user_guide.md](docs/user_guide.md).
65
+ Common problems are covered in [docs/troubleshooting.md](docs/troubleshooting.md).
66
+ Answers to frequently asked questions can be found in the [FAQ](docs/faq.md).
67
+
68
+ ## Easy Windows install
69
+
70
+ ```powershell
71
+ iwr -useb https://raw.githubusercontent.com/CallMarcus/dji-drone-metadata-embedder/master/tools/bootstrap.ps1 | iex
72
+ ```
73
+
74
+ ```powershell
75
+ winget install -e --id CallMarcus.DJI-Embed
76
+ ```
77
+
78
+ If winget reports **"No package found"**, the package is still pending publication. Use the PowerShell one-liner above instead.
79
+
80
+ You can also download a ready-to-run **dji-embed.exe** from the [GitHub Releases page](https://github.com/CallMarcus/dji-drone-metadata-embedder/releases) if `winget` is unavailable.
81
+
82
+ ### Windows – manual path
83
+
84
+ ```powershell
85
+ winget install -e --id Python.Python.3
86
+ winget install -e --id Gyan.FFmpeg
87
+ winget install -e --id PhilHarvey.ExifTool
88
+ pip install dji-metadata-embedder
89
+ ```
90
+
91
+ ## macOS / Linux quick-start
92
+
93
+ ```bash
94
+ brew install ffmpeg exiftool
95
+ sudo apt update && sudo apt install ffmpeg exiftool
96
+ pip install dji-drone-metadata-embedder
97
+ ```
98
+
99
+ ```bash
100
+ docker run --rm -v "$PWD":/data callmarcus/dji-embed -i *.MP4
101
+ ```
102
+
103
+ <details>
104
+ <summary>Advanced</summary>
105
+
106
+ - Build from source with `pip install -r requirements.txt`
107
+ - Use the provided `Dockerfile` for custom images
108
+ - Review CI scripts under `.github/workflows`
109
+
110
+ </details>
111
+
112
+
113
+ ## Features
114
+
115
+ - **Batch Processing**: Process entire directories of DJI drone footage automatically
116
+ - **GPS Metadata Embedding**: Embed GPS coordinates as standard metadata tags
117
+ - **Subtitle Track Preservation**: Keep telemetry data as subtitle track for overlay viewing
118
+ - **Multiple Format Support**: Handles different DJI SRT telemetry formats
119
+ - **Telemetry Export**: Export flight data to JSON, GPX, or CSV formats
120
+ - **DAT Flight Log Support**: Merge `.DAT` flight logs into metadata
121
+ - **Cross-Platform**: Works on Windows, macOS, and Linux
122
+ - **Progress Bar**: See processing status while videos are being embedded
123
+
124
+ ## Supported DJI Models
125
+
126
+ The tool has been tested with:
127
+ - DJI Mini 3 Pro
128
+ - DJI Mini 4 Pro
129
+ - DJI Mavic 3
130
+ - DJI Air 2S
131
+ - Other models using similar SRT formats
132
+
133
+ ## Requirements
134
+
135
+ - Python 3.6 or higher
136
+ - FFmpeg
137
+ - ExifTool (optional, for additional metadata embedding)
138
+
139
+ ## Usage
140
+
141
+ If the command `python` is not recognized, use `py` instead.
142
+
143
+ ### Basic Usage
144
+
145
+ Process a single directory:
146
+ ```bash
147
+ dji-embed /path/to/drone/footage
148
+ ```
149
+
150
+ ### Options
151
+
152
+ ```bash
153
+ dji-embed [OPTIONS] [DIRECTORY]
154
+
155
+ Arguments:
156
+ DIRECTORY Directory containing MP4 and SRT files
157
+
158
+ Options:
159
+ -o, --output Output directory (default: ./processed)
160
+ --exiftool Also use ExifTool for GPS metadata
161
+ --check Only check dependencies
162
+ --doctor Show system information and dependency status
163
+ --dat FILE Merge specified DAT flight log
164
+ --dat-auto Auto-detect DAT logs matching videos
165
+ --redact MODE Redact GPS data (none, drop, fuzz)
166
+ --verbose Show detailed progress
167
+ --quiet Suppress progress bar and most output
168
+ ```
169
+
170
+ By default, processing shows a progress bar for each file.
171
+ Use `--verbose` for detailed output or `--quiet` to reduce messages.
172
+ The `--doctor` option does not require a directory argument.
173
+
174
+ ### Examples
175
+
176
+ Process footage with custom output directory:
177
+ ```bash
178
+ dji-embed "D:\DroneFootage\Flight1" -o "D:\ProcessedVideos"
179
+ ```
180
+
181
+ Process with ExifTool for additional metadata:
182
+ ```bash
183
+ dji-embed "D:\DroneFootage\Flight1" --exiftool
184
+ ```
185
+
186
+ Check dependencies:
187
+ ```bash
188
+ dji-embed --check "D:\DroneFootage"
189
+ ```
190
+
191
+ Run the environment doctor:
192
+ ```bash
193
+ dji-embed --doctor
194
+ ```
195
+
196
+ ### Convert Telemetry to Other Formats
197
+
198
+ Extract GPS track to GPX:
199
+ ```bash
200
+ python -m dji_metadata_embedder.telemetry_converter gpx DJI_0001.SRT
201
+ ```
202
+
203
+ Export telemetry to CSV:
204
+ ```bash
205
+ python -m dji_metadata_embedder.telemetry_converter csv DJI_0001.SRT -o telemetry.csv
206
+ ```
207
+
208
+ Batch convert directory to GPX:
209
+ ```bash
210
+ python -m dji_metadata_embedder.telemetry_converter gpx /path/to/srt/files --batch
211
+ ```
212
+
213
+ Batch convert directory to CSV:
214
+ ```bash
215
+ python -m dji_metadata_embedder.telemetry_converter csv /path/to/srt/files --batch
216
+ ```
217
+
218
+ ### Check Existing Metadata
219
+
220
+ You can check if your videos or photos already contain GPS or altitude
221
+ information using the metadata checker script:
222
+
223
+ ```bash
224
+ python -m dji_metadata_embedder.metadata_check DJI_0001.MP4
225
+ python -m dji_metadata_embedder.metadata_check /path/to/footage
226
+ ```
227
+
228
+ See [docs/METADATA_CHECKER.md](docs/METADATA_CHECKER.md) for details.
229
+
230
+ ## Output
231
+
232
+ The tool creates a `processed` subdirectory containing:
233
+
234
+ - `*_metadata.MP4` - Video files with embedded metadata and telemetry subtitles
235
+ - `*_telemetry.json` - Flight summary with GPS data, altitude, and camera settings
236
+
237
+ Example JSON output:
238
+ ```json
239
+ {
240
+ "filename": "DJI_0158.MP4",
241
+ "first_gps": [59.302335, 18.203059],
242
+ "average_gps": [59.302336, 18.203058],
243
+ "max_altitude": 132.86,
244
+ "max_relative_altitude": 1.5,
245
+ "flight_duration": "00:00:00 - 00:00:32",
246
+ "num_gps_points": 967,
247
+ "camera_settings": {
248
+ "iso": "2700",
249
+ "shutter": "1/30.0",
250
+ "fnum": "170"
251
+ },
252
+ "location": "Stockholm, Sweden"
253
+ }
254
+ ```
255
+
256
+ ## How It Works
257
+
258
+ 1. **SRT Parsing**: Extracts telemetry data from DJI SRT subtitle files
259
+ 2. **Metadata Embedding**: Uses FFmpeg to:
260
+ - Add SRT as subtitle track (preserves all telemetry)
261
+ - Embed GPS coordinates in video metadata
262
+ - Add altitude and other metadata tags
263
+ 3. **No Re-encoding**: Uses stream copy for fast processing without quality loss
264
+ 4. **Summary Generation**: Creates JSON files with flight statistics
265
+
266
+ ## SRT Format Support
267
+
268
+ The tool supports multiple DJI SRT formats:
269
+
270
+ ### Format 1 (DJI Mini 3 Pro):
271
+ ```
272
+ [latitude: 59.302335] [longitude: 18.203059] [rel_alt: 1.300 abs_alt: 132.860]
273
+ ```
274
+
275
+ ### Format 2 (Older models):
276
+ ```
277
+ GPS(59.302335,18.203059,132.860)
278
+ ```
279
+
280
+ ## Use Cases
281
+
282
+ - **Photo Management**: Videos become searchable by location in Windows Photos, Google Photos, etc.
283
+ - **Video Editing**: Telemetry subtitle track can be used for overlay effects
284
+ - **Flight Analysis**: Export GPX tracks for Google Earth visualization
285
+ - **Archival**: Preserve all flight data within the video file itself
286
+
287
+ ## Troubleshooting
288
+
289
+ See [docs/troubleshooting.md](docs/troubleshooting.md) for additional tips.
290
+ ### "Python was not found"
291
+ Use `py` instead of `python`:
292
+ ```bash
293
+ dji-embed /path/to/footage
294
+ ```
295
+
296
+ ### "ffmpeg is not recognized"
297
+ Ensure FFmpeg is in your PATH. Test with:
298
+ ```bash
299
+ ffmpeg -version
300
+ ```
301
+
302
+ ### No GPS data in JSON
303
+ Check that your SRT files contain GPS coordinates. Open an SRT file to verify the format.
304
+
305
+ ## Contributing
306
+
307
+ Contributions are welcome! Please feel free to submit issues or pull requests.
308
+
309
+ ### Adding Support for New Models
310
+
311
+ If your DJI model uses a different SRT format:
312
+ 1. Open an issue with a sample SRT file
313
+ 2. Or submit a PR with regex patterns for the new format
314
+
315
+ ## Release
316
+
317
+ See [docs/RELEASE.md](docs/RELEASE.md) for instructions on publishing a new version.
318
+
319
+ ## License
320
+
321
+ MIT License - see LICENSE file for details
322
+
323
+ ## Acknowledgments
324
+
325
+ - Thanks to the DJI drone community for format documentation
326
+ - FFmpeg and ExifTool teams for their excellent tools
327
+
328
+ ## Related Projects
329
+
330
+ - [exiftool](https://exiftool.org/) - Read/write metadata in media files
331
+ - [ffmpeg](https://ffmpeg.org/) - Media processing framework
332
+ - [gpx.py](https://github.com/tkrajina/gpxpy) - GPX file parser (for further processing)
333
+
334
+ ## Disclaimer
335
+
336
+ This tool is not affiliated with or endorsed by DJI. Use at your own risk.
337
+
338
+ [Winget]: https://img.shields.io/badge/winget-CallMarcus.DJI--Embed-blue?logo=windows
339
+ [winget]: https://winget.run/pkg/CallMarcus/DJI-Embed
340
+ [GitHub Release]: https://img.shields.io/github/v/release/CallMarcus/dji-drone-metadata-embedder?logo=github
341
+ [release]: https://github.com/CallMarcus/dji-drone-metadata-embedder/releases
342
+ [PyPI]: https://img.shields.io/pypi/v/dji-drone-metadata-embedder?logo=pypi
343
+ [pypi]: https://pypi.org/project/dji-drone-metadata-embedder/