Difference between revisions of "DAB/DAB+ encoding"

From OpenDigitalRadio
Jump to navigationJump to search
 
(6 intermediate revisions by the same user not shown)
Line 2: Line 2:
  
 
==DAB+ encoding==
 
==DAB+ encoding==
===DAB+ audio encoding with crc-dabplus===
 
*'''[[CRC-dabplus]]''' HE-AAC encoder (DAB+) from CRC (warning, it is not free/open source because of royalty)
 
  
Example streaming one radio and with a buffer to compensate for bursty output from encoder
+
===DAB+ audio encoding with ODR-AudioEnc===
  crc-dabplus -i souphttpsrc://location=http://maxxima.mine.nu:8000 -g -m -c 2 -b 48 -o file:///dev/stdout |mbuffer -m 100k -P 100  >output_fifo
+
'''[[ODR-AudioEnc]]''' HE-AAC encoder (DAB+), originally developed by Fraunhofer Institute, open source version from android tree.
 +
 
 +
The ZeroMQ output can be used in combination with the ODR-DabMux ZMQ input. This setup makes sense for a remote encoder (e.g. at the programme originator), and therefore the example given uses an alsa input:
 +
 
 +
ALSASRC="default"
 +
BITRATE=64
 +
  DST="tcp://your.dabmux.example.com:9000"
 +
 +
odr-audioenc -d $ALSASRC -r 32000 -b $BITRATE -o $DST -l
 +
 
 +
A JACK input can also be used instead of ALSA, using the -j=name option.
  
===DAB+ audio encoding with fdk-aac-dabplus===
 
*'''[[fdk-aac-dabplus]]''' HE-AAC encoder (DAB+), originally developed by Fraunhofer Institute, open source version from android tree.
 
  
 +
The older variant uses pipes to connect the different tools together. This setup is less stable than the above.
 
Example streaming one radio and with a buffer to compensate for bursty output from encoder
 
Example streaming one radio and with a buffer to compensate for bursty output from encoder
 
  mpg321 -r 48000 "http://pub1.di.fm:80/di_trance" -s 2>/dev/null | \
 
  mpg321 -r 48000 "http://pub1.di.fm:80/di_trance" -s 2>/dev/null | \
Line 16: Line 23:
 
  mbuffer -q -m 100k -P 100 -s 1080 > output_fifo
 
  mbuffer -q -m 100k -P 100 -s 1080 > output_fifo
  
 +
===DAB+ audio encoding with crc-dabplus===
 +
*'''[[CRC-dabplus]]''' HE-AAC encoder (DAB+) from CRC (warning, it is not free/open source because of royalty)
 +
 +
Example streaming one radio and with a buffer to compensate for bursty output from encoder
 +
crc-dabplus -i souphttpsrc://location=http://maxxima.mine.nu:8000 -g -m -c 2 -b 48 -o file:///dev/stdout |mbuffer -m 100k -P 100  >output_fifo
  
====jack input====
+
 
 +
====CRC-DABPLUS with JACK input====
  
 
crc-dabplus uses Gstreamer for input/output.
 
crc-dabplus uses Gstreamer for input/output.
Line 53: Line 66:
 
*'''[[toolame]]''' MPEG-Layer II encoder (DAB)
 
*'''[[toolame]]''' MPEG-Layer II encoder (DAB)
  
====Using toolame with Jack====
+
====Using toolame with JACK====
 
Toolame doesn't support jack by default, we use arecord with ALSA emulation to get the raw PCM stream. See [[Mapping of jack source to ALSA]] for instructions. It is a dirty workaround, it is foreseen to find a better way in the future for example by modifying toolame to support jack:
 
Toolame doesn't support jack by default, we use arecord with ALSA emulation to get the raw PCM stream. See [[Mapping of jack source to ALSA]] for instructions. It is a dirty workaround, it is foreseen to find a better way in the future for example by modifying toolame to support jack:
  
Line 62: Line 75:
 
   
 
   
 
  jack-stdout system:capture_1 system:capture_2 |toolame -s 48 -D 4 -b 192 /dev/stdin ./3.ff
 
  jack-stdout system:capture_1 system:capture_2 |toolame -s 48 -D 4 -b 192 /dev/stdin ./3.ff
 
====toolame modified for Jack input (BETA)====
 
 
Toolame has been modified to support JACK (BETA), rendering the dirty workaround mentioned below unnecessary. See [[Toolame#JACK_version]] for more info.
 
 
Example:
 
toolame -D 4 -b 128 -j -n toolame1 ./1.ff
 

Latest revision as of 13:00, 6 February 2017

Encoding the sound to MPEG-2 Layer II for DAB, MPEG-4 HE-AACv2 for DAB+ or video in MPEG-4 H.264 for T-DMB before feeding it to the multiplexer.

DAB+ encoding

DAB+ audio encoding with ODR-AudioEnc

ODR-AudioEnc HE-AAC encoder (DAB+), originally developed by Fraunhofer Institute, open source version from android tree.

The ZeroMQ output can be used in combination with the ODR-DabMux ZMQ input. This setup makes sense for a remote encoder (e.g. at the programme originator), and therefore the example given uses an alsa input:

ALSASRC="default"
BITRATE=64
DST="tcp://your.dabmux.example.com:9000"

odr-audioenc -d $ALSASRC -r 32000 -b $BITRATE -o $DST -l

A JACK input can also be used instead of ALSA, using the -j=name option.


The older variant uses pipes to connect the different tools together. This setup is less stable than the above. Example streaming one radio and with a buffer to compensate for bursty output from encoder

mpg321 -r 48000 "http://pub1.di.fm:80/di_trance" -s 2>/dev/null | \
aac-enc-dabplus -b 72 -f raw -c 2 -r 48000 -i /dev/stdin -o /dev/stdout 2>/dev/null | \
mbuffer -q -m 100k -P 100 -s 1080 > output_fifo

DAB+ audio encoding with crc-dabplus

  • CRC-dabplus HE-AAC encoder (DAB+) from CRC (warning, it is not free/open source because of royalty)

Example streaming one radio and with a buffer to compensate for bursty output from encoder

crc-dabplus -i souphttpsrc://location=http://maxxima.mine.nu:8000 -g -m -c 2 -b 48 -o file:///dev/stdout |mbuffer -m 100k -P 100  >output_fifo 


CRC-DABPLUS with JACK input

crc-dabplus uses Gstreamer for input/output.

Example of jackplug input (ALSA emulation), encoding at 48kbps, output to a FIFO file:

crc-dabplus -i card://jackplug -g -c 2 -b 48 -o file://2.ff

Similar example but with DLS input from TCP on port 12000

crc-dabplus -i card://jackplug -g -c 2 -b 80 -d tcpserver://:12000 -p 28 -t dls -o file://4.ff

Tools for data services encoding

Decoding Internet stream

Here are some simple way to get internet radio stream as input and decode them into raw PCM samples to feed DAB/DAB+ encoders

mpg123 input

"mpg123" can be used to take Internet radio stream and convert them from mp3 to raw PCM samples. Be careful, it has been noticed that earlier version have a memory leak when resampling. We use version 1.4.3 to avoid the problem.

Example that decode an mp3 stream, resample it to 48kHz and output the raw samples to stdout:

mpg123 -b 1024 -r 48000 -s http://maxxima.mine.nu:8000

mplayer

simple mplayer command for jack output

mplayer -ao jack http://maxxima.mine.nu:8000

DAB encoding

DAB audio encoding with toolame

  • toolame MPEG-Layer II encoder (DAB)

Using toolame with JACK

Toolame doesn't support jack by default, we use arecord with ALSA emulation to get the raw PCM stream. See Mapping of jack source to ALSA for instructions. It is a dirty workaround, it is foreseen to find a better way in the future for example by modifying toolame to support jack:

Example:

arecord -t raw -f S16_LE -c 2 -r 48000 -D jackplug |toolame -s 48 -D 4 -b 128 /dev/stdin ./1.ff

Another possibility is to use jack-stdout tool that grab samples from jack and send them to the standard output

jack-stdout system:capture_1 system:capture_2 |toolame -s 48 -D 4 -b 192 /dev/stdin ./3.ff