Files
mediamtx/docs/2-features/11-forward.md
T

1.6 KiB

Forward streams

Incoming streams can be natively forwarded to other servers with the following protocols:

It is also possible to use FFmpeg to perform the forwarding.

SRT

Add the target URL inside dest of a forward entry:

paths:
  mypath:
    forward:
      - dest: srt://host:port?streamid=streamid

WebRTC

We support forwarding streams by using the WebRTC protocol and the WHIP extension. Add the target URL inside dest of a forward entry. Use whip:// for HTTP and whips:// for HTTPS:

paths:
  mypath:
    forward:
      - dest: whip://host:port/mystream/whip
        whipBearerToken: mytoken

If the remote server is a MediaMTX instance, remember to add a /whip suffix after the stream name, since in MediaMTX it's part of the WHIP URL.

RTSP

Add the target URL inside dest of a forward entry:

paths:
  mypath:
    forward:
      - dest: rtsp://user:pass@host:port/path

RTMP

Add the target URL inside dest of a forward entry:

paths:
  mypath:
    forward:
      - dest: rtmp://user:pass@host:port/path#streamKey

FFmpeg

When the destination requires transcoding, filtering or a protocol that is not supported by forward, use FFmpeg inside the runOnAvailable parameter instead:

pathDefaults:
  runOnAvailable: >
    ffmpeg -i rtsp://localhost:$RTSP_PORT/$MTX_PATH
    -c copy
    -f rtsp rtsp://other-server:8554/another-path
  runOnAvailableRestart: yes