ReStreamBot is a bot for Telegram made in 2022 that allows you to re-route your stream in multiple platforms at the same time with the power of a Linux server.
git clone https://github.com/Bizzy-0110/ReStreamBot.git
cd ReStreamBot
pip install requirements.txt
To install Nginx with the RTMP module you can follow this guide.
A summary of the guide can be found under here.
Download dependencies:
sudo apt update
sudo apt install -y build-essential libpcre3 libpcre3-dev libssl-dev
From your home directory, download the nginx source code and get the RTMP module source code from git:
wget http://nginx.org/download/nginx-1.15.1.tar.gz
wget https://github.com/sergey-dryabzhinsky/nginx-rtmp-module/archive/dev.zip
Unpack/unzip them both, enter the nginx directory and build nginx with the RTMP module:
tar -zxvf nginx-1.15.1.tar.gz
unzip dev.zip
cd nginx-1.15.1
./configure --with-http_ssl_module --add-module=../nginx-rtmp-module-dev
make
sudo make install
And nginx is installed! By default it installs to /usr/local/nginx, so to start the server run the following command:
sudo /usr/local/nginx/sbin/nginx
To restart it, use:
sudo /usr/local/nginx/sbin/nginx -s stop
sudo /usr/local/nginx/sbin/nginx
Edit the costants at the beginning of the main.py
according to your needs
And add the bot token and the whitelist members in secret.json
.
Open the Nginx configuration and add the following
rtmp {
server {
listen 1935;
chunk_size 4096;
application starting_key {
live on;
record off;
meta copy;
# <put here the rtmp servers that you want>
# Example
# Youtube
# push rtmp://a.rtmp.youtube.com/live2/{stream_key};
# Twitch
# push rtmp://ingest.global-contribute.live-video.net/app/{stream_key};
}
}
}
Urls for Twitch
Url for youtube:
push rtmp://a.rtmp.youtube.com/live2/<YourStreamKey>
python3 main.py
/stop = stop the stream and change the token
/start = generate a new token and start the nginx service
/reload = reload the nginx service
/get_token = get the current token
/help = get help for the commands
Setup the bot and start it After starting the bot with the appropriate command go to the OBS settings, then go to Stream section, select custom in the Service selector, now, in the Server textbox insert:
rtmp://<YourLinuxServerIp>/<TheTokenGivenByTheBot>
Then if you configured correctly when you start your livestream the video streaming should be re-sent to the selected platforms