FFmpeg Tee Muxer vs Tee Protocol Explained

In FFmpeg, both the tee muxer and the tee protocol are used to send a single input stream to multiple outputs simultaneously, but they operate at different stages of the media processing pipeline. The fundamental difference lies in the level at which the stream splitting occurs: the tee muxer duplicates data at the packet level before container encapsulation, allowing for different output formats, whereas the tee protocol duplicates the final, fully-muxed byte stream at the I/O layer to identical destinations. Understanding this distinction is crucial for optimizing streaming workflows and resource utilization.

The tee Muxer

The tee muxer operates at the muxing level of FFmpeg. It receives encoded audio and video packets and duplicates them, sending the copies to multiple separate muxers. Because it splits the stream before containerization, you can write to different output formats and apply different muxer-specific options to each destination.

The tee Protocol

The tee protocol operates at the network and file I/O layer, which is much lower in the pipeline than the muxer. It takes a single, fully encapsulated byte stream from a single muxer and replicates those exact bytes to multiple destinations.

Summary of Differences

Feature tee Muxer tee Protocol
Pipeline Level Muxer / Container Level I/O / Protocol Level
Output Formats Can be different (e.g., FLV and MP4) Must be identical (e.g., UDP and UDP)
Configuration High (per-output muxer options) Low (identical byte replication)
CPU Overhead Slightly higher due to multiple muxing processes Extremely low, as muxing happens only once