How Do I setup Media Servers with OBS?

0

I have been streaming many years by RTMP direct into my house IP/ddns which hosts an NGINX server. I ingest that stream with OBS then remotely start obs using a websockets connected iOS app. I have recently moved to a new location where I don't have full access to the networking and would like to setup a custom streaming server that can do the same.

I have tried setting up a windows machine that I can stream into and keep online for the same purpose through AWS but it did not seem cost effective for what I needed. I also tried setting up other nginx servers and containers, as well as taking the time to play around with some of the media services available.

I'm not sure what the best solution is, but I would like your opinion on the best way to go about this and still keep it cost-effective to leave always active so whenever I start a stream, it just goes online on its own. I need the ability to access obs remotely to configure it as well as have the processing power to handle incoming/outgoing streams. the ability to leave other bots running as well such as lumia and or streamerbot is a plus.

Generally they will be 1080p @30 and sometimes @60. bitrate generally kept 5000-7000.

Another option would have AWS just handle the media and i still ingest that internally in my home and stream out from OBS there. would probably work better than me sending the stream into the house then also outgoing.

Dro
asked a month ago125 views
1 Answer
0

To set up a cost-effective and reliable media server for streaming with OBS, leveraging AWS services can be a viable solution. Here’s a detailed plan to achieve this:

Solution Overview

  1. AWS EC2 for OBS and NGINX: Use an EC2 instance to host OBS and NGINX with RTMP.
  2. AWS S3 and CloudFront for Distribution: Use S3 and CloudFront to serve the streams if you want to scale.
  3. Remote Access: Access OBS remotely using a WebSocket server or similar setup.
  4. Cost Management: Choose cost-effective instance types and use spot instances if suitable.

Step-by-Step Setup

Step 1: Set Up an EC2 Instance

  1. Launch an EC2 Instance:
  • Go to the EC2 Dashboard.
  • Click on "Launch Instance".
  • Choose an instance type based on your requirements (t3.medium or t3.large for a balance of cost and performance).
  • Configure instance details, add storage (EBS), and configure security groups to allow SSH (port 22) and RTMP (port 1935).
  1. Install Required Software:
  • Connect to your instance using SSH.
  • Update the instance and install NGINX with RTMP module.
sudo apt update
sudo apt install nginx
sudo apt install libnginx-mod-rtmp
  1. Configure NGINX for RTMP:
  • Edit the NGINX configuration file to add RTMP settings.
sudo nano /etc/nginx/nginx.conf
  • Add the following RTMP configuration:
rtmp {
    server {
        listen 1935;
        chunk_size 4096;

        application live {
            live on;
            record off;
        }
    }
}
  1. Install OBS:
  • Install OBS on the EC2 instance. This might require adding a repository and installing OBS using a package manager.
sudo apt install ffmpeg
sudo add-apt-repository ppa:obsproject/obs-studio
sudo apt update
sudo apt install obs-studio

Step 2: Configure Remote Access to OBS

  1. Install OBS WebSocket Plugin:
  • Download and install the OBS WebSocket plugin to allow remote control.
sudo apt install obs-websocket
  1. Configure OBS WebSocket:
  • Open OBS and configure the WebSocket settings (port and authentication).
  1. Set Up Remote Control:
  • Use an iOS app that supports OBS WebSocket to control OBS remotely.

Step 3: Streaming Setup

  1. Set Up OBS for Streaming:
  • Open OBS and set up the streaming settings to stream to the NGINX RTMP server.
  • Use the RTMP URL rtmp://<your-ec2-public-ip>/live.
  1. Start Streaming:
  • Start streaming from OBS on your local machine to the EC2 instance.

Step 4: Optimize for Cost and Performance

  1. Instance Type:
  • Use a burstable performance instance (e.g., t3.medium) for cost-effectiveness.
  • Consider spot instances for further cost savings.
  1. Storage and Bandwidth:
  • Monitor storage and bandwidth usage. Use CloudWatch to set up alarms for high usage.
  • Consider using S3 for storing stream recordings if needed.
  1. Auto-scaling:
  • If you expect varying traffic, set up auto-scaling groups to handle peak loads.

Alternative: AWS Media Services

If you want AWS to handle the media streaming:

  1. AWS MediaLive and MediaPackage:
  • Use AWS MediaLive to ingest and process live video streams.
  • Use AWS MediaPackage to prepare and protect your video for delivery.
  1. Workflow:
  • Stream from OBS to AWS MediaLive.
  • MediaLive processes the stream and sends it to MediaPackage.
  • MediaPackage delivers the stream via CloudFront.

Example AWS MediaLive Setup

  1. Create a MediaLive Channel:
  • Go to AWS MediaLive.
  • Create an input for your stream (RTMP).
  • Create a channel and configure it to use the input and output to MediaPackage.
  1. Create a MediaPackage Channel:
  • Go to AWS MediaPackage.
  • Create a channel and endpoints for HLS or DASH.
  1. Stream to MediaLive:
  • Configure OBS to stream to the MediaLive RTMP endpoint.
  1. Distribute via CloudFront:
  • Set up a CloudFront distribution for the MediaPackage endpoints.

Conclusion

Setting up a media server on AWS can provide flexibility and scalability for your streaming needs. Using an EC2 instance for NGINX and OBS offers a cost-effective solution, while AWS MediaLive and MediaPackage provide a more managed and scalable approach. Choose the setup that best fits your requirements and budget.

profile picture
EXPERT
answered a month ago