-
Notifications
You must be signed in to change notification settings - Fork 0
/
Documentation040_Icecast.txt
44 lines (34 loc) · 4.02 KB
/
Documentation040_Icecast.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
::v3.0::1o.2o22::2019.4.0::
================================================================================
Icecast source:
================================================================================
This provides support for any AudioSource to become an Icecast source via IcecastSource component.
IcecastSource processes OnAudioFilterRead signal, optionally encodes it, and pushes result to opened source connection to Icecast, which can be then connected to by any streaming client.
IcecastSource configuration should match Icecast source and mountpoint definition - all fields are hopefully comprehensively annotated in the Editor with tooltips.
Icecast 2.4.0 + is supported.
Icecast settings are reasonably well documented directly in the xml configuration file; for common testing it is enough to set
<hostname> (for server URL) and in <listen-socket> section <bind-address> (for IP the source to connect to) and optionally <shoutcast-mount>
- these should match IcecastSource fields and it should then automatically connect and start pushing whatever content is being played in OnAudioFilterRead.
In the IcecastSourceDemo scene is an example configuration for a site specific local Icecast server with an AudioStream radio being as source.
Currently OGGVORBIS or OGGOPUS can be chosen as audio codec for the signal, or raw PCM without any encoding.
PCM data is fast, but has rather significant disadvantage in occupying very high network bandwidth - between 100 - 200 kB/s depending on Unity audio settings.
For OGGVORBIS encoding a custom modified MIT licensed library is used, available here: https://github.com/r618/.NET-Ogg-Vorbis-Encoder .
Note: this is very likely not an ideal implementation and I'm not entirely satisfied with it - I made it run much faster than original, but it still barely fits into OnAudioFilterRead timeslot.
If you know of any other C# only Vorbis encoding library, please let me know!
For PCM server/source:
- make sure the AudioStream client uses exactly the same audio properties, i.e. samplerate, channels, and byte format as originating machine with IcecastSource
( this means not the format of the audio it is playing, but properties of its audio output as reported e.g. by AudioSettings.outputSampleRate, byte format should be PCM16 under most circumstances),
otherwise the signals won't match and connection will be dropped.
Note: Icecast admin might not show complete mountpoint information and sound preview/player in the browser might be missing, but if you connect to the mountpoint with properly configured client (i.e. with same byte format, channels and samplerate as mentioned above) the stream will still be played by the client (not all common audio players support this)
For OGGVORBIS server/source:
- Default or Best Performance DSP Buffer Size in Audio Settings is recommended to provide larger audio buffer
- Currently only supports 40k+ Stereo VBR encoding
- bitrate is currently determined automatically by Icecast; I haven't found a reliable way to explicitly set/influence this on Icecast source so far; on my setup it is anywhere between 300-500 kbps.
- any common streaming client/webbrowser (including AudioStream) can play this source by connecting to the Icecast mountpoint/instance.
- currently, AudioStream client seems to have better performance with this stream than AudioStreamMinimal. It is necessary to set rather high (~ 300k) Stream Block Alignment on AudioStreamMinimal to connect and stream from this source due to probably higher bitrate and its refresh rate not being ideal for it.
OGGOPUS source:
- supports only 1-, or 2- channel audio, quality of the encoder is set to be highest possible
- Sampling rate of input signal (of Unity audio) must be one of 8000, 12000, 16000, 24000, or 48000
- entered bitrate is considered when creating the encoder
- FMOD/AudioStream does not support OPUS family of codecs, so you won't be able to connect to Icecast server with AudioStream when using this encoder, but common audio players/browsers can play it.
- OPUS has much favorable bitrate and performance