Skip to content

Media: upload, process and publish

10 min reading

A design separating object storage, processing states and playback versions

Page details

System Design · Compose complete systems

10 min reading · 25 min with practice

Sources

Published · Last edited:

Prerequisite: Payments with uncertain external outcomes. For basics, use the independent System Design foundations.

More
20px

Hypothetical scenario. Northwind’s trainer finishes uploading a recorded lesson. Dev marks it published, but Priya opens a player whose required rendition or playlist is not ready. A processing retry could repeat the same mistake with a different incomplete set of assets.

Dev: “The durable source object is present.”

Maya: “Which complete presentation can the viewer actually play?”

Define publication as a coherent version containing its required assets, separately from upload acceptance and processing progress. Captions and selected playback qualities belong to this declared case. Its duration and bitrate inputs are illustrative; payment and feed demand are not inherited.

The design separates upload acceptance, validated source, processing, publication and delivery. The initial product is on-demand recorded video with captions and a small set of renditions. Live broadcasting, recommendation training, advertising insertion and rights-management implementation are excluded. Those can change the architecture substantially.

Define readiness as a versioned presentation whose required assets are validated and accessible under the reader's permission. An uploaded byte count is useful evidence at one stage, but cannot establish that the video decodes or that its captions match.

Which completed state may the viewer rely on?

Media processing can outlive one request or worker. It consumes CPU, temporary storage and object bandwidth, and can fail after creating some outputs. Retrying an entire job without identity can create conflicting presentations or overwrite a newer edit.

Object writes and metadata transactions have separate boundaries. A database row can become visible before referenced objects exist, while objects can remain orphaned after metadata fails. Design both publication and cleanup rather than assuming a directory listing is the authoritative catalogue.

Playback also has an independent resource profile. A small number of uploaded lessons can generate large sustained egress. Separating processing from delivery protects readers from a transcoding backlog, but only if they do not share an unbounded bottleneck.

Publish a complete presentation version

Assign an upload identity and preserve the original object version. Validation checks the supported media shape and records the processing specification. Workers produce rendition assets under a job and output version, then verify the required outputs before an atomic metadata transition makes that presentation available.

Media publication follows validation of versioned assetsAn uploaded original enters processing. Renditions and captions are validated before a presentation pointer is published. Playback reads that complete version through an authorized delivery path.Original versionProcess + verify assetspublish version pointerAuthorized playlistand segmentsFailed partial outputs remain unpublished and recoverable.

RFC 8216 describes HTTP Live Streaming playlists, segments and variant presentation. It is an informational specification describing its protocol version, not a guarantee of every current player feature. A client can select among available variants under its implementation and network conditions.

The metadata pointer identifies one complete presentation. An edit produces another version rather than mutating assets that existing players may be fetching. Retire old assets only after the declared cache and playback-retention policy permits it.

Publish a complete versioned media manifest

Hypothetical scenario. Upload U12 names immutable input I12. Processing jobs produce rendition objects bound to I12 and a declared recipe version. A presentation manifest M12 names only verified complete outputs; a conditional current pointer selects M12 for playback. Completing a multipart upload is not the same as publishing the presentation.

Publish a complete versioned media manifest — selected design evidence
RecordExample fieldsReady condition
Upload U12input I12, checksum, stateVerified source bytes
Rendition jobI12, recipe, output identityVerified complete output
Manifest M12source revision, rendition referencesAll required assets ready
Current presentationexpected predecessor, M12Conditional desired-version match
The pointer exposes one coherent manifest whose referenced outputs have already been verified.The pointer exposes one coherent manifest whose referenced outputs have already been verified. Upload I12 to Encode / verify: immutable source; Encode / verify to Manifest M12: complete rendition refs; Manifest M12 to Playback: selected published pointer.Upload I12Encode / verifyManifest M12Playbackimmutable sourcecomplete rendition refsselected published pointer
The pointer exposes one coherent manifest whose referenced outputs have already been verified. Enlarge the diagram to inspect its labels; the surrounding records and explanation give the text alternative.

The upload interface returns intent and transfer state. The publish interface checks desired source version, output completeness and permission. Playback returns the selected manifest and authorized object references. HLS playlists describe available media representations; the application's manifest lifecycle decides which coherent presentation a user may obtain.

Choose processing strategy using resource cost as well as elapsed wait. Eagerly producing every rendition spends compute and temporary storage for assets that may never be watched. Delaying work can increase first-view latency and complicate completeness. Keep retry outputs immutable and reusable by verified input/recipe identity; do not let a stale job replace the current presentation after an edit.

Calculate duration, bitrate and delivery work

Hypothetical scenario. Choose a ten-minute lesson:10 × 60 = 600 seconds. At a chosen encoded bitrate of 2 megabits per second, media payload is 600 × 2 = 1,200 megabits; dividing by eight gives 150 megabytes. Container, audio choices and protocol overhead are excluded.

Choose three renditions at 1,2 and 4 megabits per second over the same duration. Their combined nominal rate is 1 +2 +4 = 7 megabits per second. Combined payload is 600 × 7 ÷ 8 = 525 MB. This is rendition payload, not a claim that the original has that size or that a real encoder maintains an exact constant rate.

With chosen six-second segments,600 ÷ 6 = 100 segments per rendition and 3 × 100 = 300 segment objects across the selected renditions, before captions, initialization objects and playlists. Shorter segments change request frequency and buffering behavior; they are not a free latency improvement.

Make upload acceptance inspectable

An upload intent records the owner, object identity, supported size policy and desired processing specification. Multipart transfer can retry parts under its storage contract. Completion still needs the selected integrity and format checks before the source becomes eligible for processing. A user-supplied content-type label cannot establish that the file decodes.

Assign processing identity from the accepted input version and output specification. Repeated attempts then produce recognizable outputs for the same intended presentation. Store outputs under versioned identities rather than overwriting segments that an existing player may still request. PostgreSQL owns the publication pointer; object storage owns the referenced bytes.

In the wild: protocols separate transfer and presentation

Amazon S3’s multipart-upload documentation describes object transfer and completion. RFC 8216 describes its version of HLS playlists and segments. These are different boundaries: a completed object upload does not establish a playable presentation.

A playlist references unfinished output

Hypothetical failure scenario. A processing worker writes the first rendition’s playlist, updates the lesson pointer and crashes before the required segments and captions finish. Individual writes succeeded, but the now-public presentation is incomplete. Retrying another worker without version checks can also mix assets from different edits.

Verify the complete required asset set and source identity before the guarded publication transition. Keep failed partial output unpublished and recoverable. The worker’s progress record distinguishes completed outputs, outstanding verification and an obsolete desired revision. A successful job process is not automatically authority to become current.

Keep the first publication contract narrow

Start with recorded media, a small declared rendition set and a versioned on-demand workflow. Exclude live broadcasting until its latency, sliding-window and failure requirements are specified. A queue can buffer processing, but its acceptance response must not imply that playback is ready.

Decide which assets are required for publication and how accessibility alternatives follow the same revision. Captions from an old edit can be semantically wrong even when the file exists. A manifest’s internal references and the current-presentation pointer need one coherent version story.

Playback eligibility also needs a reader contract. Private training segments must not become public merely because a CDN can cache them. Define scoped access, cache reuse and retirement of prior presentations before exposing download addresses. The next lesson tests older jobs, processing backlog and cold delivery demand.

Challenge the proposed mechanism

Publication is later than byte upload and later than individual processing success.Publication is later than byte upload and later than individual processing success. Uploaded input to Verified outputs: recipe-bound processing; Verified outputs to Published manifest: all required references complete.Uploaded inputVerified outputsPublished manifestrecipe-bound processingall required references complete
Publication is later than byte upload and later than individual processing success. Enlarge the diagram to inspect its labels; the surrounding records and explanation give the text alternative.

Encoding succeeds for two of three required renditions. May the service publish a manifest naming all three?

Reveal the design reasoning

No. Publish only the contractually complete set or a clearly permitted partial presentation. Verify every referenced asset and desired version before moving the pointer. A job status alone cannot prove object readiness.

Decision and reconsideration: Publish immutable, version-bound manifests through one conditional pointer. Separate upload acceptance, processing and playback readiness.

Defend publication readiness

  1. Object upload is complete. May the lesson be labeled ready?

    Identify the remaining stages

    Not from upload evidence alone. Validate the source, produce and verify required assets, then publish the authorized complete version.

  2. All three rendition playlists exist. Does that prove complete playback?

    Inspect referenced assets

    No. Required segments, initialization data and captions must match the intended version and remain accessible under the delivery policy.

  3. A worker retries processing after restart. Should it overwrite current segment names?

    Preserve presentation identity

    Use the accepted input and output-specification identity with versioned outputs. Publishing a current pointer is a separate guarded decision; overwriting active assets can mix presentations.

A coherent baseline presentation can still be superseded by a corrected upload. Page 50 follows old and new processing attempts while keeping encoding demand separate from a cold-cache playback surge.

Northwind decision log

Separate durable source upload from verified playable publication.
Bind all required assets to one input and presentation version.
Next, protect publication during retries, edits and delivery bursts.

Go deeper: encoded streams and validation