
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, Linux, and macOS.
Setup
The application is datarhei Restreamer, which is the graphical user interface for datarhei Core. 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 page (for example, supporting AMD64 or GPU Cuda).
datarhei Restreamer and datarhei Core are both open-source software under the Apache License 2.0.
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:
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.
Implementation
The application consists of three logical parts: video input, system dashboard, and video output. Video input and output operate independently.
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 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.
Dashboard
Once the video signal is successfully created, you will enter the dashboard.
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 Output
There are different ways to play the video signal.
This publishing website 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” 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.
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.
Presets for publication services
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 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 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

|