SRT Restreaming

SRT restreaming is supported on Ubuntu 18.04 for Red5 Pro 8.x distributions, and Ubuntu 20.04 for 9.x and later distributions.

Please see Ubuntu setup document for requirements. In addition, you will need to enable SRT by modifying red5pro/conf/restreamer-plugin.properties, setting enable.srtingest=true.

For SRT streaming, you must run the API command first, and then start your stream. By default, you have 2 minutes (12000 milliseconds) after running the command to start your stream. If you want to extend that time, modify red5pro/conf/srt-ingest-plugin.properties socket.idle.timeout= value.

SRT also requires an encrypted passphrase, which is set for each stream via the API call. The default encryption is set to a 16-byte keylength (128-bit encryption), but this can be configured to use 24 or 32-length as well.

API Calls

The Restreamer API documentation can be found in the developer section.

Test SRT Streaming with ffmpeg

How to test SRT with an MP4 file via ffmpeg.

NOTE: unless you modify the timeout in red5pro/conf/srt-ingest-plugin.properties, you will have 2 minutes (12000 milliseconds) from when you post the API call to start the stream; if you wait longer then you will need to re-create the stream via the API (you can also change that value by modifying socket.idle.timeout= value)

1 - Create the SRT stream by running the API call (note: make sure the ports match between the API call and the ffmpeg command)

POST: https://(server).red5.org/live/restream

    "guid": "live/stream1",
    "context": "live",
    "name": "stream1",
    "level": 0,
    "parameters": {
        "type": "srt",
        "action": "create",
        "ip": "",
        "port": 8000,
        "frameType": 0,
        "latency": 100,
        "reorder": 16, 
        "overhead": 100,
        "keyLength": 16,
        "passphrase": "Red5ProRules2020"

2 - Start the stream via ffmpeg:

ffmpeg -re -stream_loop -1 -i TESTFILE.mp4 -c:v libx264 -b:v 5000k -bsf:v h264_mp4toannexb -profile:v baseline -level:v 3.2 -x264-params keyint=120:scenecut=0 -c:a aac -b:a 128k -ar 44100 -f mpegts "srt://YOUR-SERVER-IP:8000?pkt_size=1316&mode=caller&minversion=0x010300&latency=100000&oheadbw=100&transtype=live&pbkeylen=16&passphrase=Red5ProRules2020"

3 - Go to the subscribe page and refresh. You should see the stream listed.