Crates.io | dji-log-parser |
lib.rs | dji-log-parser |
version | 0.5.4 |
source | src |
created_at | 2024-01-25 22:04:57.212195 |
updated_at | 2024-11-03 10:07:53.43293 |
description | Library for parsing DJI txt logs |
homepage | |
repository | https://github.com/lvauvillier/dji-log-parser |
max_upload_size | |
id | 1114593 |
size | 179,617 |
A library and CLI tool for parsing DJI txt logs with support for all log versions and encryptions.
Starting with version 13, log records are AES encrypted and require a specific keychain for decryption. This keychain must be obtained from DJI using their API. An apiKey is necessary to access the DJI API.
Once keychains are retrieved from DJI API, they can be stored along with the original log for further offline use.
To acquire an apiKey, follow these steps:
CREATE APP
, choose Open API
as the App Type, and provide the necessary details like App Name
, Category
, and Description
.Download binary from latest release
dji-log --api-key __DJI_API_KEY__ DJIFlightRecord.txt > frames.json
or with an output arg
dji-log --api-key __DJI_API_KEY__ --output frames.json DJIFlightRecord.txt
--raw
: Export raw records instead of normalized frames--images image%d.jpeg
: Extract embedded images--thumbnails thumbnail%d.jpeg
: Extract thumbnails--csv
: Generate a CSV file of frames--kml track.kml
: Generate a KML file of the flight track--geojson track.json
: Generate a GeoJSON file of the flight trackUse %d
in the images or thumbnails option to specify a sequence.
For a complete list of options, run:
dji-log --help
Initialize a DJILog
instance from a byte slice to access version information and metadata:
let parser = DJILog::from_bytes(bytes).unwrap();
General data are not encrypted and can be accessed from the parser for all log versions:
// Print the log version
println!("Version: {:?}", parser.version);
// Print the log details section
println!("Details: {}", parser.details);
For logs version 13 and later, keychains must be retrieved from the DJI API to decode the records:
// Replace `__DJI_API_KEY__` with your actual apiKey
let keychains = parser.fetch_keychains("__DJI_API_KEY__").unwrap();
Keychains can be retrieved once, serialized, and stored along with the log file for future offline use.
Decrypt frames based on the log file version.
A Frame
is a standardized representation of log data, normalized across different log versions.
It provides a consistent and easy-to-use format for analyzing and processing DJI log information.
For versions prior to 13:
let frames = parser.frames(None);
For version 13 and later:
let frames = parser.frames(Some(keychains));
Decrypt raw records based on the log file version. For versions prior to 13:
let records = parser.records(None);
For version 13 and later:
let records = parser.records(Some(keychains));
For more information, including a more detailed overview of the log format, visit the documentation.
dji-log-parser is available under the MIT license. See the LICENSE.txt file for more info.