GLASSCODER(1) | Linux Audio Manual | GLASSCODER(1) |
glasscoder - Minimalist audio encoder for live streaming
glasscoder [OPTIONS]
glasscoder(1) is an audio encoder that is capable of generating live streams using a variety of formats and sending them to an Icecast or Shoutcast audio streaming server or posting them as HTTP Live Streams [HLS]. It is also capable of acting as an Icecast-compatible server in its own right, serving streams directly to client players and thus eliminating the need for an intervening Icecast server instance.
glasscoder(1) has no GUI or configuration file components at all; its sole 'user interface' being its command-line invocation. As such, it is particularly well suited for being driven by an external process or controller such as glassgui(1) or glasscommander(1).
--audio-atomic-frames
--audio-bitrate=kbps
--audio-channels=chans
--audio-device=type
ALSA
FILE
JACK
--audio-format=fmt
MP3
OPUS
PCM16
VORBIS
--audio-quality=qual
--audio-samplerate=rate
--errors-string=string
--errors-to=dest
STDERR
SYSLOG
STDOUT
--help
--list-codecs
--list-devices
--metadata-port=port
--meter-data
--server-auth=[username][:password]
--server-exit-on-last
--server-max-connections=conns
--server-pipe=pathname
--server-script-down=cmd
--server-script-up=cmd
--server-start-connections=conns
--server-type=type
FILE
FILEARCHIVE
HLS
IceCast2
IceOut
IceStreamer
Shout1
Shout2
--server-url=url
When used with a --server-type of IceStreamer, the host part of the URL is used to specify the address of the network interface to use for streaming (use 0.0.0.0 to indicate ALL interfaces). This parameter has no default.
--server-user-agent=agent-string
--stream-aim=aim
--stream-description=string
--stream-genre=string
--stream-icq=icq
--stream-irc=irc
--stream-name=string
--stream-timestamp-offset=offset
--stream-url=url
--verbose
--version
Advanced Linux Sound Architecture (--audio-device=ALSA)
--alsa-device=dev
Direct File Streaming (--audio-device=FILE)
--file-name=name
The Jack Audio Connection Kit (--audio-device=JACK)
--jack-client-name=name
--jack-gain=gain
--jack-server-name=name
Not all URL schemes are supported by all server types. The following chart breaks down the options.
Table 1. Supported URL Schemes by Server Type
Server Type | FILE:// | HTTP:// | SFTP:// |
FILE | Yes | No | No |
FILEARCHIVE | Yes | No | No |
HLS | Yes | Yes [1] | Yes [3] |
IceCast2 | No | Yes [2] | No |
IceOut | No | Yes | No |
IceStreamer | No | Yes | No |
Shout1 | No | Yes [2] | No |
Shout2 | No | Yes [2] | No |
[1] Utilizes the HTTP PUT and DELETE methods | |||
[2] Utilizes the HTTP GET method | |||
[3] Supports ssh(1) password authentication only |
GlassCoder supports the notion of two types of metadata:
"channel-based" metadata, which applies to the stream as a whole
and does not change for the duration of an encoding session; and
"timed" metadata, which can be changed in synchronization with the
content of the audio stream. Channel-based metadata can be specified by
means of options given to
glasscoder(1) and will be covered in detail in the sections devoted to
specific server types (below).
The primary mechanism for supplying timed metadata in GlassCoder is by means of a JSON document containing the desired metadata, sent to the target glasscoder(1) instance at the port specified by the --metadata-port option by means of an HTTP POST operation. The basic format of the JSON document is as follows:
{ "Metadata": { "Field1": "Some value", "Field2": "Some other value" } }
Not all server types support metadata, and those that do utilize wildly different schemas. Following is a breakdown of the available metadata options by server type:
Channel Metadata
IceCast2 supports the following channel metadata fields:
Name
Description
URL
Genre
Timed Metadata
IceCast2 provides one field of text, called StreamTitle, which can be dynamically updated to reflect the content currently playing on the stream. By convention, this is usually formatted as 'Artist - Title' on streams containing musical content.
For example, to set the StreamTitle field to The Beatles - Hey Jude, the following JSON could be used:
{ "Metadata": { "StreamTitle": "The Beatles - Hey Jude" } }
Legacy Interface
In addition to the primary JSON interface, the StreamTitle can be set by sending an HTTP GET request to a running glasscoder(1) instance, using the TCP port specified in the --metadata-port=port option. The request must be in the following format:
http://hostname:tcp-port/admin/metadata?mount=mount-point&mode=updinfo&song=string
Where:
hostname - The hostname or IP address of the system running glasscoder(1)
tcp-port - The TCP port number specified in the --metadata-port option to glasscoder(1)
mount-point - The mountpoint of the stream
string - The string to set, encoded as specified in Section 2 of RFC3986
For example, to set a string of "The Beatles - Hey Jude" via a glasscoder(1) instance running at encoder.example.com with a --metadata-port value of 1234 for a mountpoint of MyStream, the URL would be:
http://encoder.example.com:1234/admin/metadata?mount=MyStream&mode=updinfo&song=The%20Beatles%20-%20Hey%20Jude
Channel Metadata
ShoutCast supports the following channel metadata fields:
Name
URL
Genre
ICQ ID
AOL Instant Messenger ID
IRC ID
Timed Metadata
ShoutCast provides two fields of text which can be dynamically updated to reflect the content currently playing on the stream, called StreamTitle and StreamUrl. By convention, the StreamTitle is usually formatted as 'Artist - Title' on streams containing musical content, while StreamUrl is used to provide a URL whence stream specific content --e.g. album cover art -- can be retrieved.
For example, to set the StreamTitle field to The Beatles - Hey Jude and the StreamUrl field to http://images.example.com/1234.png, the following JSON could be used:
{ "Metadata": { "StreamTitle": "The Beatles - Hey Jude", "StreamUrl": "http://images.example.com/1234.png" } }
The use of either of these fields is optional in any given metadata update. If only one field is given, the other will remain unchanged.
Legacy Interface
In addition to the primary JSON interface, the StreamTitle and StreamUrl fields can be set by sending an HTTP GET request to a running glasscoder(1) instance, using the TCP port specified in the --metadata-port=port option. The request must be in the following format:
http://hostname:tcp-port/admin.cgi?pass=password&mode=updinfo&song=stream-title&url=stream-url
Where:
hostname - The hostname or IP address of the system running glasscoder(1)
tcp-port - The TCP port number specified in the --metadata-port option to glasscoder(1)
password - The ShoutCast password, encoded as specified in Section 2 of RFC3986
stream-title - The string to set for StreamTitle, encoded as specified in Section 2 of RFC3986
stream-url - The string to set for StreamUrl, encoded as specified in Section 2 of RFC3986
For example, to set a StreamTitle of "The Beatles - Hey Jude" and a StreamUrl of "http://image.example.com/1234.png" with a password of "MyPassword" via a glasscoder(1) instance running at encoder.example.com with a --metadata-port value of 1234, the URL would be:
http://encoder.example.com:1234/admin.cgi?pass=MyPassword&mode=updinfo&song=The%20Beatles%20-%20Hey%20Jude&url=http://image.example.com/1234.png
Timed Metadata
HLS supports timed metadata in the form of embedded ID3v2.4 tags. Available fields thus include the entire set of text tags defined in the ID3v2.4 frame specification (available at http://id3.org/id3v2.4.0-frames).
For example, a typical metadata update could use the following JSON:
{ "Metadata": { "TIT2": "Hey Jude", "TPE1": "The Beatles", "TALB": "The White Album", "TRSO": "WXYZ Radio" } }
A user defined text information frame (TXXX) can be sent by using the following special notation for the field identifier:
TXXXdesc
Where:
desc - The TXXX Description string (see Section 4.2.6 of the ID3v2.4 Frame Specification)
For example:
{ "Metadata": { "TIT2": "Hey Jude", "TPE1": "The Beatles", "TALB": "The White Album", "TRSO": "WXYZ Radio", "TXXXxyz": "TXXX frame with a description string of \"xyz\"" } }
The Debian version of GlassCoder does not support the MPEG-4 HE-AAC+ encoding, as it is non-free. The AudioScience HPI source device is excluded for the same reason.
SFTP:// transfers are done in "insecure" mode (due to crippled support for ssh(1) host keys in curl(1)).
ssh(1) public key authentication is unsupported (due to crippled support for ed25519 keys in curl(1)).
Ogg metadata support is still missing.
Fred Gleason <fredg@paravelsystems.com>
glasscoder-ipc(7), glasscommander(1), glassgui(1), jackd(1)
RFC3986 - Uniform Resource Identifier (URI): Generic Syntax
ID3v2.4 Native Frame Specification (http://id3.org/id3v2.4.0-frames)
Fred Gleason <fredg@paravelsystems.com>
01/27/2020 | October 2019 |