An OBS RTMP server is a self-hosted media endpoint that receives live video streams from OBS Studio using the Real-Time Messaging Protocol, then distributes or records that feed. Running your own server gives you full control over latency, privacy, branding, and cost compared to third-party platforms. You can pair it with solutions like VideoSDK Interactive Live Streaming for broader audience delivery.
Broadcasting live video to platforms like YouTube or Twitch is straightforward, but what happens when you need full control over the ingest pipeline? Maybe you want to stream privately to a select audience, multistream without paying a third-party service, or reduce the latency between your camera and your viewers. A self-hosted OBS RTMP server solves all three problems.
OBS Studio remains the most popular open-source encoder for live streaming, and RTMP is still the dominant ingest protocol it supports. By standing up your own RTMP server using Nginx with the RTMP module, you create a private endpoint that OBS pushes to directly. This guide walks through every step, from server preparation to security hardening to performance tuning, so you can launch a production-ready OBS RTMP server in 2026.
What Is an OBS RTMP Server?
An OBS RTMP server is a media server configured to accept incoming RTMP streams from OBS Studio and either record them, re-broadcast them, or convert them into other formats for playback. The server typically runs Nginx compiled with the RTMP module, which adds streaming capabilities to the standard Nginx web server. OBS acts as the publisher, encoding your camera and screen capture into a compressed bitstream and pushing it to the server over a TCP connection.
VideoSDK provides its own Interactive Live Streaming infrastructure for developers who need sub-second audience interaction, but for broadcasters who want a traditional RTMP ingest layer, a self-hosted Nginx RTMP server remains the most flexible and cost-effective option.
RTMP Protocol Overview
RTMP, or Real-Time Messaging Protocol, was originally developed by Macromedia and later acquired by Adobe. It operates over TCP and uses a three-way handshake to establish a persistent connection between the publisher and the server. Once connected, OBS sends audio and video data in chunked packets called messages, each tagged with a timestamp so the server can reconstruct the stream in correct order. RTMP supports adaptive bitrate streaming and carries metadata about resolution, frame rate, and codec settings alongside the media payload.
Role of OBS in the Ingest Chain
OBS Studio functions as the encoder in this architecture. It captures raw video from your camera or screen, compresses it using codecs like H.264 or HEVC, wraps it in an FLV container, and pushes the resulting bitstream to your RTMP server endpoint. OBS handles scene composition, audio mixing, and encoding on your local machine. The server simply receives what OBS sends. This separation of concerns means you can switch encoders, adjust bitrates, or change scenes in OBS without touching the server configuration.
Why Use Your Own RTMP Server?
Running your own OBS RTMP server delivers four concrete advantages over relying solely on hosted streaming platforms. First, privacy: your video never touches a third-party CDN unless you explicitly configure re-streaming. Second, multistreaming: you can receive one stream from OBS and fan it out to multiple destinations simultaneously without paying for a service like Restream. Third, latency control: you tune buffer sizes, chunk durations, and playback formats to achieve sub-second delay where needed. Fourth, cost: a modest VPS can handle a single 1080p stream for a few dollars per month, far less than most hosted multistreaming plans.
Cost Comparison: Hosted vs Self-Hosted
Hosted streaming platforms typically charge based on bandwidth, concurrent viewers, or output destinations. A plan supporting 1080p multistreaming to three platforms can cost twenty to fifty dollars monthly. A self-hosted Nginx RTMP server on a basic VPS with one CPU core and one gigabyte of RAM handles a single inbound 1080p stream and re-broadcasts it for roughly five dollars per month. The tradeoff is operational effort: you maintain the server, apply security patches, and troubleshoot issues yourself.
Latency and Quality Control
When you control the server, you control every parameter that affects latency and quality. Nginx RTMP buffer sizes, HLS segment durations, and OBS encoder settings all become tunable knobs. On hosted platforms, these values are fixed or limited to preset options. With your own server, you can target sub-second latency using HTTP-FLV playback, or accept a few seconds of delay in exchange for broader device compatibility using HLS. You also avoid platform-imposed bitrate caps, meaning your 1080p 60fps stream stays at full quality end to end.
Preparing the Server Environment
Before installing anything, you need a clean server running a Linux distribution. Ubuntu 22.04 or 24.04 LTS is the most commonly recommended option because of its long support cycle and extensive package availability. The server should have at least one CPU core, one gigabyte of RAM, and adequate bandwidth for your target bitrate plus headroom for viewers. A 1080p stream at 6 Mbps requires roughly 8 Mbps of upload bandwidth for the ingest alone, plus additional bandwidth per concurrent viewer if they connect directly to your server.
Network considerations matter as much as hardware. Your server needs a public IP address, open access to port 1935 for RTMP traffic, and optionally ports 80 and 443 if you plan to enable HTTP-FLV or HLS playback. If your VPS provider offers a firewall panel, configure it there as well as on the operating system level for defense in depth.
Choosing a VPS or On-Premise Machine
A cloud VPS is the easiest starting point because it comes with a public IP and predictable bandwidth. Providers like DigitalOcean, Linode, Vultr, and Hetzner offer plans in the five-dollar range that handle single-stream ingest comfortably. An on-premise machine works if you have a reliable internet connection with sufficient upload speed and a static or dynamic DNS address. On-premise deployments give you zero recurring cost but require you to manage power, cooling, and network security yourself.
Installing Required Packages
After your server is running and updated, install the build tools and libraries needed to compile Nginx with the RTMP module. This includes the compiler toolchain, the PCRE library for Nginx rewrite support, the zlib library for gzip compression, and OpenSSL for TLS support. On Ubuntu, you install these through the package manager by updating your package index first, then pulling in the build-essential metapackage along with the development headers for PCRE, zlib, and OpenSSL. This preparation step ensures the compilation process does not fail due to missing dependencies.
Installing Nginx with the RTMP Module
The standard Nginx package included in most Linux distributions does not include the RTMP module. You need to compile Nginx from source with the module linked in. Start by downloading the Nginx source tarball from the official Nginx website and the RTMP module source from its GitHub repository. The RTMP module, maintained by arut on GitHub, is the de facto standard for adding streaming capabilities to Nginx. Extract both archives into separate directories on your server.
Next, run the Nginx configure script with a flag that adds the RTMP module directory as an additional module. The configure script checks your system for dependencies and generates a Makefile tailored to your environment. You specify the installation prefix, enable the HTTP and stream modules as needed, and point the add-module flag at the extracted RTMP module directory. After configuration completes successfully, compile the project and install the resulting binaries.
Compiling Nginx from Source
Compilation involves three stages. First, the configure script probes your system for the compiler, libraries, and headers required to build Nginx. It generates configuration files and a Makefile. Second, the build step compiles Nginx core source files along with the RTMP module source files into object files and links them into the final binary. Third, the install step copies the binary, default configuration files, and helper scripts to the prefix directory you specified during configuration. The entire process typically takes two to five minutes on a single-core VPS.
Verifying the RTMP Module Load
After installation, verify that Nginx recognizes the RTMP module. Run the Nginx binary with the version and configuration flags to print the compiled modules list. You should see the RTMP module listed among the configure arguments. If it does not appear, the most common cause is an incorrect path passed to the add-module flag during configuration. Re-run the configure step with the correct path and rebuild.
Alternative: Pre-built Packages or Docker Image
If compiling from source feels daunting, community-maintained Docker images bundle Nginx with the RTMP module pre-compiled. Pulling a Docker image and running it with a mounted configuration file gets you a working RTMP server in minutes. The tradeoff is less control over compile-time options and potential lag behind the latest Nginx security patches. For production use, compiling from source remains the recommended path.
Configuring the RTMP Server for OBS
Once Nginx with the RTMP module is installed, you configure it by editing the main Nginx configuration file. The RTMP module introduces a new top-level block called the RTMP section, separate from the HTTP section you may already be familiar with. Inside the RTMP block, you define a server that listens on port 1935, and within that server, you define one or more application blocks. Each application represents a distinct streaming endpoint.
A typical configuration defines a live application that accepts incoming streams from OBS and allows playback. You specify whether recording is enabled, where recorded files are saved, and whether the stream should be published to additional endpoints. The application name becomes part of the RTMP URL that OBS targets. For example, if your application is named live, the full RTMP URL your OBS clients enter combines the server address, the application name, and the stream key.
Sample nginx.conf Structure
The configuration file has two major sections. The events block sets connection limits and is standard for all Nginx setups. The RTMP block is where streaming behavior lives. Inside it, a server directive binds to port 1935. Within the server, an application directive named live sets the mode to live broadcasting, enables publishing from clients, and enables playing for viewers. You can add a record directive to save streams as FLV files to a specified directory. A deny play all directive followed by an allow play directive lets you restrict which IPs can pull the stream. The HTTP block handles web-based playback if you enable HLS or HTTP-FLV, serving segments or streams through standard HTTP on port 80 or 443.
Enabling Stream Key Authentication
Without authentication, anyone who knows your server address and application name can publish or view streams. The RTMP module supports an on-publish and on-play callback mechanism. You configure a directive that points to a URL on your HTTP server, and Nginx calls that URL every time a client attempts to publish or play. If the URL returns a 200 status code, the connection is allowed. If it returns anything else, the connection is rejected. This lets you validate stream keys against a database or a simple static list.
Adding HLS or HTTP-FLV Playback
For browser-based playback, convert the RTMP stream into HLS or HTTP-FLV. The RTMP module includes an HLS directive that segments the live stream into short TS files and generates a playlist M3U8 file. You serve these files through the HTTP block using standard Nginx location directives. HTTP-FLV provides lower latency than HLS by serving the FLV stream directly over HTTP, and works well with flv.js for browser playback. HLS adds two to ten seconds of latency but offers broader device compatibility.
Securing Your RTMP Stream
Security is the area where most self-hosted streaming servers fail. An open RTMP server is an invitation for bandwidth abuse and unauthorized broadcasting. You need at least three layers of protection: a firewall restricting access to port 1935, TLS encryption for the RTMP connection, and stream key authentication to prevent unauthorized publishing.
Firewall Port 1935 Configuration
Configure your firewall to allow inbound TCP traffic on port 1935 only from known IP addresses when possible. If OBS runs from a fixed location like a studio, restrict publishing to that IP. For viewer connections, consider whether viewers pull RTMP directly or through HLS over HTTP. If viewers use HLS, they connect on port 80 or 443, and you can close 1935 to everyone except your OBS publisher. On Ubuntu, use the uncomplicated firewall tool to add rules for port 1935 with source IP restrictions.
Enabling RTMPS with Let's Encrypt
RTMPS is RTMP over TLS, and it prevents intermediaries from inspecting or tampering with your stream in transit. The Nginx RTMP module supports TLS through the SSL directives in the server block. You obtain a certificate from Let's Encrypt using the certbot tool, which verifies your domain and deposits the certificate files on your server. Then you reference those files in the RTMP server block using the SSL certificate and key directives. OBS supports RTMPS URLs natively, so the client-side change is simply updating the URL scheme from RTMP to RTMPS.
Stream Key Rotation Practices
Rotate your stream keys periodically, especially if multiple people publish to the same server. Generate a new key, update the authentication endpoint, and notify publishers. Avoid hardcoding keys in shared OBS profiles. If a key is compromised, revoke it immediately at the authentication layer rather than changing the server configuration.
Testing Ingest and Playback
After configuration, test both the ingest and playback paths before going live. Start by pushing a test stream from OBS and verifying that the server accepts it without errors. Then attempt playback through multiple clients to confirm the stream is reachable and plays correctly.
Using OBS Output Settings
In OBS, open the Settings panel and navigate to the Stream section. Set the service to Custom and enter your server URL in the format RTMP colon slash slash your server IP or domain colon 1935 slash application name. Enter your stream key in the stream key field. If you enabled RTMPS, use the RTMPS URL scheme instead. Click Start Streaming in the main OBS window. Watch the OBS status bar for the green indicator and check the server logs for a publish event confirming the connection was accepted.
Playback Verification Steps
For RTMP playback, open VLC and use the Open Network Stream option. Enter the RTMP URL matching your server, application, and stream key. The stream should appear within one to two seconds. For HLS playback, open a browser and navigate to the M3U8 playlist URL served by your HTTP block. Use a player library like hls.js if native HLS support is unavailable. For HTTP-FLV, use a page with flv.js pointing to the FLV endpoint. Compare the latency between your live action and the playback to establish a baseline for your configuration.
Optimizing Performance and Latency
Performance tuning for an OBS RTMP server involves adjusting server-side buffers, optimizing OBS encoder settings, and monitoring system resources. The goal is to minimize latency without introducing stuttering or dropped frames.
Buffer and Chunk Size Tweaks
The Nginx RTMP module exposes several directives that control buffering behavior. The chunk size directive sets the size of data chunks sent to clients, with a default of 4096 bytes. Increasing it can reduce overhead but increases memory usage per connection. The buffer directive controls how much data the server buffers before sending, and lowering it reduces latency at the risk of stuttering on unstable connections. For HLS, the hls_fragment directive sets segment duration, typically two to five seconds. Shorter fragments reduce latency but increase CPU usage and the number of files written to disk. Test different values and monitor for dropped frames on the playback side.
OBS Encoder Settings for Low Latency
On the OBS side, use the x264 encoder with a tuned preset for low latency. The ultrafast or veryfast preset minimizes encoding delay. Set the keyframe interval to two seconds to align with HLS segment boundaries. Use a CBR rate control method with a bitrate appropriate for your resolution and available bandwidth. Disable any look-ahead or psychovisual tuning options that add encoding delay. If your CPU supports hardware encoding through NVENC or QuickSync, use it to offload encoding from the CPU and reduce frame processing time. Monitor the OBS stats panel for dropped frames and encoder lag during testing.
Common Issues and Troubleshooting
Even with a correct setup, you may encounter connection failures, audio sync problems, or stream key mismatches. Systematic diagnosis saves hours of frustration.
"Connection Refused" Diagnosis
A connection refused error from OBS means the server is not accepting connections on port 1935. Check three things in order. First, confirm Nginx is running by checking the process list. Second, verify the RTMP block is in the configuration and the server directive binds to port 1935. Third, check the firewall rules on both the operating system and the VPS provider panel. If all three are correct, review the Nginx error log for startup errors that might indicate a syntax problem in the configuration file.
Audio and Video Desync Fixes
Audio and video desynchronization typically stems from one of two causes. The first is a mismatch between OBS audio delay settings and the video processing pipeline. Check the sync offset in OBS advanced audio properties and adjust the audio delay in milliseconds until lipsync is correct. The second cause is player-side buffering. HLS players buffer several segments before starting playback, which can cause apparent desync. Switch to HTTP-FLV or RTMP playback for lower-latency observation, or reduce the HLS playlist length and fragment size.
Log-Based Debugging
Both OBS and Nginx produce detailed logs. The Nginx error log, typically located in the logs directory under the installation prefix, shows connection events, authentication callback results, and module errors. The OBS log file, accessible from the Help menu, shows encoder settings, connection attempts, and dropped frame counts. Cross-referencing timestamps between the two logs pinpoints where in the pipeline a failure occurs.
Alternatives to RTMP and When to Switch
RTMP has served the streaming community well for over a decade, but newer protocols offer advantages in specific scenarios. Understanding when to switch prevents you from forcing RTMP into use cases where it underperforms.
Decision Matrix Overview
SRT, or Secure Reliable Transport, is better than RTMP for unreliable network conditions because it supports packet recovery over UDP and includes built-in encryption. Choose SRT when streaming over lossy connections or satellite links. WebRTC offers sub-500 millisecond latency and is ideal for interactive use cases like live auctions or remote collaboration. Choose WebRTC when audience interaction is required. HLS remains the best choice for large-scale one-to-many broadcasting because of its CDN compatibility and device support. Choose HLS when you need maximum reach and can tolerate several seconds of latency.
For developers building interactive streaming experiences, VideoSDK's Interactive Live Streaming provides sub-second latency with built-in viewer-to-speaker promotion, real-time chat, and audience polling. If your use case outgrows what a single RTMP server can handle, exploring a managed RTC platform becomes the logical next step. You can also review VideoSDK's code samples for integration patterns.
Definitions Glossary
RTMP (Real-Time Messaging Protocol): A TCP-based protocol for streaming audio, video, and data between a publisher and a server. OBS Studio uses RTMP to push encoded streams to an ingest endpoint.
Nginx RTMP Module: An open-source extension for the Nginx web server that adds RTMP ingest, re-publishing, recording, and HLS conversion capabilities. Maintained on GitHub by developer arut.
Stream Key: A unique identifier string that authenticates a publisher connecting to an RTMP server. OBS sends the stream key as part of the RTMP URL to prove the publisher is authorized.
HLS (HTTP Live Streaming): A protocol that segments a live stream into short media files served over HTTP, accompanied by a playlist file. HLS adds latency but offers broad device and CDN compatibility.
RTMPS: RTMP encapsulated in a TLS connection, providing encryption for stream data in transit. Requires a TLS certificate on the server and an RTMPS-compatible client like OBS.
Key Takeaways
- A self-hosted OBS RTMP server using Nginx with the RTMP module gives you full control over privacy, latency, multistreaming, and cost compared to hosted streaming platforms.
- Compiling Nginx from source with the RTMP module is the recommended installation path, though Docker images offer a faster setup alternative for testing.
- Security requires three layers: firewall restrictions on port 1935, RTMPS for TLS encryption, and stream key authentication via on-publish callbacks.
- Latency tuning involves adjusting Nginx buffer sizes, HLS fragment durations, and OBS encoder presets in combination, then monitoring for dropped frames.
- When RTMP no longer meets your needs, SRT handles unreliable networks, WebRTC enables sub-second interactivity, and managed platforms like VideoSDK Interactive Live Streaming scale audience delivery without infrastructure overhead.
Conclusion
Setting up an OBS RTMP server with Nginx is a practical way to take ownership of your live streaming pipeline. You start with a basic VPS, compile Nginx with the RTMP module, configure an application block for live ingest, secure it with firewall rules and stream key authentication, and then tune buffers and encoder settings for your latency target. The result is a private, cost-effective streaming endpoint that you fully control.
If you want to go beyond single-server RTMP and build interactive streaming experiences with sub-second latency, explore VideoSDK Interactive Live Streaming or browse the VideoSDK documentation for SDK integration guides. You can also join the VideoSDK Discord community to discuss streaming architecture with other developers. Sign up free at app.videosdk.live/login to start building.
What are you building with your OBS RTMP server? Drop a comment below, I would love to hear what kind of streaming workflow you are working on.
Free $20 Balance for AI Voice Agents & Video Calls
FAQ
