i am completely new to rtmp and nginx and ubuntu i just want to use a vps to restream my stream to multiple site like twitch, youtube etc... it worked fine for me but recently my main streaming website aparat.com change his system and they don't take push command in /usr/local/nginx/conf/nginx.conf i used this :
application live {
live on;
record off;
push rtmp://live.cdn.asset.aparat.com:443/event/<stream key>;
}
and it work fine with twitch or youtube or mixer but it won't work with aparat.com
don't know why they give me this instead and tell me to use it :
application live {
live on;
record off;
hls off;
dash off;
wait_key on;
exec_publish ffmpeg -i rtmp://127.0.0.1/live/name -async 1 -vsync 1 -c copy -f flv "rtmp://rtmp.cdn.asset.aparat.com:443/event/<stream key>";
}
when i start streaming i get no stream on site. should i change anything beside on the line i highligh? should i install anything on my ubuntu 18.04.4?
please just consider i have no idea about anything there and i just cope paste codes...
i install ffmpeg and stunnel already and config them i also try this :
exec_publish ffmpeg -i rtmp://127.0.0.1/live/name -async 1 -vsync 1 -c copy -f flv "rtmp://live.cdn.asset.aparat.com:443/event/<stream key>";
exec_publish ffmpeg -i rtmp://127.0.0.1:19350/live/name -async 1 -vsync 1 -c copy -f flv "rtmp://live.cdn.asset.aparat.com:443/event/<stream key>";
exec_publish ffmpeg -i rtmp://127.0.0.1:19350/live/name -async 1 -vsync 1 -c copy -f flv "rtmp://rtmp.cdn.asset.aparat.com:443/event/<stream key>";
an i should say everything is ok with twitch and youtube also i use OBS to stream games and everything is fine when i stream directly to aparat.com and using rtmp://rtmp.cdn.asset.aparat.com:443/event
The service suggests the following command:
Let's understand the command above:
rtmp://127.0.0.1/live/name - This is a block on your nginx settings. So you must to create a server block listening the localhost, port 1935, because 1935 is the default rtmp protocol port, or you can change to any other port and append this port to the command above, like this:
rtmp://127.0.0.1/live/name - This is the publishing point and your nginx publish block inside the server block above (this name can be anything that you wish) but it must to exists otherwise the nginx server will drop the connection.
rtmp://127.0.0.1/live/name - This is your streaming name (this name can be anything that you wish) like the publish name above.
Ok. Now you have a new rtmp server block, listening localhost connections, using the port that you wish, the publish name that you wish and the streaming name that you wish. Now, inside this block you must to re-encode your streaming using ffmeg if required by the service destination (aparat) and send it to the stunnel proxy or simply push the stream to the stunnel proxy because this service requires RTMPS. Something like this:
Now, let's understand the push stunnel proxy url:
rtmp://127.0.0.1:1936/event/streamkey - This part is the url where stunnel will listen connections, server(127.0.0.1) and port(1936).
rtmp://127.0.0.1:1936/event/streamkey - This is the path where stunnel will publish your stream on then service destination (aparat).
Now, stunnel will simply replace the 127.0.0.1:1936 by the host and port required by the service (443) and send your stream using RTMPS.
Below, my sugestion for the stunnel.conf:
Now, on your default pusblish block on your server, add this line, replacing the first command suggested by your remote service:
The command above inside your default publish block will push the stream to the server block (localhost:1935) and this will send the stream to the stunnel proxy.
Understand that you don't need the new server block to send the stream directly to the stunnel proxy. This is an explanation for your question using the command that you posted.
You can just replace that command by this on your default publish block, and it will send the stream to the stunnel proxy:
Replace
By
You only need a stunnel proxy working fine.
Done, restart nginx and stunnel services and happy stream.