diff options
author | Robin Alexander <robin.alexander@netplus.ch> | 2025-06-01 16:43:38 +0200 |
---|---|---|
committer | Robin Alexander <robin.alexander@netplus.ch> | 2025-06-01 16:43:38 +0200 |
commit | ba74f99f62d6f715107db8075a5be3a57af3e3b7 (patch) | |
tree | aa7c9bb97a012a2da53f9d9f54f917a270e7d51b | |
parent | 20be04f39e6998d9f9346e86c4d12f0bb4aa9eb2 (diff) | |
download | ODR-AudioEnc-ba74f99f62d6f715107db8075a5be3a57af3e3b7.tar.gz ODR-AudioEnc-ba74f99f62d6f715107db8075a5be3a57af3e3b7.tar.bz2 ODR-AudioEnc-ba74f99f62d6f715107db8075a5be3a57af3e3b7.zip |
Fix issues identified by markdownlint
-rw-r--r-- | README.md | 190 | ||||
-rw-r--r-- | TODO.md | 17 |
2 files changed, 129 insertions, 78 deletions
@@ -32,27 +32,33 @@ For detailed usage, see the usage screen of the tool with the *-h* option. More information is available on the [Opendigitalradio wiki](http://opendigitalradio.org) -# Installation +## Installation + You have 3 ways to install odr-audioenc on your host: -## Using your linux distribution packaging system -`odr-audioenc` is available on the official repositories of several debian-based distributions, such as Debian +### Using your linux distribution packaging system + +`odr-audioenc` is available on the official repositories of several debian-based distributions, such as Debian (from Debian 12), Ubuntu (from 24.10), Opensuse and Arch. -If you are using Debian 12 (Bookworm), you will need to +If you are using Debian 12 (Bookworm), you will need to [add the backports repository](https://backports.debian.org/Instructions/) -## Using installation scripts +### Using installation scripts + If your linux distribution is debian-based, you can install odr-audioenc -as well as the other main components of the mmbTools set with the +as well as the other main components of the mmbTools set with the [Opendigitalradio dab-scripts](https://github.com/opendigitalradio/dab-scripts.git) -## Compiling manually +### Compiling manually + Unlike the 2 previous options, this one allows you to compile odr-audioenc with the features you really need. -### Requirements +#### Requirements + For Debian Bullseye-based OS, run the following commands: -``` + +```sh # Required packages ## C++11 compiler sudo apt-get install --yes build-essential automake libtool @@ -79,39 +85,47 @@ sudo apt-get install --yes libcurl4-openssl-dev **Attention**: on versions older than Debian Buster, you'll need `vlc-nox` instead of `vlc-plugin-base` -### Compilation +#### Compilation + 1. Clone this repository: - ``` + + ```sh # stable version: git clone https://github.com/Opendigitalradio/ODR-AudioEnc.git # or development version (at your own risk): git clone https://github.com/Opendigitalradio/ODR-AudioEnc.git -b next ``` + 1. Configure the project - ``` + + ```sh cd ODR-AudioEnc ./bootstrap # Select the features you need: ./configure --enable-alsa --enable-jack --enable-vlc --enable-gst ``` + 1. Compile and install: - ``` + + ```sh make sudo make install ``` -# How to use +## How to use We assume that you have a ODR-DabMux configured for an EDI input on port 9000. - ALSASRC="default" - DST="tcp://yourserver:9000" - BITRATE=64 +```sh +ALSASRC="default" +DST="tcp://yourserver:9000" +BITRATE=64 +``` -## General remarks +### General remarks Avoid using sources that are already encoded with a low bitrate, because encoder cascading will noticeably reduce audio quality. Best are sources @@ -130,8 +144,8 @@ to saturation, especially when you have to resample. When you see little exclamation marks with the `-l` option, it's too loud! Reduce the gain at the source, or use the gain option if that's not possible. +### DAB+ AAC encoder configuration -## DAB+ AAC encoder configuration By default, when not overridden by the `--aaclc`, `--sbr` or `--ps` options, the encoder is configured according to bitrate and number of channels. @@ -142,30 +156,41 @@ If two channels are used, PS (Parametric Stereo, also called HE-AAC v2) is enabled up to 48kbps. Between 56kbps and 80kbps, SBR is enabled. 88kbps and higher are using AAC-LC. -## EDI output +### EDI output The EDI output included in ODR-AudioEnc is able to connect to one or several instances of ODR-DabMux. The `-e` option can be used more than once to achieve this. The same goes for the ZeroMQ output (`-o` option). -## Scenario *wav file for offline processing* +### Scenario *wav file for offline processing* + Wave file encoding, for non-realtime processing - odr-audioenc -b $BITRATE -i wave_file.wav -o station1.dabp +```sh +odr-audioenc -b $BITRATE -i wave_file.wav -o station1.dabp +``` + +### Scenario *file that VLC supports* -## Scenario *file that VLC supports* If you want to input a file through libvlc, you need to give an absolute path: - odr-audioenc -b $BITRATE -v file:///home/odr/audio/source.mp3 -o station1.dabp +```sh +odr-audioenc -b $BITRATE -v file:///home/odr/audio/source.mp3 -o station1.dabp +``` + +### Scenario *ALSA* -## Scenario *ALSA* Live Stream from ALSA sound card at 32kHz, with EDI output for ODR-DabMux: - odr-audioenc -d $ALSASRC -c 2 -r 32000 -b $BITRATE -e $DST -l +```sh +odr-audioenc -d $ALSASRC -c 2 -r 32000 -b $BITRATE -e $DST -l +``` To enable sound card drift compensation, add the option **-D**: - odr-audioenc -d $ALSASRC -c 2 -r 32000 -b $BITRATE -e $DST -D -l +```sh +odr-audioenc -d $ALSASRC -c 2 -r 32000 -b $BITRATE -e $DST -D -l +``` You might see **U** and **O** appearing on the terminal. They correspond to audio **u**nderruns and **o**verruns that happen due to the different speeds at which @@ -173,12 +198,15 @@ the audio is captured from the soundcard, and encoded into HE-AACv2. High occurrence of these will lead to audible artifacts. -## Scenario *encode a webstream* +### Scenario *encode a webstream* + You can use either GStreamer with the `-G` option or libVLC with `-v`. Read a webstream and send it to ODR-DabMux over EDI: - odr-audioenc -G $URL -r 32000 -c 2 -e $DST -l -b $BITRATE +```sh +odr-audioenc -G $URL -r 32000 -c 2 -e $DST -l -b $BITRATE +``` If you need to extract the ICY-Text information, e.g. for DLS, you can use the `-w <filename>` option to write the ICY-Text into a file that can be read by @@ -188,44 +216,55 @@ libVLC. If the webstream bitrate is slightly wrong (bad clock at the source), you can enable drift compensation with `-D`. -## Scenario *Custom GStreamer pipeline* +### Scenario *Custom GStreamer pipeline* The `--gst-pipeline` option lets you run custom pipelines, using the same syntax as `gst-launch`, which can be necessary for sources that you cannot specify through a URI through the `-G` option. For example, you may use udpsrc to receive an RTP stream: - odr-audioenc --gst-pipeline 'udpsrc port=5004 caps=application/x-rtp,media=(string)audio,payload=(int)10,clock-rate=44100 ! rtpL16depay ! audioconvert ! audioresample' \ +```sh +odr-audioenc --gst-pipeline 'udpsrc port=5004 caps=application/x-rtp,media=(string)audio,payload=(int)10,clock-rate=44100 ! rtpL16depay ! audioconvert ! audioresample' \ -e $DST -l -b $BITRATE +``` + +### Scenario *JACK input* -## Scenario *JACK input* JACK input: Instead of `-i (file input)` or `-d (ALSA input)`, use `-j *name*`, where *name* specifies the JACK name for the encoder: - odr-audioenc -j myenc -l -b $BITRATE -e $DST +```sh +odr-audioenc -j myenc -l -b $BITRATE -e $DST +``` The JACK server must run at the samplerate of the encoder (32kHz or 48kHz). If that is not possible, one workaround is to access JACK through VLC, which will resample accordingly: - odr-audioenc -l -v jack://dab -b $BITRATE -e $DST +```sh +odr-audioenc -l -v jack://dab -b $BITRATE -e $DST +``` -## Scenario *LiveWire* or *AES67* +### Scenario *LiveWire* or *AES67* When audio data is available on the network as a multicast stream, it can be encoded using the following pipeline: - rtpdump -F payload 239.192.1.1/5004 | \ - sox -t raw -e signed-integer -r 48000 -c 2 -b 24 -B /dev/stdin -t raw --no-dither -r 48000 -c 2 -b 16 -L /dev/stdout gain 4 | \ - odr-audioenc -f raw -b $BITRATE -i /dev/stdin -e $DST +```sh +rtpdump -F payload 239.192.1.1/5004 | \ +sox -t raw -e signed-integer -r 48000 -c 2 -b 24 -B /dev/stdin -t raw --no-dither -r 48000 -c 2 -b 16 -L /dev/stdout gain 4 | \ +odr-audioenc -f raw -b $BITRATE -i /dev/stdin -e $DST +``` It is also possible to use the libvlc input, where you need to create an SDP file with the following contents: - v=0 - o=Node 1 1 IN IP4 172.16.235.155 - s=TestSine - t=0 0 - a=type:multicast - c=IN IP4 239.192.0.1 - m=audio 5004 RTP/AVP 97 - a=rtpmap:97 L24/48000/2 +```text +v=0 +o=Node 1 1 IN IP4 172.16.235.155 +s=TestSine +t=0 0 +a=type:multicast +c=IN IP4 239.192.0.1 +m=audio 5004 RTP/AVP 97 +a=rtpmap:97 L24/48000/2 +``` Replace the IP address in the `o=` field by the one corresponding to your source node IP address, and the IP in `c=` by the multicast IP of your stream. @@ -235,8 +274,8 @@ This could maybe also work with GStreamer, but needs more testing. Help would be in improving the GStreamer input code to also support more advanced features, some pointers are in *TODO.md* +### Scenario *local file through snd-aloop* -## Scenario *local file through snd-aloop* Play some local audio source from a file, with EDI or ZMQ output for ODR-DabMux. The problem with playing a file is that *odr-audioenc* cannot directly be used, because ODR-DabMux does not back-pressure the encoder, which will therefore encode much faster than realtime. @@ -244,43 +283,57 @@ does not back-pressure the encoder, which will therefore encode much faster than While this issue is sorted out, the following trick is a very flexible solution: use the alsa virtual loop soundcard *snd-aloop* in the following way: - modprobe snd-aloop +```sh +modprobe snd-aloop +``` This creates a new audio card (usually 'hw:1' but have a look at `/proc/asound/card` to be sure) that can then be used for the alsa encoder. - ./odr-audioenc -d hw:1 -c 2 -r 32000 -b 64 -e $DST -l +```sh +odr-audioenc -d hw:1 -c 2 -r 32000 -b 64 -e $DST -l +``` Then, you can use any media player that has an alsa output to play whatever source it supports: - cd your/preferred/music - mplayer -ao alsa:device=hw=1.1 -srate 32000 -format=s16le -shuffle * +```sh +cd your/preferred/music +mplayer -ao alsa:device=hw=1.1 -srate 32000 -format=s16le -shuffle * +``` **Important**: you must specify the correct sample rate and sample format on both "sides" of the virtual sound card. +### Scenario *mplayer and fifo* -## Scenario *mplayer and fifo* **Warning**: Connection through pipes to ODR-DabMux are deprecated in favour of EDI. Live Stream resampling (to 32KHz) and encoding from FIFO and preparing for DAB muxer, with FIFO to odr-dabmux using mplayer. If there are no data in FIFO, encoder generates silence. - mplayer -quiet -loop 0 -af resample=32000:nowaveheader,format=s16le,channels=2 -ao pcm:file=/tmp/aac.fifo:fast <FILE/URL> & - odr-audioenc -l -f raw --fifo-silence -i /tmp/aac.fifo -r 32000 -c 2 -b 72 -o /dev/stdout \ - mbuffer -q -m 10k -P 100 -s 1080 > station1.fifo +```sh +mplayer \ + -quiet -loop 0 \ + -af resample=32000:nowaveheader,format=s16le,channels=2 \ + -ao pcm:file=/tmp/aac.fifo:fast <FILE/URL> & +odr-audioenc \ + -l -f raw --fifo-silence -i /tmp/aac.fifo -r 32000 -c 2 -b 72 \ + -o /dev/stdout \ +mbuffer -q -m 10k -P 100 -s 1080 > station1.fifo +``` **Note**: Do not use `/dev/stdout` for PCM output in mplayer. Mplayer logs messages to stdout. ## Return values + odr-audioenc returns: - * 0 if it encoded the whole input file - * 1 if some options were not understood, or encoder initialisation failed - * 2 if the silence timeout was reached - * 3 if the AAC encoder failed - * 4 it sending data over the network failed - * 5 if the input had a fault +* 0: if it encoded the whole input file +* 1: if some options were not understood, or encoder initialisation failed +* 2: if the silence timeout was reached +* 3: if the AAC encoder failed +* 4: it sending data over the network failed +* 5: if the input had a fault The `-R` option to get ODR-AudioEnc to restart the input automatically has been deprecated. As this feature does not guarantee that @@ -288,8 +341,8 @@ the odr-audioenc process will never die, running it under a process supervisor is recommended regardless of this feature being enabled or not. It will be removed in a future version. - ## Known Limitations + Some receivers did not decode audio anymore between v0.3.0 and v0.5.0, because of a change implemented to get PAD to work. The change was subsequently reverted in v0.5.1 because it was deemed essential that audio decoding works on all receivers. @@ -298,16 +351,16 @@ v0.7.0 fixes most issues, and PAD now works much more reliably. Version 0.4.0 of the encoder changed the ZeroMQ framing. It will only work with ODR-DabMux v0.7.0 and later. -# LICENCE +## LICENCE The ODR-AudioEnc project contains - - The code for odr-audioenc in src/ licensed under the Apache Licence v2.0. See - http://www.apache.org/licenses/LICENSE-2.0 - - libtoolame-dab, derived from TooLAME, licensed under LGPL v2.1 or later. See +* The code for odr-audioenc in src/ licensed under the Apache Licence v2.0. See + <http://www.apache.org/licenses/LICENSE-2.0> +* libtoolame-dab, derived from TooLAME, licensed under LGPL v2.1 or later. See `libtoolame-dab/LGPL.txt`. This is built into a shared library. - - EDI output (files in src/edi) are GPLv3+ - - The FDK-AAC encoder, patched for DAB+ support, licensed under the terms in +* EDI output (files in src/edi) are GPLv3+ +* The FDK-AAC encoder, patched for DAB+ support, licensed under the terms in `fdk-aac/NOTICE`, built into a shared library. The odr-audioenc binary is statically linked against the libtoolame-dab and fdk-aac @@ -315,4 +368,3 @@ libraries. Whether it is legal or not to distribute compiled binaries from these sources is unclear to me. Please seek legal advice to answer this question. - @@ -1,24 +1,23 @@ +# To Do + This TODO file lists ideas and features for future developments. They are more or less ordered according to their benefit, but that is subjective to some degree. Unless written, no activity has been started on the topics. -Drift compenstation statistics ------------------------------- +## Drift compenstation statistics Insert drift compensation statistics into EDI metadata. - -GStreamer input and AES67 -------------------------- +## GStreamer input and AES67 AES67 support could be nice. -GST can apparently use PTP https://gstreamer.freedesktop.org/documentation/net/gstptpclock.html?gi-language=c +GST can apparently use PTP <https://gstreamer.freedesktop.org/documentation/net/gstptpclock.html?gi-language=c> -https://gstreamer.freedesktop.org/documentation/sdpelem/sdpdemux.html?gi-language=c +<https://gstreamer.freedesktop.org/documentation/sdpelem/sdpdemux.html?gi-language=c> -https://www.collabora.com/news-and-blog/blog/2017/04/25/receiving-an-aes67-stream-with-gstreamer/ +<https://www.collabora.com/news-and-blog/blog/2017/04/25/receiving-an-aes67-stream-with-gstreamer/> -https://archive.fosdem.org/2016/schedule/event/synchronised_gstreamer/attachments/slides/889/export/events/attachments/synchronised_gstreamer/slides/889/synchronised_multidevice_media_playback_with_GStreamer.pdf +<https://archive.fosdem.org/2016/schedule/event/synchronised_gstreamer/attachments/slides/889/export/events/attachments/synchronised_gstreamer/slides/889/synchronised_multidevice_media_playback_with_GStreamer.pdf> |