# Galène streaming gateway
<!--
Copyright (C) 2024 A. Iooss
SPDX-License-Identifier: CC0-1.0
-->
Gateway to send streams such as RTMP or SRT to
[Galène videoconference server](https://galene.org/).
It is based on Gstreamer and implements the Galène protocol.
**This project is not production ready, and you might experience frame drops and crashes.**
> **Note**
> To stream from OBS Studio to Galène, you should rather prefer [WebRTC-HTTP ingestion protocol (WHIP)](https://datatracker.ietf.org/doc/draft-ietf-wish-whip/).
> OBS Studio introduced WHIP output in [version 30.0](https://github.com/obsproject/obs-studio/releases/tag/30.0.0-beta1).
> Galène supports WHIP on its master branch since July 2023, it will be part of Galène 0.8.
![Streaming from OBS to Galène, video background from KaMy Video Stock](./docs/demo.png)
## Installation
Real-time video conversion requires resources. If many users are going to use
this gateway simultaneously, you should scale your machine resources
accordingly.
Installation works on Ubuntu 20.10 and Debian Bullseye or any later version.
For Windows users, we recommend to use
[Windows Subsystem for Linux](https://learn.microsoft.com/en-us/windows/wsl/install).
### Dependencies
```bash
# On Debian/Ubuntu-based distributions
sudo apt install python3-gi python3-gi-cairo python3-websockets gir1.2-gst-plugins-bad-1.0 gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly gstreamer1.0-libav gstreamer1.0-nice
# On ArchLinux-based distributions
sudo pacman -S python-setuptools python-pip python-websockets python-gobject gobject-introspection gst-python gst-plugins-base gst-plugins-bad gst-plugins-ugly gst-libav
# On NixOS
nix-shell -p gobject-introspection -p gst_all_1.gst-libav -p gst_all_1.gst-plugins-bad -p gst_all_1.gst-plugins-base -p gst_all_1.gst-plugins-good -p gst_all_1.gst-plugins-ugly -p libnice -p python3 -p python3Packages.gst-python -p python3Packages.pygobject3 -p python3Packages.websockets
```
Then you should be able to either run `./galene-stream.py` in this repository,
or install it using pip.
### Configuration for UDP streaming
Launch the gateway using:
```
galene-stream --input "udp://127.0.0.1:8888" --output "https://galene.example.org/group/public/" --username bot
```
Then you can stream to `udp://127.0.0.1:8888` with no stream key.
### Configuration for RTMP streaming
```
+--------------------+ +----------+ +-------------+ +------+
|Streaming software | RTMP |NGINX RTMP| RTMP |Galène Stream| WebRTC |Galène|
|(such as OBS-Studio)+------> Server <------+ Gateway +--------> |
+--------------------+ +----------+ +-------------+ +------+
```
You need a NGINX RTMP server, you may remix the provided
[nginx.conf](./docs/nginx.conf). You can launch NGINX as user using:
```
nginx -c nginx.conf -p $PWD
```
You may launch the gateway after the NGINX server using:
```
galene-stream --input "rtmp://127.0.0.1:1935/live/test" --output "https://galene.example.org/group/public/" --username bot
```
Then you can stream to `rtmp://127.0.0.1:1935/live` with stream key `test`.
### Configuration for SRT streaming
SRT support is still experimental in some Linux distributions.
It has been reported to work on ArchLinux (on 2021/03/30).
When using OBS, you need to have FFMpeg compiled with SRT support.
To check if SRT is available, run `ffmpeg -protocols | grep srt`.
On Windows and MacOS, OBS comes with his own FFMpeg that will work.
Launch the gateway using:
```
galene-stream --input "srt://127.0.0.1:9710?mode=listener" --output "https://galene.example.org/group/public/" --username bot
```
Then you can stream to `srt://127.0.0.1:9710` with no stream key.
More information on [OBS Wiki, Streaming With SRT Or RIST Protocols](https://obsproject.com/wiki/Streaming-With-SRT-Or-RIST-Protocols).
### Configuration for file streaming
For debugging purposes you can directly stream a file,
```
galene-stream --input "file://source.webm" --output "https://galene.example.org/group/public/" --username bot
```
## Contributing
We welcome contributions that stays in the scope of this project.
Please format your code using `black` and test it using `pytest`.
### Collecting statistics about GStreamer WebRTC element
During a stream, you can send `!webrtc` in the chat to get some statistics
about the connectivity between the gateway and Galène.
### Debugging GStreamer pipeline
#### Logging pipeline statistics
You may use these environment variables,
```
GST_DEBUG="GST_TRACER:7" GST_TRACERS="latency;stats;rusage" GST_DEBUG_FILE=trace.log
```
Then you may inspect logs using `gst-stats-1.0 trace.log`.
#### Plotting pipeline graph
It is possible to plot pipeline status just before exiting the script by setting
`GST_DEBUG_DUMP_DOT_DIR` environnement variable to a directory.
For example, `export GST_DEBUG_DUMP_DOT_DIR=.`.
Then you can use GraphViz to generate an image from the dot file:
`dot -Tpng pipeline.dot > pipeline.png`.
## License
This project is compliant with version 3.2 of the REUSE Specification.
This gateway is developed by former members of [Crans](https://www.crans.org/)
and [Aurore](https://auro.re/) network organizations to build a self-hosted
free and open-source streaming server based on [Galène](https://galene.org/).
We believe in open source software.
Raw data
{
"_id": null,
"home_page": "https://github.com/erdnaxe/galene-stream",
"name": "galene-stream",
"maintainer": "erdnaxe",
"docs_url": null,
"requires_python": null,
"maintainer_email": "erdnaxe@crans.org",
"keywords": "galene, stream, rtmp, srt, webrtc, gstreamer",
"author": null,
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/2f/79/ec5872e4c2df3633ae6d24ec7766a366d35f839a60d3c91b029d3b4ebb72/galene_stream-0.2.0.tar.gz",
"platform": null,
"description": "# Gal\u00e8ne streaming gateway\n\n<!--\nCopyright (C) 2024 A. Iooss\nSPDX-License-Identifier: CC0-1.0\n-->\n\nGateway to send streams such as RTMP or SRT to\n[Gal\u00e8ne videoconference server](https://galene.org/).\nIt is based on Gstreamer and implements the Gal\u00e8ne protocol.\n**This project is not production ready, and you might experience frame drops and crashes.**\n\n> **Note**\n> To stream from OBS Studio to Gal\u00e8ne, you should rather prefer [WebRTC-HTTP ingestion protocol (WHIP)](https://datatracker.ietf.org/doc/draft-ietf-wish-whip/).\n> OBS Studio introduced WHIP output in [version 30.0](https://github.com/obsproject/obs-studio/releases/tag/30.0.0-beta1).\n> Gal\u00e8ne supports WHIP on its master branch since July 2023, it will be part of Gal\u00e8ne 0.8.\n\n![Streaming from OBS to Gal\u00e8ne, video background from KaMy Video Stock](./docs/demo.png)\n\n## Installation\n\nReal-time video conversion requires resources. If many users are going to use\nthis gateway simultaneously, you should scale your machine resources\naccordingly.\n\nInstallation works on Ubuntu 20.10 and Debian Bullseye or any later version.\n\nFor Windows users, we recommend to use\n[Windows Subsystem for Linux](https://learn.microsoft.com/en-us/windows/wsl/install).\n\n### Dependencies\n\n```bash\n# On Debian/Ubuntu-based distributions\nsudo apt install python3-gi python3-gi-cairo python3-websockets gir1.2-gst-plugins-bad-1.0 gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly gstreamer1.0-libav gstreamer1.0-nice\n\n# On ArchLinux-based distributions\nsudo pacman -S python-setuptools python-pip python-websockets python-gobject gobject-introspection gst-python gst-plugins-base gst-plugins-bad gst-plugins-ugly gst-libav\n\n# On NixOS\nnix-shell -p gobject-introspection -p gst_all_1.gst-libav -p gst_all_1.gst-plugins-bad -p gst_all_1.gst-plugins-base -p gst_all_1.gst-plugins-good -p gst_all_1.gst-plugins-ugly -p libnice -p python3 -p python3Packages.gst-python -p python3Packages.pygobject3 -p python3Packages.websockets\n```\n\nThen you should be able to either run `./galene-stream.py` in this repository,\nor install it using pip.\n\n### Configuration for UDP streaming\n\nLaunch the gateway using:\n\n```\ngalene-stream --input \"udp://127.0.0.1:8888\" --output \"https://galene.example.org/group/public/\" --username bot\n```\n\nThen you can stream to `udp://127.0.0.1:8888` with no stream key.\n\n### Configuration for RTMP streaming\n\n```\n+--------------------+ +----------+ +-------------+ +------+\n|Streaming software | RTMP |NGINX RTMP| RTMP |Gal\u00e8ne Stream| WebRTC |Gal\u00e8ne|\n|(such as OBS-Studio)+------> Server <------+ Gateway +--------> |\n+--------------------+ +----------+ +-------------+ +------+\n```\n\nYou need a NGINX RTMP server, you may remix the provided\n[nginx.conf](./docs/nginx.conf). You can launch NGINX as user using:\n\n```\nnginx -c nginx.conf -p $PWD\n```\n\nYou may launch the gateway after the NGINX server using:\n\n```\ngalene-stream --input \"rtmp://127.0.0.1:1935/live/test\" --output \"https://galene.example.org/group/public/\" --username bot\n```\n\nThen you can stream to `rtmp://127.0.0.1:1935/live` with stream key `test`.\n\n### Configuration for SRT streaming\n\nSRT support is still experimental in some Linux distributions.\nIt has been reported to work on ArchLinux (on 2021/03/30).\n\nWhen using OBS, you need to have FFMpeg compiled with SRT support.\nTo check if SRT is available, run `ffmpeg -protocols | grep srt`.\nOn Windows and MacOS, OBS comes with his own FFMpeg that will work.\n\nLaunch the gateway using:\n\n```\ngalene-stream --input \"srt://127.0.0.1:9710?mode=listener\" --output \"https://galene.example.org/group/public/\" --username bot\n```\n\nThen you can stream to `srt://127.0.0.1:9710` with no stream key.\n\nMore information on [OBS Wiki, Streaming With SRT Or RIST Protocols](https://obsproject.com/wiki/Streaming-With-SRT-Or-RIST-Protocols).\n\n### Configuration for file streaming\n\nFor debugging purposes you can directly stream a file,\n\n```\ngalene-stream --input \"file://source.webm\" --output \"https://galene.example.org/group/public/\" --username bot\n```\n\n## Contributing\n\nWe welcome contributions that stays in the scope of this project.\nPlease format your code using `black` and test it using `pytest`.\n\n### Collecting statistics about GStreamer WebRTC element\n\nDuring a stream, you can send `!webrtc` in the chat to get some statistics\nabout the connectivity between the gateway and Gal\u00e8ne.\n\n### Debugging GStreamer pipeline\n\n#### Logging pipeline statistics\n\nYou may use these environment variables,\n\n```\nGST_DEBUG=\"GST_TRACER:7\" GST_TRACERS=\"latency;stats;rusage\" GST_DEBUG_FILE=trace.log\n```\n\nThen you may inspect logs using `gst-stats-1.0 trace.log`.\n\n#### Plotting pipeline graph\n\nIt is possible to plot pipeline status just before exiting the script by setting\n`GST_DEBUG_DUMP_DOT_DIR` environnement variable to a directory.\n\nFor example, `export GST_DEBUG_DUMP_DOT_DIR=.`.\n\nThen you can use GraphViz to generate an image from the dot file:\n`dot -Tpng pipeline.dot > pipeline.png`.\n\n## License\n\nThis project is compliant with version 3.2 of the REUSE Specification.\n\nThis gateway is developed by former members of [Crans](https://www.crans.org/)\nand [Aurore](https://auro.re/) network organizations to build a self-hosted\nfree and open-source streaming server based on [Gal\u00e8ne](https://galene.org/).\nWe believe in open source software.\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Gateway to send streams to Gal\u00e8ne videoconference server.",
"version": "0.2.0",
"project_urls": {
"Homepage": "https://github.com/erdnaxe/galene-stream"
},
"split_keywords": [
"galene",
" stream",
" rtmp",
" srt",
" webrtc",
" gstreamer"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "4798ad7d01aacacf8e5af8d5b56cd5269060befcef54f179ef05d7b49016a638",
"md5": "b4b66eb0f8da4f85f4e5a2de4afae5b3",
"sha256": "597739aa64a88d088a7042988c7d3466f8210bddb88e7e5a799647451abd056c"
},
"downloads": -1,
"filename": "galene_stream-0.2.0-py2.py3-none-any.whl",
"has_sig": false,
"md5_digest": "b4b66eb0f8da4f85f4e5a2de4afae5b3",
"packagetype": "bdist_wheel",
"python_version": "py2.py3",
"requires_python": null,
"size": 16157,
"upload_time": "2024-12-06T07:18:46",
"upload_time_iso_8601": "2024-12-06T07:18:46.526894Z",
"url": "https://files.pythonhosted.org/packages/47/98/ad7d01aacacf8e5af8d5b56cd5269060befcef54f179ef05d7b49016a638/galene_stream-0.2.0-py2.py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "2f79ec5872e4c2df3633ae6d24ec7766a366d35f839a60d3c91b029d3b4ebb72",
"md5": "ec2af9b55cf12740b3c6ef64bc8dcc1d",
"sha256": "ea059f26c3dbb34838ee3488598f150c5db36086c208b433802a452c2504cda6"
},
"downloads": -1,
"filename": "galene_stream-0.2.0.tar.gz",
"has_sig": false,
"md5_digest": "ec2af9b55cf12740b3c6ef64bc8dcc1d",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 394479,
"upload_time": "2024-12-06T07:18:48",
"upload_time_iso_8601": "2024-12-06T07:18:48.119315Z",
"url": "https://files.pythonhosted.org/packages/2f/79/ec5872e4c2df3633ae6d24ec7766a366d35f839a60d3c91b029d3b4ebb72/galene_stream-0.2.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-06 07:18:48",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "erdnaxe",
"github_project": "galene-stream",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "galene-stream"
}