Skip to Content
Internet Protocol
Unreal Engine Plugin

RTMP Receiver

Play live RTMP/RTMPS streams in Unreal Engine 5.8: video texture for materials and UMG, spatialized audio, low latency mode, pull from servers and Media Framework.

The RTMP receiver decodes a live H.264/AAC stream and plays it through the Media Framework: you get a video texture for materials and UMG, and a spatialized audio component. It can receive a stream published to this machine (OBS, FFmpeg, another Unreal) or pull one from any RTMP server. 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 "IPRtmpReceiver.h"

How to use

Blueprint: add a Construct Object from Class node, set Class to IPRtmp Receiver and Outer to self, and store the result in a variable.

Construct IPRtmp Receiver
Class
Outer
Return Value
Function

Call one of the start nodes (Start From Server, Start Pull or Start Url), then plug Get Video Texture into a material and call Create Audio Component for sound.

C++: Use the code bellow

#include "IPRtmpReceiver.h"

UIPRtmpReceiver* Receiver = NewObject<UIPRtmpReceiver>(this);
Receiver->StartFromServer(Server, TEXT("live"), StreamKey, EIPRtmpLatencyMode::LowLatency);
ScreenMaterial->SetTextureParameterValue(TEXT("Video"), Receiver->GetVideoTexture());
Receiver->CreateAudioComponent(ScreenActor);

Keep a reference

Store the receiver in a variable (Blueprint) or a UPROPERTY (C++). An object that nothing references is destroyed by the garbage collector, and the stream stops.

Latency modes

EIPRtmpLatencyMode sets the size of the jitter buffer. Audio is the master clock.

ModeDefault bufferUse it for
Low Latency150 msLowest delay, on a good local network. More rebuffering on bad networks.
Smooth (default)1000 msInternet streams: tolerant to network jitter.

Latency Ms overrides the buffer size of the mode (0 uses the default above, up to 10000 ms).

Nodes

Start From Server

  • Receives the stream published to an RTMP Server of this plugin, with the given App and Stream Key.
  • The server must already be open: otherwise it returns false and On Error is triggered.
  • You can start the receiver before the publisher connects: On Started fires when the stream arrives.
Start From ServerTarget is IPRtmp Receiver
Target
Server
App
Stream Key
Latency Mode
Latency Ms
Return Value
Function

Start Pull

  • Plays a stream from an RTMP server: MediaMTX, nginx-rtmp, or another Unreal with playback enabled.
  • Url is rtmp://host[:port]/app or rtmps://host[:port]/app. The Stream Key (or view key) is passed separately: it is kept in memory only and never logged.
  • Reconnects with exponential backoff if the connection drops. Server refusals (unknown key, TLS errors...) are reported through On Error and are not retried.
  • For rtmps://, certificates are always verified.
Start PullTarget is IPRtmp Receiver
Target
Url
Stream Key
Latency Mode
Latency Ms
Return Value
Function

Start Url

  • Starts from a single URL:
    • iprtmp://host:port/app/key: a stream published to this machine. The port is served by an RTMP Server opened on it or, when none exists, by an internal listener.
    • rtmp://host[:port]/app/key or rtmps://...: plays the stream from that RTMP server, like Start Pull.
  • Prefer Start Pull or Start From Server when the key is a secret, so it is not part of a URL.
Start UrlTarget is IPRtmp Receiver
Target
Url
Latency Mode
Latency Ms
Return Value
Function

Stop

  • Stops receiving. On Ended is triggered if a stream was playing.
StopTarget is IPRtmp Receiver
Target
Function

Is Active

  • Return true between a successful start and Stop.
Is Active
Return Value
Pure function

Is Streaming

  • Return true while a publisher is sending the stream.
Is Streaming
Return Value
Pure function

Get Video Texture

  • Media Texture with the video, usable in materials and UMG. Valid after a start node.
Get Video Texture
Return Value
Pure function

Get Media Player

  • The underlying Media Player, for anything the Media Framework offers.
Get Media Player
Return Value
Pure function

Create Audio Component

  • Creates (or returns) a spatialized Media Sound Component playing the stream audio, attached to the root of Owner.
  • Configure attenuation on the returned component as for any audio component. It can be called before or after a start node.
Create Audio ComponentTarget is IPRtmp Receiver
Target
Owner
Return Value
Function

Get Stats

Get Stats
Return Value
Pure function

Events

On Started

  • A publisher started sending the stream (also after the publisher reconnects).
Bind Event to On Started
Target
Event
On StartedCustom Event
Event binding

On Ended

  • The stream stopped: the publisher disconnected, or Stop was called.
Bind Event to On Ended
Target
Event
On EndedCustom Event
Event binding

On Error

  • An error happened: invalid URL, server not open, refused key, TLS error... The message never contains the stream key.
Bind Event to On Error
Target
Event
On ErrorCustom Event
Message
Event binding

On Frame

  • A new video frame was presented. Frame carries metadata only (never the pixels): width, height, time and fps.
Bind Event to On Frame
Target
Event
On FrameCustom Event
Frame
Event binding

Structs

Receiver Stats

FIPRtmpReceiverStats, returned by Get Stats.

FieldTypeDescription
StreamingBooleanA publisher is currently sending this stream.
Width, HeightIntegerVideo size.
FpsFloatVideo frames handed to the Media Framework per second.
Bitrate KbpsFloatIncoming media bitrate (audio + video).
Buffered MsFloatMedia buffered ahead of presentation (jitter buffer). Network and encoder delay are not included.
Audio Sample Rate, Audio ChannelsIntegerAudio format.
Dropped Video Frames, Dropped Audio FramesInteger64Frames dropped since the start.
RebuffersIntegerTimes the buffer ran out and playback paused to refill it.
DiscontinuitiesIntegerTimestamp jumps of more than 1 s in the incoming stream (for example when the publisher restarts).
Video Decoder, Audio DecoderStringName of the decoders in use.

Video Frame Info

FIPVideoFrameInfo, sent by On Frame.

FieldTypeDescription
Width, HeightIntegerFrame size.
TimeFloat (double)Presentation time on the player timeline, in seconds.
FpsFloatFrames per second measured over the last second.

Media Source

The receiver plays through the Media Framework, so streams also work with your own Media Player, Media Texture, Media Sound Component and Media Plate. The plugin registers a media player for these URLs:

  • iprtmp://0.0.0.0:1935/<app>/<stream key>: a stream published to this machine. The port is served by an RTMP Server opened on it or, when none exists, by an internal listener.
  • rtmp://host[:port]/<app>[/<key>] or rtmps://...: plays the stream from that RTMP server (pull).

IP Rtmp Media Source (UIPRtmpMediaSource) is the media source for these URLs. Create it at runtime (Construct Object from Class) and open it with the Open Source node of a Media Player.

PropertyDefaultDescription
URLiprtmp://0.0.0.0:1935/live/streamStream URL, see above.
Latency ModeSmoothSee Latency modes.
Latency Ms0Jitter buffer target in ms (0 = default of the mode).

Keys in saved assets

A key written in a URL ends up in saved assets and in source control. Set the URL at runtime, or use Set Stream Key.

Set Stream Key

  • Stream key for rtmp(s):// URLs, kept in memory only (never saved). When empty, the last path segment of the URL is used.
Set Stream KeyTarget is IPRtmp Media Source
Target
In Stream Key
Function
Edit on GitHub

On this page