Appearance
Media
Uploads go straight to storage through presigned multipart URLs; everything slow runs in the media container on the media-* queues. All routes are under /v1. Responses are { data, meta }; errors are Problem Details with the codes below.
Upload and assets (signed-in user)
| Method | Path | Body / query | Response | Errors |
|---|---|---|---|---|
| POST | /media/uploads | { profileId, kind: audio|video|image, purpose: recording_audio|music_video|lyric_video|visualizer|artwork|stem_source|other, fileName, contentType, byteSize, checksumSha256? } | 201 { assetId, partSizeBytes, partUrls[], expiresAt } | MEDIA_UPLOAD_TYPE_INVALID, MEDIA_UPLOAD_TOO_LARGE, MEDIA_ASSET_NOT_FOUND (profile not yours), RATE_LIMITED |
| POST | /media/uploads/:assetId/complete | { parts: [{ partNumber, etag }] } (every part, 1..n) | AssetView (status uploaded) | MEDIA_UPLOAD_NOT_PENDING, MEDIA_UPLOAD_INCOMPLETE |
| POST | /media/uploads/:assetId/abort | — | { status: "ok" } | MEDIA_UPLOAD_NOT_PENDING |
| GET | /media/assets | profileId, status?, kind?, cursor?, limit? | page of AssetView | MEDIA_ASSET_NOT_FOUND |
| GET | /media/assets/:assetId | — | AssetView | MEDIA_ASSET_NOT_FOUND |
| DELETE | /media/assets/:assetId | — | { status: "ok" } | MEDIA_INVALID_TRANSITION |
| GET | /media/assets/:assetId/events | — | [{ type, stage, progressPercent, occurredAt }] (newest first, 100) | MEDIA_ASSET_NOT_FOUND |
| GET | /media/assets/:assetId/waveform | — | { url } signed JSON { version, durationMs, buckets, peaks[] } | MEDIA_ASSET_NOT_FOUND |
| GET | /media/assets/:assetId/playback | tier=preview|full (default preview), quality (default aac_128) | application/vnd.apple.mpegurl media playlist | MEDIA_ASSET_NOT_READY, MEDIA_RENDITION_NOT_FOUND |
| GET | /media/assets/:assetId/key | — | raw 16-byte AES-128 key, no-store (owner check of their own stream) | MEDIA_CONTENT_KEY_NOT_FOUND |
| POST | /media/assets/:assetId/stems | — | 202 { status: "accepted" } | MEDIA_ASSET_NOT_READY, MEDIA_INVALID_TRANSITION |
| GET | /media/assets/:assetId/stems | — | [{ stem: vocals|drums|bass|other, url }] | MEDIA_ASSET_NOT_READY |
Access: the uploader, or anyone the canManageProfile port allows for the asset's profile. Everyone else gets MEDIA_ASSET_NOT_FOUND.
AssetView: id, profileId, kind, purpose, status (pending|uploaded|processing|ready|failed|cancelled|deleted), originalFileName, contentType, byteSize, durationMs, width, height, isLossless, sampleRateHz, bitDepth, loudnessIntegratedLufs, truePeakDbtp, previewStartMs, isPossibleDuplicate, failureCode, progressPercent, renditions[{ tier, kind, quality, status }], createdAt, readyAt.
Staff (catalog:moderate)
| Method | Path | Response | Errors |
|---|---|---|---|
| GET | /staff/media/assets/:assetId | AssetView | MEDIA_ASSET_NOT_FOUND |
| POST | /staff/media/assets/:assetId/reprocess | 202 | MEDIA_INVALID_TRANSITION |
Pipeline
| Queue | Job | Does |
|---|---|---|
media-ingest | media.ingest | download, SHA-256, ffprobe, SoX stats, validation, chromaprint, duplicate check (checksum, then fingerprint), plan renditions |
media-transcode | media.transcode (one per rendition) | AAC HLS 64/128/256, FLAC HLS (lossless masters), video 360/480/720/1080, 15 s previews (audio 128k, video ≤480p, unencrypted), waveform + EBU R128 loudness, artwork 3000…64 px |
media-analysis | media.analyse, media.stems | BPM, key, energy, danceability, valence, 128-d embedding; stems via external separator |
media-package | media.package | offline file (aac_256 m4a or flac), AES-128-CBC with the asset's content key |
media | media.maintenance (hourly) | next months' media_asset_events partitions; aborts uploads pending past MEDIA_UPLOAD_ABANDON_HOURS |
Full-tier HLS segments and init sections are AES-128 sealed with one key per asset; the playlist's EXT-X-KEY points at MEDIA_KEY_URL_TEMPLATE (served by playback, gated by entitlement and lease). Signed URLs live MEDIA_PLAYBACK_URL_TTL_SECONDS.
Storage layout: masters/<id>/original.<ext>, hls/<id>/<tier>/<quality>/<render>/…, artwork/<id>/<size>.jpg, waveform/<id>/peaks.json, stems/<id>/<stem>.flac, packages/<id>/<quality>.plmz.
Events
| Type | When |
|---|---|
media.asset.uploaded | multipart completed (starts ingest) |
media.asset.progress | every stage; relay to studio:<profileId> |
media.asset.ready / media.asset.failed | outcome |
media.asset.duplicate_detected | another owner's live asset matches |
media.asset.preview_changed | preview re-rendered from a new start |
media.analysis.completed, media.stems.ready, media.package.ready | derived outputs |
Module API additions
| Member | Purpose |
|---|---|
describeMasters(assetIds) | codec, container, bit depth, sample rate, channels, duration, byte size, SHA-256, bucket, key |
signedDownloadUrl(assetId, ttlSeconds, filename?) | { url, filename, expiresAt }; the storage port can't set Content-Disposition, so the name is returned beside the URL |
listStemAssets(recordingAssetId) | ready stems as rendition IDs by stem (vocals, drums, bass, other) |
importExternalAsset({ ownerProfileId, ownerUserId, kind, purpose?, contentType, fileName?, source: { sourceUrl } | { bucket, key } }) | creates a pending asset; media.import (queue media-ingest) copies it in, then the normal pipeline runs |
fingerprintMatches(assetId) | [{ assetId, ownerUserId, profileId, score, matchedBy: checksum|fingerprint|similar_fingerprint }], best first |
Account privacy
On identity.user.deleted: unfinished uploads (pending|uploaded|processing|failed|cancelled) become deleted and open multipart uploads are aborted. Ready assets stay (they may back catalogue) with originalFileName redacted and sourceUrl cleared. Data export section media: uploads.
Analysis and stems modes
| Variable | Values | Notes |
|---|---|---|
MEDIA_ANALYSER_MODE | native (default), command, fake | native: aubio tempo/onset for BPM and onset density, ffmpeg decodes a 60 s mono window (-f f32le, 22.05 kHz) for chroma + Krumhansl key, RMS loudness, energy/danceability/valence/acousticness heuristics, and a 128-d band-energy embedding (plemuz-bands-v1, heuristic, not learned). command runs an external analyser that prints the result JSON. Production refuses fake. |
MEDIA_AUBIO_PATH | default aubio | from aubio-tools in the media image |
MEDIA_STEMS_MODE | none (default), command, fake | none refuses stem requests with MEDIA_STEMS_DISABLED (409). command runs Demucs from the optional media-ml image via MEDIA_STEMS_COMMAND, e.g. demucs -n htdemucs -o {output} {input}. Production refuses fake, and requires the command when command is set. |
instrumentalness is null in native mode.