Skip to main content

Listen, monitor and archive your streams!

Project description

earhorn

Listen, monitor and archive your streams!

Install

If you need to listen or archive an Icecast stream, you will need ffmpeg:

sudo apt install ffmpeg

Install earhorn from pip (install the s3 extra to upload the segment to an s3 bucket):

pipx install earhorn
pipx install earhorn[s3]

You can start archiving an Icecast stream by providing a stream url and an archive path:

earhorn \
  --stream-url https://stream.example.org/live.ogg \
  --archive-path=/to/my/archive

You can also start exporting the Icecast stats as prometheus metrics by providing an Icecast stats url:

earhorn \
  --stats-url https://stream.example.org/admin/stats.xml \
  --stats-user admin \
  --stats-password hackme

Docker

docker pull ghcr.io/jooola/earhorn

Usage

Usage: earhorn [OPTIONS]

  ENVIRONMENT VARIABLES:

  If a `.env` file is present in the current directory, it will be loaded and can be used to pass environment
  variables to this tool.

  ARCHIVE STORAGE:

  The storage can be defined using a path to a local directory or an url to an s3 bucket. Segments will be saved on
  the storage you specified.

  To use an s3 bucket, you need to install the `s3` extras (`pip install earhorn[s3]`), use `s3://bucket-name` as
  value for the `--archive-path` option and export the s3 bucket credentials listed in the table below:

  | Variable                | Description                               | Example                     |
  | ----------------------- | ----------------------------------------- | --------------------------- |
  | AWS_ACCESS_KEY_ID       | The access key for your bucket user       | AKIA568knmklmk              |
  | AWS_SECRET_ACCESS_KEY   | The secret key for your bucket user       | mi0y84wu498zxsasa           |
  | AWS_S3_ENDPOINT_URL     | The endpoint to your s3 bucket (optional) | https://s3.nl-ams.scw.cloud |
  | AWS_S3_REGION_NAME      | Region of your s3 bucket                  | us-east-2                   |

  Example: export AWS_S3_ENPOINT_URL="https://s3.nl-ams.scw.cloud"

  ARCHIVE SEGMENTS:

  To change the segments duration or format, see the ffmpeg documentation for details
  about the available options:
  https://ffmpeg.org/ffmpeg-formats.html#segment_002c-stream_005fsegment_002c-ssegment

Options:
  --listen-port INTEGER           Listen port for the prometheus metrics endpoint.  [default: 9950]
  --hook PATH                     Path to a custom script executed to handle stream state `events`.
  --stats-url TEXT                URL to the icecast admin xml stats page.
  --stats-user TEXT               Username for the icecast admin xml stats page.  [default: admin]
  --stats-password TEXT           Password for the icecast admin xml stats page.
  --stream-url TEXT               URL to the icecast stream.
  --silence-detect-noise TEXT     Silence detect noise.  [default: -60dB]
  --silence-detect-duration TEXT  Silence detect duration.  [default: 2]
  --archive-path PATH             Path or url to the archive storage, supported storage are local filesystem and s3.
                                  If defined, the stream will be archived in the storage as segments.
  --archive-segment-filepath TEXT
                                  Archive segment filepath.  [default:
                                  {year}/{month}/{day}/{hour}{minute}{second}.{format}]
  --archive-segment-size INTEGER  Archive segment size in seconds.  [default: 3600]
  --archive-segment-format TEXT   Archive segment format.  [default: ogg]
  --archive-segment-format-options TEXT
                                  Archive segment format options.
  --archive-copy-stream           Copy the `stream` without transcoding (reduce CPU usage). WARNING: The stream has to
                                  be in the same format as the `--archive-segment-format`.
  --help                          Show this message and exit.

Developmement

To develop this project, start by reading the Makefile to have a basic understanding of the possible tasks.

Install the project and the dependencies in a virtual environment:

make install
source .venv/bin/activate
earhorn --help

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

earhorn-0.21.1.tar.gz (28.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

earhorn-0.21.1-py3-none-any.whl (29.5 kB view details)

Uploaded Python 3

File details

Details for the file earhorn-0.21.1.tar.gz.

File metadata

  • Download URL: earhorn-0.21.1.tar.gz
  • Upload date:
  • Size: 28.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for earhorn-0.21.1.tar.gz
Algorithm Hash digest
SHA256 b45126b1232811d1d3b44078170a759b5016acde66f88fbf1bb4df134ec72b28
MD5 473cfcd15f6f3e8b6961fb8135d173d7
BLAKE2b-256 f6d6d0aa00effff9ce2f1ffd8f67ff023494cac1a8a40198189ddae034628104

See more details on using hashes here.

Provenance

The following attestation bundles were made for earhorn-0.21.1.tar.gz:

Publisher: release.yml on jooola/earhorn

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file earhorn-0.21.1-py3-none-any.whl.

File metadata

  • Download URL: earhorn-0.21.1-py3-none-any.whl
  • Upload date:
  • Size: 29.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for earhorn-0.21.1-py3-none-any.whl
Algorithm Hash digest
SHA256 51bd3375b619b1acea5562abc3cb33bf7aa9a793af9ba6a2b3663a57ee3e641a
MD5 47b3ab565d3bc239c2f8ea035d0bab31
BLAKE2b-256 3298fcb0d8b127d2a0fe1771068efdcea00370920be31ad4460af41be708709b

See more details on using hashes here.

Provenance

The following attestation bundles were made for earhorn-0.21.1-py3-none-any.whl:

Publisher: release.yml on jooola/earhorn

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page