Skip to main content

SRT to RTMP

Requrements:

sudo apt install -y ffmpeg srt-tools

To test start a SRT stream with FFMPEG:

ffmpeg -re -i video.mp4 -c:v copy -c:a copy -f mpegts "srt://127.0.0.1:2088?mode=caller&passphrase=mypassword"

start srt listener:

srt-live-transmit srt://:2088?passphrase=mypassword udp://127.0.0.1:23000

convert srt to rtmp with ffmpeg:

ffmpeg -i udp://127.0.0.1:23000 -c:v copy -c:a copy -f flv rtmp://192.168.1.129:1935/live

replace rtmp://192.168.1.129:1935/live with your RMP stream destination

 

 

Set as systemd

edit /etc/systemd/system/srt-live-transmit.service

 

[Unit]
Description=SRT Live Transmit Service
After=network.target

[Service]
ExecStart=/usr/bin/srt-live-transmit srt://:2088?passphrase=mypassword udp://127.0.0.1:23000
Restart=always
RestartSec=10

[Install]
WantedBy=multi-user.target

change srt://:2088?passphrase=mypassword

 

edit /etc/systemd/system/ffmpeg.service

[Unit]
Description=FFmpeg RTMP Service
After=network.target srt-live-transmit.service
Requires=srt-live-transmit.service

[Service]
ExecStart=/usr/bin/ffmpeg -i udp://127.0.0.1:23000 -c:v copy -c:a copy -f flv rtmp://192.168.1.129:1935/live
Restart=always
RestartSec=10

[Install]
WantedBy=multi-user.target

change rtmp://192.168.1.129:1935/live

Aktivate:

sudo systemctl daemon-reload
sudo systemctl enable srt-live-transmit
sudo systemctl enable ffmpeg

and start:

sudo systemctl start srt-live-transmit
sudo systemctl start ffmpeg

 

check:

sudo systemctl status srt-live-transmit
sudo systemctl status ffmpeg