Skip to content

Instantly share code, notes, and snippets.

@marshallmassengill
Created November 6, 2023 16:00
Show Gist options
  • Save marshallmassengill/2687e259fb8f15356d33a0f32f1fd3f8 to your computer and use it in GitHub Desktop.
Save marshallmassengill/2687e259fb8f15356d33a0f32f1fd3f8 to your computer and use it in GitHub Desktop.
Setup for MPEG-TS multicast/UDP streaming Test
Install gstreamer + plugins on one system:
gst-launch-1.0 -v mpegtsmux name=mux alignment=1 ! udpsink host=238.0.0.1 port=1234 videotestsrc ! video/x-raw,width=1280,height=720,format=I420 ! x264enc speed-preset=ultrafast bitrate=3000 key-int-max=60 ! video/x-h264,profile=high ! mux.
Download and install mediamtx to "receive" the stream sent from gstreamer.
https://github.com/bluenviron/mediamtx
mediamtx will be used to re-broadcast the stream over webrtc. This can be done on as many systems as seems reasonable for demonstrating multicast.
mediamtx.yml config file (note, this file needs to be edited to have the right IPs):
--------------------------------------------------
logLevel: info
logDestinations: [stdout]
logFile: mediamtx.log
readTimeout: 10s
writeTimeout: 10s
writeQueueSize: 512
udpMaxPayloadSize: 1472
externalAuthenticationURL:
api: no
apiAddress: 127.0.0.1:9997
metrics: no
metricsAddress: 127.0.0.1:9998
pprof: no
pprofAddress: 127.0.0.1:9999
runOnConnect:
runOnConnectRestart: no
runOnDisconnect:
rtsp: yes
protocols: [udp, multicast, tcp]
encryption: "no"
rtspAddress: :8554
rtspsAddress: :8322
rtpAddress: :8000
rtcpAddress: :8001
multicastIPRange: 224.1.0.0/16
multicastRTPPort: 8002
multicastRTCPPort: 8003
serverKey: server.key
serverCert: server.crt
authMethods: [basic]
rtmp: no
rtmpAddress: :1935
rtmpEncryption: "no"
rtmpsAddress: :1936
rtmpServerKey: server.key
rtmpServerCert: server.crt
hls: no
hlsAddress: :8888
hlsEncryption: no
hlsServerKey: server.key
hlsServerCert: server.crt
hlsAlwaysRemux: no
hlsVariant: lowLatency
hlsSegmentCount: 7
hlsSegmentDuration: 1s
hlsPartDuration: 200ms
hlsSegmentMaxSize: 50M
hlsAllowOrigin: '*'
hlsTrustedProxies: []
hlsDirectory: ''
webrtc: yes
webrtcAddress: :8889
webrtcEncryption: no
webrtcServerKey: server.key
webrtcServerCert: server.crt
webrtcAllowOrigin: '*'
webrtcTrustedProxies: []
webrtcICEServers2:
- url: stun:stun.l.google.com:19302
username: ''
password: ''
webrtcICEInterfaces: []
webrtcICEHostNAT1To1IPs: []
webrtcICEUDPMuxAddress: 10.10.101.104:8888
srt: no
srtAddress: :8890
paths:
mypath:
source: udp://238.0.0.1:1234
all_others:
--------------------------------------------------
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment