Skip to content

Commit 401b962

Browse files
authored
video_process command to handle timelapse videos
2 parents 7a9df77 + 13cf7ef commit 401b962

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

mapillary_tools/sample_video.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,14 @@ def _sample_single_video_by_distance(
354354
f"interpolated time {interp.time} should match the video sample time {video_sample.exact_composition_time}"
355355
)
356356

357-
timestamp = start_time + datetime.timedelta(seconds=interp.time)
357+
# Try to use GPS epoch time if available (for timelapse videos)
358+
gps_epoch_time = interp.get_gps_epoch_time()
359+
if gps_epoch_time is not None:
360+
timestamp = datetime.datetime.fromtimestamp(
361+
gps_epoch_time, tz=datetime.timezone.utc
362+
)
363+
else:
364+
timestamp = start_time + datetime.timedelta(seconds=interp.time)
358365
exif_edit = ExifEdit(sample_paths[0])
359366
exif_edit.add_date_time_original(timestamp)
360367
exif_edit.add_gps_datetime(timestamp)

0 commit comments

Comments
 (0)