Difference between revisions of "FDK-AAC-DABplus"

From OpenDigitalRadio
Jump to navigationJump to search
Line 1: Line 1:
 +
This is open-source version of DAB+ encoder. fdk-aac-dabplus reads audio data from standard input, and outputs data on standard output. The second tool fdk-aac-dabplus-zmq outputs frames using ZeroMQ, which can be used with the inputZmq from [CRC-DabMux]
 +
 
== Installation ==
 
== Installation ==
This is open-source version of DAB+ encoder.
+
===Prerequisites===
 +
 
 +
fdk-aac-dabplus depends on libfec.
 +
 
 +
fdk-aac-dabplus-zmq depends on libfec and ZeroMQ.
 +
 
 +
For instructions on how to install these, please see [CRC-DabMux#Prerequisites]
  
To build DAB+ encoder, you need fec library from crc.ca website: http://mmbtools.crc.ca/content/view/39/65/, follow instrutcions to install it to the system. If you already build crc-dabmux from sources, then this library is already installed. Next, download and build encoder:
+
===Building===
  
  git clone https://github.com/piratfm/fdk-aac-dabplus.git
+
  git clone https://github.com/mpbraendli/fdk-aac-dabplus.git
 
  cd fdk-aac-dabplus
 
  cd fdk-aac-dabplus
 
  ./bootstrap
 
  ./bootstrap
  ./configure --enable-example
+
  ./configure --enable-example --enable-zmq
 
  make
 
  make
 
  sudo make install
 
  sudo make install
  
 +
Remove the flag --enable-zmq if you don't want to compile fdk-aac-dabplus-zmq
 +
 +
If the bootstrap step fails, you can try
 +
autoreconf -i
 +
instead.
 +
 +
 +
==Usage==
 +
===Encoding===
 +
After successful installation, it can be used to encode DAB+ in several ways.
 +
 +
Encoding of audio input, output to fifo:
 +
ALSASRC="default"
 +
BITRATE=64
 +
 +
sox -t alsa $ALSASRC -b 16 -t raw - rate 48k channels 2 | \
 +
  ../fdk-aac-dabplus/aac-enc-dabplus \
 +
  -i /dev/stdin -b $BITRATE -f raw -a -o -o /dev/stdout 2>/dev/null | \
 +
  mbuffer -q -m 10k -P 100 -s 360 > station1.fifo
 +
 +
Encoding of audio input, output to crc-dabmux using ZeroMQ
 +
ALSASRC="default"
 +
BITRATE=64
 +
DST="tcp://your.dabmux.example.com:9000"
  
== Encoding samples ==
+
sox -t alsa $ALSASRC -b 16 -t raw - rate 48k channels 2 | \
After successful installation, DAB+ encoding may be used:
+
  ../fdk-aac-dabplus/aac-enc-dabplus-zmq \
 +
  -i /dev/stdin -b $BITRATE -f raw -a -o $DST
  
 
Live Stream enconding and preparing for DAB mux:
 
Live Stream enconding and preparing for DAB mux:
Line 23: Line 56:
 
  aac-enc-dabplus -a -b 64 -i wave_file.wav -o station1.dabp
 
  aac-enc-dabplus -a -b 64 -i wave_file.wav -o station1.dabp
  
 +
Also have a look at the ''encode-'' scripts available in the [[https://github.com/mpbraendli/mmbtools-aux mmbtools-aux repository]]
  
== Problems solving ==
+
===Problem solving===
If crc-dabmux generates lot of errors like this:
+
If you are using a '''pipe between the encoder and crc-dabmux''', and you see a lot of errors like this:
 
  <2> ERROR: Incomplete DAB+ frame! 136 != 360
 
  <2> ERROR: Incomplete DAB+ frame! 136 != 360
 
  <5> reach end of file -> rewinding
 
  <5> reach end of file -> rewinding
Line 31: Line 65:
 
  <6> ETI frame number: 228
 
  <6> ETI frame number: 228
  
Then the stream have to be buffered before giving it to muxer, this additional buffer installed between encoder and fifo. To calculate proper block size for mbuffer ("-s" parameter), the table below may be used:
+
Then the stream has to be buffered before giving it to muxer, this additional buffer installed between encoder and fifo. To calculate proper block size for mbuffer ("-s" parameter), the table below may be used:
  
 
{| border="1" cellpadding="5" cellspacing="0"
 
{| border="1" cellpadding="5" cellspacing="0"
Line 65: Line 99:
 
|}
 
|}
  
In example above, for stream with bitrate 24 kbps, mbuffer size setted to 360 bytes. This trick helping to solve problem.
+
In example above, for stream with bitrate 24 kbps, mbuffer size set to 360 bytes. This trick helping to solve problem.
 +
 
 +
 
 +
In the case you are using '''ZeroMQ between the encoder and crc-dabmux''', and you see errors that the size of the data is wrong, then the configured bitrate in the mux probably doesn't correspond to the bitrate given to the encoder. Make sure they are identical.

Revision as of 12:15, 31 January 2014

This is open-source version of DAB+ encoder. fdk-aac-dabplus reads audio data from standard input, and outputs data on standard output. The second tool fdk-aac-dabplus-zmq outputs frames using ZeroMQ, which can be used with the inputZmq from [CRC-DabMux]

Installation

Prerequisites

fdk-aac-dabplus depends on libfec.

fdk-aac-dabplus-zmq depends on libfec and ZeroMQ.

For instructions on how to install these, please see [CRC-DabMux#Prerequisites]

Building

git clone https://github.com/mpbraendli/fdk-aac-dabplus.git
cd fdk-aac-dabplus
./bootstrap
./configure --enable-example --enable-zmq
make
sudo make install

Remove the flag --enable-zmq if you don't want to compile fdk-aac-dabplus-zmq

If the bootstrap step fails, you can try

autoreconf -i

instead.


Usage

Encoding

After successful installation, it can be used to encode DAB+ in several ways.

Encoding of audio input, output to fifo:

ALSASRC="default"
BITRATE=64
sox -t alsa $ALSASRC -b 16 -t raw - rate 48k channels 2 | \
  ../fdk-aac-dabplus/aac-enc-dabplus \
  -i /dev/stdin -b $BITRATE -f raw -a -o -o /dev/stdout 2>/dev/null | \
  mbuffer -q -m 10k -P 100 -s 360 > station1.fifo

Encoding of audio input, output to crc-dabmux using ZeroMQ

ALSASRC="default"
BITRATE=64
DST="tcp://your.dabmux.example.com:9000"
sox -t alsa $ALSASRC -b 16 -t raw - rate 48k channels 2 | \
  ../fdk-aac-dabplus/aac-enc-dabplus-zmq \
  -i /dev/stdin -b $BITRATE -f raw -a -o $DST

Live Stream enconding and preparing for DAB mux:

arecord -t raw -f S16_LE -c 2 -r 48000 -D plughw:CARD=Loopback,DEV=0,SUBDEV=0 | \
aac-enc-dabplus -b 24 -f raw -c 2 -r 48000 -i /dev/stdin -o /dev/stdout 2>/dev/null | \
mbuffer -q -m 10k -P 100 -s 360 > station1.fifo

Wave file enconding and preparing for crc-dabmux:

aac-enc-dabplus -a -b 64 -i wave_file.wav -o station1.dabp

Also have a look at the encode- scripts available in the [mmbtools-aux repository]

Problem solving

If you are using a pipe between the encoder and crc-dabmux, and you see a lot of errors like this:

<2> ERROR: Incomplete DAB+ frame! 136 != 360
<5> reach end of file -> rewinding
<2> ERROR: Can't rewind file
<6> ETI frame number: 228

Then the stream has to be buffered before giving it to muxer, this additional buffer installed between encoder and fifo. To calculate proper block size for mbuffer ("-s" parameter), the table below may be used:

DAB+ Stream bitrate, kbps Block size, bytes
16 240
24 360
32 480
48 720
56 840
64 960
72 1080
128 1920
160 2400

In example above, for stream with bitrate 24 kbps, mbuffer size set to 360 bytes. This trick helping to solve problem.


In the case you are using ZeroMQ between the encoder and crc-dabmux, and you see errors that the size of the data is wrong, then the configured bitrate in the mux probably doesn't correspond to the bitrate given to the encoder. Make sure they are identical.