Skip to content

Upload a video in pieces, one sequence for each part of its track between gaps - #988

Merged
caglarpir merged 1 commit into
mapillary:mainfrom
caglarpir:upload-video-in-pieces
Dec 2, 2026
Merged

caglarpir merged 1 commit into
mapillary:mainfrom
caglarpir:upload-video-in-pieces

Conversation

@caglarpir

@caglarpir caglarpir commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

A video whose description has MAPGPSTrackGaps (#986) was uploaded as one sequence. Its frames in a gap, where the GPS was lost, were placed on a straight line across it, and the sequence was drawn with a line across the gap. It is now uploaded in pieces, one sequence for each part of the track between gaps.

  • Each piece is cut from the video at its sync samples (transform_mp4_cut, Add transform_mp4_cut to build the upload of a part of a video #985) and carries a CAMM track of its part. Nothing is re-encoded, each piece reads only its own samples, and the video in the gaps is not uploaded.
  • The video is uploaded whole, as before, if it can't be cut, which includes any error while cutting it. The same happens if its sync samples are so far apart that the pieces would upload more of it than all of it: when a gap is shorter than the time between two sync samples, the pieces would overlap, so the video is uploaded whole, with the line across the gap. The whole video is built only then.
  • process checks each part as it checks a video. A part that fails, such as a stationary one, or a part with a single point, is left out with a warning. The file size and timestamp checks stay on the whole video.
  • The upload history records each piece, and records the video once all its pieces are. An upload that stopped after some pieces uploads only the others the next time; a piece uploaded again would be a duplicate sequence. check_upload_history finds the video once all its pieces are uploaded.
  • --delete_after_upload (Add --delete_after_upload to delete files once their uploads finished #972) deletes a video uploaded in pieces only once all its pieces have finished in the run. If one fails, or is skipped as uploaded before, the video is kept. This doesn't depend on the upload history, which may be off. The last result comes once the video is closed, as Windows deletes no open file.
  • Each piece yields its own result, with video_piece_idx and video_piece_keys. The progress events of a piece carry video_piece_idx, video_piece_keys, and a sequence_md5sum of their own, and so does the upload_error event (Send each failed upload over IPC with its error #984) of a piece that fails. Its error_message names the piece, as the log does: video.mp4 (piece 2 of 2): ....
  • The upload summary counts such a video once: "1 video uploaded, as 2 sequences".

Example: a 52 s phone video with a 21.5 s gap between its two GPX segments.

  • It is now uploaded as two pieces, 127 kB and 112 kB, from a 405 kB file.
  • Locating the frames along each piece's track puts none in the gap. With one upload, 107 of the 242 frames were in the gap.

A video without gaps uploads byte for byte as on main.

…ween gaps

A video whose description has MAPGPSTrackGaps, where the GPS was lost,
was uploaded whole as one sequence. Its frames in a gap were placed on
the straight line across it, and the sequence was drawn with a line
across the gap.

Each part of the track between the gaps is now uploaded as a sequence of
its own: a piece of the video cut from the sync sample before the first
point of the part to the one after its last (transform_mp4_cut), with a
CAMM track of the part, timed from the start of the piece. Nothing is
encoded again, each piece reads only its own samples of the video, and
the video in the gaps is not uploaded. The video is uploaded whole, as
before, if it cannot be cut (such as when its video tracks have no sync
sample at the same time), or if its sync samples are so far apart that
the pieces would upload more of it than all of it. The whole video is
built only then.

process checks each part as it checks a video, and leaves out a part
that fails, such as a stationary one, or one with a single point, with a
warning: the gaps on either side of it become one. The video fails only
if no part passes. The file size and timestamp checks stay on the whole
video, and a video without gaps is checked as before.

The upload history records each piece on its own, by the fingerprint of
the video and the span of the part, and the video once all its pieces
are. An upload that stopped after some of the pieces uploads only the
others the next time, since a piece uploaded again would be a sequence
of its own again. check_upload_history finds the video once all its
pieces are uploaded.

--delete_after_upload deletes a video uploaded in pieces only once all
its pieces have finished in the run: one that fails, or is skipped as
uploaded before, keeps the video. Each piece yields its own result, with
its index and the keys of all the pieces; the last result comes once the video
is closed, as Windows deletes no open file.

The progress events of a piece carry video_piece_idx, video_piece_keys
and a sequence_md5sum of their own, and so does the upload_error event of
a piece that fails, whose message names the piece, as the log does. The upload summary counts a video
uploaded in pieces once, with the number of sequences it was uploaded as.
@caglarpir
caglarpir force-pushed the upload-video-in-pieces branch from 422c26f to f75ca4d Compare December 2, 2026 08:45
@caglarpir
caglarpir merged commit 75e1167 into mapillary:main Dec 2, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant