Skip to content

Upload a video larger than 32 GiB in pieces, which Mapillary can process - #995

Open
caglarpir wants to merge 1 commit into
mapillary:mainfrom
caglarpir:max-video-piece-size
Open

caglarpir wants to merge 1 commit into
mapillary:mainfrom
caglarpir:max-video-piece-size

Conversation

@caglarpir

Copy link
Copy Markdown
Contributor

The upload service stores an upload in chunks of 20 MB, and Mapillary keeps the handle of each chunk, about 210 bytes, with the sequence. A video of about 100 GB, which process allows (MAX_SEQUENCE_FILESIZE is 110 GiB), has a handle of over 1 MB, and its sequence is then too large to be stored with the positions of its frames: the video uploads, but fails to process on Mapillary.

A video whose upload would be larger than MAPILLARY_TOOLS_MAX_VIDEO_UPLOAD_SIZE (32 GiB) is now uploaded in pieces of about equal length, as a video with gaps in its track is (#988): each piece is cut at sync samples, from the one before its first point to the one after its last (transform_mp4_cut), with the CAMM track of its points, and is a sequence of its own. So is a part of a track between gaps whose piece would be larger. A piece that is still larger, such as where the bitrate is higher, is split again. Nothing is encoded again.

  • A video that cannot be cut, or whose sync samples are so far apart that its pieces would upload a tenth more than it, is uploaded whole, as before, with a warning.
  • A video file larger than the limit whose upload is not (the upload leaves out audio) is uploaded whole.
  • The upload history records each piece by its span, as for gaps, so an interrupted upload resumes with the pieces not uploaded.
  • INF turns it off.

At 32 GiB the handle of a piece is at most about 370 kB, which leaves most of the room for the positions of its frames.

Test plan

  • New unit tests in tests/unit/test_upload_video_pieces.py: pieces of about equal length, parts between gaps split further, whole when the upload (without audio) is no larger, whole when the sync samples are too far apart, no limit, and resume from the upload history. Doctests for _split_part.
  • pytest tests/unit (2224 passed), pytest tests/integration with the executable (141 passed), ruff check, ruff format --check, usort diff, mypy mapillary_tools tests/cli.
  • Synthetic 3-hour 30 fps video (324k samples): planning the pieces takes about 8 s.

The upload service stores an upload in chunks of 20 MB, and Mapillary
keeps the handle of each chunk, about 210 bytes, with the sequence. A
video of about 100 GB, which process allows (MAX_SEQUENCE_FILESIZE is
110 GiB), has a handle of over 1 MB, and its sequence is then too large
to be stored with the positions of its frames: the video uploads, but
fails to process on Mapillary.

A video whose upload would be larger than MAX_VIDEO_UPLOAD_SIZE (32 GiB,
MAPILLARY_TOOLS_MAX_VIDEO_UPLOAD_SIZE) is now uploaded in pieces of about
equal length, as a video with gaps in its track is: each piece is cut
from the video from the sync sample before its first point to the one
after its last (transform_mp4_cut), with the CAMM track of its points,
and is a sequence of its own. So is a part of a track between gaps whose
piece would be larger. A piece that is still larger, such as where the
bitrate is higher, is split again. Nothing is encoded again. The video
between the last point of a piece and the first point of the next one
may be in neither.

A video that cannot be cut, or whose sync samples are so far apart that
its pieces would upload a tenth more than it, is uploaded whole, as
before, with a warning. A video file larger than the limit whose upload
is not, as it leaves out the audio, is uploaded whole too.

The upload history records each piece by its span, as for a video with
gaps: an upload that stopped after some of the pieces uploads only the
others the next time, with the same limit.

At 32 GiB, the handle of a piece is at most about 370 kB, which leaves
most of the room for the positions of its frames.
@meta-cla meta-cla Bot added the cla signed label Dec 4, 2026
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