📜 ⬆️ ⬇️

Broadcast AAC stream using Icecast2 and streamTranscoder

Recently, I had the task of broadcasting a radio stream and a stream of an online podcast broadcast, in AAC (Advanced Audio Coding) format. This format is more economical than MP3, and at the same time allows you to maintain an acceptable sound quality. Subjectively, 48Kbps AAC is no different from 64Kbps MP3. In this brief note I will describe how I set up simultaneous broadcasting in MP3 formats 128Kbps, MP3 64Kbps and AAC 48Kbps. At the same time, I used the OpenSource-tool streamTranscoderv3, about which, for some reason, there was not a word on the habr. The principle of operation of streamTranscoder is shown in the figure. Further, how to collect and use it.

First of all, let's checkout the source of this program:
# svn co svn.oddsock.org/public/trunk/streamTranscoderv3

To build these sources, I needed to install the following packages (I have a server on Ubuntu 10.04):
# apt-get install automake libtool libmad0-dev libflac-dev libfaac-dev

In order to build successfully, I had to finish the files in the source package a little.
1. Added a line to the Makefile.am:
ACLOCAL_AMFLAGS = -I m4 

2. Uncommented the line in configure.in
 AC_PROG_CXX 

3. For the utility to be compiled with AAC support, I had to add another line to the configure.in file:
  AC_DEFINE(HAVE_FAAC,1) 

just before the line
  FAAC_CFLAGS 

4. For the correct assembly, I had to specify another such “crutch”:
 LIBFLAC_LIBDIR=. ./autogen.sh 

After compilation we get the streamTranscoderv3 binary, which we put, for example, in / opt / streamtranscoder.
# mkdir -p / opt / streamTranscoder
# mv streamTranscoderv3 / opt / streamTranscoder
# cd / opt / streamTranscoder
# ./streamTranscoderv3

The first launch of the binary will create a streamTranscoder_0.cfg config in the current directory, in which you will need to specify the parameters of the source stream. We edit to approximately this state:
 # The source URL for the broadcast. It must be in the form http://server:port/mountpoint. For those servers without a mountpoint (Shoutcast) use http://server:port. SourceURL=http://127.0.0.1:1976/apple AutomaticReconnectSecs=10 AutoConnect=1 # Log Level 1 = LOG_ERROR, 2 = LOG_ERROR+LOG_INFO, 3 = LOG_ERROR+LOG_INFO+LOG_DEBUG LogLevel=2 # Log File LogFile=streamTranscoder # Number of encoders to use NumEncoders=2 

The SourceURL parameter points to a source stream that already exists. In addition to the other more or less clear parameters, we also specified the parameter NumEncoders = 2, which means that we will form two additional streams (in our case, 64Kbps MP3 and 48Kbps AAC).
By running the binary again, we get the encoders' configs, in our case streamTranscoder_1.cfg and streamTranscoder_2.cfg . They are much more weighty, it makes no sense to comment on each item, just give a link to what my config for AAC looks like.

You can evaluate the sound quality on the AppleInsider.ru podcast page , or by feeding these links to your favorite player: Hi (MP3 128Kbps) , Low (MP3 64Kbps) , AAC (48Kbps) .

')

Source: https://habr.com/ru/post/138186/


All Articles