How to Stream Audio to Shoutcast with FFmpeg

This article provides a quick guide on how to stream live audio to a Shoutcast server using FFmpeg with secure authentication. You will learn how to configure your FFmpeg command, format the connection URL with your credentials, and execute the stream to ensure a stable and secure broadcast to your Shoutcast directory.

Understanding Shoutcast Authentication in FFmpeg

Shoutcast servers rely on the ICY (SHOUTcast/Icecast) protocol for source connections. To connect securely, you must pass your stream credentials directly within the output URL.

For Shoutcast v2, the connection URL requires a username (typically source), a password, the server address, the port, and the stream ID (mountpoint).

The standard URL format is: icy://username:password@server_address:port/streamid

If your Shoutcast server only requires a password (common in Shoutcast v1 legacy mode), the format is: icy://:password@server_address:port


Step 1: Identify Your Audio Source

Before running FFmpeg, identify the audio source you want to stream.


Step 2: Construct the FFmpeg Command

To stream a local audio file to a Shoutcast server using secure MP3 encoding, use the following command template:

ffmpeg -re -i input.mp3 -acodec libmp3lame -b:a 128k -ac 2 -ar 44100 -f mp3 "icy://source:your_password@your_server_ip:port/1"

Command Breakdown:


Step 3: Stream from a Live Microphone (Optional)

If you are broadcasting a live microphone instead of an audio file, replace the input parameter.

On Windows:

ffmpeg -f dshow -i audio="Microphone Name" -acodec libmp3lame -b:a 128k -ac 2 -ar 44100 -f mp3 "icy://source:your_password@your_server_ip:port/1"

On Linux:

ffmpeg -f alsa -i hw:0 -acodec libmp3lame -b:a 128k -ac 2 -ar 44100 -f mp3 "icy://source:your_password@your_server_ip:port/1"

Step 4: Verify the Connection

Once you run the command, FFmpeg will begin encoding and displaying the frame rate and bitrate statistics in your terminal. Check your Shoutcast Admin Panel to verify that the stream status has changed to “Active” and that your listeners can hear the audio.