Stream Stereo as Two Mono RTP Streams with FFmpeg

This guide explains how to use FFmpeg to split a stereo audio input and broadcast it as two separate, independent mono RTP (Real-time Transport Protocol) streams. You will learn the exact command-line syntax, how the audio filtergraph separates the channels, and how to configure the destination ports for receiver playback.

The FFmpeg Command

To split a stereo source and stream it to two different RTP destinations, use the following command:

ffmpeg -i input.mp3 -filter_complex "[0:a]channelsplit=channel_layout=stereo[left][right]" \
-map "[left]" -c:a pcm_s16be -f rtp rtp://127.0.0.1:5004 \
-map "[right]" -c:a pcm_s16be -f rtp rtp://127.0.0.1:5006

Command Breakdown

Accessing the Streams (SDP Files)

RTP streams require a Session Description Protocol (SDP) file for receivers (like VLC or FFplay) to understand the audio encoding and port mapping.

FFmpeg displays the SDP configuration in the console output when you run the command. To capture and save these configurations directly to files for your players, add the -sdp_file option:

ffmpeg -i input.mp3 -filter_complex "[0:a]channelsplit=channel_layout=stereo[left][right]" \
-map "[left]" -c:a pcm_s16be -f rtp -sdp_file left.sdp rtp://127.0.0.1:5004 \
-map "[right]" -c:a pcm_s16be -f rtp -sdp_file right.sdp rtp://127.0.0.1:5006

Receivers can then play the independent mono streams by opening the generated left.sdp or right.sdp files.