Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Can't access GCP hosted rtsp stream externally

Hello,

I have been trying to host a video to rtsp stream on a gcp vm instance.

My steps were :

a) Set up an external ip to my vm, and setup firewall rules to allow traffick.

b)Install mediamtx to my vm and start a server with ./mediamtx

c)install ffmpeg and stream my video with : ffmpeg -i video.mp4 -rtsp_transport tcp -f rtsp rtsp://externalip:8554/live.stream

The stream runs locally, but when I try to access in with vlc or ffplay rtsp://externalip:8554/live.stream, I cannot connect. I tried to ping the server from the client side, and it works ok.

What am I missing ? Are there any more configurations I need to do to my project ?

Solved Solved
2 1 957
1 ACCEPTED SOLUTION

Hi @Nikos_Daskalas 

Welcome to Google Cloud Community!

Since you can access the rtsp locally to the said machine, you can consider to check your ffmpeg configuration. Based on the mediamtx documentation, you may want to see this link to configure ffmpeg.

Also, you may want to verify if this could be folder permission issue (i.e. folder security user, group, etc) since you can only access it locally.

Lastly, you can also look if all the ports below are allowed thru the firewall.

###############################################
# Global settings -> RTSP

# Allow publishing and reading streams with the RTSP protocol.
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]

###############################################

You can see ports needed to be allowed from the documentation of mediamtx thru this link. For the documentation on how to allow ports on the GCP's VPC, you may want to see this guide.

I hope this information is helpful.

If you need further assistance, you can always file a ticket on our support team.

View solution in original post

1 REPLY 1

Hi @Nikos_Daskalas 

Welcome to Google Cloud Community!

Since you can access the rtsp locally to the said machine, you can consider to check your ffmpeg configuration. Based on the mediamtx documentation, you may want to see this link to configure ffmpeg.

Also, you may want to verify if this could be folder permission issue (i.e. folder security user, group, etc) since you can only access it locally.

Lastly, you can also look if all the ports below are allowed thru the firewall.

###############################################
# Global settings -> RTSP

# Allow publishing and reading streams with the RTSP protocol.
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]

###############################################

You can see ports needed to be allowed from the documentation of mediamtx thru this link. For the documentation on how to allow ports on the GCP's VPC, you may want to see this guide.

I hope this information is helpful.

If you need further assistance, you can always file a ticket on our support team.