Nginx with rtmp not working on GCP. Cannot receive incoming stream

52 Views Asked by At

I compiled nginx and nginx-rtmp module from source via

git clone https://github.com/arut/nginx-rtmp-module.git
git clone https://github.com/nginx/nginx.git

I did this following this tutorial

And my configuration is as follows


user  nobody;

worker_processes  auto;
pid /run/nginx.pid;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

#pid        logs/nginx.pid;


events {
    worker_connections  1024;
}

rtmp {
    server {
        listen 1935;
        chunk_size 4096;
        allow publish all;
        application live {
            live on;
            record off;
        }
    }
}

Firewall:

sudo ufw allow 1935/tcp

However, I cannot push my stream from my computer to this GCP RTMP server via ffmpeg, it keeps throwing a cannot open tcp connection error.

[tcp @ 000001dc6449dac0] Connection to tcp://ipaddress:1935?tcp_nodelay=0 failed: Error number -138 occurred
[rtmp @ 000001dc6449d5c0] Cannot open connection tcp://ipaddress:1935?tcp_nodelay=0
rtmp://ipaddress/live/bbb: Error number -138 occurred

This is my launch command:

ffmpeg -re -i video.mp4 -vcodec copy -loop -1 -c:a aac -b:a 160k -ar 44100 -strict -2 -f flv rtmp://{gcp.ipaddress}/live/bbb

All Im trying to create is a simple RTMP server endpoints where my applications can stream video to and from GCP using RTMP, nothing fancy like HLS or any sort that require further complicated configurations

I tried adding allow publish all; sudo ufw allow 1935. yet still the same results.

0

There are 0 best solutions below