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 webcam and re-stream the video to social networks.
How to Use Your Raspberry Pi as a Streaming ServerWord count: 2798, reading time: 4 minutes

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

For various reasons, people need to stream real-time video from webcams. The Raspberry Pi platform is ideal for such applications. It requires very little power for continuous applications like a real-time streaming server. It can communicate with the Raspicam camera module, USB cameras, or other network video signals. This system serves as an RTMP, HLS, and SRT server. This article demonstrates how to set up a Raspberry Pi as a streaming server using HLS streaming. You will 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

This application is datarhei RestreamerπŸ”— github.com, which is the graphical user interface of datarhei CoreπŸ”— github.com. Datarhei Core runs the renowned media framework FFmpeg at its core. The easiest way to get started with datarhei Restreamer is to install the official Docker container. Downloading and installing through Docker Hub is done automatically via the docker pull command. Once installed, Restreamer starts immediately. If you don’t have a Raspberry Pi, you can use one of the other Docker containers from the datarhei Restreamer GitHubπŸ”— github.com page (e.g., 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 are the installation commands for Raspberry Pi models 3 and above that support GPU:

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

Regardless of which command you use, you only need the --privileged option to access local devices such as USB cameras.

After installation, connect the Raspberry Pi to the local network. Then open a web browser and go to http://device-ip:8181/ui to access 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

Set a password, and the system is ready for the first login. The wizard will start configuring the first video source.

Tip: The above Docker command permanently saves configuration data with a username and password in the /opt/restreamer/config folder.

How to Use Your Raspberry Pi as a Streaming Server

Implementation

This application consists of three logical parts: video input, system dashboard, and video output. Video input and output run 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, Raspberry Pi camera, or a network source such as an IP camera or m3u8 file from the web. HLS, RTMP, and real-time SRT protocols can be used. The wizard helps configure video resolution and sound correctly. In the final step, you can assign different Creative Commons(Creative Commons) licenses. It’s worth looking at the settings for video signals. You will find several options, such as transcoding or rotating the video for vertical video platforms.

How to Use Your Raspberry Pi as a Streaming Server

Dashboard

Once you successfully create a video signal, you will enter the dashboard.

How to Use Your Raspberry Pi as a Streaming Server

datarhei Restreamer dashboard

It serves as 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.
β—ˆ Launch 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 video signals.

This publishing siteπŸ”— demo.datarhei.com is the simplest, instantly available, and internally hosted login page for Restreamer. The playback page can also be transmitted to Chromecast and AirPlay. Basic settings such as adjusting the background image and adding logos in the player can be done directly in Restreamer. Those who know HTML can customize the page for themselves. Advanced users can inject code to use external modules on the site, like 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 site’s HTTPS certificate is activated through Let’s Encrypt with minimal effort. By simply forwarding the HTTPS port to the Raspberry Pi’s LAN IP, the site can be publicly accessible.

How to Use Your Raspberry Pi as a Streaming Server

Landing page from datarhei Restreamer

Publishing services are a great way to re-stream content. There are many ready-made modules for popular sites like YouTube, Twitch, or PeerTube. Similarly, this goes for other streaming software and popular CDNs. Full 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 to Stream Media 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 a power-saving manner. Pre-set configurations make it easy to configure 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 into the system environment. Using different video sources and transmission protocols as the basis of the project provides great flexibility, making this system highly customizable. Moreover, the datarhei Core with FFmpeg makes it easy for software developers to extend all application processes.

This program turns the Raspberry Pi into a dedicated streaming server. You can independently stream live 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 site with the username β€œadmin” and password β€œdemo” before installation.

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

Author: Sven Erbeck, Editor: 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 CC-BY-SA protocol. If you need to reprint, please leave a message under the article β€œReprint: Public Account Name”, and we will add you to the whitelist, allowing β€œto modify when reprinting articles”.

Leave a Comment

Your email address will not be published. Required fields are marked *