Two examples are provided for SRT inter-operation, one uses a file and the other is more direct. Ensure that you update any servers URL's or namespaces to match your setup.
This example uses a file ingest read by ffmpeg which provides an SRT listener endpoint for openmoq-publisher to call; the caller uses the json configuration file.
- Create your json file; example path and name:
/tmp/srt_caller.json
{
"srt_caller": [
{
"id": "cam1",
"srt": {
"mode": "caller",
"host": "127.0.0.1",
"port": 9000,
"latency_ms": 120
},
"mpegts": {
"auto_detect_program": true,
"program_number": null,
"video_pid": null,
"audio_pid": null
},
"cmaf": {
"fragment_on_keyframe": true,
"empty_moov": true,
"default_base_moof": true,
"separate_moof_per_track": true,
"target_fragment_duration_ms": 1000
}
}
]
}- Start ffmpeg as the SRT listener using file ingest
ffmpeg -hide_banner -stream_loop -1 -re -i fragmented.mp4 \
-map 0:v:0 -map 0:a:0 \
-r 30 -g 60 -keyint_min 60 -sc_threshold 0 -bf 0 \
-c:a aac -b:a 128k -ar 48000 -ac 2 \
-f mpegts "srt://0.0.0.0:9000?mode=listener&pkt_size=1316"- Start the publisher which uses the json file
./build/openmoq-publisher --live-source srt --srt-config /tmp/srt_caller.json --transport webtransport --endpoint https://moq-relay1.red5.net:4433/moq --namespace live/srt --draft 16 --publish-catalog- Create your json file; example path and name:
/tmp/srt_caller_direct.json
{
"srt_caller_direct": [
{
"id": "read_teste",
"srt": {
"mode": "caller",
"host": "127.0.0.1",
"port": 8890,
"latency_ms": 200
},
"mpegts": {
"auto_detect_program": true,
"program_number": null,
"video_pid": null,
"audio_pid": null
},
"cmaf": {
"fragment_on_keyframe": true,
"empty_moov": true,
"default_base_moof": true,
"separate_moof_per_track": true,
"target_fragment_duration_ms": 1000
}
}
]
}- Start the publisher which uses the json file
./build/openmoq-publisher --live-source srt --srt-config /tmp/srt_caller_direct.json --transport webtransport --endpoint https://moq-relay2.red5.net:4433/moq --namespace live/srt --draft 16 --publish-catalog