Networkingencodingvideo encodingffmpeg

Transcoding

Definition

Transcoding decodes a media file and re-encodes it with a different codec, resolution, bitrate or container, producing the renditions a streaming service delivers.

In practice

Uploaded videos arrive in many formats and must become a standard ladder of renditions, cut into segments for adaptive streaming. Transcoding is CPU or GPU heavy and slow, so it runs asynchronously: the upload enqueues tasks per rendition and per chunk, and a pool of workers scales on queue backlog. Splitting a video into chunks lets many workers encode one file in parallel.

Codec choice trades compute for bandwidth: newer codecs such as AV1 cut file size noticeably but take far longer to encode than H.264, so services often encode popular videos with them and keep older codecs for the long tail and older devices. Workers must be idempotent, since a crashed task will be retried.

Example

A 20-minute upload is split into 60 chunks; 4 renditions give 240 tasks, and 120 workers finish them in a few minutes instead of over an hour on one machine.