Skip to content

Software to turn a Raspberry Pi into a production grade audio encoder

License

Notifications You must be signed in to change notification settings

oszuidwest/rpi-audio-encoder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

99 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rpi-audio-encoder

This repository contains the audio streaming software for ZuidWest FM in the Netherlands. The setup involves a Raspberry Pi 4 or 5 and a HiFiBerry Digi+ I/O for audio input. The system uses FFmpeg as an encoder, integrated with Supervisor for process management via a web interface. It supports audio streaming to a SRT server.

The encoder, stationed in the studio, connects to the digital output of an Orban Optimod, enabling streaming to any SRT server. Companion server software to complete the audio stack is available in this repository.

Raspberry Pi and SRT logo

Preparing the Raspberry Pi

  • Install Ubuntu Server 22.04 LTS 64-bit or Raspbian 12 64-bit.
  • Follow the guide at https://www.hifiberry.com/docs/software/configuring-linux-3-18-x/ for HiFiBerry setup.
  • Gain root access with sudo su.
  • Download and execute the install script using /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/oszuidwest/rpi-encoder/main/install.sh)".

⚠️ Note: A significant issue exists with kernel versions 6.0 - 6.5 when recording from a HiFiBerry using FFmpeg. Linux distributions with kernel 6.0 to 6.5 are incompatible. We highly recommend Ubuntu 22.04 Server LTS with kernel 5.15 or Raspbian 12 with kernel 6.6 or newer.

Post installation clean-up

  • You probably don't need WiFi. Disable it by adding dtoverlay=disable-wifi to /boot/firmware/config.txt
  • You probably don't need tools for Thunderbolt, Bluetooth, NTFS, Remote Syslogs and Telnet. Remove them with apt remove bolt bluez ntfs-3g rsyslog telnet

On Ubuntu 22.04:

  • You probably don't need LXD for managing containerized applications and virtual machines. Remove it with snap remove lxd
  • You can speed-up booting by removing optional: true from eth0 in /etc/netplan/50-cloud-init.yaml.

Configuring the Audio Processor

  • Connect the digital output of the audio processor to the HiFiBerry's input.
  • Ensure the processor outputs 48kHz 16-bit audio, as the HiFiBerry does not support resampling. This setting is hardcoded.
  • Preferably, set the digital output to transmit SPDIF data. Although AES/EBU might work, it is not identically standardized.

Example for an Orban Optimod:

Audio Encoding Presets

Included audio encoding presets:

  • mp2: Streams MPEG-1 Audio Layer II audio at 384 kbit/s, regarded as the benchmark for compressed broadcast audio.
  • mp3: Streams MPEG-1 Audio Layer III audio at 320 kbit/s, the highest mp3 quality achievable.
  • ogg: Streams OGG Vorbis audio at 500 kbit/s, the highest quality for ogg/vorbis.
  • wav: Streams uncompressed 16-bit Little Endian audio, the pinnacle of uncompressed audio quality.

Icecast Support

Icecast support was removed in version 2.0. SRT has been thoroughly evaluated for reliability. Version 1.1 with support for Icecast is still available for download.

Additional information on SRT: