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, Linux, and macOS.
Setup
This application is datarhei Restreamer, which is the graphical user interface of datarhei Core. 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 page (e.g., supporting AMD64 or GPU Cuda).
Datarhei Restreamer and datarhei Core are both open-source software under the Apache License 2.0.
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:
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.
Implementation
This application consists of three logical parts: video input, system dashboard, and video output. Video input and output run independently.
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 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.
Dashboard
Once you successfully create a video signal, you will enter the dashboard.
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 Output
There are different ways to play video signals.
This publishing site 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β 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.
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.
Presets for publication services
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 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 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
|
Leave a Comment
Your email address will not be published. Required fields are marked *