Skip to main content

Setup

Minimum Requirements

  • Debian 10+
  • 512mb RAM
  • 1 Core

Installing System Tools and Node.js

apt update; \
apt install -y git curl nano xz-utils; \
curl -sL https://deb.nodesource.com/setup_15.x | bash -; \
apt install -y nodejs

Installing FFmpeg

cd /tmp; \
rm -r ffmpeg*; \
wget https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-amd64-static.tar.xz; \
tar xvf ffmpeg-release-amd64-static.tar.xz; \
cd /tmp/ffmpeg-*/; \
mv ffmpeg ffprobe /usr/bin/;

Cloning the Media Server Git Repository

cd ~; \
git clone https://github.com/mediafoundation/mediaserver.git; \
cd mediaserver; \
npm i

Running the Application

To ensure you are in the correct path, run the following command to start your Media Server:

node app.js

Testing the server

If everything is set up correctly, open a web browser and navigate to your server's IP address to view your Media Server homepage.

http://YOUR.IP.ADDRESS/

Home Page

Securing the server

For added security, it's recommended that you change the default secret passphrase in order to prevent unauthorized users from streaming to your RTMP server. This passphrase is used to generate secure stream keys.

nano config.js
mediaserver/config.js
const config = {
passphrase: "My Secret Passphrase",
//...

Using Media Network to Scale Your Media Server

Optionally, to scale up your streaming platform to millions of users, you can add your server as a resource to Media Network’s CDN marketplace to match with a CDN provider.

note

Follow this tutorial to learn how to add your resource to the marketplace using your server's IP address.

Editing the Config to Use Your Generated Media Network Subdomain

After adding your server's IP address to Media Network and matching it with a provider, a new random subdomain will be assigned to you. The next step is to edit your Media Server's configuration file and assign this newly generated domain.

nano config.js
mediaserver/config.js
const config = {
//...
cdn_url: "https://Resource_ID.medianetwork.cloud",
//...
info

Make sure to restart your Media Server instance after editing the configuration file, as it's required to apply changes.

Removing a stream

curl -X "DELETE" http://admin:admin@localhost/api/streams/live/STREAM_NAME

Admin Panel

Media Server comes with an admin panel and an API that are installed by default. You can use the panel to view stream and network usage details. Simply access the panel through a web browser using the following URL:

http://YOUR.IP.ADDRESS:8080/admin

To set up the admin username and password, edit the config.js file and restart the Media Server instance.

mediaserver/config.js
//...
auth: {
api : true,
api_user: 'admin',
api_pass: 'admin',
},
//...

Credits

Media Server is a fork of illuspas' Node-Media-Server, a Node.js modified implementation of RTMP/HTTP-FLV/WS-FLV/HLS/DASH Media Server Based on Arut's nginx RTMP Module.