Skip to Content
Internet Protocol
Unreal Engine Plugin

RTMP Server

RTMP/RTMPS server for Unreal Engine: receive OBS and FFmpeg streams, serve viewers with view keys, Blueprint nodes and C++ usage.

The RTMP server accepts publishers (OBS, FFmpeg, another Unreal) and makes their audio and video available to an RTMP Receiver. It can also let RTMP clients (VLC, ffplay, OBS) watch those streams. See the RTMP overview for complete flows.

Unreal Engine 5.8 and DirectX 12 only

RTMP is supported only on Unreal Engine 5.8, Win64, with the DirectX 12 RHI. Set Project Settings > Platforms > Windows > Default RHI to DirectX 12. On DirectX 11 or Vulkan the GPU encoder refuses to start, and publishing fails with an error.

References

#include "rtmp/rtmpserver.h"

How to use

Blueprint: search by GetInternetProtocolSubsystem and call CreateRTMPServer function

C++: Use the code bellow

#include "rtmp/rtmpserver.h"

URTMPServer* Server = NewObject<URTMPServer>(this);
FServerBindOptions Bind;
Bind.Address = TEXT("0.0.0.0");
Bind.Port = 1935;
Server->Open(Bind);

Variables

Backlog

  • Set/Get the maximum number of pending connections the server will accept in queue.
Backlog
Variable

Nodes

Is Open

  • Return true if the server is listening.
Is Open
Return Value
Pure function

Local Endpoint

  • Get the local endpoint of the server. Use this function only after Open.
Local Endpoint
Return Value
Pure function

Get Error Code

  • Return a struct of the latest error code.
Get Error Code
Return Value
Pure function

Open

  • Opens the listening socket. The RTMP default port is 1935.
  • It returns false if the server is already open or if any error happens during the bind. On Listening is triggered on success.
  • Address must be an IP literal, localhost or empty (any address). Host names are not resolved: they, and ports outside 0-65535, fail with an Invalid argument error.
  • Publishers connect to rtmp://<this machine>:<port>/<app>/<stream key>.
OpenTarget is RTMPServer
Target
Bind Opts
Return Value
Function

Close

  • Close the server and every publisher and viewer connection. 'on_close' event will be triggered.
CloseTarget is RTMPServer
Target
Function

Set Allowed Stream Keys

  • Restricts which stream keys may publish. An empty array accepts any key.
  • A publisher using a key that is not allowed is refused with NetStream.Publish.Unauthorized.
  • A second publisher using a key that is already live is refused (NetStream.Publish.BadName).
  • Keys are kept in memory only (never a saved property), so they never end up in versioned config.
Set Allowed Stream KeysTarget is RTMPServer
Target
Stream Keys
Function

Set Tls Options

  • Enables RTMPS (RTMP over TLS) for the next Open. Publishers and viewers then use rtmps://.
  • Requires a certificate and a private key. See Security Context Options.
Set Tls OptionsTarget is RTMPServer
Target
Sec Opts
Function

Clear Tls Options

  • Disables RTMPS for the next Open.
Clear Tls OptionsTarget is RTMPServer
Target
Function

Playback

Playback lets RTMP clients (VLC, ffplay, an OBS Media Source, another Unreal) watch the streams published to this server. It is off by default. Viewers never get the publishing key: each stream is reached through a separate view key, at rtmp://<this machine>:<port>/<app>/<view key>.

  • Each viewer costs the full stream bitrate in upload bandwidth.
  • Each viewer has a bounded send queue: under congestion P-frames are dropped and the stream resumes at the next keyframe.
  • Viewers stay connected while the publisher reconnects.

Set Playback Enabled

  • Allows RTMP clients to watch published streams. Applies immediately.
  • Max Viewers Per Stream: 0 means unlimited.
Set Playback EnabledTarget is RTMPServer
Target
Enabled
Max Viewers Per Stream
Function

Is Playback Enabled

  • Return true if playback is enabled.
Is Playback Enabled
Return Value
Pure function

Set Playback Key

  • Lets viewers watch App / Stream Key by opening rtmp://host:port/App/View Key.
  • Returns false if View Key is empty or equal to Stream Key (that would reveal the publishing key).
  • Several view keys may point to the same stream.
Set Playback KeyTarget is RTMPServer
Target
App
Stream Key
View Key
Return Value
Function

Remove Playback Key

  • Removes one view key of App.
Remove Playback KeyTarget is RTMPServer
Target
App
View Key
Function

Clear Playback Keys

  • Removes every view key.
Clear Playback KeysTarget is RTMPServer
Target
Function

Get Viewer Count

  • Number of clients currently watching streams of App. An empty App counts every app.
Get Viewer Count
Target
App
Return Value
Pure function

Events

Stream keys are secrets

Stream Name in the publish events is the stream key sent by the publisher. Never show or log it. The plugin never logs keys, and playback events never report them.

On Listening

  • This event will be triggered when the server starts listening.
Bind Event to On Listening
Target
Event
On ListeningCustom Event
Event binding

On Publish Started

  • A publisher started sending a stream.
Bind Event to On Publish Started
Target
Event
On Publish StartedCustom Event
App
Stream Name
Remote
Event binding

On Publish Ended

  • A publisher stopped or disconnected. More streams may start later with the same key.
Bind Event to On Publish Ended
Target
Event
On Publish EndedCustom Event
App
Stream Name
Remote
Event binding

On Play Started

  • A client started watching a stream of App.
Bind Event to On Play Started
Target
Event
On Play StartedCustom Event
App
Remote
Event binding

On Play Ended

  • A client stopped watching a stream of App.
Bind Event to On Play Ended
Target
Event
On Play EndedCustom Event
App
Remote
Event binding

On Close

  • Event triggered when the server is closed.
Bind Event to On Close
Target
Event
On CloseCustom Event
Event binding

On Error

  • Event triggered if any error occur during async process.
Bind Event to On Error
Target
Event
On ErrorCustom Event
Error Code
Event binding
Edit on GitHub

On this page