Skip to content

Fix SRT telemetry parsing for DJI videos - #2065

Merged
MJohnson459 merged 1 commit into
OpenDroneMap:masterfrom
MJohnson459:fix-srtparser
Aug 11, 2026
Merged

Fix SRT telemetry parsing for DJI videos#2065
MJohnson459 merged 1 commit into
OpenDroneMap:masterfrom
MJohnson459:fix-srtparser

Conversation

@MJohnson459

Copy link
Copy Markdown
Contributor

This started as a fix for #2063 but while attempting to test it I hit other bugs with the parsing.

We have one DJI dataset we use in oats. I'm not entirely sure which model was used but we also had some examples as comments in the parser.

I split out the "parsing" from the file loading to make it possible to transfer these all to tests. All of the tests bar one failed which was Phantom4 RTK.

The issue was two parts - firstly match_single defaults to ints but the "shutter speed" was a float (in all but the one test case) so it threw a ValueError. Next, was a bugged log warning which caused the parser to throw which eventually causes all SRT data to be silently dropped in video2dataset.

The fix was for the bug was

  shutter = match_single([
-                r"shutter : \d+/(\d+\.?\d*)",
-                r"SS (\d+\.?\d*)"
+                (r"shutter : \d+/(\d+\.?\d*)", float),
+                (r"SS (\d+\.?\d*)", float)
             ], line)

and

- log.ODM_WARNING("Cannot parse SRT line \"%s\": %s", (line, str(e)))
+ log.ODM_WARNING("Cannot parse SRT line \"%s\": %s" % (line, str(e)))

I also fixed the original issue in #2063 by adding the nonzero_float(v) function. The rest of the changes are restructuring so I could add the tests.

The zero-coordinate guard compared the regex match, a string, against the
integer 0, so it never fired and frames recorded before GPS lock parsed to
(0, 0) instead of None. Those positions entered the GPS track and were
interpolated against valid fixes.

Shutter speed was parsed with the default int transform, so a decimal
denominator such as "1/60.0" raised ValueError. The handler meant to report
that called ODM_WARNING with two positional arguments and raised TypeError
instead, aborting the parse. video2dataset catches the failure and drops the
parser, so an affected video silently lost its GPS and camera metadata. Of
the formats we claim to support only Phantom4 RTK survived, its "SS 60"
being the one without a decimal.

Split the block-reading loop out of parse() into parse_lines(), so parsing
no longer requires a file on disk, and move the sample of each supported
format out of a comment block and into a test that asserts what it parses
to. The formats had drifted: the layout the dji_video dataset uses was not
among them.
@MJohnson459
MJohnson459 merged commit 5167557 into OpenDroneMap:master Aug 11, 2026
2 checks passed
@MJohnson459
MJohnson459 deleted the fix-srtparser branch August 11, 2026 16:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SRT parser: zero-coordinate filter never fires (string compared to 0), so pre-GPS-lock frames get (0,0) positions

2 participants