How to Use Your Raspberry Pi as a Streaming Server

How to Use Your Raspberry Pi as a Streaming Server
Introduction: Stream real-time video from a Raspberry Pi network camera and re-stream the video to social networks.
How to Use Your Raspberry Pi as a Streaming ServerWord count: 2798, estimated reading time: 4 minutes

Stream real-time video from a Raspberry Pi network camera and re-stream the video to social networks.

For various reasons, people need to stream real-time video from network cameras. The Raspberry Pi platform is well-suited for such applications. For continuous applications like real-time streaming servers, it requires very little power. It can communicate with the Raspicam camera module, USB cameras, or other network video signals. This system is an RTMP, HLS, and SRT server. This article demonstrates how to set up a Raspberry Pi as a streaming server using HLS streaming. You need a video source to use it as a streaming server.

Even without a Raspberry Pi, you can complete the steps described here. Additionally, there are further installation instructions for Windows🔗 docs.datarhei.com, Linux🔗 docs.datarhei.com, and macOS🔗 docs.datarhei.com.

How to Use Your Raspberry Pi as a Streaming Server

Setup

The application is datarhei Restreamer🔗 github.com, which is the graphical user interface for datarhei Core🔗 github.com. datarhei Core runs the well-known media framework FFmpeg underneath. The easiest way to get started with datarhei Restreamer is to install the official Docker container. The program is downloaded and installed automatically using the docker pull command from Docker Hub. Once installed, Restreamer starts immediately. If you do not have a Raspberry Pi, you can use one of the other Docker containers from the datarhei Restreamer GitHub🔗 github.com page (for example, supporting AMD64 or GPU Cuda).

datarhei Restreamer and datarhei Core are both open-source software under the Apache License 2.0🔗 github.com.

The following is the installation command for Raspberry Pi 3 and above with GPU support:

docker run -d --restart=always --name restreamer \
   -v /opt/restreamer/config:/core/config -v /opt/restreamer/data:/core/data \
   --privileged \
   -p 8080:8080 -p 8181:8181 \
   -p 1935:1935 -p 1936:1936 \
   -p 6000:6000/udp \
   datarhei/restreamer:rpi-latest

No matter which command you use, you only need the --privileged option to access local devices like USB cameras.

After installation, connect the Raspberry Pi to the local network. Then enter http://device-ip:8181/ui in the browser to open the web-based GUI.

You should see the following screen:

How to Use Your Raspberry Pi as a Streaming Server

First login into datarhei Restreamer

Assign a password, and the system can proceed with the first login. The wizard will begin configuring the first video source.

Tip: The Docker command above permanently stores configuration data with login name and password in the /opt/restreamer/config folder.

How to Use Your Raspberry Pi as a Streaming Server

Implementation

The application consists of three logical parts: video input, system dashboard, and video output. Video input and output operate independently.

How to Use Your Raspberry Pi as a Streaming Server

Video Input

The wizard will help you create a video source from scratch. This can be a USB video source, a Raspberry Pi camera, or a network source such as an IP camera or an m3u8 file from the internet. HLS, RTMP, and real-time SRT protocols can be used. The wizard can help configure video resolution and audio correctly. In the last step, you can assign different Creative Commons(Creative Commons) licenses. It is worth looking at the settings for the video signal. You will find several options, such as transcoding for vertical video platforms or rotating the video.

How to Use Your Raspberry Pi as a Streaming Server

Dashboard

Once the video signal is successfully created, you will enter the dashboard.

How to Use Your Raspberry Pi as a Streaming Server

datarhei Restreamer dashboard

It is the central starting point for all other settings. To see all the features of the program, you can switch to expert mode in system preferences.

The dashboard contains the following:

â—ˆ Video signal settings.
â—ˆ Active content URLs for RTMP, SRT, HLS servers, and snapshots.
â—ˆ All active publishing services for re-streaming.
â—ˆ Start the wizard to create additional video sources.
â—ˆ System menu.
â—ˆ Real-time video signal statistics.
â—ˆ Real-time system monitoring.

How to Use Your Raspberry Pi as a Streaming Server

Video Output

There are different ways to play the video signal.

This publishing website🔗 demo.datarhei.com is the simplest, instantly available, and internally hosted login page for Restreamer. The playback page can also be streamed to Chromecast and AirPlay. Basic settings like adjusting the background image and adding logos in the player can be done directly within Restreamer. Those who know HTML can customize the page for themselves. Advanced users can inject code to use external modules of the website, such as chat. The statistics module under the video player shows active viewers and total views. The “Share(Share)” button supports the distribution of live streams. The website’s HTTPS certificate is activated via Let’s Encrypt with minimal effort. By simply forwarding the HTTPS port to the Raspberry Pi’s LAN IP, the website can be publicly accessible.

How to Use Your Raspberry Pi as a Streaming Server

Landing page from datarhei Restreamer

The publishing service is a great way to re-stream content. There are many ready-made modules for popular websites like YouTube, Twitch, or PeerTube. Similarly, there are many for other streaming software and popular CDNs. Complete control over video protocols allows streaming to all target addresses that support RTMP, HLS, and SRT. An HTML snippet code with a video player works on the webpage.

How to Use Your Raspberry Pi as a Streaming Server

Presets for publication services

How to Use Your Raspberry Pi as a Streaming Server

Using Raspberry Pi for Streaming Saves Power

This article demonstrates how to turn a Raspberry Pi into a streaming server. The Raspberry Pi platform allows you to interact with various video signals in an energy-efficient way. The pre-configured settings make it easy to set up the server, and advanced users can make some adjustments to the system. You can use it for playback, host live streaming on a website, or integrate with OBS🔗 opensource.com in the system environment. Using different video sources and transmission protocols as the basis of the project provides great flexibility, making this system highly customizable. Additionally, with FFmpeg, datarhei Core makes it easy for software developers to extend all application processes.

The program turns the Raspberry Pi into a dedicated streaming server. You can live stream independently to a website or multi-stream to different video networks without the need for additional video providers.

You can test the fully functional demo🔗 demo.datarhei.com on the project website using the login name “admin” and password “demo”.

via: https://opensource.com/article/23/3/raspberry-pi-streaming-server

Author: Sven Erbeck Topic: lkxed Translator: geekpi Proofreader: wxy

This article is originally compiled by LCTT and proudly presented by Linux China

How to Use Your Raspberry Pi as a Streaming Server
LCTT Translator: geekpi
💎💎💎💎
How to Use Your Raspberry Pi as a Streaming Server
Translation: 1887.5 articles

|

Contribution: 3423 days
2013-10-25
→
2023-03-10
https://linux.cn/lctt/geekpi
Welcome to reprint in accordance with the CC-BY-SA agreement,
If you need to reprint, please leave a message under the article “Reprint: Public Account Name“,
We will add you to the whitelist, authorizing “the article can be modified when reprinted“.

Leave a Comment

×