I tried using an open source application 'Restreamer' that can self-host a streaming site and distribute it to YouTube, Twitter, Twitch, etc.



There are many services for distribution such as YouTube and Twitch in the world. Open source software that allows anyone to operate such a distribution service is ' Restreamer '. It is a convenient software that not only can be distributed on a site hosted by yourself, but also has a function to redistribute to other distribution services, so I actually used it and tried it out.

datarhei Restreamer - Restreamer

https://docs.datarhei.com/restreamer/

datarhei/restreamer: The Restreamer is a complete streaming server solution for self-hosting. It has a visually appealing user interface and no ongoing license costs. Upload your live stream to YouTube, Twitch, Facebook, Vimeo, or other streaming solutions like Wowza. Receive video data from OBS and publish it with the RTMP and SRT server.
https://github.com/datarhei/restreamer


Since Restreamer uses Docker to start, install Docker using the method that suits your environment from the link below.

Install Docker Engine | Docker Documentation
https://docs.docker.com/engine/install/


Since I am using Debian this time, I entered the following command.

[code] sudo apt-get update
sudo apt-get install ca-certificates curl gnupg

sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
sudo chmod a+r /etc/apt/keyrings/docker.gpg

echo \
'deb [arch='$(dpkg --print-architecture)' signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian \
'$(. /etc/os-release && echo '$VERSION_CODENAME')' stable' | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin[/code]



After Docker is installed, start Restreamer with the following command. Inside Docker, the server listens for HTTP communication on port 8080 and HTTPS communication on port 8181, so forward them to the usual ports 80 and 8181 respectively. In addition, the distribution service uses TCP ports 1935 and 1936 and UDP port 6000, so if the server is set up with a firewall, etc., it must be set to allow communication.
[code] sudo docker run -d --restart=always --name restreamer \
-v /opt/restreamer/config:/core/config \
-v /opt/restreamer/data:/core/data \
-p 80:8080 -p 443:8181 \
-p 1935:1935 -p 1936:1936 \
-p 6000:6000/udp \
datarhei/restreamer:latest[/code]



When I went to the server, I saw the Restreamer logo. Click on the link to the admin panel provided below.



First you need to register an account. Enter the desired user name and password and click 'REGISTER USER'.



Click NEXT: VIDEO SETUP.



Decide how to input video signals to the server. Since I will use

OBS Studio this time, click 'RTMP server'.



Click 'ENABLE RTMP SERVER...'.



This time, we will use TLS to make a secure connection, so check 'RTMP server' as well as 'RTMPS server'. Since additional settings are required, click the part labeled 'TLS/HTTPS'.



Enter your self-hosted domain name, check 'Let's Encrypt certification' for SSL communication, and enter your email address. There is a setting to change the HTTP or HTTPS port on this screen, but this is only a setting for deciding the port that Restreamer listens to. If you are forwarding the port in the Docker settings like this time, you do not need to change it.



Scroll the screen and click 'SAVE'.



Since it is said that the server needs to be restarted, click 'RESTART'.



There is no notification whether or not the restart was successful, but if you can click the control panel and operate it, it is proof that the restart was successful. Click 'RTMP' on the left tab, enter an appropriate character string in the token field and click 'SAVE'. After saving, close the setting screen with the X button on the upper right.



The delivery destination is displayed, so copy it.



Open the distribution software and set the copied URL as the destination. In the case of OBS Studio, select 'Custom' in the service column on the 'Distribution' tab of the settings and paste the URL in the server part.



When I go back to Restreamer and try to proceed, I get a warning that the stream has not arrived and I cannot proceed.



Start distribution with the distribution software.



You can now continue setting in Restreamer. First, select the resolution of the distribution. This time, the settings set in OBS Studio were displayed as they were, and there were no other options. Click NEXT.



It will be the audio setting screen, but this time click 'NEXT' without changing anything.



You can enter the delivery title, description, and delivery person information. Click 'NEXT' when you are done.



Select a distribution license. There was a set of Creative Commons licenses, and an option of 'no license' was provided. After deciding the license, click 'SAVE'.



The delivery management screen will open. Click the edit button of the pencil icon on the right side of 'Player'.



The URL for viewing the distribution is prepared on the setting screen of this player. Copy 'Player URL'.


When I opened it in another window, the delivery was displayed safely. Restreamer's standard player uses the entire screen to display the distribution, so if you view the distribution screen on the PC during distribution, an infinite loop will occur like the screen reflected in the distribution screen... bottom. The area outside the red line in the figure below is the UI of the original browser. There was a delay of about 20 to 30 seconds after operating the screen until it was displayed on the stream.



You can also set up redistribution by clicking the '+' mark button on the upper right of the distribution management screen.



Major distribution services such as Facebook Live, YouTube Live, Twitter, and Twitch are registered as redistribution destinations. I will check the connection settings to YouTube Live.



Use 'Stream key' to connect to YouTube Live. Click 'GET'.



Since YouTube's distribution dashboard opens, it is OK if you use the stream key described here.



Also, even if the service is not registered as a redistribution destination, redistribution to any distribution service is possible by selecting the appropriate protocol.



In addition, for example, Twitch regulates simultaneous distribution for all users as of June 2023, so if you use an application called Restreamer that allows you to distribute on another site while distributing on your own site, you will immediately be in violation of the terms. state. Some of the services posted may say `` technically it is possible to connect but it violates the terms '', so be careful that you need to check the terms yourself when redistributing .

in Review,   Software,   Web Service,   Web Application, Posted by log1d_ts