Skip to content

byrdsandbytes/beatnik-icecast-bridge

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Beatnik Icecast Bridge

A "Silent Bridge" that pipes raw audio data from a Snapcast client directly into an Icecast MP3 stream using a headless Docker container. This setup requires no virtual sound cards or host drivers.

Overview

  • Input: Connects to a Snapserver as a client.
  • Processing: Pipes raw PCM audio from snapclient directly to ffmpeg.
  • Output: Encodes audio to MP3 and streams it to an Icecast server.

Prerequisites

  • Docker and Docker Compose installed.
  • Access to a running Snapserver.

Setup

  1. Clone the repository:

    git clone https://github.com/byrdsandbytes/beatnik-icecast-bridge
    cd beatnik-icecast-bridge
  2. Configure Environment Variables: A .env file is used to store your configuration. The repository includes a template, but you should create/verify your own:

    # .env
    SNAPSERVER_IP=192.168.1.50
    
    # Icecast Configuration
    ICECAST_SOURCE_PASSWORD=hackme
    ICECAST_ADMIN_PASSWORD=hackme
    ICECAST_PASSWORD=hackme
    ICECAST_RELAY_PASSWORD=hackme
    
    # Internal URL for the bridge to connect to Icecast
    ICECAST_URL=icecast://source:hackme@icecast:8000/stream
    
    # Cloudflare Tunnel Configuration (Optional)
    TUNNEL_TOKEN=your_cloudflare_tunnel_token
    • SNAPSERVER_IP: The IP address of your Snapserver.
    • ICECAST_URL: The full URL to stream to the internal Icecast server.
    • ICECAST_*_PASSWORD: Passwords for the Icecast server.
    • TUNNEL_TOKEN: Your Cloudflare Zero Trust tunnel token (if exposing via Cloudflare).

Usage

  1. Build and Run: Use Docker Compose to build the image and start the containers (bridge + icecast) in the background.

    docker compose up -d --build
  2. Access Stream: The Icecast server will be available on port 8010 (to avoid conflicts with other services).

    • Stream URL: http://<your-pi-ip>:8010/stream
    • Admin Panel: http://<your-pi-ip>:8010/admin/
  3. View Logs: Check the logs to ensure the connection is established and audio is streaming.

    docker compose logs -f
  4. Stop: To stop the bridge:

    docker compose down

Expose via Cloudflare Tunnel (Optional)

You can securely expose your Icecast stream to the internet using Cloudflare Zero Trust without opening any firewall ports.

For a comprehensive, step-by-step tutorial on setting up your Cloudflare account, creating a tunnel, and extracting your TUNNEL_TOKEN, please see the Cloudflare Setup Guide.

wrapper script

The audio pipeline logic is contained in start.sh:

#!/bin/sh
snapclient -h $SNAPSERVER_IP --logsink stderr --player file | \
ffmpeg -f s16le -ar 48000 -ac 2 -i pipe:0 \
-af "alimiter=limit=0.99" \
-codec:a libmp3lame -b:a 128k -content_type audio/mpeg \
-f mp3 $ICECAST_URL

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors