I am using this command to start a server on my linux machine:
docker run -d --rm -it --network=host aler9/rtsp-simple-server
And this command to connect an rtsp stream
docker run -v $(pwd):$(pwd) --network=host linuxserver/ffmpeg:arm64v8-latest -re -stream_loop -1 -i $(pwd)/sample.mp4 -c copy -f rtsp rtsp://localhost:8554/mystream
Is it possible to start a second rtsp server and connect rtsp streams to this second server.
What I am trying to do is to simulate multiple cameras with one sub stream for each camera
Try running multiple rtsp servers like so:
docker run --rm -it -e RTSP_PROTOCOLS=tcp -p 8554:8554 -p 1935:1935 aler9/rtsp-simple-server
docker run --rm -it -e RTSP_PROTOCOLS=tcp -p 8555:8554 -p 1936:1935 aler9/rtsp-simple-server
docker run --rm -it -e RTSP_PROTOCOLS=tcp -p 8556:8554 -p 1937:1935 aler9/rtsp-simple-server
and connect like so:
# Connecting to first server
docker run -v $(pwd):$(pwd) --network=host linuxserver/ffmpeg:arm64v8-latest -re -stream_loop -1 -i
$(pwd)/sample.mp4 -c copy -f rtsp rtsp://localhost:8554/mystream
# Connecting to second server
docker run -v $(pwd):$(pwd) --network=host linuxserver/ffmpeg:arm64v8-latest -re -stream_loop -1 -i $(pwd)/sample.mp4 -c copy -f rtsp rtsp://localhost:8555/mystream
# Connecting to third server
docker run -v $(pwd):$(pwd) --network=host linuxserver/ffmpeg:arm64v8-latest -re -stream_loop -1 -i $(pwd)/sample.mp4 -c copy -f rtsp rtsp://localhost:8556/mystream
This solution basically uses docker port mapping and map each server to diffrent ports so they won't colide. According to aler9/rtsp-simple-server
port mapping is working for tcp and might not work for udp.
Solution for udp will require more investigation.