Bringing Recordings to Spotify Live Rooms
Spotify Live gives creators a low-friction way to host live audio conversations with fans, but the ephemerality of those rooms has been a limit. Creators who wanted to repurpose their live content for later listening previously had to rely on their own recordings—lower quality, missing voices, or manual syncing of multiple tracks. Spotify Live now lets creators record a room natively and later receive a distributable file. The audio is captured by an invisible listener, processed into a single file, and delivered to the host.
Starting a Room and Kicking Off the Recording
A creator starts a room as usual, then selects the recording option and supplies an email address for delivery of the finished file. From that point, the room creation call flows through several services:
- The room microservice receives the creation request and streams an event through Google Pub/Sub.
- The Recording service, a dedicated microservice listening for room lifecycle messages, picks up the creation event and stores the room metadata.
- The Recording service then sends a start request to the cloud recording API for the room’s audio.
The start request is a standard HTTP call, as shown in the snippet below. The body includes details about the channel, stream type, and storage configuration.
The cloud recording API acts as the room's listener, joining it in a way that is invisible to actual participants. Raw audio is streamed into a storage bucket in .ts segments, each corresponding to a time interval. An accompanying .m3u8 playlist file records the sequence of those segments.
Live audio layers are imperfect, though. Intermittent connectivity hiccups with the host can corrupt a recording, and there have been cases where a room's capture contained only one speaker’s audio. The Recording service now taps callbacks from the real-time audio service to react when something changes. If the real-time audio in a room stops and restarts, the recording routine restarts immediately to avoid gaps and track loss.
Ending the Room and Building the Final File
Figure 2
The ending process begins when clients hit the endpoint to end a room. That message lands in Pub/Sub, the Recording service acknowledges it, and a sequence of events follows:
- The cloud recording API is instructed to remove the listener and finalize all audio files.
- The Recording service downloads the
.tsand.m3u8files, verifying that every segment listed in the playlist has been retrieved. FFmpegstitches the audio segments in the correct order. At this stage, the service also runs a few cleanup steps: discarding corrupted packets, removing silence from the start, stripping any video information, and tagging the file with a unique room identifier.- The final
.mp4is uploaded to S3, and a link to the file is emailed to the host.
The room IDs stored in the file metadata are encrypted before being embedded, which the service does by encrypting a room ID with its metadata encryption key and then base64-encoding both the resulting data and the IV for inclusion in an FFmpeg metadata tag.
encryptedMetadata, iv: = encryptRoomID(service.metadataEncryptionKey, RoomId)
base64IV: = base64.StdEncoding.EncodeToString(iv)
base64Metadata: = base64.StdEncoding.EncodeToString(encryptedMetadata)
args: = [] string {
"-i", inputFile,
// Discard Corrupted packets
"-fflags",
"+discardcorrupt",
// Strip off an silence at the beginning of the track
"-af",
"silenceremove=start_periods=1:start_duration=0.01:start_threshold=0.01",
// Don't include video information
"-vn",
"-movflags",
"+use_metadata_tags",
"-metadata",
fmt.Sprintf("comment=greenRoom:%s:%s", base64IV, base64Metadata),
finalOutputFile,
}
ffmpegScript: = exec.Command("ffmpeg", args...)
err: = ffmpegScript.Run()
if err != nil {
service.logger.LogError(ctx, "ffmpeg error stripping silence: " + err.Error())
return
}
Work remains in the form of optional intros and outros, which can be added to the recording at this step. The service will accommodate creators who want to brand or frame their live captures.
With the ability to record and redistribute live conversations, Spotify Live gives creators an easy path to repurpose rooms as podcasts. The engineering focus, beyond building the capture pipeline, has been on making sure the feature survives the messiness of real-time audio. Tooling that keeps recordings intact through interruptions—combined with the subsequent assembly into a shareable file—makes that possible.



