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
Emit a stream consisting of self-contained frames --e.g. by disabling the MPEG-1 bit reservoir. Useful mostly for debugging.
--audio-bitrate=kbps
The constant stream data rate in kilobits per second. Default value is 128. Use of this option is mutually exclusive with that of the --audio-quality option (see below).
--audio-channels=chans
The number of audio channels to use. Valid values are 1 or 2. Default value is 2.
--audio-device=type
The type of audio device to use. The default value is JACK. See the DEVICE OPTIONS section (below) for the options appropriate for each audio device type. Valid values are:
ALSA
The Advanced Linux Sound Architecture.
FILE
Stream directly from a file.
JACK
The Jack Audio Connection Kit.
--audio-format=fmt
The audio encoding format to use. The default value is VORBIS. Valid fmt values are:
MP2
MPEG-1/1.5 Layer 2
MP3
MPEG-1/1.5 Layer 3
OPUS
Ogg Opus (RFC-6716)
PCM16
PCM16 Uncompressed
VORBIS
Ogg Vorbis
--audio-quality=qual
Use variable bitrate streaming at the given audio quality. qual can be in the range 0.0 (lowest quality) to 1.0 (highest). Use of this option is mutually exclusive with that of the --audio-bitrate option (see above).
--audio-samplerate=rate
The audio sample rate to use for streaming. If the underlying audio layer is operating at a different sample rate, the input will be automatically resampled to this rate. Default value is 44100.
--credentials-file=filename
Get the credentials for connecting to the server in the filename file. The contents of the file should be formatted as follows:
[Credentials] Username=<username> Password=<password>
When using the --ssh-identity option, the passphrase for the specified identity file should be used as the password value.
--delete-credentials
Delete the file specified by --credentials-file after being read.
--errors-string=string
Prepend string to messages sent to the syslog service (see the --errors-to option, below). Useful for disambiguating messages from multiple glasscoder(1) instances.
--errors-to=dest
Send error messages to dest (default standard error). Valid destinations are:
STDERR
Standard error.
SYSLOG
The system syslog service.
STDOUT
Standard output,in machine readable format (useful for communication with another 'controller' program). See also the --meter-data option below.
--help
Print a short usage message and exit.
--list-codecs
Print a list of available codecs and then exit.
--list-devices
Print a list of available source devices and then exit.
--metadata-port=port
Accept metadata updates via HTTP at port port. Default value is 0, which disables metadata updates. See the METADATA section (below) for information regarding the supported update formats.
--meter-data
Output meter level updates on standard output. Useful for driving an external metering display.
--server-auth=[username][:password] (DEPRECATED)
The authentication parameters to use. This parameter has no default.
NEVER USE THIS OPTION! It allows credentials to be seen by other users on the system. Use the --credentials-file option to specify server credentials instead.
--server-exit-on-last
Exit the program upon closure of the last player connection. This setting is used only by the IceStreamer server.
--server-max-connections=conns
Allow a maximum of conns simultaneous player connections. Players beyond this maximum attempting to connect will receive an immediate TCP disconnect before the HTTP handshake. This setting is used only by the IceStreamer server.
--server-no-deletes
Do not clean up or delete content previously posted to the publishing point. This setting is used only by the HLS server type.
--server-pipe=pathname
Location to create a UNIX socket for piping connection socket descriptors. Useful for implementing proxy connectors for the IceStreamer server. For further details about this feature, see the Proxy Connections section of the glasscoder-ipc(7) man page. The default is to create no UNIX socket. This setting is used only by the IceStreamer server.
--server-script-down=cmd
Run the command cmd when the connection enters the disconnected state.
--server-script-up=cmd
Run the command cmd when the connection enters the connected state.
--server-start-connections=conns
Do not start the audio transport until at least conns connections have been established. Used only by the IceStreamer server in conjunction with the FILE audio device. Default value is 0 --i.e. start the transport immediately.
--server-type=type
The type of streaming server to use (default is Icecast2). Valid values for type are:
FILE
Local file
FILEARCHIVE
Local file archive. Stream to a set of files on the local system, starting a new file at the beginning of each hour.
HLS
HLS/HTTP Live Streaming
IceCast2
IceCast v2
IceOut
Output an Icecast-compatible stream on standard output.
IceStreamer
Stream directly to players using the internal Icecast-compatible server.
Shout1
Shoutcast v1
Shout2
Shoutcast v2
--server-url=url
The URL describing the server resource to stream to. See the SUPPORTED URL SCHEMES section (below) for a list of what URL schemes are appropriate for which server types.
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
The User-Agent header value to use when connecting to external servers. Default value is GlassCoder/2.0.1. This setting is used only by IceCast2 and HLS servers.
--ssh-identity=filename
The path to the file containing an ssh(1) identity to use when connecting via SFTP. When using this option, the passphrase for the identity file should be provided as the server password. See the --credentials-file option for details.
--stream-aim=aim
The AOL Instant Messenger ID to associate with the stream. There is no default value. This setting is used only by Shoutcast servers.
--stream-description=string
The string to show as the stream description. There is no default value. This setting is used only by Icecast servers.
--stream-genre=string
The string to show as the stream genre. There is no default value. This setting is used only by Icecast and Shoutcast servers.
--stream-icq=icq
The ICQ ID to associate with the stream. There is no default value. This setting is used only by Shoutcast servers.
--stream-irc=irc
The Internet Relay Chat ID to associate with the stream. There is no default value. This setting is used only by Shoutcast servers.
--stream-name=string
The string to show as the stream name. There is no default value. This setting is used only by Icecast and Shoutcast servers.
--stream-timestamp-offset=offset
The offset to add to the value of stream timestamps, in seconds. Default value is 0. This setting is used only for HLS streams.
--stream-url=url
The URL to show for a page giving more information about the stream. There is no default value. This setting is used only by Icecast and Shoutcast servers, but is ignored by Shoutcast v2 servers.
--verbose
Increase verbosity level of information printed to standard error. WARNING: this may cause cleartext passwords to printed!
--version
Output version information and exit.
Advanced Linux Sound Architecture (--audio-device=ALSA)
--alsa-device=dev
The name of the ALSA device to use. If no --audio-device option is given, then the hw:0 device will be used.
Direct File Streaming (--audio-device=FILE)
--file-name=name
The name of the file to stream. If no --file-name option is given, then the name of the file will be read from standard input.
The Jack Audio Connection Kit (--audio-device=JACK)
--jack-client-name=name
The name of the JACK client to use. Default is glasscoder.
--jack-gain=gain
Apply a fixed gain of gain dB before encoding. Default is 0 dB.
--jack-server-name=name
The name of the JACK server instance to use.
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 |
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 |
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
Specified by the --stream-name option.
Description
Specified by the --stream-description option.
URL
Should be a link to content related to the stream. Specified by the --stream-url option.
Genre
Should be a single word describing the nature of the stream content. Specified by the --stream-genre option.
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
Specified by the --stream-name option.
URL
Should be a link to content related to the stream. Specified by the --stream-url option.
Genre
Should be a single word describing the nature of the stream content. Specified by the --stream-genre option.
ICQ ID
Should be User Identification Number for an ICQ user associated with the stream content. Specified by the --stream-icq option.
AOL Instant Messenger ID
Should be an ID for an AOL Instant Messenger user associated with the stream content. Specified by the --stream-aim option.
IRC ID
Should be an ID for an Internet Relay Chat channel associated with the stream content. Specified by the --stream-irc option.
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.
Never use the --server-auth option; it allows credentials to be seen by other users on the system. Use the --credentials-file option to specify server credentials instead.
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>
07/12/2022 | February 2022 |