I want to create a proxy server that can ingest the RTMP video stream and gives an RTMP stream as output. How can I design this proxy server?
If you are aware of FFmpeg then it would be easy. With FFmpeg, you can ingest the RTMP stream and output the RTMP stream with or without transcoding. You just need to invoke the following command from your desired programming language.
ffmpeg -i rtmp://input-server/stream -vcodec copy -acodec copy -f flv rtmp://output-server/stream
Also, Node-Media-Server library in NodeJs provides a friendly interface for creating RTMP proxy and uses FFmpeg under the hood.
How to use NGINX as an RTMP proxy?
Like, I currently use NGINX as an HTTP proxy, as shown below.
http { server { server_name example.com; location / { proxy_pass http://localhost:3000/; } } }
But now, I want to know if there is a way to use NGINX for RTMP similar to
rtmp { server { server_name example.com; location / { proxy_pass rtmp://localhost:1935; } } }
I hope this may help you: Enabling Video Streaming for Remote Learning with NGINX and NGINX Plus - NGINX
Great! But didn’t work for me. Basically, I want to transfer
rtmp:/domain.com to rtmp:/localhost:193
because I’m running a NodeJS server at that address.
Hey! Have you used nginx’s upstream features??
I reviewed the Nginx documentation; the setup listed below may be helpful.
Nginx TCP and UDP Load Balancing
stream { server { listen 3000; proxy_pass localhost:1935; proxy_buffer_size 32k; } }