Two Proven Methods
You can achieve RTSP/RTMP/SRT to WebRTC conversion using either Stream Proxy Mode (server pulls the stream) or Push Mode (encoder pushes to server). Choose the one that fits your workflow.
| Method | Best For | Configuration Scope |
|---|---|---|
| Stream Proxy Mode | Pulling existing RTSP/RTMP/SRT streams (e.g., from IP cameras, encoders) and exposing them as WebRTC. |
mediaserver.cfg (<proxy> sections)
|
| Push Mode | Actively pushing streams from OBS, FFmpeg, or any encoder to the server; get instant WebRTC playback. | Server-wide (<rtmp>, <rtsp>, <srt> listeners) + <application> name |
Method 1: Stream Proxy Mode (Pull from Source)
Configure the Media Server to pull an RTSP, RTMP, or SRT stream and re-publish it as WebRTC. Edit mediaserver.cfg and add one or more <proxy> entries.
Step 1: Edit mediaserver.cfg
<proxy>
<suffix>proxy</suffix> <!-- URL suffix for WebRTC -->
<url>rtsp://192.168.3.36/live</url> <!-- Source stream (RTSP, RTMP, or SRT) -->
<user></user> <!-- Optional credentials -->
<pass></pass>
<transfer>TCP</transfer> <!-- Transport for RTSP (UDP/TCP) -->
<ondemand>1</ondemand> <!-- 1: pull on first client request -->
<output> <!-- Optional transcode settings -->
<video>
<codec>H264</codec> <!-- Leave empty to passthrough -->
<width></width>
<height></height>
<framerate></framerate>
<bitrate></bitrate>
</video>
<audio>
<codec>G711U</codec> <!-- or OPUS, etc. -->
<samplerate>8000</samplerate>
<channels>1</channels>
<bitrate></bitrate>
</audio>
</output>
</proxy>
<!-- More proxy entries can be added -->
<proxy>
<suffix>camera2</suffix>
<url>rtmp://192.168.3.40/live/stream</url>
...
</proxy>
Resulting WebRTC URL
After configuration, the stream becomes available at:
-
[serverip]and[serverport]are taken from the<http>section inmediaserver.cfg(default IP and port, e.g., 8080). -
[application-name]is defined in<application><name>(commonly "live"). -
[suffix]is the value from<suffix>inside the proxy block.
Example: If HTTP server IP is 192.168.1.100, port 8080, application name live, and suffix proxy, the WebRTC address becomes:
Open this URL in a browser that supports WebRTC (Chrome, Firefox, Edge) to play the stream with <1s latency.
Method 2: Push Mode (Encoder Pushes to Server)
You can push RTSP, RTMP, or SRT streams directly to the Happytimesoft Media Server. The server automatically makes them available as WebRTC streams without additional proxy configuration.
Step 1: Push Your Stream
Use OBS, FFmpeg, RTMP Pusher, or any encoder that supports the protocol. The push URL format depends on the protocol:
| Protocol | Push URL format | Notes |
|---|---|---|
| RTMP |
rtmp://[serverip]:[rtmp-port]/[application-name]/[stream-key]
|
Default RTMP port: 1935 |
| RTSP |
rtsp://[serverip]:[rtsp-port]/[application-name]/[stream-id]
|
Default RTSP port: 554 |
| SRT |
srt://[serverip]:[srt-port]?streamid=[application-name]/[stream-name]
|
Default SRT port: 10080 (configurable) |
Example using RTMP with OBS/FFmpeg:
rtmp://192.168.1.100:1935/live/stream1
(application-name = live, stream-key = stream1)
Step 2: WebRTC Playback URL
Once data is received, the WebRTC stream is immediately available at:
The streamid parameter must match the application and stream name used in the push URL. For the RTMP example above, the WebRTC URL becomes:
8080 by default) and server IP are defined in the <http> section. For RTSP/SRT pushes, the stream name after the application becomes the stream identifier.
Workflow Diagram
Source → (Pull via proxy or push) → Media Server → WebRTC → Any modern browser
Best Practices & Tips
- Choose the right mode: Use Proxy Mode when you cannot change the source's destination (e.g., an existing camera feed). Use Push Mode if you control the encoder and want simplicity.
- Network connectivity: Ensure the Media Server can reach the source IP/port in Proxy Mode. For Push Mode, firewalls must allow incoming connections on RTMP (1935), RTSP (554), SRT (10080), and HTTP (8080) ports.
-
Application name: The
<application><name>inmediaserver.cfgdefines the first path segment. Common names:live,webrtc,app. Make sure it matches the streamid parameter. -
Multiple streams: You can define many
<proxy>entries or push multiple stream keys; each gets its ownstreamid.
Configuration Summary (mediaserver.cfx / .cfg)
Key sections to verify:
<application>
<name>live</name> <!-- used in streamid -->
...
</application>
<http>
<serverip></serverip> <!-- listen IP -->
<serverport>8080</serverport> <!-- WebRTC HTTP port -->
</http>
<rtmp>
<serverip></serverip>
<serverport>1935</serverport> <!-- for RTMP push -->
</rtmp>
<!-- similar for RTSP and SRT -->