Advertisement
Guest User

nginx rtmp

a guest
Feb 23rd, 2015
487
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.88 KB | None | 0 0
  1. #user nobody;
  2. worker_processes 1;
  3.  
  4. #error_log logs/error.log;
  5. #error_log logs/error.log notice;
  6. #error_log logs/error.log info;
  7.  
  8. #pid logs/nginx.pid;
  9.  
  10.  
  11. events {
  12. worker_connections 1024;
  13. }
  14.  
  15. http {
  16. include mime.types;
  17. default_type application/octet-stream;
  18. sendfile on;
  19. keepalive_timeout 65;
  20.  
  21. server {
  22. listen 1936;
  23. server_name localhost;
  24.  
  25. error_page 500 502 503 504 /50x.html;
  26. location = /50x.html {
  27. root html;
  28. }
  29.  
  30. location /hls {
  31. types {
  32. application/vnd.apple.mpegurl m3u8;
  33. }
  34. root /tmp;
  35. add_header Cache-Control no-cache;
  36. }
  37.  
  38. }
  39. }
  40.  
  41. rtmp {
  42. server {
  43. listen 1935;
  44. chunk_size 4096;
  45.  
  46. application live1 { # stream url/key: rtmp://domain.com/live1/key001
  47. live on;
  48. record off;
  49.  
  50. hls on;
  51. hls_path hls;
  52. hls_fragment 5s;
  53. hls_cleanup on;
  54. hls_type live;
  55.  
  56. allow publish 20.20.20.20; #example user IP 1
  57. allow publish 21.21.21.21; #example user IP 2
  58. allow publish 22.22.22.22; #example user IP 3
  59. allow publish 23.23.23.23; #example user IP 4
  60. allow publish 24.24.24.24; #example user IP 5
  61. deny publish all;
  62. push rtmp://hitbox.tv/streamkey; #push to hitbox
  63. push rtmp://twitch.tv/streamkey; #push to twitch
  64.  
  65. exec ffmpeg -i rtmp://localhost/live1/$name -threads 1 -c:v libx264 -profile:v baseline -b:v 750K -s 640x360 -f flv -c:a aac -ac 1 -strict -2 -b:a 96k rtmp://localhost/live1lq/$name;
  66.  
  67. }
  68.  
  69. application live1lq { #low quality game stream
  70. live on;
  71. record off;
  72. allow publish 127.0.0.1;
  73. allow publish 0.0.0.0;
  74. deny publish all;
  75. }
  76.  
  77. application live2 { # stream url/key: rtmp://domain.com/live2/streamkey
  78. live on;
  79. record off;
  80.  
  81. hls on;
  82. hls_path hls;
  83. hls_fragment 5s;
  84. hls_cleanup on;
  85. hls_type live;
  86.  
  87. allow publish 20.20.20.20; #example user IP 1
  88. allow publish 21.21.21.21; #example user IP 2
  89. allow publish 22.22.22.22; #example user IP 3
  90. allow publish 23.23.23.23; #example user IP 4
  91. allow publish 24.24.24.24; #example user IP 5
  92. deny publish all;
  93. push rtmp://other.streamsite.net/streamkey; #push to other streaming site
  94. push rtmp://other.streamsite.com/streamkey; #push to other streaming site
  95.  
  96. exec ffmpeg -i rtmp://localhost/live2/$name -threads 1 -c:v libx264 -profile:v baseline -b:v 750K -s 640x360 -f flv -c:a aac -ac 1 -strict -2 -b:a 96k rtmp://localhost/live2lq/$name;
  97. }
  98.  
  99. application live2lq { #low quality movie stream
  100. live on;
  101. record off;
  102. allow publish 127.0.0.1;
  103. allow publish 0.0.0.0;
  104. deny publish all;
  105. }
  106. }
  107. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement