Closed varnish97 closed 7 years ago
Hi @varnish97, what do you mean by private key? What kind of service do you want to use? What you just need is a RTMP URL that contains your key.
I would like to assign a private key to each client, so as to provide a broadcast to every person. Ie I'll explain: privateKey1 - Youtube (User1), Twitch (User1), Hitbox (User1). privateKey2 - Youtube (User2), Twitch (User2), Hitbox (User2). etc....
How would you advise me to do?
I didn't do anything like that myself, but if I properly understood what you want to achieve, you need to have a custom RTMP URL for each user. In this project, I use only one URL (rtmp://192.168.42.42:1935/live) which is referring to the live application from the Nginx configuration (here). So basically, what I do would be to create a new application in the Nginx conf for every user, something like this:
rtmp {
server {
listen 1935;
chunk_size 8192;
// Applications for User1
application live-privateKey1 {
live on;
record off;
allow publish {{ my_ip_address }};
deny publish all;
push rtmp://localhost/youtube-privateKey1/${name};
exec ffmpeg -i rtmp://localhost/$app/$name -c:v libx264 -preset veryfast -c:a copy
-b:v 3500k
-bufsize 3500k
-maxrate 3500k
-s 1280x720 -r 30
-f flv rtmp://localhost/twitch-privateKey1/$name;
push rtmp://localhost/dailymotion-privateKey1/${name};
push rtmp://localhost/hitbox-privateKey1/${name};
}
application youtube-privateKey1 {
live on;
record off;
allow publish 127.0.0.1;
deny publish all;
push rtmp://a.rtmp.youtube.com/live2/{{ youtube_key_user1 }};
}
application twitch-privateKey1 {
live on;
record off;
allow publish 127.0.0.1;
deny publish all;
push rtmp://live-cdg.twitch.tv/app/{{ twitch_key_user1 }};
}
application dailymotion-privateKey1 {
live on;
record off;
allow publish 127.0.0.1;
deny publish all;
push rtmp://publish.dailymotion.com/publish-dm/{{ dailymotion_key_user1 }};
}
application hitbox-privateKey1 {
live on;
record off;
allow publish 127.0.0.1;
deny publish all;
push rtmp://live.hitbox.tv/push/{{ hitbox_key_user1 }};
}
// Applications for User2
application live-privateKey2 {
live on;
record off;
allow publish {{ my_ip_address }};
deny publish all;
push rtmp://localhost/youtube-privateKey2/${name};
exec ffmpeg -i rtmp://localhost/$app/$name -c:v libx264 -preset veryfast -c:a copy
-b:v 3500k
-bufsize 3500k
-maxrate 3500k
-s 1280x720 -r 30
-f flv rtmp://localhost/twitch-privateKey2/$name;
push rtmp://localhost/dailymotion-privateKey2/${name};
push rtmp://localhost/hitbox-privateKey2/${name};
}
application youtube-privateKey2 {
live on;
record off;
allow publish 127.0.0.1;
deny publish all;
push rtmp://a.rtmp.youtube.com/live2/{{ youtube_key_user2 }};
}
application twitch-privateKey2 {
live on;
record off;
allow publish 127.0.0.1;
deny publish all;
push rtmp://live-cdg.twitch.tv/app/{{ twitch_key_user2 }};
}
application dailymotion-privateKey2 {
live on;
record off;
allow publish 127.0.0.1;
deny publish all;
push rtmp://publish.dailymotion.com/publish-dm/{{ dailymotion_key_user2 }};
}
application hitbox-privateKey2 {
live on;
record off;
allow publish 127.0.0.1;
deny publish all;
push rtmp://live.hitbox.tv/push/{{ hitbox_key_user2 }};
}
}
}
Then, you just have to send the stream on the corresponding RTMP URL depending on the user (rtmp://192.168.42.42:1935/live-privateKey1 for User1).
But I'm pretty sure there is a better way to do that. Please ask the same question on the Nginx RTMP module project (here), they might have a better answer to your problem.
Thank you, great! I also had to rate Conceived in this way, Thank you very much
Hi, i can set private key for private stream with nginx?